diff --git a/Analysis/CMakeLists.txt b/Analysis/CMakeLists.txt index 58590ac4f319bc8f4bc40f2fd0f093d97927a4a4..9009dbfc5d635a07ba3d53e03aa28b8ca2b2af06 100644 --- a/Analysis/CMakeLists.txt +++ b/Analysis/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(TotalInvMass) add_subdirectory(TrackInspect) add_subdirectory(DumpEvent) +add_subdirectory(ReadDigi) diff --git a/Analysis/ReadDigi/CMakeLists.txt b/Analysis/ReadDigi/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6954260f1e397b86d2370b7e66c5599394c0d3f --- /dev/null +++ b/Analysis/ReadDigi/CMakeLists.txt @@ -0,0 +1,22 @@ + +gaudi_add_module(ReadDigi + SOURCES src/ReadDigiAlg.cpp + src/HelixClassD.cc + LINK k4FWCore::k4FWCore + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${CLHEP_LIBRARIES} + ${GSL_LIBRARIES} + ${LCIO_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict + ${ROOT_LIBRARIES} +) + +target_include_directories(ReadDigi + PUBLIC ${LCIO_INCLUDE_DIRS}) + +install(TARGETS ReadDigi + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Analysis/ReadDigi/src/HelixClassD.cc b/Analysis/ReadDigi/src/HelixClassD.cc new file mode 100644 index 0000000000000000000000000000000000000000..a29fc7ba4e3100b6042eaebaa9039d05db673cd2 --- /dev/null +++ b/Analysis/ReadDigi/src/HelixClassD.cc @@ -0,0 +1,801 @@ +#include "HelixClassD.hh" +#include <math.h> +#include <stdlib.h> +#include <iostream> +//#include "ced_cli.h" + +HelixClassD::HelixClassD() { + _const_2pi = 2.0*M_PI; + _const_pi2 = 0.5*M_PI; + _FCT = 2.99792458E-4; +} + +HelixClassD::~HelixClassD() {} + +void HelixClassD::Initialize_VP(float * pos, float * mom, float q, float B) { + _referencePoint[0] = pos[0]; + _referencePoint[1] = pos[1]; + _referencePoint[2] = pos[2]; + _momentum[0] = mom[0]; + _momentum[1] = mom[1]; + _momentum[2] = mom[2]; + _charge = q; + _bField = B; + _pxy = sqrt(mom[0]*mom[0]+mom[1]*mom[1]); + _radius = _pxy / (_FCT*B); + _omega = q/_radius; + _tanLambda = mom[2]/_pxy; + _phiMomRefPoint = atan2(mom[1],mom[0]); + _xCentre = pos[0] + _radius*cos(_phiMomRefPoint-_const_pi2*q); + _yCentre = pos[1] + _radius*sin(_phiMomRefPoint-_const_pi2*q); + _phiRefPoint = atan2(pos[1]-_yCentre,pos[0]-_xCentre); + _phiAtPCA = atan2(-_yCentre,-_xCentre); + _phi0 = -_const_pi2*q + _phiAtPCA; + while (_phi0<0) _phi0+=_const_2pi; + while (_phi0>=_const_2pi) _phi0-=_const_2pi; + _xAtPCA = _xCentre + _radius*cos(_phiAtPCA); + _yAtPCA = _yCentre + _radius*sin(_phiAtPCA); + // _d0 = -_xAtPCA*sin(_phi0) + _yAtPCA*cos(_phi0); + double pxy = double(_pxy); + double radius = pxy/double(_FCT*B); + double xCentre = double(pos[0]) + radius*double(cos(_phiMomRefPoint-_const_pi2*q)); + double yCentre = double(pos[1]) + radius*double(sin(_phiMomRefPoint-_const_pi2*q)); + + double d0; + + if (q>0) { + d0 = double(q)*radius - double(sqrt(xCentre*xCentre+yCentre*yCentre)); + } + else { + d0 = double(q)*radius + double(sqrt(xCentre*xCentre+yCentre*yCentre)); + } + + _d0 = float(d0); + + // if (fabs(_d0)>0.001 ) { + // std::cout << "New helix : " << std::endl; + // std::cout << " Position : " << pos[0] + // << " " << pos[1] + // << " " << pos[2] << std::endl; + // std::cout << " Radius = " << _radius << std::endl; + // std::cout << " RC = " << sqrt(_xCentre*_xCentre+_yCentre*_yCentre) << std::endl; + // std::cout << " D0 = " << _d0 << std::endl; + // } + + _pxAtPCA = _pxy*cos(_phi0); + _pyAtPCA = _pxy*sin(_phi0); + float deltaPhi = _phiRefPoint - _phiAtPCA; + float xCircles = -pos[2]*q/(_radius*_tanLambda) - deltaPhi; + xCircles = xCircles/_const_2pi; + int nCircles; + int n1,n2; + + if (xCircles >= 0.) { + n1 = int(xCircles); + n2 = n1 + 1; + } + else { + n1 = int(xCircles) - 1; + n2 = n1 + 1; + } + + if (fabs(n1-xCircles) < fabs(n2-xCircles)) { + nCircles = n1; + } + else { + nCircles = n2; + } + _z0 = pos[2] + _radius*_tanLambda*q*(deltaPhi + _const_2pi*nCircles); + +} + +void HelixClassD::Initialize_Canonical(float phi0, float d0, float z0, + float omega, float tanLambda, float B) { + _omega = omega; + _d0 = d0; + _phi0 = phi0; + _z0 = z0; + _tanLambda = tanLambda; + _charge = omega/fabs(omega); + _radius = 1./fabs(omega); + _xAtPCA = -_d0*sin(_phi0); + _yAtPCA = _d0*cos(_phi0); + _referencePoint[0] = _xAtPCA; + _referencePoint[1] = _yAtPCA; + _referencePoint[2] = _z0; + _pxy = _FCT*B*_radius; + _momentum[0] = _pxy*cos(_phi0); + _momentum[1] = _pxy*sin(_phi0); + _momentum[2] = _tanLambda * _pxy; + _pxAtPCA = _momentum[0]; + _pyAtPCA = _momentum[1]; + _phiMomRefPoint = atan2(_momentum[1],_momentum[0]); + _xCentre = _referencePoint[0] + + _radius*cos(_phi0-_const_pi2*_charge); + _yCentre = _referencePoint[1] + + _radius*sin(_phi0-_const_pi2*_charge); + _phiAtPCA = atan2(-_yCentre,-_xCentre); + _phiRefPoint = _phiAtPCA ; + _bField = B; +} + + +void HelixClassD::Initialize_BZ(float xCentre, float yCentre, float radius, + float bZ, float phi0, float B, float signPz, + float zBegin) { + + _radius = radius; + _pxy = _FCT*B*_radius; + _charge = -(bZ*signPz)/fabs(bZ*signPz); + _momentum[2] = -_charge*_pxy/(bZ*_radius); + _xCentre = xCentre; + _yCentre = yCentre; + _omega = _charge/radius; + _phiAtPCA = atan2(-_yCentre,-_xCentre); + _phi0 = -_const_pi2*_charge + _phiAtPCA; + while (_phi0<0) _phi0+=_const_2pi; + while (_phi0>=_const_2pi) _phi0-=_const_2pi; + _xAtPCA = _xCentre + _radius*cos(_phiAtPCA); + _yAtPCA = _yCentre + _radius*sin(_phiAtPCA); + _d0 = -_xAtPCA*sin(_phi0) + _yAtPCA*cos(_phi0); + _pxAtPCA = _pxy*cos(_phi0); + _pyAtPCA = _pxy*sin(_phi0); + _referencePoint[2] = zBegin; + _referencePoint[0] = xCentre + radius*cos(bZ*zBegin+phi0); + _referencePoint[1] = yCentre + radius*sin(bZ*zBegin+phi0); + _phiRefPoint = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); + _phiMomRefPoint = -_const_pi2*_charge + _phiRefPoint; + _tanLambda = _momentum[2]/_pxy; + _momentum[0] = _pxy*cos(_phiMomRefPoint); + _momentum[1] = _pxy*sin(_phiMomRefPoint); + + float deltaPhi = _phiRefPoint - _phiAtPCA; + float xCircles = bZ*_referencePoint[2] - deltaPhi; + xCircles = xCircles/_const_2pi; + int nCircles; + int n1,n2; + + if (xCircles >= 0.) { + n1 = int(xCircles); + n2 = n1 + 1; + } + else { + n1 = int(xCircles) - 1; + n2 = n1 + 1; + } + + if (fabs(n1-xCircles) < fabs(n2-xCircles)) { + nCircles = n1; + } + else { + nCircles = n2; + } + _z0 = _referencePoint[2] - (deltaPhi + _const_2pi*nCircles)/bZ; + _bField = B; + +} + +const float * HelixClassD::getMomentum() { + return _momentum; +} +const float * HelixClassD::getReferencePoint() { + return _referencePoint; +} +float HelixClassD::getPhi0() { + if (_phi0<0.0) + _phi0 += 2*M_PI; + return _phi0; +} +float HelixClassD::getD0() { + return _d0; +} +float HelixClassD::getZ0() { + return _z0; +} +float HelixClassD::getOmega() { + return _omega; +} +float HelixClassD::getTanLambda() { + return _tanLambda; +} +float HelixClassD::getPXY() { + return _pxy; +} +float HelixClassD::getXC() { + return _xCentre; +} + +float HelixClassD::getYC() { + return _yCentre; +} + +float HelixClassD::getRadius() { + return _radius; +} + +float HelixClassD::getBz() { + return _bZ; +} + +float HelixClassD::getPhiZ() { + return _phiZ; +} + +float HelixClassD::getCharge() { + return _charge; +} + +float HelixClassD::getPointInXY(float x0, float y0, float ax, float ay, + float * ref , float * point) { + + float time; + + float AA = sqrt(ax*ax+ay*ay); + + + if (AA <= 0) { + time = -1.0e+20; + return time; + } + + + float BB = ax*(x0-_xCentre) + ay*(y0-_yCentre); + BB = BB / AA; + + float CC = (x0-_xCentre)*(x0-_xCentre) + + (y0-_yCentre)*(y0-_yCentre) - _radius*_radius; + + CC = CC / AA; + + float DET = BB*BB - CC; + float tt1 = 0.; + float tt2 = 0.; + float xx1,xx2,yy1,yy2; + + + if (DET < 0 ) { + time = 1.0e+10; + point[0]=0.0; + point[1]=0.0; + point[2]=0.0; + return time; + } + + + tt1 = - BB + sqrt(DET); + tt2 = - BB - sqrt(DET); + + xx1 = x0 + tt1*ax; + yy1 = y0 + tt1*ay; + xx2 = x0 + tt2*ax; + yy2 = y0 + tt2*ay; + + float phi1 = atan2(yy1-_yCentre,xx1-_xCentre); + float phi2 = atan2(yy2-_yCentre,xx2-_xCentre); + float phi0 = atan2(ref[1]-_yCentre,ref[0]-_xCentre); + + float dphi1 = phi1 - phi0; + float dphi2 = phi2 - phi0; + + if (dphi1 < 0 && _charge < 0) { + dphi1 = dphi1 + _const_2pi; + } + else if (dphi1 > 0 && _charge > 0) { + dphi1 = dphi1 - _const_2pi; + } + + if (dphi2 < 0 && _charge < 0) { + dphi2 = dphi2 + _const_2pi; + } + else if (dphi2 > 0 && _charge > 0) { + dphi2 = dphi2 - _const_2pi; + } + + // Times + tt1 = -_charge*dphi1*_radius/_pxy; + tt2 = -_charge*dphi2*_radius/_pxy; + + if (tt1 < 0. ) + std::cout << "WARNING " << tt1 << std::endl; + if (tt2 < 0. ) + std::cout << "WARNING " << tt2 << std::endl; + + + if (tt1 < tt2) { + point[0] = xx1; + point[1] = yy1; + time = tt1; + } + else { + point[0] = xx2; + point[1] = yy2; + time = tt2; + } + + point[2] = ref[2]+time*_momentum[2]; + + + + return time; + +} + + +float HelixClassD::getPointOnCircle(float Radius, float * ref, float * point) { + + float distCenterToIP = sqrt(_xCentre*_xCentre + _yCentre*_yCentre); + + point[0] = 0.0; + point[1] = 0.0; + point[2] = 0.0; + + if ((distCenterToIP+_radius)<Radius) { + float xx = -1.0e+20; + return xx; + } + + if ((_radius+Radius)<distCenterToIP) { + float xx = -1.0e+20; + return xx; + } + + float phiCentre = atan2(_yCentre,_xCentre); + float phiStar = Radius*Radius + distCenterToIP*distCenterToIP + - _radius*_radius; + + phiStar = 0.5*phiStar/fmax(1.0e-20,Radius*distCenterToIP); + + if (phiStar > 1.0) + phiStar = 0.9999999; + + if (phiStar < -1.0) + phiStar = -0.9999999; + + phiStar = acos(phiStar); + + float tt1,tt2,time; + + float xx1 = Radius*cos(phiCentre+phiStar); + float yy1 = Radius*sin(phiCentre+phiStar); + + float xx2 = Radius*cos(phiCentre-phiStar); + float yy2 = Radius*sin(phiCentre-phiStar); + + + float phi1 = atan2(yy1-_yCentre,xx1-_xCentre); + float phi2 = atan2(yy2-_yCentre,xx2-_xCentre); + float phi0 = atan2(ref[1]-_yCentre,ref[0]-_xCentre); + + float dphi1 = phi1 - phi0; + float dphi2 = phi2 - phi0; + + if (dphi1 < 0 && _charge < 0) { + dphi1 = dphi1 + _const_2pi; + } + else if (dphi1 > 0 && _charge > 0) { + dphi1 = dphi1 - _const_2pi; + } + + if (dphi2 < 0 && _charge < 0) { + dphi2 = dphi2 + _const_2pi; + } + else if (dphi2 > 0 && _charge > 0) { + dphi2 = dphi2 - _const_2pi; + } + + // Times + tt1 = -_charge*dphi1*_radius/_pxy; + tt2 = -_charge*dphi2*_radius/_pxy; + + if (tt1 < 0. ) + std::cout << "WARNING " << tt1 << std::endl; + if (tt2 < 0. ) + std::cout << "WARNING " << tt2 << std::endl; + + + float time2; + if (tt1 < tt2) { + point[0] = xx1; + point[1] = yy1; + point[3] = xx2; + point[4] = yy2; + time = tt1; + time2 = tt2; + } + else { + point[0] = xx2; + point[1] = yy2; + point[3] = xx1; + point[4] = yy1; + time = tt2; + time2 = tt1; + } + + point[2] = ref[2]+time*_momentum[2]; + point[5] = ref[2]+time2*_momentum[2]; + + + return time; + +} + + +float HelixClassD::getPointInZ(float zLine, float * ref, float * point) { + + float time = zLine - ref[2]; + + if (_momentum[2] == 0.) { + time = -1.0e+20; + point[0] = 0.; + point[1] = 0.; + point[2] = 0.; + return time; + } + + time = time/_momentum[2]; + + float phi0 = atan2(ref[1] - _yCentre , ref[0] - _xCentre); + float phi = phi0 - _charge*_pxy*time/_radius; + float xx = _xCentre + _radius*cos(phi); + float yy = _yCentre + _radius*sin(phi); + + point[0] = xx; + point[1] = yy; + point[2] = zLine; + + return time; + + +} + +int HelixClassD::getNCircle(float * xPoint) { + + int nCircles = 0; + + float phi = atan2(xPoint[1]-_yCentre,xPoint[0]-_xCentre); + float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); + + if (fabs(_tanLambda*_radius)>1.0e-20) { + float xCircles = phi0 - phi -_charge*(xPoint[2]-_referencePoint[2])/(_tanLambda*_radius); + xCircles = xCircles/_const_2pi; + int n1,n2; + + if (xCircles >= 0.) { + n1 = int(xCircles); + n2 = n1 + 1; + } + else { + n1 = int(xCircles) - 1; + n2 = n1 + 1; + } + + if (fabs(n1-xCircles) < fabs(n2-xCircles)) { + nCircles = n1; + } + else { + nCircles = n2; + } + + } + return nCircles; + +} + +float HelixClassD::getDistanceToPoint(float * xPoint, float * Distance) { + + float zOnHelix; + float phi = atan2(xPoint[1]-_yCentre,xPoint[0]-_xCentre); + float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); + //calculate distance to XYprojected centre of Helix, comparing this with distance to radius around centre gives DistXY + float DistXY = (_xCentre-xPoint[0])*(_xCentre-xPoint[0]) + (_yCentre-xPoint[1])*(_yCentre-xPoint[1]); + DistXY = sqrt(DistXY); + DistXY = fabs(DistXY - _radius); + + int nCircles = 0; + + if (fabs(_tanLambda*_radius)>1.0e-20) { + float xCircles = phi0 - phi -_charge*(xPoint[2]-_referencePoint[2])/(_tanLambda*_radius); + xCircles = xCircles/_const_2pi; + int n1,n2; + + if (xCircles >= 0.) { + n1 = int(xCircles); + n2 = n1 + 1; + } + else { + n1 = int(xCircles) - 1; + n2 = n1 + 1; + } + + if (fabs(n1-xCircles) < fabs(n2-xCircles)) { + nCircles = n1; + } + else { + nCircles = n2; + } + + } + + float DPhi = _const_2pi*((float)nCircles) + phi - phi0; + + zOnHelix = _referencePoint[2] - _charge*_radius*_tanLambda*DPhi; + + float DistZ = fabs(zOnHelix - xPoint[2]); + float Time; + + if (fabs(_momentum[2]) > 1.0e-20) { + Time = (zOnHelix - _referencePoint[2])/_momentum[2]; + } + else { + Time = _charge*_radius*DPhi/_pxy; + } + + Distance[0] = DistXY; + Distance[1] = DistZ; + Distance[2] = sqrt(DistXY*DistXY+DistZ*DistZ); + + return Time; + + +} + +//When we are not interested in the exact distance, we can check if we are +//already far enough away in XY, before we start calculating in Z as the +//distance will only increase +float HelixClassD::getDistanceToPoint(const std::vector<float>& xPoint, float distCut) { + //calculate distance to XYprojected centre of Helix, comparing this with distance to radius around centre gives DistXY + float tempx = xPoint[0]-_xCentre; + float tempy = xPoint[1]-_yCentre; + float tempsq = sqrt(tempx*tempx + tempy*tempy); + float tempdf = tempsq - _radius; + float DistXY = fabs( tempdf ); + //If this is bigger than distCut, we dont have to know how much bigger this is + if( DistXY > distCut) { + return DistXY; + } + + int nCircles = 0; + float phi = atan2(tempy,tempx); + float phi0 = atan2(_referencePoint[1]-_yCentre,_referencePoint[0]-_xCentre); + float phidiff = phi0-phi; + float tempz = xPoint[2] - _referencePoint[2];//Yes referencePoint + float tanradius = _tanLambda*_radius; + if (fabs(tanradius)>1.0e-20) { + float xCircles = (phidiff -_charge*tempz/tanradius)/_const_2pi; + int n1,n2; + if (xCircles >= 0.) { + n1 = int(xCircles); + n2 = n1 + 1; + } + else { + n1 = int(xCircles) - 1; + n2 = n1 + 1; + } + if (fabs(n1-xCircles) < fabs(n2-xCircles)) { + nCircles = n1; + } + else { + nCircles = n2; + } + } + float DistZ = - tempz - _charge*tanradius*(_const_2pi*((float)nCircles) - phidiff); + return sqrt(DistXY*DistXY+DistZ*DistZ); +}//getDistanceToPoint(vector,float) + +float HelixClassD::getDistanceToPoint(const float* xPoint, float distCut) { + std::vector<float> xPosition(xPoint, xPoint + 3 );//We are expecting three coordinates, must be +3, last element is excluded! + return getDistanceToPoint(xPosition, distCut); +}//getDistanceToPoint(float*,float) + + + +void HelixClassD::setHelixEdges(float * xStart, float * xEnd) { + for (int i=0; i<3; ++i) { + _xStart[i] = xStart[i]; + _xEnd[i] = xEnd[i]; + } + +} + +float HelixClassD::getDistanceToHelix(HelixClassD * helix, float * pos, float * mom) { + + float x01 = getXC(); + float y01 = getYC(); + + float x02 = helix->getXC(); + float y02 = helix->getYC(); + + float rad1 = getRadius(); + float rad2 = helix->getRadius(); + + float distance = sqrt((x01-x02)*(x01-x02)+(y01-y02)*(y01-y02)); + + bool singlePoint = true; + + float phi1 = 0; + float phi2 = 0; + + if (rad1+rad2<distance) { + phi1 = atan2(y02-y01,x02-x01); + phi2 = atan2(y01-y02,x01-x02); + } + else if (distance+rad2<rad1) { + phi1 = atan2(y02-y01,x02-x01); + phi2 = phi1; + } + else if (distance+rad1<rad2) { + phi1 = atan2(y01-y02,x01-x02); + phi2 = phi1; + } + else { + singlePoint = false; + float cosAlpha = 0.5*(distance*distance+rad2*rad2-rad1*rad1)/(distance*rad2); + float alpha = acos(cosAlpha); + float phi0 = atan2(y01-y02,x01-x02); + phi1 = phi0 + alpha; + phi2 = phi0 - alpha; + } + + + float ref1[3]; + float ref2[3]; + for (int i=0;i<3;++i) { + ref1[i]=_referencePoint[i]; + ref2[i]=helix->getReferencePoint()[i]; + } + + float pos1[3]; + float pos2[3]; + float mom1[3]; + float mom2[3]; + + + if (singlePoint ) { + + float xSect1 = x01 + rad1*cos(phi1); + float ySect1 = y01 + rad1*sin(phi1); + float xSect2 = x02 + rad2*cos(phi2); + float ySect2 = y02 + rad2*sin(phi2); + float R1 = sqrt(xSect1*xSect1+ySect1*ySect1); + float R2 = sqrt(xSect2*xSect2+ySect2*ySect2); + + getPointOnCircle(R1,ref1,pos1); + helix->getPointOnCircle(R2,ref2,pos2); + + } + else { + + float xSect1 = x02 + rad2*cos(phi1); + float ySect1 = y02 + rad2*sin(phi1); + float xSect2 = x02 + rad2*cos(phi2); + float ySect2 = y02 + rad2*sin(phi2); + + // std::cout << "(xSect1,ySect1)=(" << xSect1 << "," << ySect1 << ")" << std::endl; + // std::cout << "(xSect2,ySect2)=(" << xSect2 << "," << ySect2 << ")" << std::endl; + + float temp21[3]; + float temp22[3]; + + float phiI2 = atan2(ref2[1]-y02,ref2[0]-x02); + float phiF21 = atan2(ySect1-y02,xSect1-x02); + float phiF22 = atan2(ySect2-y02,xSect2-x02); + float deltaPhi21 = phiF21 - phiI2; + float deltaPhi22 = phiF22 - phiI2; + float charge2 = helix->getCharge(); + float pxy2 = helix->getPXY(); + float pz2 = helix->getMomentum()[2]; + if (deltaPhi21 < 0 && charge2 < 0) { + deltaPhi21 += _const_2pi; + } + else if (deltaPhi21 > 0 && charge2 > 0) { + deltaPhi21 -= _const_2pi; + } + + if (deltaPhi22 < 0 && charge2 < 0) { + deltaPhi22 += _const_2pi; + } + else if (deltaPhi22 > 0 && charge2 > 0) { + deltaPhi22 -= _const_2pi; + } + + float time21 = -charge2*deltaPhi21*rad2/pxy2; + float time22 = -charge2*deltaPhi22*rad2/pxy2; + + float Z21 = ref2[2] + time21*pz2; + float Z22 = ref2[2] + time22*pz2; + + temp21[0] = xSect1; temp21[1] = ySect1; temp21[2] = Z21; + temp22[0] = xSect2; temp22[1] = ySect2; temp22[2] = Z22; + + + // std::cout << "temp21 = " << temp21[0] << " " << temp21[1] << " " << temp21[2] << std::endl; + // std::cout << "temp22 = " << temp22[0] << " " << temp22[1] << " " << temp22[2] << std::endl; + + + float temp11[3]; + float temp12[3]; + + float phiI1 = atan2(ref1[1]-y01,ref1[0]-x01); + float phiF11 = atan2(ySect1-y01,xSect1-x01); + float phiF12 = atan2(ySect2-y01,xSect2-x01); + float deltaPhi11 = phiF11 - phiI1; + float deltaPhi12 = phiF12 - phiI1; + float charge1 = _charge; + float pxy1 = _pxy; + float pz1 = _momentum[2]; + if (deltaPhi11 < 0 && charge1 < 0) { + deltaPhi11 += _const_2pi; + } + else if (deltaPhi11 > 0 && charge1 > 0) { + deltaPhi11 -= _const_2pi; + } + + if (deltaPhi12 < 0 && charge1 < 0) { + deltaPhi12 += _const_2pi; + } + else if (deltaPhi12 > 0 && charge1 > 0) { + deltaPhi12 -= _const_2pi; + } + + float time11 = -charge1*deltaPhi11*rad1/pxy1; + float time12 = -charge1*deltaPhi12*rad1/pxy1; + + float Z11 = ref1[2] + time11*pz1; + float Z12 = ref1[2] + time12*pz1; + + temp11[0] = xSect1; temp11[1] = ySect1; temp11[2] = Z11; + temp12[0] = xSect2; temp12[1] = ySect2; temp12[2] = Z12; + + // std::cout << "temp11 = " << temp11[0] << " " << temp11[1] << " " << temp11[2] << std::endl; + // std::cout << "temp12 = " << temp12[0] << " " << temp12[1] << " " << temp12[2] << std::endl; + + float Dist1 = 0; + float Dist2 = 0; + + for (int j=0;j<3;++j) { + Dist1 += (temp11[j]-temp21[j])*(temp11[j]-temp21[j]); + Dist2 += (temp12[j]-temp22[j])*(temp12[j]-temp22[j]); + } + + if (Dist1<Dist2) { + for (int l=0;l<3;++l) { + pos1[l] = temp11[l]; + pos2[l] = temp21[l]; + } + } + else { + for (int l=0;l<3;++l) { + pos1[l] = temp12[l]; + pos2[l] = temp22[l]; + } + } + + } + + getExtrapolatedMomentum(pos1,mom1); + helix->getExtrapolatedMomentum(pos2,mom2); + + float helixDistance = 0; + + for (int i=0;i<3;++i) { + helixDistance += (pos1[i] - pos2[i])*(pos1[i] - pos2[i]); + pos[i] = 0.5*(pos1[i]+pos2[i]); + mom[i] = mom1[i]+mom2[i]; + } + helixDistance = sqrt(helixDistance); + + return helixDistance; + +} + +void HelixClassD::getExtrapolatedMomentum(float * pos, float * momentum) { + + float phi = atan2(pos[1]-_yCentre,pos[0]-_xCentre); + if (phi <0.) phi += _const_2pi; + phi = phi - _phiAtPCA + _phi0; + momentum[0] = _pxy*cos(phi); + momentum[1] = _pxy*sin(phi); + momentum[2] = _momentum[2]; + + +} diff --git a/Analysis/ReadDigi/src/HelixClassD.hh b/Analysis/ReadDigi/src/HelixClassD.hh new file mode 100644 index 0000000000000000000000000000000000000000..c9e4d4c386addf9312eb56ac8a89e25b6260820f --- /dev/null +++ b/Analysis/ReadDigi/src/HelixClassD.hh @@ -0,0 +1,304 @@ +#ifndef HELIXARD_HH +#define HELIXARD_HH 1 +#include <vector> +/** + * Utility class to manipulate with different parameterisations <br> + * of helix. Helix can be initialized in a three different <br> + * ways using the following public methods : <br> + * 1) Initialize_VP(float * pos, float * mom, float q, float B) : <br> + * initialization of helix is done using <br> + * - position of the reference point : pos[3]; <br> + * - momentum vector at the reference point : mom[3];<br> + * - particle charge : q;<br> + * - magnetic field (in Tesla) : B;<br> + * 2) Initialize_BZ(float xCentre, float yCentre, float radius, <br> + * float bZ, float phi0, float B, float signPz,<br> + * float zBegin):<br> + * initialization of helix is done according to the following<br> + * parameterization<br> + * x = xCentre + radius*cos(bZ*z + phi0)<br> + * y = yCentre + radius*sin(bZ*z + phi0)<br> + * where (x,y,z) - position of point on the helix<br> + * - (xCentre,yCentre) is the centre of circumference in R-Phi plane<br> + * - radius is the radius of circumference<br> + * - bZ is the helix slope parameter<br> + * - phi0 is the initial phase of circumference<br> + * - B is the magnetic field (in Tesla)<br> + * - signPz is the sign of the z component of momentum vector<br> + * - zBegin is the z coordinate of the reference point;<br> + * 3) void Initialize_Canonical(float phi0, float d0, float z0, float omega,<br> + * float tanlambda, float B) :<br> + * canonical (LEP-wise) parameterisation with the following parameters<br> + * - phi0 - Phi angle of momentum vector at the point of<br> + * closest approach to IP in R-Phi plane; + * - d0 - signed distance of closest approach to IP in R-Phi plane;<br> + * - z0 - z coordinate of the point of closest approach in R-Phi plane;<br> + * - omega - signed curvature;<br> + * - tanlambda - tangent of dip angle;<br> + * - B - magnetic field (in Tesla);<br> + * A set of public methods (getters) provide access to <br> + * various parameters associated with helix. Helix Class contains<br> + * also several utility methods, allowing for calculation of helix<br> + * intersection points with planes parallel and perpendicular to <br> + * z (beam) axis and determination of the distance of closest approach<br> + * from arbitrary 3D point to the helix. <br> + * @author A. Raspereza (DESY)<br> + * @version $Id: HelixClassD.h,v 1.16 2008-06-05 13:47:18 rasp Exp $<br> + * + */ + +//#include "LineClass.h" +class HelixClassD; + +class HelixClassD { + public: + +/** + * Constructor. Initializations of constants which are used + * to calculate various parameters associated with helix. + */ + HelixClassD(); +/** + * Destructor. + */ + ~HelixClassD(); +/** + * Initialization of helix using <br> + * - position of the reference point : pos[3]; <br> + * - momentum vector at the reference point : mom[3];<br> + * - particle charge : q;<br> + * - magnetic field (in Tesla) : B<br> + */ + void Initialize_VP(float * pos, float * mom, float q, float B); + +/** + * Initialization of helix according to the following<br> + * parameterization<br> + * x = xCentre + radius*cos(bZ*z + phi0)<br> + * y = yCentre + radius*sin(bZ*z + phi0)<br> + * where (x,y,z) - position of point on the helix<br> + * - (xCentre,yCentre) is the centre of circumference in R-Phi plane<br> + * - radius is the radius of circumference<br> + * - bZ is the helix slope parameter<br> + * - phi0 is the initial phase of circumference<br> + * - B is the magnetic field (in Tesla)<br> + * - signPz is the sign of the z component of momentum vector<br> + * - zBegin is the z coordinate of the reference point<br> + */ + void Initialize_BZ(float xCentre, float yCentre, float radius, + float bZ, float phi0, float B, float signPz, + float zBegin); +/** + * Canonical (LEP-wise) parameterisation with the following parameters<br> + * - phi0 - Phi angle of momentum vector at the point of<br> + * closest approach to IP in R-Phi plane; + * - d0 - signed distance of closest approach in R-Phi plane;<br> + * - z0 - z coordinate of the point of closest approach to IP + * in R-Phi plane;<br> + * - omega - signed curvature;<br> + * - tanlambda - tangent of dip angle;<br> + * - B - magnetic field (in Tesla)<br> + */ + void Initialize_Canonical(float phi0, float d0, float z0, float omega, + float tanlambda, float B); + /** + * Returns momentum of particle at the point of closest approach <br> + * to IP <br> + */ + const float * getMomentum(); + + /** + * Returns reference point of track <br> + */ + const float * getReferencePoint(); + + /** + * Returns Phi angle of the momentum vector <br> + * at the point of closest approach to IP <br> + */ + float getPhi0(); + + /** + * Returns signed distance of closest approach <br> + * to IP in the R-Phi plane <br> + */ + float getD0(); + + /** + * Returns z coordinate of the point of closest + * approach to IP in the R-Phi plane <br> + */ + float getZ0(); + + /** + * Returns signed curvature of the track <br> + */ + float getOmega(); + + /** + * Returns tangent of dip angle of the track <br> + */ + float getTanLambda(); + + /** + * Returns transverse momentum of the track <br> + */ + float getPXY(); + + + /** + * Returns x coordinate of circumference + */ + float getXC(); + + /** + * Returns y coordinate of circumference + */ + float getYC(); + + + /** + * Returns radius of circumference + */ + float getRadius(); + + + /** + * Returns helix intersection point with the plane <br> + * parallel to z axis. Plane is defined by two coordinates <br> + * of the point belonging to the plane (x0,y0) and normal <br> + * vector (ax,ay). ref[3] is the reference point of the helix. <br> + * point[3] - returned vector holding the coordinates of <br> + * intersection point <br> + */ + float getPointInXY(float x0, float y0, float ax, float ay, + float * ref , float * point); + + /** + * Returns helix intersection point with the plane <br> + * perpendicular to z axis. Plane is defined by z coordinate <br> + * of the plane. ref[3] is the reference point of the helix. <br> + * point[3] - returned vector holding the coordinates of <br> + * intersection point <br> + */ + float getPointInZ(float zLine, float * ref, float * point); + + /** + * Return distance of the closest approach of the helix to <br> + * arbitrary 3D point in space. xPoint[3] - coordinates of <br> + * space point. Distance[3] - vector of distances of helix to <br> + * a given point in various projections : <br> + * Distance[0] - distance in R-Phi plane <br> + * Distance[1] - distance along Z axis <br> + * Distance[2] - 3D distance <br> + */ + float getDistanceToPoint(float * xPoint, float * Distance); + + /** + * Return distance of the closest approach of the helix to <br> + * arbitrary 3D point in space. xPoint[3] - coordinates of <br> + * space point. distCut - limit on the distance between helix <br> + * and the point to reduce calculation time <br> + * If R-Phi is found to be greater than distCut, rPhi distance is returned <br> + * If the R-Phi distance is not too big, than the exact 3D distance is returned <br> + * This function can be used, if the exact distance is not always needed <br> + */ + float getDistanceToPoint(const float* xPoint, float distCut); + float getDistanceToPoint(const std::vector<float>& xPoint, float distCut); + + /** + * This method calculates coordinates of both intersection <br> + * of the helix with a cylinder. <br> + * Rotational symmetry with respect to z axis is assumed, <br> + * meaning that cylinder axis corresponds to the z axis <br> + * of reference frame. <br> + * Inputs : <br> + * Radius - radius of cylinder. <br> + * ref[3] - point of closest approach to the origin of the helix. <br> + * Output : <br> + * point[6] - coordinates of intersection point. <br> + * Method returns also generic time, defined as the <br> + * ratio of helix length from reference point to the intersection <br> + * point to the particle momentum <br> + */ + float getPointOnCircle(float Radius, float * ref, float * point); + + /** Returns distance between two helixes <br> + * Output : <br> + * pos[3] - position of the point of closest approach <br> + * mom[3] - momentum of V0 <br> + */ + float getDistanceToHelix(HelixClassD * helix, float * pos, float * mom); + + int getNCircle(float * XPoint); + + /** + * Set Edges of helix + */ + void setHelixEdges(float * xStart, float * xEnd); + + /** + * Returns starting point of helix + */ + float * getStartingPoint() {return _xStart;} + + /** + * Returns endpoint of helix + */ + float * getEndPoint() {return _xEnd;} + + /** + * Returns BZ for the second parameterization + */ + float getBz(); + + /** + * Returns Phi for the second parameterization + */ + float getPhiZ(); + + /** + * Returns extrapolated momentum + */ + void getExtrapolatedMomentum(float * pos, float * momentum); + + /** + * Returns charge + */ + float getCharge(); + + private: + float _momentum[3]; // momentum @ ref point + float _referencePoint[3]; // coordinates @ ref point + float _phi0; // phi0 in canonical parameterization + float _d0; // d0 in canonical parameterisation + float _z0; // z0 in canonical parameterisation + float _omega; // signed curvuture in canonical parameterisation + float _tanLambda; // TanLambda + float _pxy; // Transverse momentum + float _charge; // Particle Charge + float _bField; // Magnetic field (assumed to point to Z>0) + float _radius; // radius of circle in XY plane + float _xCentre; // X of circle centre + float _yCentre; // Y of circle centre + float _phiRefPoint; // Phi w.r.t. (X0,Y0) of circle @ ref point + float _phiAtPCA; // Phi w.r.t. (X0,Y0) of circle @ PCA + float _xAtPCA; // X @ PCA + float _yAtPCA; // Y @ PCA + float _pxAtPCA; // PX @ PCA + float _pyAtPCA; // PY @ PCA + float _phiMomRefPoint; // Phi of Momentum vector @ ref point + float _const_pi; // PI + float _const_2pi; // 2*PI + float _const_pi2; // PI/2 + float _FCT; // 2.99792458E-4 + float _xStart[3]; // Starting point of track segment + float _xEnd[3]; // Ending point of track segment + + float _bZ; + float _phiZ; + +}; + + +#endif diff --git a/Analysis/ReadDigi/src/ReadDigiAlg.cpp b/Analysis/ReadDigi/src/ReadDigiAlg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..186a5dd7c37502d48c336287071a465375f15b41 --- /dev/null +++ b/Analysis/ReadDigi/src/ReadDigiAlg.cpp @@ -0,0 +1,390 @@ +#ifndef READ_DIGI_C +#define READ_DIGI_C + +#include "ReadDigiAlg.h" + +DECLARE_COMPONENT(ReadDigiAlg) + +ReadDigiAlg::ReadDigiAlg(const std::string& name, ISvcLocator* svcLoc) + : GaudiAlgorithm(name, svcLoc), + _nEvt(0) +{ + declareProperty("MCParticle", m_MCParticleCol, "MCParticle collection (input)"); + + //Tracker hit + declareProperty("SITRawHits", m_SITRawColHdl, "SIT Raw Hit Collection of SpacePoints"); + declareProperty("SETRawHits", m_SETRawColHdl, "SET Raw Hit Collection of SpacePoints"); + declareProperty("FTDRawHits", m_FTDRawColHdl, "FTD Raw Hit Collection of SpacePoints"); + declareProperty("VTXTrackerHits", m_VTXTrackerHitColHdl, "VTX Hit Collection"); + declareProperty("SITTrackerHits", m_SITTrackerHitColHdl, "SIT Hit Collection"); + declareProperty("SETTrackerHits", m_SETTrackerHitColHdl, "SET Hit Collection"); + declareProperty("TPCTrackerHits", m_TPCTrackerHitColHdl, "TPC Hit Collection"); + declareProperty("FTDSpacePoints", m_FTDSpacePointColHdl, "FTD FTDSpacePoint Collection"); + declareProperty("FTDPixelTrackerHits", m_FTDPixelTrackerHitColHdl, "handler of FTD Pixel Hit Collection"); + + //Track + declareProperty("FullTracks", m_fullTrk, "Full Track Collection"); + declareProperty("TPCTracks", m_TPCTrk, "TPC Track Collection"); + declareProperty("SiTracks", m_SiTrk, "Si Track Collection"); + + //declareProperty("EcalBarrelCollection", m_ECalBarrelHitCol, "ECal Barrel"); + //declareProperty("EcalEndcapsCollection", m_ECalEndcapHitCol, "ECal Endcap"); + //declareProperty("HcalBarrelCollection", m_HCalBarrelHitCol, "HCal Barrel"); + //declareProperty("HcalEndcapsCollection", m_HCalEndcapHitCol, "HCal Endcap"); + +} + +StatusCode ReadDigiAlg::initialize() +{ + debug() << "begin initialize ReadDigiAlg" << endmsg; + std::string s_outfile = _filename; + m_wfile = new TFile(s_outfile.c_str(), "recreate"); + m_mctree = new TTree("MCParticle", "MCParticle"); + m_trktree = new TTree("RecoTrk", "RecoTrk"); + + m_mctree->Branch("N_MCP", &N_MCP); + m_mctree->Branch("MCP_px", &MCP_px); + m_mctree->Branch("MCP_py", &MCP_py); + m_mctree->Branch("MCP_pz", &MCP_pz); + m_mctree->Branch("MCP_E", &MCP_E); + m_mctree->Branch("MCP_endPoint_x", &MCP_endPoint_x); + m_mctree->Branch("MCP_endPoint_y", &MCP_endPoint_y); + m_mctree->Branch("MCP_endPoint_z", &MCP_endPoint_z); + m_mctree->Branch("MCP_pdgid", &MCP_pdgid); + m_mctree->Branch("MCP_gStatus", &MCP_gStatus); + + m_trktree->Branch("N_SiTrk", &N_SiTrk); + m_trktree->Branch("N_TPCTrk", &N_TPCTrk); + m_trktree->Branch("N_fullTrk", &N_fullTrk); + m_trktree->Branch("N_VTXhit", &N_VTXhit); + m_trktree->Branch("N_SIThit", &N_SIThit); + m_trktree->Branch("N_TPChit", &N_TPChit); + m_trktree->Branch("N_SEThit", &N_SEThit); + m_trktree->Branch("N_FTDhit", &N_FTDhit); + m_trktree->Branch("N_SITrawhit", &N_SITrawhit); + m_trktree->Branch("N_SETrawhit", &N_SETrawhit); + m_trktree->Branch("trk_px", &m_trk_px); + m_trktree->Branch("trk_py", &m_trk_py); + m_trktree->Branch("trk_pz", &m_trk_pz); + m_trktree->Branch("trk_p", &m_trk_p); + m_trktree->Branch("trk_startpoint_x", &m_trk_startpoint_x); + m_trktree->Branch("trk_startpoint_y", &m_trk_startpoint_y); + m_trktree->Branch("trk_startpoint_z", &m_trk_startpoint_z); + m_trktree->Branch("trk_endpoint_x", &m_trk_endpoint_x); + m_trktree->Branch("trk_endpoint_y", &m_trk_endpoint_y); + m_trktree->Branch("trk_endpoint_z", &m_trk_endpoint_z); + m_trktree->Branch("trk_type", &m_trk_type); + m_trktree->Branch("trk_Nhit", &m_trk_Nhit); + + return GaudiAlgorithm::initialize(); +} + +StatusCode ReadDigiAlg::execute() +{ + if(_nEvt==0) std::cout<<"ReadDigiAlg::execute Start"<<std::endl; + debug() << "Processing event: "<<_nEvt<< endmsg; + + Clear(); + + try{ + const edm4hep::MCParticleCollection* const_MCPCol = m_MCParticleCol.get(); + if(const_MCPCol){ + N_MCP = const_MCPCol->size(); + for(int i=0; i<N_MCP; i++){ + edm4hep::MCParticle m_MCp = const_MCPCol->at(i); + MCP_px.push_back(m_MCp.getMomentum().x); + MCP_py.push_back(m_MCp.getMomentum().y); + MCP_pz.push_back(m_MCp.getMomentum().z); + MCP_E.push_back(m_MCp.getEnergy()); + MCP_endPoint_x.push_back(m_MCp.getEndpoint().x); + MCP_endPoint_y.push_back(m_MCp.getEndpoint().y); + MCP_endPoint_z.push_back(m_MCp.getEndpoint().z); + MCP_pdgid.push_back(m_MCp.getPDG()); + MCP_gStatus.push_back(m_MCp.getGeneratorStatus()); + } + } + }catch(GaudiException &e){ + debug()<<"MC Particle is not available "<<endmsg; + } + + try{ + if(m_VTXTrackerHitColHdl.get()) + N_VTXhit = m_VTXTrackerHitColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"VTX hit is not available "<<endmsg; + } + + try{ + if(m_SITTrackerHitColHdl.get()) + N_SIThit = m_SITTrackerHitColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"SIT hit is not available "<<endmsg; + } + + try{ + if(m_TPCTrackerHitColHdl.get()) + N_TPChit = m_TPCTrackerHitColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"TPC hit is not available "<<endmsg; + } + + try{ + if(m_SETTrackerHitColHdl.get()) + N_SEThit = m_SETTrackerHitColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"SET hit is not available "<<endmsg; + } + + try{ + if(m_FTDSpacePointColHdl.get()) + N_FTDhit = m_FTDSpacePointColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"FDT space point is not available "<<endmsg; + } + + try{ + if(m_SITRawColHdl.get()) + N_SITrawhit = m_SITRawColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"SIT raw hit is not available "<<endmsg; + } + + try{ + if(m_SETRawColHdl.get()) + N_SETrawhit = m_SETRawColHdl.get()->size(); + }catch(GaudiException &e){ + debug()<<"SET raw hit is not available "<<endmsg; + } + + try{ + auto const_SiTrkCol = m_SiTrk.get(); + if(const_SiTrkCol){ + N_SiTrk = const_SiTrkCol->size(); + for(int i=0; i<N_SiTrk; i++){ + auto m_trk = const_SiTrkCol->at(i); + if(m_trk.trackStates_size()==0) continue; + if(m_trk.trackerHits_size()==0) continue; + edm4hep::TrackState m_trkstate = m_trk.getTrackStates(0); + + HelixClassD * TrkInit_Helix = new HelixClassD(); + TrkInit_Helix->Initialize_Canonical(m_trkstate.phi, m_trkstate.D0, m_trkstate.Z0, m_trkstate.omega, m_trkstate.tanLambda, _Bfield); + TVector3 TrkMom(TrkInit_Helix->getMomentum()[0],TrkInit_Helix->getMomentum()[1],TrkInit_Helix->getMomentum()[2]); + + int NTrkHit = m_trk.trackerHits_size(); + TVector3 StartPointPos = TVector3((m_trk.getTrackerHits(0)).getPosition().x,(m_trk.getTrackerHits(0)).getPosition().y,(m_trk.getTrackerHits(0)).getPosition().z); + TVector3 EndPointPos = TVector3((m_trk.getTrackerHits(NTrkHit - 1)).getPosition().x,(m_trk.getTrackerHits(NTrkHit - 1)).getPosition().y,(m_trk.getTrackerHits(NTrkHit - 1)).getPosition().z); + + m_trk_Nhit.push_back(NTrkHit); + m_trk_px.push_back(TrkMom.x()); + m_trk_py.push_back(TrkMom.y()); + m_trk_pz.push_back(TrkMom.z()); + m_trk_p.push_back(TrkMom.Mag()); + m_trk_endpoint_x.push_back(EndPointPos.x()); + m_trk_endpoint_y.push_back(EndPointPos.y()); + m_trk_endpoint_z.push_back(EndPointPos.z()); + m_trk_startpoint_x.push_back(StartPointPos.x()); + m_trk_startpoint_y.push_back(StartPointPos.y()); + m_trk_startpoint_z.push_back(StartPointPos.z()); + m_trk_type.push_back(1); + + delete TrkInit_Helix; + } + } + }catch(GaudiException &e){ + debug()<<"Si track is not available "<<endmsg; + } + + try{ + auto const_TPCTrkCol = m_TPCTrk.get(); + if(const_TPCTrkCol){ + N_TPCTrk = const_TPCTrkCol->size(); + for(int i=0; i<N_TPCTrk; i++){ + auto m_trk = const_TPCTrkCol->at(i); + if(m_trk.trackStates_size()==0) continue; + if(m_trk.trackerHits_size()==0) continue; + edm4hep::TrackState m_trkstate = m_trk.getTrackStates(0); + + HelixClassD * TrkInit_Helix = new HelixClassD(); + TrkInit_Helix->Initialize_Canonical(m_trkstate.phi, m_trkstate.D0, m_trkstate.Z0, m_trkstate.omega, m_trkstate.tanLambda, _Bfield); + TVector3 TrkMom(TrkInit_Helix->getMomentum()[0],TrkInit_Helix->getMomentum()[1],TrkInit_Helix->getMomentum()[2]); + + int NTrkHit = m_trk.trackerHits_size(); + TVector3 StartPointPos = TVector3((m_trk.getTrackerHits(0)).getPosition().x,(m_trk.getTrackerHits(0)).getPosition().y,(m_trk.getTrackerHits(0)).getPosition().z); + TVector3 EndPointPos = TVector3((m_trk.getTrackerHits(NTrkHit - 1)).getPosition().x,(m_trk.getTrackerHits(NTrkHit - 1)).getPosition().y,(m_trk.getTrackerHits(NTrkHit - 1)).getPosition().z); + + m_trk_Nhit.push_back(NTrkHit); + m_trk_px.push_back(TrkMom.x()); + m_trk_py.push_back(TrkMom.y()); + m_trk_pz.push_back(TrkMom.z()); + m_trk_p.push_back(TrkMom.Mag()); + m_trk_endpoint_x.push_back(EndPointPos.x()); + m_trk_endpoint_y.push_back(EndPointPos.y()); + m_trk_endpoint_z.push_back(EndPointPos.z()); + m_trk_startpoint_x.push_back(StartPointPos.x()); + m_trk_startpoint_y.push_back(StartPointPos.y()); + m_trk_startpoint_z.push_back(StartPointPos.z()); + m_trk_type.push_back(2); + + delete TrkInit_Helix; + } + } + }catch(GaudiException &e){ + debug()<<"TPC track is not available "<<endmsg; + } + + + try{ + auto const_fullTrkCol = m_fullTrk.get(); + if(const_fullTrkCol){ + N_fullTrk = const_fullTrkCol->size(); + for(int i=0; i<N_fullTrk; i++){ + auto m_trk = const_fullTrkCol->at(i); + if(m_trk.trackStates_size()==0) continue; + if(m_trk.trackerHits_size()==0) continue; + edm4hep::TrackState m_trkstate = m_trk.getTrackStates(0); + + HelixClassD * TrkInit_Helix = new HelixClassD(); + TrkInit_Helix->Initialize_Canonical(m_trkstate.phi, m_trkstate.D0, m_trkstate.Z0, m_trkstate.omega, m_trkstate.tanLambda, _Bfield); + TVector3 TrkMom(TrkInit_Helix->getMomentum()[0],TrkInit_Helix->getMomentum()[1],TrkInit_Helix->getMomentum()[2]); + + int NTrkHit = m_trk.trackerHits_size(); + TVector3 StartPointPos = TVector3((m_trk.getTrackerHits(0)).getPosition().x,(m_trk.getTrackerHits(0)).getPosition().y,(m_trk.getTrackerHits(0)).getPosition().z); + TVector3 EndPointPos = TVector3((m_trk.getTrackerHits(NTrkHit - 1)).getPosition().x,(m_trk.getTrackerHits(NTrkHit - 1)).getPosition().y,(m_trk.getTrackerHits(NTrkHit - 1)).getPosition().z); + + m_trk_Nhit.push_back(NTrkHit); + m_trk_px.push_back(TrkMom.x()); + m_trk_py.push_back(TrkMom.y()); + m_trk_pz.push_back(TrkMom.z()); + m_trk_p.push_back(TrkMom.Mag()); + m_trk_endpoint_x.push_back(EndPointPos.x()); + m_trk_endpoint_y.push_back(EndPointPos.y()); + m_trk_endpoint_z.push_back(EndPointPos.z()); + m_trk_startpoint_x.push_back(StartPointPos.x()); + m_trk_startpoint_y.push_back(StartPointPos.y()); + m_trk_startpoint_z.push_back(StartPointPos.z()); + m_trk_type.push_back(3); + + delete TrkInit_Helix; + } + } + }catch(GaudiException &e){ + debug()<<"Full track is not available "<<endmsg; + } + +/* const edm4hep::SimCalorimeterHitCollection* ECalBHitCol = m_ECalBarrelHitCol.get(); + Nhit_EcalB = ECalBHitCol->size(); + for(int i=0; i<ECalBHitCol->size(); i++){ + edm4hep::SimCalorimeterHit CaloHit = ECalBHitCol->at(i); + + CaloHit_type.push_back(0); + CaloHit_x.push_back(CaloHit.getPosition().x); + CaloHit_y.push_back(CaloHit.getPosition().y); + CaloHit_z.push_back(CaloHit.getPosition().z); + CaloHit_E.push_back(CaloHit.getEnergy()); + CaloHit_Eem.push_back(CaloHit.getEnergy()); + CaloHit_Ehad.push_back(0.); + + Etot += CaloHit.getEnergy(); + Etot_ecal += CaloHit.getEnergy(); + } +*/ + +/* const edm4hep::SimCalorimeterHitCollection* ECalEHitCol = m_ECalEndcapHitCol.get(); + Nhit_EcalE = ECalEHitCol->size(); + for(int i=0; i<ECalEHitCol->size(); i++){ + edm4hep::SimCalorimeterHit CaloHit = ECalEHitCol->at(i); + + CaloHit_type.push_back(1); + CaloHit_x.push_back(CaloHit.getPosition().x); + CaloHit_y.push_back(CaloHit.getPosition().y); + CaloHit_z.push_back(CaloHit.getPosition().z); + CaloHit_E.push_back(CaloHit.getEnergy()); + CaloHit_Eem.push_back(CaloHit.getEnergy()); + CaloHit_Ehad.push_back(0.); + } +*/ +/* const edm4hep::SimCalorimeterHitCollection* HCalBHitCol = m_HCalBarrelHitCol.get(); + Nhit_HcalB = HCalBHitCol->size(); + for(int i=0; i<HCalBHitCol->size(); i++){ + edm4hep::SimCalorimeterHit CaloHit = HCalBHitCol->at(i); + //if(CaloHit.getEnergy()<0.0001) continue; + + CaloHit_x.push_back(CaloHit.getPosition().x); + CaloHit_y.push_back(CaloHit.getPosition().y); + CaloHit_z.push_back(CaloHit.getPosition().z); + CaloHit_E.push_back(CaloHit.getEnergy()); + + int Nconb = 0; + double Econb = 0.; + for(int iCont=0; iCont < CaloHit.contributions_size(); ++iCont){ + auto conb = CaloHit.getContributions(iCont); + float conb_En = conb.getEnergy(); + if( !conb.isAvailable() ) continue; + if(conb_En == 0) continue; + + Nconb++; + Econb += conb_En; + } + + Etot += CaloHit.getEnergy(); + } +*/ + + m_mctree->Fill(); + m_trktree->Fill(); + _nEvt++; + return StatusCode::SUCCESS; +} + +StatusCode ReadDigiAlg::finalize() +{ + debug() << "begin finalize ReadDigiAlg" << endmsg; + m_wfile->cd(); + m_mctree->Write(); + m_trktree->Write(); + m_wfile->Close(); + + return GaudiAlgorithm::finalize(); +} + +StatusCode ReadDigiAlg::Clear() +{ + + N_MCP = -99; + MCP_px.clear(); + MCP_py.clear(); + MCP_pz.clear(); + MCP_E.clear(); + MCP_endPoint_x.clear(); + MCP_endPoint_y.clear(); + MCP_endPoint_z.clear(); + MCP_pdgid.clear(); + MCP_gStatus.clear(); + + N_SiTrk = -99; + N_TPCTrk = -99; + N_fullTrk = -99; + N_VTXhit = -99; + N_SIThit = -99; + N_TPChit = -99; + N_SEThit = -99; + N_FTDhit = -99; + N_SITrawhit = -99; + N_SETrawhit = -99; + m_trk_px.clear(); + m_trk_py.clear(); + m_trk_pz.clear(); + m_trk_p.clear(); + m_trk_endpoint_x.clear(); + m_trk_endpoint_y.clear(); + m_trk_endpoint_z.clear(); + m_trk_startpoint_x.clear(); + m_trk_startpoint_y.clear(); + m_trk_startpoint_z.clear(); + m_trk_type.clear(); + m_trk_Nhit.clear(); + + return StatusCode::SUCCESS; +} + +#endif diff --git a/Analysis/ReadDigi/src/ReadDigiAlg.h b/Analysis/ReadDigi/src/ReadDigiAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..abfcb759211046dd0ce96caf2c4e85ee05f6200d --- /dev/null +++ b/Analysis/ReadDigi/src/ReadDigiAlg.h @@ -0,0 +1,91 @@ +#ifndef READ_DIGI_H +#define READ_DIGI_H + +#include "k4FWCore/DataHandle.h" +#include "GaudiAlg/GaudiAlgorithm.h" + +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/TrackerHit.h" +#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" +#include "HelixClassD.hh" + +#include "TFile.h" +#include "TTree.h" +#include "TVector3.h" +using namespace std; + +class ReadDigiAlg : public GaudiAlgorithm +{ + +public : + + ReadDigiAlg(const std::string& name, ISvcLocator* svcLoc); + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + StatusCode Clear(); + +private : + DataHandle<edm4hep::MCParticleCollection> m_MCParticleCol{"MCParticle", Gaudi::DataHandle::Reader, this}; + + DataHandle<edm4hep::TrackerHitCollection> m_SITRawColHdl{"SITTrackerHits", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_SETRawColHdl{"SETTrackerHits", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_FTDRawColHdl{"FTDStripTrackerHits", Gaudi::DataHandle::Reader, this}; + + DataHandle<edm4hep::TrackerHitCollection> m_VTXTrackerHitColHdl{"VTXTrackerHits", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_SITTrackerHitColHdl{"SITSpacePoints", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_TPCTrackerHitColHdl{"TPCTrackerHits", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_SETTrackerHitColHdl{"SETSpacePoints", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_FTDSpacePointColHdl{"FTDSpacePoints", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackerHitCollection> m_FTDPixelTrackerHitColHdl{"FTDPixelTrackerHits", Gaudi::DataHandle::Reader, this}; + + DataHandle<edm4hep::TrackCollection> m_SiTrk{"SiTracks", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackCollection> m_TPCTrk{"ClupatraTracks", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::TrackCollection> m_fullTrk{"MarlinTrkTracks", Gaudi::DataHandle::Reader, this}; + + //DataHandle<edm4hep::SimCalorimeterHitCollection> m_ECalBarrelHitCol{"EcalBarrelCollection", Gaudi::DataHandle::Reader, this}; + //DataHandle<edm4hep::SimCalorimeterHitCollection> m_ECalEndcapHitCol{"EcalEndcapCollection", Gaudi::DataHandle::Reader, this}; + //DataHandle<edm4hep::SimCalorimeterHitCollection> m_HCalBarrelHitCol{"HcalBarrelCollection", Gaudi::DataHandle::Reader, this}; + //DataHandle<edm4hep::SimCalorimeterHitCollection> m_HCalEndcapHitCol{"HcalEndcapsCollection", Gaudi::DataHandle::Reader, this}; + + mutable Gaudi::Property<std::string> _filename{this, "OutFileName", "testout.root", "Output file name"}; + mutable Gaudi::Property<double> _Bfield{this, "BField", 3., "Magnet field"}; + + + typedef std::vector<float> FloatVec; + typedef std::vector<int> IntVec; + + + int _nEvt; + TFile *m_wfile; + TTree *m_mctree, *m_trktree; + + //MCParticle + int N_MCP; + FloatVec MCP_px, MCP_py, MCP_pz, MCP_E, MCP_endPoint_x, MCP_endPoint_y, MCP_endPoint_z; + IntVec MCP_pdgid, MCP_gStatus; + + //Tracker + int N_SiTrk, N_TPCTrk, N_fullTrk; + int N_VTXhit, N_SIThit, N_TPChit, N_SEThit, N_FTDhit, N_SITrawhit, N_SETrawhit; + FloatVec m_trk_px, m_trk_py, m_trk_pz, m_trk_p; + FloatVec m_trk_endpoint_x, m_trk_endpoint_y, m_trk_endpoint_z, m_trk_startpoint_x, m_trk_startpoint_y, m_trk_startpoint_z; + IntVec m_trk_type, m_trk_Nhit; + + + //ECal + //int Nhit_EcalB; + //int Nhit_EcalE; + //int Nhit_HcalB; + //int Nhit_HcalE; + //IntVec CaloHit_type; //0: EM hit. 1: Had hit. + //FloatVec CaloHit_x, CaloHit_y, CaloHit_z, CaloHit_E, CaloHit_Eem, CaloHit_Ehad, CaloHit_aveT, CaloHit_Tmin, CaloHit_TmaxE; + + +}; + +#endif diff --git a/Detector/DetCRD/compact/CRD_common_v01/SHcalGlass_Barrel_v05.xml b/Detector/DetCRD/compact/CRD_common_v01/SHcalGlass_Barrel_v05.xml index d0770876d9a30bbcf3a9a50dd2ff681c48a0edc5..4ea47145ce8497d4303320083ab77e539b8acc24 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/SHcalGlass_Barrel_v05.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/SHcalGlass_Barrel_v05.xml @@ -57,6 +57,8 @@ <readouts> <readout name="HcalBarrelCollection"> + <!--id>system:5,stave:4,layer:6,tile:16,x:32:-16,y:-16</id--> + <segmentation type="TiledLayerGridXY" grid_size_x="Hcal_cell_size" grid_size_y="Hcal_cell_size"/> <id>system:5,stave:4,layer:6,tile:16,x:32:-16,y:-16</id> </readout> </readouts> diff --git a/Detector/DetCRD/scripts/TDR_o1_v01/calodigi.py b/Detector/DetCRD/scripts/TDR_o1_v01/calodigi.py index 707db43246582421be23e543e1e0d70f77e8c6de..bff27594109f154b3eb450f102ba44a46154594b 100644 --- a/Detector/DetCRD/scripts/TDR_o1_v01/calodigi.py +++ b/Detector/DetCRD/scripts/TDR_o1_v01/calodigi.py @@ -89,10 +89,23 @@ HcalDigi.CaloMCPAssociationCollection = "HCALBarrelParticleAssoCol" HcalDigi.SkipEvt = 0 HcalDigi.Seed = 2079 #Digitalization parameters -HcalDigi.MIPResponse = 0.01 # 0.5 MeV / MIP -HcalDigi.MIPThreshold = 0.5 # Unit: MIP +HcalDigi.MIPResponse = 0.007126 # MeV / MIP +HcalDigi.MIPThreshold = 0.1 # Unit: MIP HcalDigi.CalibrHCAL = 1. -HcalDigi.Debug=0 +HcalDigi.UseRealisticDigi = 1 # Flag to use digitization model. +HcalDigi.SiPMPixel = 57600 # 57600 for 6025PE (6*6 mm, 25 um pixel pitch) +HcalDigi.TileNonUniformity = 0.0 +HcalDigi.ADCError = 0.0 +HcalDigi.MIPADCMean = 80.*30.0 # Light yield 80 pe/mip +HcalDigi.PeADCMean = 30.0 +HcalDigi.PeADCSigma = 0. +HcalDigi.ADCBaselineHG = 0 +HcalDigi.ADCBaselineSigmaHG = 0. +HcalDigi.ADCBaselineLG = 0 +HcalDigi.ADCBaselineSigmaLG = 0. +HcalDigi.ADCHLRatio = 1 +HcalDigi.ADCSwitch = 1e7 +HcalDigi.ADCLimit = 1e7 HcalDigi.WriteNtuple = 0 HcalDigi.OutFileName = "Digi_HCAL.root" diff --git a/Detector/DetCRD/scripts/TDR_o1_v01/sim.py b/Detector/DetCRD/scripts/TDR_o1_v01/sim.py index d46de9314e25051d76c7539ef2133b6777dc048d..dbf60e86d54544ca9a44748c83582789032fc5c9 100644 --- a/Detector/DetCRD/scripts/TDR_o1_v01/sim.py +++ b/Detector/DetCRD/scripts/TDR_o1_v01/sim.py @@ -96,7 +96,7 @@ from Configurables import ApplicationMgr mgr = ApplicationMgr( TopAlg = [genalg, detsimalg, out], EvtSel = 'NONE', - EvtMax = 10, + EvtMax = 5, ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc], HistogramPersistency = 'ROOT', OutputLevel = ERROR diff --git a/Digitisers/CaloDigi/src/EcalDigiAlg.cpp b/Digitisers/CaloDigi/src/EcalDigiAlg.cpp index bba340457624114510e66015c3b318ee0ba90df7..504a8288238962e6e26cf5101a9b51d2f4402c2a 100644 --- a/Digitisers/CaloDigi/src/EcalDigiAlg.cpp +++ b/Digitisers/CaloDigi/src/EcalDigiAlg.cpp @@ -292,7 +292,7 @@ StatusCode EcalDigiAlg::execute() } } - if(_UseRelDigi){ + if(_UseRelDigi){ // ############################################# // ####### Realistic Charge Digitization ####### // ############################################# @@ -301,7 +301,10 @@ StatusCode EcalDigiAlg::execute() double sEcalCryMipLY = fEcalCryMipLY; //TODO: fEcalMIPEnergy should depends on crystal size. - int ScinGen = std::round(gRandom->Poisson((totQ1_Truth+totQ2_Truth)*1000 / fEcalMIPEnergy * sEcalCryMipLY)); + int ScinGen; + if(fUseDigiScint) + ScinGen = std::round(gRandom->Poisson((totQ1_Truth+totQ2_Truth)*1000 / fEcalMIPEnergy * sEcalCryMipLY)); + else ScinGen = (totQ1_Truth+totQ2_Truth)*1000 / fEcalMIPEnergy * sEcalCryMipLY; totQ1_Digi = EnergyDigi(ScinGen*totQ1_Truth/(totQ1_Truth+totQ2_Truth), sEcalCryMipLY)/1000; totQ2_Digi = EnergyDigi(ScinGen*totQ2_Truth/(totQ1_Truth+totQ2_Truth), sEcalCryMipLY)/1000; @@ -443,15 +446,14 @@ StatusCode EcalDigiAlg::finalize() } double EcalDigiAlg::EnergyDigi(double ScinGen, double sEcalCryMipLY){ - Int_t sPix = int(ScinGen); - // if(sPix/sEcalCryMipLY < fEcalMIP_Thre) return 0; - // return sPix/sEcalCryMipLY*fEcalMIPEnergy; + Int_t sPix; - // return sPix/sEcalCryMipLY*fEcalMIPEnergy; + // ####### SiPM Saturation ####### + if(fUseDigiSaturation) + sPix = std::round(fEcalSiPMPixels * (1 - TMath::Exp(-sPix / fEcalSiPMPixels))); + else sPix = int(ScinGen); - // ####### SiPM Saturation ####### - // sPix = std::round(fEcalSiPMPixels * (1 - TMath::Exp(-sPix / fEcalSiPMPixels))); // ################################ // ####### ADC Digitization ####### @@ -464,35 +466,44 @@ double EcalDigiAlg::EnergyDigi(double ScinGen, double sEcalCryMipLY){ Double_t sADCMean = sPix * fEcalChargeADCMean; Double_t sADCSigma = std::sqrt(sPix * fEcalChargeADCSigma * fEcalChargeADCSigma + fEcalNoiseADCSigma * fEcalNoiseADCSigma); Int_t sADC = -1; - sADC = std::round(gRandom->Gaus(sADCMean, sADCSigma)); - - if(sADC <= fADCSwitch){ - Use_G1 = kTRUE; - sADC = std::round(gRandom->Gaus(sADC, fEcalADCError * sADC)); - Double_t sMIP = sADC / fEcalChargeADCMean / sEcalCryMipLY; - if(sMIP < fEcalMIP_Thre) return 0; - return sMIP * fEcalMIPEnergy; - } - else if(sADC > fADCSwitch && int(sADC/fGainRatio_12) <= fADCSwitch){ - Use_G2 = kTRUE; - sADCMean = sPix * fEcalChargeADCMean / fGainRatio_12; - sADCSigma = std::sqrt(sPix * fEcalChargeADCSigma / fGainRatio_12 * fEcalChargeADCSigma / fGainRatio_12 + fEcalNoiseADCSigma * fEcalNoiseADCSigma); + if(fUseDigiADC){ sADC = std::round(gRandom->Gaus(sADCMean, sADCSigma)); - sADC = std::round(gRandom->Gaus(sADC, fEcalADCError * sADC)); - Double_t sMIP = sADC / fEcalChargeADCMean * fGainRatio_12 / sEcalCryMipLY; - if(sMIP < fEcalMIP_Thre) return 0; - return sMIP * fEcalMIPEnergy; + + if(sADC <= fADCSwitch){ + Use_G1 = kTRUE; + sADC = std::round(gRandom->Gaus(sADC, fEcalADCError * sADC)); + Double_t sMIP = sADC / fEcalChargeADCMean / sEcalCryMipLY; + if(sMIP < fEcalMIP_Thre) return 0; + return sMIP * fEcalMIPEnergy; + } + else if(sADC > fADCSwitch && int(sADC/fGainRatio_12) <= fADCSwitch){ + Use_G2 = kTRUE; + sADCMean = sPix * fEcalChargeADCMean / fGainRatio_12; + sADCSigma = std::sqrt(sPix * fEcalChargeADCSigma / fGainRatio_12 * fEcalChargeADCSigma / fGainRatio_12 + fEcalNoiseADCSigma * fEcalNoiseADCSigma); + sADC = std::round(gRandom->Gaus(sADCMean, sADCSigma)); + sADC = std::round(gRandom->Gaus(sADC, fEcalADCError * sADC)); + Double_t sMIP = sADC / fEcalChargeADCMean * fGainRatio_12 / sEcalCryMipLY; + if(sMIP < fEcalMIP_Thre) return 0; + return sMIP * fEcalMIPEnergy; + } + else if(int(sADC/fGainRatio_12) > fADCSwitch){ + Use_G3 = kTRUE; + sADCMean = sPix * fEcalChargeADCMean / fGainRatio_12 / fGainRatio_23; + sADCSigma = std::sqrt(sPix * fEcalChargeADCSigma / fGainRatio_12 / fGainRatio_23 * fEcalChargeADCSigma / fGainRatio_12 / fGainRatio_23 + fEcalNoiseADCSigma * fEcalNoiseADCSigma); + sADC = std::round(gRandom->Gaus(sADCMean, sADCSigma)); + sADC = std::round(gRandom->Gaus(sADC, fEcalADCError * sADC)); + if (sADC > fADC-1) sADC = fADC-1; + Double_t sMIP = sADC / fEcalChargeADCMean * fGainRatio_12 * fGainRatio_23 / sEcalCryMipLY; + if(sMIP < fEcalMIP_Thre) return 0; + return sMIP * fEcalMIPEnergy; + } + } - else if(int(sADC/fGainRatio_12) > fADCSwitch){ - Use_G3 = kTRUE; - sADCMean = sPix * fEcalChargeADCMean / fGainRatio_12 / fGainRatio_23; - sADCSigma = std::sqrt(sPix * fEcalChargeADCSigma / fGainRatio_12 / fGainRatio_23 * fEcalChargeADCSigma / fGainRatio_12 / fGainRatio_23 + fEcalNoiseADCSigma * fEcalNoiseADCSigma); - sADC = std::round(gRandom->Gaus(sADCMean, sADCSigma)); - sADC = std::round(gRandom->Gaus(sADC, fEcalADCError * sADC)); - if (sADC > fADC-1) sADC = fADC-1; - Double_t sMIP = sADC / fEcalChargeADCMean * fGainRatio_12 * fGainRatio_23 / sEcalCryMipLY; - if(sMIP < fEcalMIP_Thre) return 0; - return sMIP * fEcalMIPEnergy; + else{ + sADC = sADCMean; + Double_t sMIP = sADC / fEcalChargeADCMean / sEcalCryMipLY; + if(sMIP < fEcalMIP_Thre) return 0; + return sMIP * fEcalMIPEnergy; } } @@ -535,13 +546,13 @@ StatusCode EcalDigiAlg::MergeHits( const edm4hep::SimCalorimeterHitCollection& m double EcalDigiAlg::GetBarLength(CaloBar& bar){ //TODO: reading bar length from geosvc. - if(bar.getSlayer()==1) return 375.133; + if(bar.getSlayer()==1) return 374.667; else{ if(bar.getModule()%2 == 0){ - return 295.905 + (bar.getDlayer()-1)* 6.13231; + return 288 + (bar.getDlayer()-1)*12.7080; } else{ - return 416.843 - (bar.getDlayer()+1)* 2.25221; + return 409 - (bar.getDlayer()-1)*4.6670; } } diff --git a/Digitisers/CaloDigi/src/EcalDigiAlg.h b/Digitisers/CaloDigi/src/EcalDigiAlg.h index 058a06bda8cd80e027b2f9912cda16da0eccc885..684ad726d0d7f4e2d665efdcfbbf4a0cdb8b086e 100644 --- a/Digitisers/CaloDigi/src/EcalDigiAlg.h +++ b/Digitisers/CaloDigi/src/EcalDigiAlg.h @@ -109,6 +109,10 @@ protected: mutable Gaudi::Property<float> _Qthfrac {this, "ChargeThresholdFrac", 0.05, "Charge threshold fraction"}; + mutable Gaudi::Property<int> fUseDigiScint{this, "UseDigiScint", 1, "Add scintillation effect in digitization"}; + mutable Gaudi::Property<int> fUseDigiSaturation{this, "UseDigiSaturation", 0, "Add SiPM saturation effect in digitization"}; + mutable Gaudi::Property<int> fUseDigiADC{this, "UseDigiADC", 1, "Add ADC precision effect in digitization"}; + mutable Gaudi::Property<int> fADC{this, "ADC", 4096, "Total ADC conuts"}; mutable Gaudi::Property<int> fNofGain{this, "NofGain", 3, "Number of gain modes"}; mutable Gaudi::Property<int> fADCSwitch{this, "ADCSwitch", 4000, "switching point of different gain mode"}; diff --git a/Digitisers/CaloDigi/src/HcalDigiAlg.cpp b/Digitisers/CaloDigi/src/HcalDigiAlg.cpp index a72a30cb22f501b1992d0e7ae3447e2387d6b41d..d0d65cac15d7b15c3452930ac1446b681abd40db 100644 --- a/Digitisers/CaloDigi/src/HcalDigiAlg.cpp +++ b/Digitisers/CaloDigi/src/HcalDigiAlg.cpp @@ -49,12 +49,18 @@ StatusCode HcalDigiAlg::initialize() std::string s_outfile = _filename; m_wfile = new TFile(s_outfile.c_str(), "recreate"); t_simHit = new TTree("simHit", "simHit"); + t_simHit->Branch("totE", &m_totE); t_simHit->Branch("simHit_x", &m_simHit_x); t_simHit->Branch("simHit_y", &m_simHit_y); t_simHit->Branch("simHit_z", &m_simHit_z); t_simHit->Branch("simHit_E", &m_simHit_E); + t_simHit->Branch("simHit_Etruth", &m_simHit_Etruth); + t_simHit->Branch("simHit_Eatt", &m_simHit_Eatt); + t_simHit->Branch("simHit_Npe_scint", &m_simHit_Npe_scint); + t_simHit->Branch("simHit_Npe_sipm", &m_simHit_Npe_sipm); + t_simHit->Branch("simHit_rawQ", &m_simHit_rawQ); t_simHit->Branch("simHit_HG", &m_simHit_HG); t_simHit->Branch("simHit_LG", &m_simHit_LG); t_simHit->Branch("simHit_steps", &m_simHit_steps); @@ -96,6 +102,7 @@ StatusCode HcalDigiAlg::execute() Clear(); m_totE = 0.; const edm4hep::SimCalorimeterHitCollection* SimHitCol = r_SimCaloCol.get(); + std::vector<edm4hep::SimCalorimeterHit> m_simhitCol; m_simhitCol.clear(); edm4hep::CalorimeterHitCollection* caloVec = w_DigiCaloCol.createAndPut(); edm4hep::MCRecoCaloAssociationCollection* caloAssoVec = w_CaloAssociationCol.createAndPut(); @@ -108,30 +115,51 @@ StatusCode HcalDigiAlg::execute() } if(_Debug>=1) std::cout<<"digi, input sim hit size="<< SimHitCol->size() <<std::endl; + MergeHits(*SimHitCol, m_simhitCol); - for(int isim=0; isim<SimHitCol->size(); isim++){ + for(int isim=0; isim<m_simhitCol.size(); isim++){ - auto simhit = SimHitCol->at(isim); + auto simhit = m_simhitCol.at(isim); if(!simhit.isAvailable()) continue; if(simhit.getEnergy()==0) continue; unsigned long long id = simhit.getCellID(); - double Ehit = simhit.getEnergy(); + edm4hep::Vector3f hitpos = simhit.getPosition(); + TVector3 tilepos(hitpos.x, hitpos.y, hitpos.z); //cm to mm. + + //Loop G4 steps to get the attenuated light yield. + double Ehit_truth = 0.; + double Ehit = 0.; + for(int iCont=0; iCont < simhit.contributions_size(); ++iCont){ + auto conb = simhit.getContributions(iCont); + if( !conb.isAvailable() ) { std::cout<<" Can not get SimHitContribution: "<<iCont<<std::endl; continue;} + TVector3 steppos(conb.getStepPosition().x, conb.getStepPosition().y, conb.getStepPosition().z); + + double _distance = (tilepos-steppos).Mag(); //Simplified: use R(step-center) not R(step-SiPM) as distance. + Ehit_truth += conb.getEnergy(); + Ehit += conb.getEnergy()*exp(-1.*_distance/_EffAttenLength); + } + double Ehit_att = Ehit; + double sChargeOut = 0; double sChargeOutHG = 0; double sChargeOutLG = 0; + double Npe_scint = 0; + double Npe_SiPM = 0; //Digitization if(_UseRelDigi){ // -- Scintillation (Energy -> MIP -> Np.e.) int sPix = gRandom->Poisson(Ehit / _MIPCali * (_MIPADC / _PeADCMean)); + Npe_scint = sPix; // -- Tile non-uniformity sPix = sPix * (1.0 + gRandom->Uniform(-_TileRes, _TileRes)); // -- SiPM Saturation (Np.e. -> Npixel) sPix = std::round(_Pixel * (1.0 - TMath::Exp(-sPix * 1.0 / _Pixel))); + Npe_SiPM = sPix; // -- ADC response (Npixel -> ADC) double sChargeMean = sPix * _PeADCMean; double sChargeSigma = sqrt(sPix * _PeADCSigma * _PeADCSigma); - double sChargeOut = gRandom->Gaus(sChargeMean, sChargeSigma); + sChargeOut = gRandom->Gaus(sChargeMean, sChargeSigma); // -- (ADC->MIP) sChargeOutHG = sChargeOut + gRandom->Gaus(_BaselineHG, _BaselineSigmaHG); sChargeOutLG = sChargeOut / _HLRatio + gRandom->Gaus(_BaselineLG, _BaselineSigmaLG); @@ -200,14 +228,19 @@ StatusCode HcalDigiAlg::execute() m_simHit_y.push_back(digiHit.getPosition().y); m_simHit_z.push_back(digiHit.getPosition().z); m_simHit_E.push_back(digiHit.getEnergy()); + m_simHit_Etruth.push_back(Ehit_truth); + m_simHit_Eatt.push_back(Ehit_att); + m_simHit_rawQ.push_back(sChargeOut); m_simHit_HG.push_back(sChargeOutHG); m_simHit_LG.push_back(sChargeOutLG); + m_simHit_Npe_scint.push_back(Npe_scint); + m_simHit_Npe_sipm.push_back(Npe_SiPM); m_simHit_steps.push_back(simhit.contributions_size()); - m_simHit_module.push_back(m_decoder->get(id, "module")); - m_simHit_stave.push_back(m_decoder->get(id, "stave")); - m_simHit_layer.push_back(m_decoder->get(id, "layer")); - m_simHit_slice.push_back(m_decoder->get(id, "slice")); - m_simHit_tower.push_back(m_decoder->get(id, "tower")); + //m_simHit_module.push_back(m_decoder->get(id, "stave")); + //m_simHit_stave.push_back(m_decoder->get(id, "layer")); + //m_simHit_layer.push_back(m_decoder->get(id, "tile")); + //m_simHit_slice.push_back(m_decoder->get(id, "x")); + //m_simHit_tower.push_back(m_decoder->get(id, "y")); m_simHit_cellID.push_back(id); } } @@ -233,20 +266,75 @@ StatusCode HcalDigiAlg::finalize() } +StatusCode HcalDigiAlg::MergeHits( const edm4hep::SimCalorimeterHitCollection& m_col, std::vector<edm4hep::SimCalorimeterHit>& m_hits ){ + + m_hits.clear(); + std::vector<edm4hep::MutableSimCalorimeterHit> m_mergedhit; + m_mergedhit.clear(); + + for(int iter=0; iter<m_col.size(); iter++){ + edm4hep::SimCalorimeterHit m_step = m_col[iter]; + if(!m_step.isAvailable()){ cout<<"ERROR HIT!"<<endl; continue;} + if(m_step.getEnergy()==0 || m_step.contributions_size()<1) continue; + unsigned long long cellid = m_step.getCellID(); + //edm4hep::Vector3f pos = m_step.getPosition();; + dd4hep::Position hitpos = m_cellIDConverter->position(cellid); + edm4hep::Vector3f pos(hitpos.x()*10, hitpos.y()*10, hitpos.z()*10); + + + edm4hep::MutableCaloHitContribution conb; + conb.setEnergy(m_step.getEnergy()); + conb.setStepPosition(m_step.getPosition()); + conb.setParticle( m_step.getContributions(0).getParticle() ); + conb.setTime(m_step.getContributions(0).getTime()); + + edm4hep::MutableSimCalorimeterHit m_hit = find(m_mergedhit, cellid); + if(m_hit.getCellID()==0){ + m_hit.setCellID(cellid); + m_hit.setPosition(pos); + m_mergedhit.push_back(m_hit); + } + m_hit.addToContributions(conb); + m_hit.setEnergy(m_hit.getEnergy()+m_step.getEnergy()); + } + + for(auto iter = m_mergedhit.begin(); iter!=m_mergedhit.end(); iter++){ + edm4hep::SimCalorimeterHit constsimhit = *iter; + m_hits.push_back( constsimhit ); + } + return StatusCode::SUCCESS; +} + + +edm4hep::MutableSimCalorimeterHit HcalDigiAlg::find(const std::vector<edm4hep::MutableSimCalorimeterHit>& m_col, unsigned long long& cellid) const{ + for(int i=0;i<m_col.size();i++){ + edm4hep::MutableSimCalorimeterHit hit=m_col.at(i); + if(hit.getCellID() == cellid) return hit; + } + edm4hep::MutableSimCalorimeterHit hit ; + hit.setCellID(0); + return hit; +} + void HcalDigiAlg::Clear(){ m_totE = -99; - m_simHit_x.clear(); - m_simHit_y.clear(); - m_simHit_z.clear(); - m_simHit_E.clear(); - m_simHit_HG.clear(); - m_simHit_LG.clear(); - m_simHit_steps.clear(); - m_simHit_module.clear(); - m_simHit_stave.clear(); - m_simHit_layer.clear(); - m_simHit_slice.clear(); - m_simHit_tower.clear(); + m_simHit_x.clear(); + m_simHit_y.clear(); + m_simHit_z.clear(); + m_simHit_E.clear(); + m_simHit_Eatt.clear(); + m_simHit_Etruth.clear(); + m_simHit_rawQ.clear(); + m_simHit_HG.clear(); + m_simHit_LG.clear(); + m_simHit_Npe_scint.clear(); + m_simHit_Npe_sipm.clear(); + m_simHit_steps.clear(); + m_simHit_module.clear(); + m_simHit_stave.clear(); + m_simHit_layer.clear(); + m_simHit_slice.clear(); + m_simHit_tower.clear(); m_simHit_cellID.clear(); } diff --git a/Digitisers/CaloDigi/src/HcalDigiAlg.h b/Digitisers/CaloDigi/src/HcalDigiAlg.h index c65f3d5aeab25a004d382bd7cb266a75a480edd5..5043488eac9183da665ec6616294b550d99c53db 100644 --- a/Digitisers/CaloDigi/src/HcalDigiAlg.h +++ b/Digitisers/CaloDigi/src/HcalDigiAlg.h @@ -52,6 +52,9 @@ public: */ virtual StatusCode finalize() ; + StatusCode MergeHits(const edm4hep::SimCalorimeterHitCollection& m_col, std::vector<edm4hep::SimCalorimeterHit>& m_hits); + edm4hep::MutableSimCalorimeterHit find(const std::vector<edm4hep::MutableSimCalorimeterHit>& m_col, unsigned long long& cellid) const; + void Clear(); protected: @@ -66,7 +69,7 @@ protected: TTree* t_simHit; double m_totE; - FloatVec m_simHit_x, m_simHit_y, m_simHit_z, m_simHit_E, m_simHit_slice, m_simHit_layer, m_simHit_tower, m_simHit_stave, m_simHit_module, m_simHit_HG, m_simHit_LG; + FloatVec m_simHit_x, m_simHit_y, m_simHit_z, m_simHit_E, m_simHit_Etruth, m_simHit_Eatt, m_simHit_slice, m_simHit_layer, m_simHit_tower, m_simHit_stave, m_simHit_module, m_simHit_HG, m_simHit_LG, m_simHit_rawQ, m_simHit_Npe_scint, m_simHit_Npe_sipm; std::vector<unsigned long long> m_simHit_cellID; std::vector<int> m_simHit_steps; @@ -96,6 +99,7 @@ protected: mutable Gaudi::Property<float> _ADCError{this, "ADCError", 0.0002, "ADC Error (/ADC)"}; mutable Gaudi::Property<float> _MIPADC{this, "MIPADCMean", 345.7, "Mean value of MIP response adc (/ADC)"}; mutable Gaudi::Property<float> _TileRes{this, "TileNonUniformity", 0.05, "Non-uniformity level of one tile response"}; + mutable Gaudi::Property<float> _EffAttenLength{this, "EffAttenLength", 20., "Effictive attenuation length (mm)"}; mutable Gaudi::Property<float> _PeADCMean{this, "PeADCMean", 30.0, "Mean value of single photons adc (/ADC)"}; mutable Gaudi::Property<float> _PeADCSigma{this, "PeADCSigma", 3.5, "Sigma of single photons adc (/ADC)"}; mutable Gaudi::Property<float> _BaselineHG{this, "ADCBaselineHG", 377.4, "Mean value of HG baseline adc (/ADC)"}; diff --git a/Reconstruction/CMakeLists.txt b/Reconstruction/CMakeLists.txt index 20058b1c4d08665cfe763d841edfb80f86c37794..793d8828b8f2d6ee08f04c20dcef10b7e041c78f 100644 --- a/Reconstruction/CMakeLists.txt +++ b/Reconstruction/CMakeLists.txt @@ -6,4 +6,3 @@ add_subdirectory(Tracking) add_subdirectory(RecGenfitAlg) add_subdirectory(RecAssociationMaker) add_subdirectory(ParticleID) -add_subdirectory(CrystalCaloRec) diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/AxisMergingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/AxisMergingAlg.h deleted file mode 100644 index b93c40255dd0e41c26695570166fb923ec2a3362..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/AxisMergingAlg.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _AXISMERGING_ALG_H -#define _AXISMERGING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class AxisMergingAlg: public PandoraPlus::Algorithm{ -public: - - AxisMergingAlg(){}; - ~AxisMergingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new AxisMergingAlg(); } - - }; - - StatusCode ReadSettings( PandoraPlus::Settings& m_settings ); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - StatusCode TrkMatchedMerging( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ); - StatusCode OverlapMerging ( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ); - StatusCode BranchMerging ( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ); // yyy: trying to merge fake photon to track axis - StatusCode ConeMerging ( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ); - StatusCode FragmentsMerging ( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ); - bool MergeToClosestCluster( PandoraPlus::CaloHalfCluster* m_badaxis, std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ); - -private: - - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterU = nullptr; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterV = nullptr; - - std::vector<const PandoraPlus::CaloHalfCluster*> m_axisUCol; - std::vector<const PandoraPlus::CaloHalfCluster*> m_axisVCol; - std::vector<PandoraPlus::CaloHalfCluster*> m_newAxisUCol; - std::vector<PandoraPlus::CaloHalfCluster*> m_newAxisVCol; - - static bool compLayer( const PandoraPlus::CaloHalfCluster* sh1, const PandoraPlus::CaloHalfCluster* sh2 ) - { return sh1->getBeginningDlayer() < sh2->getBeginningDlayer(); } - -}; - -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/ClusterMergingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/ClusterMergingAlg.h deleted file mode 100644 index 8669f61eb1be4566831609cc2e96636fd60800a5..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/ClusterMergingAlg.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _CLUSTERMERGING_ALG_H -#define _CLUSTERMERGING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class ClusterMergingAlg: public PandoraPlus::Algorithm{ -public: - - ClusterMergingAlg(){}; - ~ClusterMergingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new ClusterMergingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - StatusCode SelfAlg1(); - -private: - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/ConeClustering2DAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/ConeClustering2DAlg.h deleted file mode 100644 index cf1d9ada6dd9cbfd4b3cb467cfc11ef93a0fca20..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/ConeClustering2DAlg.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _CONECLUSTERING2D_ALG_H -#define _CONECLUSTERING2D_ALG_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" -#include "TMath.h" - -using namespace PandoraPlus; -class ConeClustering2DAlg: public PandoraPlus::Algorithm{ -public: - - ConeClustering2DAlg(){}; - ~ConeClustering2DAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new ConeClustering2DAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - StatusCode LongiConeLinking( std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> >& orderedShower, - std::vector<PandoraPlus::CaloHalfCluster*>& ClusterCol, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& bk_HFclus ); - TVector2 GetProjectedAxis( const PandoraPlus::CaloHalfCluster* m_shower ); - TVector2 GetProjectedRelR( const PandoraPlus::Calo1DCluster* m_shower1, const PandoraPlus::Calo1DCluster* m_shower2 ); - -private: - - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterV; - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterU; - - std::vector<const PandoraPlus::Calo1DCluster*> m_localMaxVCol; - std::vector<const PandoraPlus::Calo1DCluster*> m_localMaxUCol; - std::vector<const PandoraPlus::CaloHalfCluster*> const_longiClusVCol; - std::vector<const PandoraPlus::CaloHalfCluster*> const_longiClusUCol; - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/ConeClusteringAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/ConeClusteringAlg.h deleted file mode 100644 index 56484d8972629691b156e1174291f2b8a057a2e5..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/ConeClusteringAlg.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _CONECLUSTERING_ALG_H -#define _CONECLUSTERING_ALG_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" -#include "TMath.h" -using namespace PandoraPlus; - -class ConeClusteringAlg: public PandoraPlus::Algorithm { -public: - - ConeClusteringAlg(){}; - ~ConeClusteringAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new ConeClusteringAlg(); } - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol); - StatusCode ClearAlgorithm(); - - StatusCode LongiConeLinking( const std::map<int, std::vector<const PandoraPlus::CaloHit*> >& orderedShower, std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& ClusterCol ); - //StatusCode MergeGoodClusters( std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusCol); - //StatusCode MergeBadToGoodCluster( std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_goodClusCol, std::shared_ptr<PandoraPlus::Calo3DCluster> m_badClus ); - //PandoraPlus::Calo3DCluster* GetClosestGoodCluster( std::vector< PandoraPlus::Calo3DCluster* >& m_goodClusCol, PandoraPlus::Calo3DCluster* m_badClus ); - - //static bool compBegin( PandoraPlus::Calo3DCluster* clus1, PandoraPlus::Calo3DCluster* clus2 ) { return clus1->getBeginningDlayer() < clus2->getBeginningDlayer(); } - -private: - - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/EnergySplittingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/EnergySplittingAlg.h deleted file mode 100644 index 94ff532da0ff2b605f3b9083c0309b01defca7a5..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/EnergySplittingAlg.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _ENERGYSPLITTING_ALG_H -#define _ENERGYSPLITTING_ALG_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" -#include "TVector3.h" -#include "TVector.h" -#include "TMatrix.h" - -using namespace PandoraPlus; -class EnergySplittingAlg: public PandoraPlus::Algorithm{ -public: - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new EnergySplittingAlg(); } - - }; - - EnergySplittingAlg(){}; - ~EnergySplittingAlg(){}; - - StatusCode ReadSettings( PandoraPlus::Settings& m_settings ); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - - StatusCode LongitudinalLinking( std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& m_showers, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_oldClusCol, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_newClusCol ); - - StatusCode HalfClusterToTowers( std::vector<PandoraPlus::CaloHalfCluster*>& m_halfClusU, - std::vector<PandoraPlus::CaloHalfCluster*>& m_halfClusV, - std::vector<PandoraPlus::CaloHalfCluster*>& m_emptyClusU, - std::vector<PandoraPlus::CaloHalfCluster*>& m_emptyClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ); - - StatusCode ClusterSplitting( const PandoraPlus::Calo1DCluster* m_cluster, - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& outshCol ); - - StatusCode SplitOverlapCluster( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_HFClusCol ); - - StatusCode MergeToClosestCluster( PandoraPlus::Calo1DCluster* iclus, std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& clusvec ); - - StatusCode MergeToClosestCluster( const PandoraPlus::Calo1DCluster* m_shower, std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_clusters ); - - void CalculateInitialEseed( const std::vector<const PandoraPlus::CaloUnit*>& Seeds, const TVector3* pos, double* Eseed); - - double GetShowerProfile(const TVector3& p_bar, const TVector3& p_seed ); - - -private: - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterU; - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterV; - std::vector<PandoraPlus::CaloHalfCluster*> p_emptyHalfClusterU; - std::vector<PandoraPlus::CaloHalfCluster*> p_emptyHalfClusterV; - std::vector<const PandoraPlus::CaloHalfCluster*> m_axisUCol; - std::vector<const PandoraPlus::CaloHalfCluster*> m_axisVCol; - - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newClusUCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newClusVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_1dShowerUCol; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_1dShowerVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_towerCol; - - PandoraPlusDataCol m_bkCol; - - //static bool compBar( const PandoraPlus::CaloUnit* bar1, const PandoraPlus::CaloUnit* bar2 ) - // { return bar1->getBar() < bar2->getBar(); } - static bool compLayer( const PandoraPlus::Calo1DCluster* sh1, const PandoraPlus::Calo1DCluster* sh2 ) - { return sh1->getDlayer() < sh2->getDlayer(); } - -}; - -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/EnergyTimeMatchingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/EnergyTimeMatchingAlg.h deleted file mode 100644 index 46d6df6ca3174c8e7c835042aef974674e0d23d4..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/EnergyTimeMatchingAlg.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef ETMATCHING_ALG_H -#define ETMATCHING_ALG_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" - -#include "TVector3.h" -using namespace PandoraPlus; - -class EnergyTimeMatchingAlg: public PandoraPlus::Algorithm{ - -public: - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new EnergyTimeMatchingAlg(); } - - }; - - EnergyTimeMatchingAlg(){}; - ~EnergyTimeMatchingAlg(){}; - - StatusCode ReadSettings( PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datasvc ); - StatusCode ClearAlgorithm(); - - StatusCode Matching(std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusterCol ); - - StatusCode PatternMatrixCalculation(std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol, - vector<vector<int>>& matrix ); - - StatusCode Chi2MatrixCalculation( std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol, - vector<vector<double>>& matrix, - std::vector< std::pair<int, int> >& chi2order); - - StatusCode ParameterMatrixCalculation(const int& M, const int& N, vector<vector<int>>& parMatrix); - - StatusCode SimplityMatrix(vector<vector<int>>& parMatrix, vector<double>& Eij, vector<vector<int>>& pattern); - - double SolveMatrix(const int& M, const int& N, vector<vector<int>>& parMatrix, vector<double>& Eij, std::vector<double>& En_clusters); - - StatusCode leastSquares(const vector<vector<int>>& A, const vector<double>& b, vector<double>& x); - - vector<vector<double>> GetClusterChi2Map( std::vector<std::vector<const PandoraPlus::Calo1DCluster*>>& barShowerUCol, - std::vector<std::vector<const PandoraPlus::Calo1DCluster*>>& barShowerVCol ); - - StatusCode ClusterBuilding( std::vector<std::vector<double>> Ematrix, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_HFClusVCol, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusterCol); - - StatusCode XYClusterMatchingL0( const PandoraPlus::CaloHalfCluster* m_longiClU, - const PandoraPlus::CaloHalfCluster* m_longiClV, - std::shared_ptr<PandoraPlus::Calo3DCluster>& m_clus ); - - StatusCode GetMatchedShowersL0( const PandoraPlus::Calo1DCluster* barShowerU, - const PandoraPlus::Calo1DCluster* barShowerV, - PandoraPlus::Calo2DCluster* outsh ); - - StatusCode GetMatchedShowersL1( const PandoraPlus::Calo1DCluster* shower1, - std::vector<const PandoraPlus::Calo1DCluster*>& showerNCol, - std::vector<PandoraPlus::Calo2DCluster*>& outshCol ); - - StatusCode ClusterReconnecting(std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusterCol); - - -private: - std::vector<PandoraPlus::Calo3DCluster*> m_towerCol; - - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol; - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_clusterCol; - - PandoraPlusDataCol m_bkCol; - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/ExampleAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/ExampleAlg.h deleted file mode 100644 index d4d0733a1d8947414889b24ca7d7c20ac53768c5..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/ExampleAlg.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _EXAMPLE_ALG_H -#define _EXAMPLE_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class ExampleAlg: public PandoraPlus::Algorithm{ -public: - - ExampleAlg(){}; - ~ExampleAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new ExampleAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - StatusCode SelfAlg1(); - -private: - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/HcalClusteringAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/HcalClusteringAlg.h deleted file mode 100644 index 31c4c76274ccb8fc4862d1ab9421987b2a4e76bc..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/HcalClusteringAlg.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef HCALCLUSTERING_ALG_H -#define HCALCLUSTERING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; - -class HcalClusteringAlg : public PandoraPlus::Algorithm{ -public: - - HcalClusteringAlg(){}; - ~HcalClusteringAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new HcalClusteringAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - template<typename T1, typename T2> StatusCode Clustering(std::vector<T1*>& m_input, std::vector<std::shared_ptr<T2>>& m_output); - StatusCode LongiConeLinking( const std::map<int, std::vector<PandoraPlus::CaloHit*> >& orderedHit, std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster> >& ClusterCol ); - -private: - -// std::vector<std::shared_ptr<PandoraPlus::CaloHit>> m_hcalHits; -}; -#endif \ No newline at end of file diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/HoughClusteringAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/HoughClusteringAlg.h deleted file mode 100644 index 1f3940fbb01e949a23a6d8095811133e3fd6532b..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/HoughClusteringAlg.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef HOUGHCLUSTERINGALG_H -#define HOUGHCLUSTERINGALG_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" -#include "TVector2.h" -#include <vector> -using namespace PandoraPlus; - -class HoughClusteringAlg: public PandoraPlus::Algorithm{ - -public: - - HoughClusteringAlg () {}; - ~HoughClusteringAlg() {}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new HoughClusteringAlg(); } - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode HoughTransformation( std::vector<PandoraPlus::HoughObject>& Hobjects ); - //StatusCode SetLineRange( int module, int slayer, double *range12, double* range34 ); - StatusCode FillHoughSpace( std::vector<PandoraPlus::HoughObject>& Hobjects, - PandoraPlus::HoughSpace& Hspace ); - StatusCode ClusterFinding( std::vector<PandoraPlus::HoughObject>& Hobjects, - PandoraPlus::HoughSpace& Hspace, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& longiClusCol ); - StatusCode CleanClusters( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_longiClusCol); - - -private: - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterV; - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterU; - - std::vector<const PandoraPlus::Calo1DCluster*> m_localMaxVCol; - std::vector<const PandoraPlus::Calo1DCluster*> m_localMaxUCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_longiClusVCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_longiClusUCol; - - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/LocalMaxFindingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/LocalMaxFindingAlg.h deleted file mode 100644 index 0ad55daff87e1c742fcc2a20cc8a4fe1c4468e60..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/LocalMaxFindingAlg.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _LOCALMAXFINDING_ALG_H -#define _LOCALMAXFINDING_ALG_H - -#include <set> -#include "Tools/Algorithm.h" -using namespace PandoraPlus; - -class LocalMaxFindingAlg: public PandoraPlus::Algorithm{ -public: - - LocalMaxFindingAlg(){}; - ~LocalMaxFindingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const { return new LocalMaxFindingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode GetLocalMax( const PandoraPlus::Calo1DCluster* m_1dClus, std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& m_output); - StatusCode GetLocalMaxBar( std::vector<const PandoraPlus::CaloUnit*>& barCol, std::vector<const PandoraPlus::CaloUnit*>& localMaxCol ); - std::vector<const PandoraPlus::CaloUnit*> getNeighbors(const PandoraPlus::CaloUnit* seed, std::vector<const PandoraPlus::CaloUnit*>& barCol); - -private: - - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusU = nullptr; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusV = nullptr; - - static bool compBar( const PandoraPlus::CaloUnit* bar1, const PandoraPlus::CaloUnit* bar2 ) - { return bar1->getBar() < bar2->getBar(); } - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/PFOCreatingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/PFOCreatingAlg.h deleted file mode 100644 index 0d9b36e728def2c340176d959a74dc37e1491d03..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/PFOCreatingAlg.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef _PFOCREATING_ALG_H -#define _PFOCREATING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class PFOCreatingAlg: public PandoraPlus::Algorithm{ -public: - - PFOCreatingAlg(){}; - ~PFOCreatingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new PFOCreatingAlg(); } - - }; - - StatusCode ReadSettings( PandoraPlus::Settings& m_settings ); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - std::vector<PandoraPlus::Track*> getTracks() const { return m_tracks; } - std::vector<PandoraPlus::Calo3DCluster*> getECALClusters() const { return m_ecal_clusters; } - std::vector<PandoraPlus::Calo3DCluster*> getHCALClusters() const { return m_hcal_clusters; } - - //Self defined algorithms - // Get canditate clusters in HCAL for charged particles - StatusCode GetChargedHCALCandidates(const PandoraPlus::Track* _track, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clusters, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clus_candidate); - // Get nearby HCAL clusters - StatusCode GetNearbyHCALCandidates( PandoraPlus::Calo3DCluster* _ecal_cluster, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clusters, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clus_candidate); - // If a neutral cluster in ECAL reach the outermost ECAL boundary - bool isReachOuterMostECAL(PandoraPlus::Calo3DCluster* _ecal_cluster); - // erase the used_elements in the left_elements - template<typename T1, typename T2> StatusCode CleanUsedElements(std::vector<T1>& _used_elements, - std::vector<T2>& _left_elements); - template<typename T1, typename T2> StatusCode CleanUsedElement(T1 _used_elements, - std::vector<T2>& _left_elements); - // Create PFO with: - // 1. tracks with no clusters in ECAL and HCAL - // 2. HCAL clusters - StatusCode CreateLeftPFO( std::vector<PandoraPlus::Track*>& _tracks, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clusters, - std::vector<std::shared_ptr<PandoraPlus::PFObject>>& _pfobjects); - - - -private: - std::vector<PandoraPlus::Track*> m_tracks; - std::vector<PandoraPlus::Calo3DCluster*> m_ecal_clusters; - std::vector<PandoraPlus::Calo3DCluster*> m_hcal_clusters; - - std::vector<std::shared_ptr<PandoraPlus::PFObject>> m_pfobjects; - - -}; - -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/PFOReclusteringAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/PFOReclusteringAlg.h deleted file mode 100644 index 97bd7048a2f44808e9b3fe80f3cae92b21acbc19..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/PFOReclusteringAlg.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _PFORECLUSTERING_ALG_H -#define _PFORECLUSTERING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class PFOReclusteringAlg: public PandoraPlus::Algorithm{ -public: - - PFOReclusteringAlg(){}; - ~PFOReclusteringAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new PFOReclusteringAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode ReCluster_MergeToChg( std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_chargedPFOs, - std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_neutralPFOs ); - - StatusCode ReCluster_SplitFromChg( std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_chargedPFOs, - std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_neutralPFOs ); - -private: - - std::vector<std::shared_ptr<PandoraPlus::PFObject>>* p_PFObjects; - - PandoraPlusDataCol m_bkCol; - - static bool compTrkP( std::shared_ptr<PandoraPlus::PFObject> pfo1, std::shared_ptr<PandoraPlus::PFObject> pfo2 ) - { return pfo1->getTrackMomentum() > pfo2->getTrackMomentum(); } -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TrackClusterConnectingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TrackClusterConnectingAlg.h deleted file mode 100644 index 483440ca84f371c52abb418407b29f8e7b2519c8..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TrackClusterConnectingAlg.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _TRACKCLUSTERCONNECTING_ALG_H -#define _TRACKCLUSTERCONNECTING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TrackClusterConnectingAlg: public PandoraPlus::Algorithm{ -public: - - TrackClusterConnectingAlg(){}; - ~TrackClusterConnectingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TrackClusterConnectingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - double GetMinR2Trk( const PandoraPlus::Calo3DCluster* p_clus, const PandoraPlus::Track* m_trk); - StatusCode PFOCreating( std::vector<const PandoraPlus::Calo3DCluster*>& m_clusters, - std::vector<const PandoraPlus::Track*>& m_trks, - std::vector<std::shared_ptr<PandoraPlus::PFObject>>& m_PFOs ); - - StatusCode EcalChFragAbsorption( std::vector<const PandoraPlus::Calo3DCluster*>& m_clusters, - std::vector<const PandoraPlus::Track*>& m_trks, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_newclusCol ); - - StatusCode HcalExtrapolatingMatch(std::vector<const PandoraPlus::Calo3DCluster*>& m_clusters, std::vector<std::shared_ptr<PandoraPlus::PFObject>>& m_PFOs); - -private: - - std::vector<const PandoraPlus::Calo3DCluster*> m_EcalClusters; - std::vector<const PandoraPlus::Calo3DCluster*> m_HcalClusters; - std::vector<const PandoraPlus::Track*> m_tracks; - - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_absorbedEcal; - std::vector<std::shared_ptr<PandoraPlus::PFObject>> m_PFObjects; - - PandoraPlusDataCol m_bkCol; - - static bool compTrkP( std::shared_ptr<PandoraPlus::PFObject> pfo1, std::shared_ptr<PandoraPlus::PFObject> pfo2 ) - { return pfo1->getTrackMomentum() > pfo2->getTrackMomentum(); } - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TrackExtrapolatingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TrackExtrapolatingAlg.h deleted file mode 100644 index af6db11ea1fe20a74e2b4bdcbc15e248a84e59a6..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TrackExtrapolatingAlg.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _TRACKEXTRAPOLATING_ALG_H -#define _TRACKEXTRAPOLATING_ALG_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" -#include "Objects/Track.h" - -using namespace PandoraPlus; -class TrackExtrapolatingAlg: public PandoraPlus::Algorithm{ -public: - - TrackExtrapolatingAlg(){}; - ~TrackExtrapolatingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TrackExtrapolatingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - // StatusCode SelfAlg1(); - - // Get normal vectors of planes in each module - StatusCode GetPlaneNormalVector(std::vector<TVector2> & normal_vectors_Ecal, std::vector<TVector2> & normal_vectors_Hcal ); - // Get points in each plane of layer - StatusCode GetLayerPoints(const std::vector<TVector2> & normal_vectors_Ecal, - const std::vector<TVector2> & normal_vectors_Hcal, - std::vector<std::vector<TVector2>> & ECAL_layer_points, - std::vector<std::vector<TVector2>> & HCAL_layer_points); - // If the track reach barrel ECAL - bool IsReachECAL(PandoraPlus::Track * track); - // Get track state at calorimeter - StatusCode GetTrackStateAtCalo(PandoraPlus::Track * track, - PandoraPlus::TrackState & trk_state_at_calo); - // get extrapolated points - StatusCode ExtrapolateByLayer(const std::vector<TVector2> & normal_vectors_Ecal, - const std::vector<TVector2> & normal_vectors_Hcal, - const std::vector<std::vector<TVector2>> & ECAL_layer_points, - const std::vector<std::vector<TVector2>> & HCAL_layer_points, - const PandoraPlus::TrackState & ECAL_trk_state, - PandoraPlus::Track* p_track); - // Get the radius rho - float GetRho(const PandoraPlus::TrackState & trk_state); - // Get coordinates of the center of the circle - TVector2 GetCenterOfCircle(const PandoraPlus::TrackState & trk_state, const float & rho); - // phase from center to reference point - float GetRefAlpha0(const PandoraPlus::TrackState & trk_state, const TVector2 & center); - // If the charged particle return back - bool IsReturn(float rho, TVector2 & center); - - std::vector<std::vector<float>> GetDeltaPhi(float rho, TVector2 center, float alpha0, - const std::vector<TVector2> & normal_vectors, - const std::vector<std::vector<TVector2>> & layer_points, - const PandoraPlus::TrackState & CALO_trk_state); - std::vector<TVector3> GetExtrapoPoints(std::string calo_name, - float rho, TVector2 center, float alpha0, - const PandoraPlus::TrackState & CALO_trk_state, - const std::vector<std::vector<float>>& delta_phi); - - // Get phi0 of extrapolated points. Note that this phi0 is not same as the definition of the phi0 in TrackState, but will be stored in TrackState - float GetExtrapolatedPhi0(float Kappa, float ECAL_phi0, TVector2 center, TVector3 ext_point); - // To sort the extrapolatedpoints, define the following comparison function - static bool SortByPhi0(const PandoraPlus::TrackState& trk_state1, const PandoraPlus::TrackState& trk_state2 ) - { return TMath::Abs(trk_state1.phi0) < TMath::Abs(trk_state2.phi0); } - -private: - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TrackMatchingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TrackMatchingAlg.h deleted file mode 100644 index 78e65a0a142470f07cf8aee64402a52b0e0f7b2b..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TrackMatchingAlg.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef TRACKMATCHING_H -#define TRACKMATCHING_H - -#include "PandoraPlusDataCol.h" -#include "Tools/Algorithm.h" -#include "TVector3.h" -using namespace PandoraPlus; - -class TrackMatchingAlg: public PandoraPlus::Algorithm{ - -public: - TrackMatchingAlg () {}; - ~TrackMatchingAlg() {}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TrackMatchingAlg(); } - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - - StatusCode GetExtrpoECALPoints(const PandoraPlus::Track* track, std::vector<TVector3>& extrapo_points); - StatusCode CreateTrackAxis(vector<TVector3>& extrapo_points, std::vector<const PandoraPlus::Calo1DCluster*>& localMaxVCol, - PandoraPlus::CaloHalfCluster* t_track_axis); - StatusCode GetNearby(const std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterV, - const std::vector<TVector3>& extrapo_points, - std::vector<PandoraPlus::CaloHalfCluster*>& t_nearbyHalfClusters, - std::vector<const PandoraPlus::Calo1DCluster*>& t_nearbyLocalMax); - StatusCode LongiConeLinking(const std::vector<TVector3>& extrapo_points, - std::vector<const PandoraPlus::Calo1DCluster*>& nearbyLocalMax, - std::vector<const PandoraPlus::Calo1DCluster*>& cone_axis); - bool isStopLinking(const std::vector<TVector3>& extrapo_points, - const PandoraPlus::Calo1DCluster* final_cone_hit); - TVector2 GetProjectedRelR(const PandoraPlus::Calo1DCluster* m_shower1, const PandoraPlus::Calo1DCluster* m_shower2 ); - TVector2 GetProjectedAxis(const std::vector<TVector3>& extrapo_points, const PandoraPlus::Calo1DCluster* m_shower); - StatusCode CreatConeAxis(PandoraPlusDataCol& m_datacol, PandoraPlus::Track* track, std::vector<PandoraPlus::CaloHalfCluster*>& nearbyHalfClusters, - std::vector<const PandoraPlus::Calo1DCluster*>& cone_axis); - -private: - std::vector<PandoraPlus::Track*> m_TrackCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterV; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterU; - - // std::vector<const PandoraPlus::CaloHalfCluster*> m_trackAxisVCol; - // std::vector<const PandoraPlus::CaloHalfCluster*> m_trackAxisUCol; - - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthClusterMergingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TruthClusterMergingAlg.h deleted file mode 100644 index baf9c15099e98458f1e8a53fb3a6cbbec553c972..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthClusterMergingAlg.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _TRUTHCLUSTERMERGING_ALG_H -#define _TRUTHCLUSTERMERGING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TruthClusterMergingAlg: public PandoraPlus::Algorithm{ -public: - - TruthClusterMergingAlg(){}; - ~TruthClusterMergingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TruthClusterMergingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - -private: - - std::vector<const PandoraPlus::Calo3DCluster*> m_EcalClusterCol; - std::vector<const PandoraPlus::Calo3DCluster*> m_HcalClusterCol; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> merged_EcalClusterCol; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> merged_HcalClusterCol; - std::vector<std::shared_ptr<PandoraPlus::PFObject>> merged_CombClusterCol; - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthClusteringAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TruthClusteringAlg.h deleted file mode 100644 index 24434fb80d316d8e8a53ed0e0d50bed71e22a8e1..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthClusteringAlg.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _TRUTHCLUS_ALG_H -#define _TRUTHCLUS_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TruthClusteringAlg: public PandoraPlus::Algorithm{ -public: - - TruthClusteringAlg(){}; - ~TruthClusteringAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TruthClusteringAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode HalfClusterToTowers( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusU, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ); - -private: - - PandoraPlusDataCol m_bkCol; - - std::vector<std::shared_ptr<PandoraPlus::Track>> m_TrackCol; - //For ECAL - std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> m_bars; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_1dclusterUCol; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_1dclusterVCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_halfclusterU; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_halfclusterV; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_towers; - //For HCAL - std::vector<std::shared_ptr<PandoraPlus::CaloHit>> m_hits; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_clusters; - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthEnergySplittingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TruthEnergySplittingAlg.h deleted file mode 100644 index 99a6190dc9fa61b73fb82a8629f1674ec3741c81..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthEnergySplittingAlg.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _TRUTHENERGYSPLITTING_ALG_H -#define _TRUTHENERGYSPLITTING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TruthEnergySplittingAlg: public PandoraPlus::Algorithm{ -public: - - TruthEnergySplittingAlg(){}; - ~TruthEnergySplittingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TruthEnergySplittingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode HalfClusterToTowers( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusU, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ); - -private: - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterU; - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterV; - - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newClusUCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newClusVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_towerCol; - - PandoraPlusDataCol m_bkCol; -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthMatchingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TruthMatchingAlg.h deleted file mode 100644 index f33dc4ff53ef328aedd8efc48e1f50f75e865047..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthMatchingAlg.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _TRUTHMATCHING_ALG_H -#define _TRUTHMATCHING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TruthMatchingAlg: public PandoraPlus::Algorithm{ -public: - - TruthMatchingAlg(){}; - ~TruthMatchingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TruthMatchingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode TruthMatching( std::vector<const PandoraPlus::CaloHalfCluster*>& m_ClUCol, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_ClVCol, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusters ); - - StatusCode XYClusterMatchingL0( const PandoraPlus::CaloHalfCluster* m_longiClX, - const PandoraPlus::CaloHalfCluster* m_longiClY, - std::shared_ptr<PandoraPlus::Calo3DCluster>& m_clus ); - - StatusCode GetMatchedShowersL0( const PandoraPlus::Calo1DCluster* barShowerX, - const PandoraPlus::Calo1DCluster* barShowerY, - PandoraPlus::Calo2DCluster* outsh); //1*1 - - StatusCode GetMatchedShowersL1( const PandoraPlus::Calo1DCluster* shower1, - std::vector<const PandoraPlus::Calo1DCluster*>& showerNCol, - std::vector<PandoraPlus::Calo2DCluster*>& outshCol ); //1*N - -private: - - std::vector<PandoraPlus::Calo3DCluster*> m_towerCol; - - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol; - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_clusterCol; - - PandoraPlusDataCol m_bkCol; - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthPatternRecAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TruthPatternRecAlg.h deleted file mode 100644 index e04e7be77d396cb7230c70413be0a8b396322e9a..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthPatternRecAlg.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _TRUTHPATTERNREC_ALG_H -#define _TRUTHPATTERNREC_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TruthPatternRecAlg: public PandoraPlus::Algorithm{ -public: - - TruthPatternRecAlg(){}; - ~TruthPatternRecAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TruthPatternRecAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - StatusCode OverlapMerging ( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_axisCol ); - -private: - - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterV; - std::vector<PandoraPlus::CaloHalfCluster*> p_HalfClusterU; - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthTrackMatchingAlg.h b/Reconstruction/CrystalCaloRec/include/Algorithm/TruthTrackMatchingAlg.h deleted file mode 100644 index 580206ffb37e5fe972083169ee1bba95e5c60112..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/TruthTrackMatchingAlg.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _TRUTHTRKMATCHING_ALG_H -#define _TRUTHTRKMATCHING_ALG_H - -#include "Tools/Algorithm.h" - -using namespace PandoraPlus; -class TruthTrackMatchingAlg: public PandoraPlus::Algorithm{ -public: - - TruthTrackMatchingAlg(){}; - ~TruthTrackMatchingAlg(){}; - - class Factory : public PandoraPlus::AlgorithmFactory - { - public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new TruthTrackMatchingAlg(); } - - }; - - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); - StatusCode ClearAlgorithm(); - - //Self defined algorithms - StatusCode SelfAlg1(); - -private: - - std::vector<PandoraPlus::Track*> m_TrackCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterV; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfClusterU; - - - -}; -#endif diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TrackExtrapolatingAlg.cpp b/Reconstruction/CrystalCaloRec/src/Algorithm/TrackExtrapolatingAlg.cpp deleted file mode 100644 index 5473b9e14995ddb2ef5d0809d6f73dce39e6b869..0000000000000000000000000000000000000000 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TrackExtrapolatingAlg.cpp +++ /dev/null @@ -1,450 +0,0 @@ -#ifndef _TRACKEXTRAPOLATING_ALG_C -#define _TRACKEXTRAPOLATING_ALG_C - -#include "TVector2.h" - -#include "Algorithm/TrackExtrapolatingAlg.h" -#include "Objects/Track.h" -#include "Objects/TrackState.h" - -using namespace TMath; -using namespace std; - -StatusCode TrackExtrapolatingAlg::ReadSettings(Settings& m_settings){ - settings = m_settings; - - //Initialize parameters - // ECAL parameters - if(settings.map_floatPars.find("ECAL_innermost_distance")==settings.map_floatPars.end()) - settings.map_floatPars["ECAL_innermost_distance"] = 1830; - if(settings.map_floatPars.find("ECAL_outermost_distance")==settings.map_floatPars.end()) - settings.map_floatPars["ECAL_outermost_distance"] = 2130; - if(settings.map_intPars.find("ECAL_Nlayers")==settings.map_intPars.end()) - settings.map_intPars["ECAL_Nlayers"] = 30; - if(settings.map_floatPars.find("ECAL_layer_width")==settings.map_floatPars.end()) - settings.map_floatPars["ECAL_layer_width"] = 10; - if(settings.map_floatPars.find("ECAL_half_length")==settings.map_floatPars.end()) - settings.map_floatPars["ECAL_half_length"] = 2900; - // HCAL parameters - if(settings.map_floatPars.find("HCAL_innermost_distance")==settings.map_floatPars.end()) - settings.map_floatPars["HCAL_innermost_distance"] = 2140; - if(settings.map_floatPars.find("HCAL_outermost_distance")==settings.map_floatPars.end()) - settings.map_floatPars["HCAL_outermost_distance"] = 3455; - if(settings.map_intPars.find("HCAL_Nlayers")==settings.map_intPars.end()) - settings.map_intPars["HCAL_Nlayers"] = 48; - if(settings.map_floatPars.find("HCAL_layer_width")==settings.map_floatPars.end()) - settings.map_floatPars["HCAL_layer_width"] = 30.5; - if(settings.map_floatPars.find("HCAL_sensitive_distance")==settings.map_floatPars.end()) - settings.map_floatPars["HCAL_sensitive_distance"] = 9.9; // distance between sensitive material and front face of each layer - if(settings.map_floatPars.find("HCAL_half_length")==settings.map_floatPars.end()) - settings.map_floatPars["HCAL_half_length"] = 3300; - - if(settings.map_intPars.find("Nmodule_ECAL")==settings.map_intPars.end()) - settings.map_intPars["Nmodule_ECAL"] = 32; - if(settings.map_intPars.find("Nmodule_HCAL")==settings.map_intPars.end()) - settings.map_intPars["Nmodule_HCAL"] = 16; - - if(settings.map_floatPars.find("B_field")==settings.map_floatPars.end()) - settings.map_floatPars["B_field"] = 3.0; - - if(settings.map_intPars.find("Input_track")==settings.map_intPars.end()) - settings.map_intPars["Input_track"] = 0; // 0: reconstructed tracks. 1: MC particle track - - return StatusCode::SUCCESS; -}; - - -StatusCode TrackExtrapolatingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ - std::cout<<"Initialize TrackExtrapolatingAlg"<<std::endl; - - return StatusCode::SUCCESS; -}; - - -StatusCode TrackExtrapolatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ -//std::cout<<"---oooOO0OOooo--- Excuting TrackExtrapolatingAlg ---oooOO0OOooo---"<<std::endl; - - std::vector<std::shared_ptr<PandoraPlus::Track>>* p_tracks = &(m_datacol.TrackCol); -//std::cout<<" Track size: "<<p_tracks->size()<<std::endl; - -//std::cout<<" GetPlaneNormalVector() "<<std::endl; - std::vector<TVector2> normal_vectors_Ecal, normal_vectors_Hcal; - GetPlaneNormalVector(normal_vectors_Ecal, normal_vectors_Hcal); - -//std::cout<<" GetLayerPoints() "<<std::endl; - std::vector<std::vector<TVector2>> ECAL_layer_points; // 32 modules, 30 layer points in each modules - std::vector<std::vector<TVector2>> HCAL_layer_points; // 16 modules, 48 layer points in each modules - GetLayerPoints(normal_vectors_Ecal, normal_vectors_Hcal, ECAL_layer_points, HCAL_layer_points); - - for(int itrk=0; itrk<p_tracks->size(); itrk++){ - // Only tracks that reach ECAL should be processed. - if(!IsReachECAL( p_tracks->at(itrk).get() )) continue; - -//std::cout<<" GetTrackStateAtCalo() "<<std::endl; - // get track state at calorimeter - PandoraPlus::TrackState CALO_trk_state; - GetTrackStateAtCalo(p_tracks->at(itrk).get(), CALO_trk_state); - -//std::cout<<" ExtrapolateByLayer() "<<std::endl; - ExtrapolateByLayer(normal_vectors_Ecal, normal_vectors_Hcal, ECAL_layer_points, HCAL_layer_points, CALO_trk_state, p_tracks->at(itrk).get()); - } // end loop tracks - - - p_tracks = nullptr; - return StatusCode::SUCCESS; -}; // RunAlgorithm end - - -StatusCode TrackExtrapolatingAlg::ClearAlgorithm(){ - std::cout<<"End run TrackExtrapolatingAlg. Clean it."<<std::endl; - - return StatusCode::SUCCESS; -}; - - -// StatusCode TrackExtrapolatingAlg::SelfAlg1(){ -// std::cout<<" Processing SelfAlg1: print Par1 = "<<settings.map_floatPars["Par1"]<<std::endl; - -// return StatusCode::SUCCESS; -// }; - - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -StatusCode TrackExtrapolatingAlg::GetPlaneNormalVector(std::vector<TVector2> & normal_vectors_Ecal, std::vector<TVector2> & normal_vectors_Hcal){ - normal_vectors_Ecal.clear(); - normal_vectors_Hcal.clear(); - - for(int im=0; im<settings.map_intPars["Nmodule_ECAL"]; im++){ - TVector2 t_vec(0, 1); - t_vec = t_vec.Rotate(1.*im/settings.map_intPars["Nmodule_ECAL"]*2*Pi()); - normal_vectors_Ecal.push_back(t_vec); - } - - for(int im=0; im<settings.map_intPars["Nmodule_HCAL"]; im++){ - TVector2 t_vec(0, 1); - t_vec = t_vec.Rotate(1.*im/settings.map_intPars["Nmodule_HCAL"]*2*Pi()); - normal_vectors_Hcal.push_back(t_vec); - } - - return StatusCode::SUCCESS; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -StatusCode TrackExtrapolatingAlg::GetLayerPoints(const std::vector<TVector2> & normal_vectors_Ecal, const std::vector<TVector2> & normal_vectors_Hcal, - std::vector<std::vector<TVector2>> & ECAL_layer_points, - std::vector<std::vector<TVector2>> & HCAL_layer_points){ - // ECAL - for(int im=0; im< normal_vectors_Ecal.size(); im++){ - std::vector<TVector2> t_points; - for(int il=0; il<settings.map_intPars["ECAL_Nlayers"]; il++){ - TVector2 t_p; - float dist = settings.map_floatPars["ECAL_innermost_distance"] + - settings.map_floatPars["ECAL_layer_width"]*il + settings.map_floatPars["ECAL_layer_width"]/2; - float xx = (normal_vectors_Ecal[im].X()/normal_vectors_Ecal[im].Mod()) * dist; - float yy = (normal_vectors_Ecal[im].Y()/normal_vectors_Ecal[im].Mod()) * dist; - t_p.SetX(xx); t_p.SetY(yy); - t_points.push_back(t_p); - } - ECAL_layer_points.push_back(t_points); - } - - // HCAL - for(int im=0; im< normal_vectors_Hcal.size(); im++){ - std::vector<TVector2> t_points; - for(int il=0; il<settings.map_intPars["HCAL_Nlayers"]; il++){ - TVector2 t_p; - float dist = settings.map_floatPars["HCAL_innermost_distance"] + - settings.map_floatPars["HCAL_layer_width"]*il + settings.map_floatPars["HCAL_sensitive_distance"]; - float xx = (normal_vectors_Hcal[im].X()/normal_vectors_Hcal[im].Mod()) * dist; - float yy = (normal_vectors_Hcal[im].Y()/normal_vectors_Hcal[im].Mod()) * dist; - t_p.SetX(xx); t_p.SetY(yy); - t_points.push_back(t_p); - } - HCAL_layer_points.push_back(t_points); - } - - return StatusCode::SUCCESS; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -bool TrackExtrapolatingAlg::IsReachECAL(PandoraPlus::Track * track){ - if(settings.map_intPars["Input_track"] == 0){ - // The track is reconstructed in ECAL. If the track reach ECAL, it should have track state at calorimeter - std::vector<TrackState> input_trackstates = track->getTrackStates("Input"); - int count=0; - TVector3 t_vec; - for(int i=0; i<input_trackstates.size(); i++){ - if(input_trackstates[i].location==PandoraPlus::TrackState::AtCalorimeter){ - count++; - t_vec = input_trackstates[i].referencePoint; - break; - } - } - if(count==0){ - std::cout<<" the track has no track state at calorimeter"<<std::endl; - return false; - } - if( Abs(Abs(t_vec.Z())-settings.map_floatPars["ECAL_half_length"]) < 1e-6 ){ - std::cout<<" the track escape from endcap"<<std::endl; - return false; - } - - - return true; - } - else if(settings.map_intPars["Input_track"] == 1){ - // The track is from MC particle as ideal helix. - // The pT should large enough to reach ECAL. The pz should not be so large that it escape from endcap - std::vector<TrackState> input_trackstates = track->getTrackStates("Input"); - if(input_trackstates.size()==0){ - std::cout << "Error! No track state!" << std::endl; - return false; - } - - TrackState IP_trk_state; - for(int i=0; i<input_trackstates.size(); i++){ - if(input_trackstates[i].location==PandoraPlus::TrackState::AtIP) - IP_trk_state = input_trackstates[i]; - break; - } - - TVector3 ref_point = IP_trk_state.referencePoint; - double rho = GetRho(IP_trk_state); - double r_max = TMath::Sqrt(ref_point.X()*ref_point.X() + ref_point.Y()*ref_point.Y()) + rho*2; - - if(r_max<settings.map_floatPars["ECAL_innermost_distance"]){ return false; } - - return true; - } - else{ - std::cout << "Error, wrong source of input tracks for TrackExtrapolatingAlg!" << std:: endl; - return false; - } - -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -StatusCode TrackExtrapolatingAlg::GetTrackStateAtCalo(PandoraPlus::Track * track, - PandoraPlus::TrackState & trk_state_at_calo){ - std::vector<TrackState> input_trackstates = track->getTrackStates("Input"); - - if(settings.map_intPars["Input_track"] == 0){ - for(int its=0; its<input_trackstates.size(); its++){ - if(input_trackstates[its].location==PandoraPlus::TrackState::AtCalorimeter){ - trk_state_at_calo=input_trackstates[its]; - break; - } - } - } - else if((settings.map_intPars["Input_track"] == 1)){ - for(int its=0; its<input_trackstates.size(); its++){ - if(input_trackstates[its].location==PandoraPlus::TrackState::AtIP){ - trk_state_at_calo=input_trackstates[its]; - break; - } - } - } - else{ - std::cout << "Error, wrong source of input tracks for TrackExtrapolatingAlg!" << std:: endl; - } - - return StatusCode::SUCCESS; - -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -StatusCode TrackExtrapolatingAlg::ExtrapolateByLayer(const std::vector<TVector2> & normal_vectors_Ecal, - const std::vector<TVector2> & normal_vectors_Hcal, - const std::vector<std::vector<TVector2>> & ECAL_layer_points, - const std::vector<std::vector<TVector2>> & HCAL_layer_points, - const PandoraPlus::TrackState & CALO_trk_state, - PandoraPlus::Track* p_track){ - float rho = GetRho(CALO_trk_state); - TVector2 center = GetCenterOfCircle(CALO_trk_state, rho); - float alpha0 = GetRefAlpha0(CALO_trk_state, center); - // bool is_rtbk = IsReturn(rho, center); - // Evaluate delta_phi - std::vector<std::vector<float>> ECAL_delta_phi = GetDeltaPhi(rho, center, alpha0, normal_vectors_Ecal, ECAL_layer_points, CALO_trk_state); - std::vector<std::vector<float>> HCAL_delta_phi = GetDeltaPhi(rho, center, alpha0, normal_vectors_Hcal, HCAL_layer_points, CALO_trk_state); - - // extrpolated track points. Will be stored as reference point in TrackState - std::vector<TVector3> ECAL_ext_points = GetExtrapoPoints("ECAL", rho, center, alpha0, CALO_trk_state, ECAL_delta_phi); - std::vector<TVector3> HCAL_ext_points = GetExtrapoPoints("HCAL", rho, center, alpha0, CALO_trk_state, HCAL_delta_phi); - - // Sort Extrapolated points - std::vector<TrackState> t_ECAL_states; - for(int ip=0; ip<ECAL_ext_points.size(); ip++){ - TrackState t_state = CALO_trk_state; - t_state.location = PandoraPlus::TrackState::AtOther; - t_state.referencePoint = ECAL_ext_points[ip]; - // Note GetExtrapolatedPhi0 is not same as the definition of phi0 in TrackState - t_state.phi0 = GetExtrapolatedPhi0(CALO_trk_state.Kappa, CALO_trk_state.phi0, center, ECAL_ext_points[ip]); - t_ECAL_states.push_back(t_state); - } - std::sort(t_ECAL_states.begin(), t_ECAL_states.end(), SortByPhi0); - p_track->setTrackStates("Ecal", t_ECAL_states); - - std::vector<TrackState> t_HCAL_states; - for(int ip=0; ip<HCAL_ext_points.size(); ip++){ - TrackState t_state = CALO_trk_state; - t_state.location = PandoraPlus::TrackState::AtOther; - t_state.referencePoint = HCAL_ext_points[ip]; - // Note GetExtrapolatedPhi0 is not same as the definition of phi0 in TrackState - t_state.phi0 = GetExtrapolatedPhi0(CALO_trk_state.Kappa, CALO_trk_state.phi0, center, HCAL_ext_points[ip]); - t_HCAL_states.push_back(t_state); - } - std::sort(t_HCAL_states.begin(), t_HCAL_states.end(), SortByPhi0); - p_track->setTrackStates("Hcal", t_HCAL_states); - - return StatusCode::SUCCESS; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -float TrackExtrapolatingAlg::GetRho(const PandoraPlus::TrackState & trk_state){ - float rho = Abs(1000. / (0.3*settings.map_floatPars["B_field"]*trk_state.Kappa)); - return rho; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -TVector2 TrackExtrapolatingAlg::GetCenterOfCircle(const PandoraPlus::TrackState & trk_state, const float & rho){ - float phi; - if(trk_state.Kappa>=0) phi = trk_state.phi0 - Pi()/2; - else phi = trk_state.phi0 + Pi()/2; - - float xc = trk_state.referencePoint.X() + ((rho+trk_state.D0)*Cos(phi)); - float yc = trk_state.referencePoint.Y() + ((rho+trk_state.D0)*Sin(phi)); - TVector2 center(xc, yc); - return center; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -float TrackExtrapolatingAlg::GetRefAlpha0(const PandoraPlus::TrackState & trk_state, const TVector2 & center){ - float deltaX = trk_state.referencePoint.X() - center.X(); - float deltaY = trk_state.referencePoint.Y() - center.Y(); - float alpha0 = ATan2(deltaY, deltaX); - return alpha0; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -std::vector<std::vector<float>> TrackExtrapolatingAlg::GetDeltaPhi(float rho, TVector2 center, float alpha0, - const std::vector<TVector2> & normal_vectors, - const std::vector<std::vector<TVector2>> & layer_points, - const PandoraPlus::TrackState & CALO_trk_state){ - std::vector<std::vector<float>> delta_phi; - for(int im=0; im<normal_vectors.size(); im++){ // for each module - std::vector<float> t_delta_phi; - float beta = ATan2(normal_vectors[im].X(), normal_vectors[im].Y()); - float denominator = rho * Sqrt( (normal_vectors[im].X()*normal_vectors[im].X()) + - (normal_vectors[im].Y()*normal_vectors[im].Y()) ); - for(int il=0; il<layer_points[im].size(); il++){ // for each layer - float numerator = (layer_points[im][il].X()*normal_vectors[im].X()) - - (center.X()*normal_vectors[im].X()) + - (layer_points[im][il].Y()*normal_vectors[im].Y()) - - (center.Y()*normal_vectors[im].Y()) ; - if(Abs(numerator/denominator)>1) continue; - float t_as = ASin(numerator/denominator); - float t_ab = ASin(Sin(alpha0+beta)); - - float t_dphi1 = t_as - t_ab; - // float t_dphi2 = Pi()-t_as - t_ab; - if(CALO_trk_state.Kappa < 0){ - t_delta_phi.push_back(t_dphi1); - // if(is_rtbk){ - // t_delta_phi.push_back(t_dphi2); - // } - } - else{ - t_delta_phi.push_back(-t_dphi1); - // if(is_rtbk){ - // t_delta_phi.push_back(-t_dphi2); - // } - } - } - delta_phi.push_back(t_delta_phi); - } - - return delta_phi; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -std::vector<TVector3> TrackExtrapolatingAlg::GetExtrapoPoints(std::string calo_name, - float rho, TVector2 center, float alpha0, - const PandoraPlus::TrackState & CALO_trk_state, - const std::vector<std::vector<float>>& delta_phi){ - std::vector<TVector3> ext_points; - for(int im=0; im<delta_phi.size(); im++){ - for(int ip=0; ip<delta_phi[im].size(); ip++){ - float x = center.X() + (rho*Cos(alpha0+delta_phi[im][ip])); - float y = center.Y() + (rho*Sin(alpha0+delta_phi[im][ip])); - float z; - if(CALO_trk_state.Kappa > 0){ - z = CALO_trk_state.referencePoint.Z() + CALO_trk_state.Z0 - - (delta_phi[im][ip]*rho*CALO_trk_state.tanLambda); - }else{ - z = CALO_trk_state.referencePoint.Z() + CALO_trk_state.Z0 + - (delta_phi[im][ip]*rho*CALO_trk_state.tanLambda); - } - - TVector3 t_vec3(x,y,z); - float rotate_angle = (6-im)*Pi()/4; - t_vec3.RotateZ(rotate_angle); - - if(calo_name=="ECAL"){ - if(Abs(z)>settings.map_floatPars["ECAL_half_length"]) continue; - if(Sqrt(x*x+y*y) > settings.map_floatPars["ECAL_outermost_distance"]/Cos(Pi()/settings.map_intPars["Nmodule_ECAL"])+100) continue; - if(Sqrt(x*x+y*y) < settings.map_floatPars["ECAL_innermost_distance"]) continue; - if(settings.map_floatPars["ECAL_outermost_distance"]*Sqrt(2)-t_vec3.X() < t_vec3.Y()) continue; - if(t_vec3.X()-settings.map_floatPars["ECAL_innermost_distance"]*Sqrt(2) > t_vec3.Y()) continue; - } - else if(calo_name=="HCAL"){ - if(Abs(z)>settings.map_floatPars["HCAL_half_length"]) continue; - if(Sqrt(x*x+y*y) > settings.map_floatPars["HCAL_outermost_distance"]) continue; - if(Sqrt(x*x+y*y) < settings.map_floatPars["HCAL_innermost_distance"]) continue; - if(t_vec3.X()-settings.map_floatPars["HCAL_innermost_distance"]*Sqrt(2) > t_vec3.Y()) continue; - } - else continue; - - TVector3 extp(x,y,z); - ext_points.push_back(extp); - } - } - - return ext_points; -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -bool TrackExtrapolatingAlg::IsReturn(float rho, TVector2 & center){ - float farest = rho + center.Mod(); - if (farest < settings.map_floatPars["ECAL_outermost_distance"]/Cos(Pi()/settings.map_intPars["Nmodule_ECAL"])+100) {return true;} - else{return false;} -} - - -// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... -float TrackExtrapolatingAlg::GetExtrapolatedPhi0(float Kappa, float ECAL_phi0, TVector2 center, TVector3 ext_point){ - // Note: phi0 of extrapolated points is (phi of velocity at extrapolated point) - (phi of velocity at ECAL front face) - TVector2 ext_point_xy(ext_point.X(), ext_point.Y()); - TVector2 ext2center = center - ext_point_xy; - float ext_phi0; - if(Kappa>=0) ext_phi0 = ext2center.Phi() + TMath::Pi()/2.; - else ext_phi0 = ext2center.Phi() - TMath::Pi()/2.; - - float phi0 = ext_phi0 - ECAL_phi0; - while(phi0 < -Pi()) phi0 = phi0 + 2*Pi(); - while(phi0 > Pi()) phi0 = phi0 - 2*Pi(); - return phi0; -} - - -#endif diff --git a/Reconstruction/PFA/CMakeLists.txt b/Reconstruction/PFA/CMakeLists.txt index 05a8afcc79cefcc218af482d3edf8e34cc1ce994..a4b9a1af2e8287c716e9f37551e935692e404334 100644 --- a/Reconstruction/PFA/CMakeLists.txt +++ b/Reconstruction/PFA/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(Arbor) add_subdirectory(Pandora) +add_subdirectory(CyberPFA) diff --git a/Reconstruction/CrystalCaloRec/CMakeLists.txt b/Reconstruction/PFA/CyberPFA/CMakeLists.txt similarity index 96% rename from Reconstruction/CrystalCaloRec/CMakeLists.txt rename to Reconstruction/PFA/CyberPFA/CMakeLists.txt index d577cb45df57b60dce98f29e7cba5766c95c670a..47a099e9d1212e207a38fe4ae652dab719535410 100644 --- a/Reconstruction/CrystalCaloRec/CMakeLists.txt +++ b/Reconstruction/PFA/CyberPFA/CMakeLists.txt @@ -26,8 +26,8 @@ gaudi_add_library(CrystalCaloRecLib ) gaudi_add_module(CrystalCaloRec - SOURCES src/PandoraPlusPFAlg.cpp - src/PandoraPlusDataCol.cpp + SOURCES src/CyberPFAlg.cpp + src/CyberDataCol.cpp src/Tools/MCParticleCreator.cpp src/Tools/TrackCreator.cpp src/Tools/CaloHitsCreator.cpp diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/AxisMergingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/AxisMergingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..50a5416c360cecb9897efbc36c629c532c0a7693 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/AxisMergingAlg.h @@ -0,0 +1,48 @@ +#ifndef _AXISMERGING_ALG_H +#define _AXISMERGING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class AxisMergingAlg: public Cyber::Algorithm{ +public: + + AxisMergingAlg(){}; + ~AxisMergingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new AxisMergingAlg(); } + + }; + + StatusCode ReadSettings( Cyber::Settings& m_settings ); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + //Self defined algorithms + StatusCode TrkMatchedMerging( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ); + StatusCode OverlapMerging ( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ); + StatusCode BranchMerging ( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ); // yyy: trying to merge fake photon to track axis + StatusCode ConeMerging ( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ); + StatusCode FragmentsMerging ( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ); + bool MergeToClosestCluster( Cyber::CaloHalfCluster* m_badaxis, std::vector<Cyber::CaloHalfCluster*>& m_axisCol ); + +private: + + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterU = nullptr; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterV = nullptr; + + std::vector<const Cyber::CaloHalfCluster*> m_axisUCol; + std::vector<const Cyber::CaloHalfCluster*> m_axisVCol; + std::vector<Cyber::CaloHalfCluster*> m_newAxisUCol; + std::vector<Cyber::CaloHalfCluster*> m_newAxisVCol; + + static bool compLayer( const Cyber::CaloHalfCluster* sh1, const Cyber::CaloHalfCluster* sh2 ) + { return sh1->getBeginningDlayer() < sh2->getBeginningDlayer(); } + +}; + +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/ClusterMergingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/ClusterMergingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..289a77b4be63a1b644ab6fe1bbe7265915fd644b --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/ClusterMergingAlg.h @@ -0,0 +1,31 @@ +#ifndef _CLUSTERMERGING_ALG_H +#define _CLUSTERMERGING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class ClusterMergingAlg: public Cyber::Algorithm{ +public: + + ClusterMergingAlg(){}; + ~ClusterMergingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new ClusterMergingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + //Self defined algorithms + StatusCode SelfAlg1(); + +private: + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/ConeClustering2DAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/ConeClustering2DAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..441586615b712153adf996023fcaf2d79e4e38e6 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/ConeClustering2DAlg.h @@ -0,0 +1,45 @@ +#ifndef _CONECLUSTERING2D_ALG_H +#define _CONECLUSTERING2D_ALG_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" +#include "TMath.h" + +using namespace Cyber; +class ConeClustering2DAlg: public Cyber::Algorithm{ +public: + + ConeClustering2DAlg(){}; + ~ConeClustering2DAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new ConeClustering2DAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + //Self defined algorithms + StatusCode LongiConeLinking( std::map<int, std::vector<const Cyber::Calo1DCluster*> >& orderedShower, + std::vector<Cyber::CaloHalfCluster*>& ClusterCol, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& bk_HFclus ); + TVector2 GetProjectedAxis( const Cyber::CaloHalfCluster* m_shower ); + TVector2 GetProjectedRelR( const Cyber::Calo1DCluster* m_shower1, const Cyber::Calo1DCluster* m_shower2 ); + +private: + + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterV; + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterU; + + std::vector<const Cyber::Calo1DCluster*> m_localMaxVCol; + std::vector<const Cyber::Calo1DCluster*> m_localMaxUCol; + std::vector<const Cyber::CaloHalfCluster*> const_longiClusVCol; + std::vector<const Cyber::CaloHalfCluster*> const_longiClusUCol; + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/ConeClusteringAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/ConeClusteringAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..aa8e2f7b0b737a95264359390e252eda411fe575 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/ConeClusteringAlg.h @@ -0,0 +1,36 @@ +#ifndef _CONECLUSTERING_ALG_H +#define _CONECLUSTERING_ALG_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" +#include "TMath.h" +using namespace Cyber; + +class ConeClusteringAlg: public Cyber::Algorithm { +public: + + ConeClusteringAlg(){}; + ~ConeClusteringAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + Cyber::Algorithm* CreateAlgorithm() const{ return new ConeClusteringAlg(); } + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol); + StatusCode ClearAlgorithm(); + + StatusCode LongiConeLinking( const std::map<int, std::vector<const Cyber::CaloHit*> >& orderedShower, std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& ClusterCol ); + //StatusCode MergeGoodClusters( std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusCol); + //StatusCode MergeBadToGoodCluster( std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_goodClusCol, std::shared_ptr<Cyber::Calo3DCluster> m_badClus ); + //Cyber::Calo3DCluster* GetClosestGoodCluster( std::vector< Cyber::Calo3DCluster* >& m_goodClusCol, Cyber::Calo3DCluster* m_badClus ); + + //static bool compBegin( Cyber::Calo3DCluster* clus1, Cyber::Calo3DCluster* clus2 ) { return clus1->getBeginningDlayer() < clus2->getBeginningDlayer(); } + +private: + + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/EnergySplittingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/EnergySplittingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a8262844f04fce53cd8489cfda0a2989ffcc2e84 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/EnergySplittingAlg.h @@ -0,0 +1,77 @@ +#ifndef _ENERGYSPLITTING_ALG_H +#define _ENERGYSPLITTING_ALG_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" +#include "TVector3.h" +#include "TVector.h" +#include "TMatrix.h" + +using namespace Cyber; +class EnergySplittingAlg: public Cyber::Algorithm{ +public: + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new EnergySplittingAlg(); } + + }; + + EnergySplittingAlg(){}; + ~EnergySplittingAlg(){}; + + StatusCode ReadSettings( Cyber::Settings& m_settings ); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + + StatusCode LongitudinalLinking( std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& m_showers, + std::vector<const Cyber::CaloHalfCluster*>& m_oldClusCol, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_newClusCol ); + + StatusCode HalfClusterToTowers( std::vector<Cyber::CaloHalfCluster*>& m_halfClusU, + std::vector<Cyber::CaloHalfCluster*>& m_halfClusV, + std::vector<Cyber::CaloHalfCluster*>& m_emptyClusU, + std::vector<Cyber::CaloHalfCluster*>& m_emptyClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ); + + StatusCode ClusterSplitting( const Cyber::Calo1DCluster* m_cluster, + std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& outshCol ); + + StatusCode SplitOverlapCluster( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_HFClusCol ); + + StatusCode MergeToClosestCluster( Cyber::Calo1DCluster* iclus, std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& clusvec ); + + StatusCode MergeToClosestCluster( const Cyber::Calo1DCluster* m_shower, std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_clusters ); + + void CalculateInitialEseed( const std::vector<const Cyber::CaloUnit*>& Seeds, const TVector3* pos, double* Eseed); + + double GetShowerProfile(const TVector3& p_bar, const TVector3& p_seed ); + + +private: + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterU; + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterV; + std::vector<Cyber::CaloHalfCluster*> p_emptyHalfClusterU; + std::vector<Cyber::CaloHalfCluster*> p_emptyHalfClusterV; + std::vector<const Cyber::CaloHalfCluster*> m_axisUCol; + std::vector<const Cyber::CaloHalfCluster*> m_axisVCol; + + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newClusUCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newClusVCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_1dShowerUCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_1dShowerVCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_towerCol; + + CyberDataCol m_bkCol; + + //static bool compBar( const Cyber::CaloUnit* bar1, const Cyber::CaloUnit* bar2 ) + // { return bar1->getBar() < bar2->getBar(); } + static bool compLayer( const Cyber::Calo1DCluster* sh1, const Cyber::Calo1DCluster* sh2 ) + { return sh1->getDlayer() < sh2->getDlayer(); } + +}; + +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/EnergyTimeMatchingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/EnergyTimeMatchingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..ab82381cfcd889f22f31936234e17951df22edf6 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/EnergyTimeMatchingAlg.h @@ -0,0 +1,83 @@ +#ifndef ETMATCHING_ALG_H +#define ETMATCHING_ALG_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" + +#include "TVector3.h" +using namespace Cyber; + +class EnergyTimeMatchingAlg: public Cyber::Algorithm{ + +public: + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new EnergyTimeMatchingAlg(); } + + }; + + EnergyTimeMatchingAlg(){}; + ~EnergyTimeMatchingAlg(){}; + + StatusCode ReadSettings( Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datasvc ); + StatusCode ClearAlgorithm(); + + StatusCode Matching(std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusterCol ); + + StatusCode PatternMatrixCalculation(std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol, + vector<vector<int>>& matrix ); + + StatusCode Chi2MatrixCalculation( std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol, + vector<vector<double>>& matrix, + std::vector< std::pair<int, int> >& chi2order); + + StatusCode ParameterMatrixCalculation(const int& M, const int& N, vector<vector<int>>& parMatrix); + + StatusCode SimplityMatrix(vector<vector<int>>& parMatrix, vector<double>& Eij, vector<vector<int>>& pattern); + + double SolveMatrix(const int& M, const int& N, vector<vector<int>>& parMatrix, vector<double>& Eij, std::vector<double>& En_clusters); + + StatusCode leastSquares(const vector<vector<int>>& A, const vector<double>& b, vector<double>& x); + + vector<vector<double>> GetClusterChi2Map( std::vector<std::vector<const Cyber::Calo1DCluster*>>& barShowerUCol, + std::vector<std::vector<const Cyber::Calo1DCluster*>>& barShowerVCol ); + + StatusCode ClusterBuilding( std::vector<std::vector<double>> Ematrix, + std::vector<const Cyber::CaloHalfCluster*>& m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*>& m_HFClusVCol, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusterCol); + + StatusCode XYClusterMatchingL0( const Cyber::CaloHalfCluster* m_longiClU, + const Cyber::CaloHalfCluster* m_longiClV, + std::shared_ptr<Cyber::Calo3DCluster>& m_clus ); + + StatusCode GetMatchedShowersL0( const Cyber::Calo1DCluster* barShowerU, + const Cyber::Calo1DCluster* barShowerV, + Cyber::Calo2DCluster* outsh ); + + StatusCode GetMatchedShowersL1( const Cyber::Calo1DCluster* shower1, + std::vector<const Cyber::Calo1DCluster*>& showerNCol, + std::vector<Cyber::Calo2DCluster*>& outshCol ); + + StatusCode ClusterReconnecting(std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusterCol); + + +private: + std::vector<Cyber::Calo3DCluster*> m_towerCol; + + std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol; + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_clusterCol; + + CyberDataCol m_bkCol; + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/ExampleAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/ExampleAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..986780c560525f5765170b54e8d34d2956797459 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/ExampleAlg.h @@ -0,0 +1,31 @@ +#ifndef _EXAMPLE_ALG_H +#define _EXAMPLE_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class ExampleAlg: public Cyber::Algorithm{ +public: + + ExampleAlg(){}; + ~ExampleAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new ExampleAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + //Self defined algorithms + StatusCode SelfAlg1(); + +private: + +}; +#endif diff --git a/Reconstruction/CrystalCaloRec/include/Algorithm/GlobalClusteringAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/GlobalClusteringAlg.h similarity index 54% rename from Reconstruction/CrystalCaloRec/include/Algorithm/GlobalClusteringAlg.h rename to Reconstruction/PFA/CyberPFA/include/Algorithm/GlobalClusteringAlg.h index 5c4642b9f388941b2e86cbd20c92d436d21c6a6d..af64b125ab71e974bd26d7f58bfb333186586aab 100644 --- a/Reconstruction/CrystalCaloRec/include/Algorithm/GlobalClusteringAlg.h +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/GlobalClusteringAlg.h @@ -9,24 +9,24 @@ #include <cstdlib> -using namespace PandoraPlus; +using namespace Cyber; -class GlobalClusteringAlg : public PandoraPlus::Algorithm{ +class GlobalClusteringAlg : public Cyber::Algorithm{ public: GlobalClusteringAlg(){}; ~GlobalClusteringAlg(){}; - class Factory : public PandoraPlus::AlgorithmFactory + class Factory : public Cyber::AlgorithmFactory { public: - PandoraPlus::Algorithm* CreateAlgorithm() const{ return new GlobalClusteringAlg(); } + Cyber::Algorithm* CreateAlgorithm() const{ return new GlobalClusteringAlg(); } }; - StatusCode ReadSettings(PandoraPlus::Settings& m_settings); - StatusCode Initialize( PandoraPlusDataCol& m_datacol ); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ); + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); StatusCode ClearAlgorithm(); template<typename T1, typename T2> StatusCode Clustering(std::vector<std::shared_ptr<T1>>& m_input, std::vector<std::shared_ptr<T2>>& m_output); @@ -43,11 +43,11 @@ public: private: - std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> m_bars; - std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> m_processbars; - std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> m_restbars; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_1dclusters; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_halfclusters; + std::vector<std::shared_ptr<Cyber::CaloUnit>> m_bars; + std::vector<std::shared_ptr<Cyber::CaloUnit>> m_processbars; + std::vector<std::shared_ptr<Cyber::CaloUnit>> m_restbars; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_1dclusters; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_halfclusters; }; #endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/HcalClusteringAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/HcalClusteringAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..bb915789ae0680790cceb4a3e607e91c5caf484f --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/HcalClusteringAlg.h @@ -0,0 +1,33 @@ +#ifndef HCALCLUSTERING_ALG_H +#define HCALCLUSTERING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; + +class HcalClusteringAlg : public Cyber::Algorithm{ +public: + + HcalClusteringAlg(){}; + ~HcalClusteringAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new HcalClusteringAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + template<typename T1, typename T2> StatusCode Clustering(std::vector<T1*>& m_input, std::vector<std::shared_ptr<T2>>& m_output); + StatusCode LongiConeLinking( const std::map<int, std::vector<Cyber::CaloHit*> >& orderedHit, std::vector<std::shared_ptr<Cyber::Calo3DCluster> >& ClusterCol ); + +private: + +// std::vector<std::shared_ptr<Cyber::CaloHit>> m_hcalHits; +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/HoughClusteringAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/HoughClusteringAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..581c6fb99d9b39773a7f8da6d898eaf0bf000979 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/HoughClusteringAlg.h @@ -0,0 +1,49 @@ +#ifndef HOUGHCLUSTERINGALG_H +#define HOUGHCLUSTERINGALG_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" +#include "TVector2.h" +#include <vector> +using namespace Cyber; + +class HoughClusteringAlg: public Cyber::Algorithm{ + +public: + + HoughClusteringAlg () {}; + ~HoughClusteringAlg() {}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new HoughClusteringAlg(); } + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode HoughTransformation( std::vector<Cyber::HoughObject>& Hobjects ); + //StatusCode SetLineRange( int module, int slayer, double *range12, double* range34 ); + StatusCode FillHoughSpace( std::vector<Cyber::HoughObject>& Hobjects, + Cyber::HoughSpace& Hspace ); + StatusCode ClusterFinding( std::vector<Cyber::HoughObject>& Hobjects, + Cyber::HoughSpace& Hspace, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& longiClusCol ); + StatusCode CleanClusters( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_longiClusCol); + + +private: + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterV; + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterU; + + std::vector<const Cyber::Calo1DCluster*> m_localMaxVCol; + std::vector<const Cyber::Calo1DCluster*> m_localMaxUCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_longiClusVCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_longiClusUCol; + + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/LocalMaxFindingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/LocalMaxFindingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..5be7cac777f320a020b80517f60bf91baa0b12b7 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/LocalMaxFindingAlg.h @@ -0,0 +1,39 @@ +#ifndef _LOCALMAXFINDING_ALG_H +#define _LOCALMAXFINDING_ALG_H + +#include <set> +#include "Tools/Algorithm.h" +using namespace Cyber; + +class LocalMaxFindingAlg: public Cyber::Algorithm{ +public: + + LocalMaxFindingAlg(){}; + ~LocalMaxFindingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const { return new LocalMaxFindingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode GetLocalMax( const Cyber::Calo1DCluster* m_1dClus, std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& m_output); + StatusCode GetLocalMaxBar( std::vector<const Cyber::CaloUnit*>& barCol, std::vector<const Cyber::CaloUnit*>& localMaxCol ); + std::vector<const Cyber::CaloUnit*> getNeighbors(const Cyber::CaloUnit* seed, std::vector<const Cyber::CaloUnit*>& barCol); + +private: + + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusU = nullptr; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusV = nullptr; + + static bool compBar( const Cyber::CaloUnit* bar1, const Cyber::CaloUnit* bar2 ) + { return bar1->getBar() < bar2->getBar(); } + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/PFOCreatingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/PFOCreatingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..95bab02aea4feae24e16ce79bc57b4cd03060614 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/PFOCreatingAlg.h @@ -0,0 +1,64 @@ +#ifndef _PFOCREATING_ALG_H +#define _PFOCREATING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class PFOCreatingAlg: public Cyber::Algorithm{ +public: + + PFOCreatingAlg(){}; + ~PFOCreatingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new PFOCreatingAlg(); } + + }; + + StatusCode ReadSettings( Cyber::Settings& m_settings ); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + std::vector<Cyber::Track*> getTracks() const { return m_tracks; } + std::vector<Cyber::Calo3DCluster*> getECALClusters() const { return m_ecal_clusters; } + std::vector<Cyber::Calo3DCluster*> getHCALClusters() const { return m_hcal_clusters; } + + //Self defined algorithms + // Get canditate clusters in HCAL for charged particles + StatusCode GetChargedHCALCandidates(const Cyber::Track* _track, + std::vector<Cyber::Calo3DCluster*>& _hcal_clusters, + std::vector<Cyber::Calo3DCluster*>& _hcal_clus_candidate); + // Get nearby HCAL clusters + StatusCode GetNearbyHCALCandidates( Cyber::Calo3DCluster* _ecal_cluster, + std::vector<Cyber::Calo3DCluster*>& _hcal_clusters, + std::vector<Cyber::Calo3DCluster*>& _hcal_clus_candidate); + // If a neutral cluster in ECAL reach the outermost ECAL boundary + bool isReachOuterMostECAL(Cyber::Calo3DCluster* _ecal_cluster); + // erase the used_elements in the left_elements + template<typename T1, typename T2> StatusCode CleanUsedElements(std::vector<T1>& _used_elements, + std::vector<T2>& _left_elements); + template<typename T1, typename T2> StatusCode CleanUsedElement(T1 _used_elements, + std::vector<T2>& _left_elements); + // Create PFO with: + // 1. tracks with no clusters in ECAL and HCAL + // 2. HCAL clusters + StatusCode CreateLeftPFO( std::vector<Cyber::Track*>& _tracks, + std::vector<Cyber::Calo3DCluster*>& _hcal_clusters, + std::vector<std::shared_ptr<Cyber::PFObject>>& _pfobjects); + + + +private: + std::vector<Cyber::Track*> m_tracks; + std::vector<Cyber::Calo3DCluster*> m_ecal_clusters; + std::vector<Cyber::Calo3DCluster*> m_hcal_clusters; + + std::vector<std::shared_ptr<Cyber::PFObject>> m_pfobjects; + + +}; + +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/PFOReclusteringAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/PFOReclusteringAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..fcc3d8a9c8e7c9926e2a7e216d06806b7cc1473b --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/PFOReclusteringAlg.h @@ -0,0 +1,40 @@ +#ifndef _PFORECLUSTERING_ALG_H +#define _PFORECLUSTERING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class PFOReclusteringAlg: public Cyber::Algorithm{ +public: + + PFOReclusteringAlg(){}; + ~PFOReclusteringAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new PFOReclusteringAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode ReCluster_MergeToChg( std::vector< std::shared_ptr<Cyber::PFObject> >& m_chargedPFOs, + std::vector< std::shared_ptr<Cyber::PFObject> >& m_neutralPFOs ); + + StatusCode ReCluster_SplitFromChg( std::vector< std::shared_ptr<Cyber::PFObject> >& m_chargedPFOs, + std::vector< std::shared_ptr<Cyber::PFObject> >& m_neutralPFOs ); + +private: + + std::vector<std::shared_ptr<Cyber::PFObject>>* p_PFObjects; + + CyberDataCol m_bkCol; + + static bool compTrkP( std::shared_ptr<Cyber::PFObject> pfo1, std::shared_ptr<Cyber::PFObject> pfo2 ) + { return pfo1->getTrackMomentum() > pfo2->getTrackMomentum(); } +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackClusterConnectingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackClusterConnectingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..c7182c6e29ad1eca1ed17451790a2c33af10edb3 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackClusterConnectingAlg.h @@ -0,0 +1,52 @@ +#ifndef _TRACKCLUSTERCONNECTING_ALG_H +#define _TRACKCLUSTERCONNECTING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TrackClusterConnectingAlg: public Cyber::Algorithm{ +public: + + TrackClusterConnectingAlg(){}; + ~TrackClusterConnectingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TrackClusterConnectingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + //Self defined algorithms + double GetMinR2Trk( const Cyber::Calo3DCluster* p_clus, const Cyber::Track* m_trk); + StatusCode PFOCreating( std::vector<const Cyber::Calo3DCluster*>& m_clusters, + std::vector<const Cyber::Track*>& m_trks, + std::vector<std::shared_ptr<Cyber::PFObject>>& m_PFOs ); + + StatusCode EcalChFragAbsorption( std::vector<const Cyber::Calo3DCluster*>& m_clusters, + std::vector<const Cyber::Track*>& m_trks, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_newclusCol ); + + StatusCode HcalExtrapolatingMatch(std::vector<const Cyber::Calo3DCluster*>& m_clusters, std::vector<std::shared_ptr<Cyber::PFObject>>& m_PFOs); + +private: + + std::vector<const Cyber::Calo3DCluster*> m_EcalClusters; + std::vector<const Cyber::Calo3DCluster*> m_HcalClusters; + std::vector<const Cyber::Track*> m_tracks; + + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_absorbedEcal; + std::vector<std::shared_ptr<Cyber::PFObject>> m_PFObjects; + + CyberDataCol m_bkCol; + + static bool compTrkP( std::shared_ptr<Cyber::PFObject> pfo1, std::shared_ptr<Cyber::PFObject> pfo2 ) + { return pfo1->getTrackMomentum() > pfo2->getTrackMomentum(); } + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackExtrapolatingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackExtrapolatingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..6760c894fbec4024b8df6b8e4537ea5f1a86b3c3 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackExtrapolatingAlg.h @@ -0,0 +1,62 @@ +#ifndef _TRACKEXTRAPOLATING_ALG_H +#define _TRACKEXTRAPOLATING_ALG_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" +#include "Objects/Track.h" + +using namespace Cyber; +class TrackExtrapolatingAlg: public Cyber::Algorithm{ +public: + + TrackExtrapolatingAlg(){}; + ~TrackExtrapolatingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TrackExtrapolatingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + + // Get points in each plane of layer + StatusCode GetLayerRadius(std::vector<float> & ECAL_layer_radius, std::vector<float> & HCAL_layer_radius); + // If the track reach barrel ECAL + bool IsReachECAL(Cyber::Track * track); + // Get track state at calorimeter + StatusCode GetTrackStateAtCalo(Cyber::Track * track, + Cyber::TrackState & trk_state_at_calo); + // get extrapolated points + StatusCode ExtrapolateByRadius( const std::vector<float> & ECAL_layer_radius, std::vector<float> & HCAL_layer_radius, + const Cyber::TrackState & CALO_trk_state, Cyber::Track* p_track); + // Get the radius rho + float GetRho(const Cyber::TrackState & trk_state); + // Get coordinates of the center of the circle + TVector2 GetCenterOfCircle(const Cyber::TrackState & trk_state, const float & rho); + // phase from center to reference point + float GetRefAlpha0(const Cyber::TrackState & trk_state, const TVector2 & center); + // If the charged particle return back + bool IsReturn(float rho, TVector2 & center); + + std::vector<float> GetDeltaPhi(float rho, TVector2 center, float alpha0, vector<float> layer_radius, const Cyber::TrackState & CALO_trk_state); + std::vector<TVector3> GetExtrapoPoints(std::string calo_name, + float rho, TVector2 center, float alpha0, + const Cyber::TrackState & CALO_trk_state, + const std::vector<float>& delta_phi); + + // Get phi0 of extrapolated points. Note that this phi0 is not same as the definition of the phi0 in TrackState, but will be stored in TrackState + float GetExtrapolatedPhi0(float Kappa, float ECAL_phi0, TVector2 center, TVector3 ext_point); + // To sort the extrapolatedpoints, define the following comparison function + static bool SortByPhi0(const Cyber::TrackState& trk_state1, const Cyber::TrackState& trk_state2 ) + { return TMath::Abs(trk_state1.phi0) < TMath::Abs(trk_state2.phi0); } + +private: + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackMatchingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackMatchingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..f13345d624cec3e4eadace5b9d35e4b33caeaff6 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TrackMatchingAlg.h @@ -0,0 +1,54 @@ +#ifndef TRACKMATCHING_H +#define TRACKMATCHING_H + +#include "CyberDataCol.h" +#include "Tools/Algorithm.h" +#include "TVector3.h" +using namespace Cyber; + +class TrackMatchingAlg: public Cyber::Algorithm{ + +public: + TrackMatchingAlg () {}; + ~TrackMatchingAlg() {}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TrackMatchingAlg(); } + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + + StatusCode GetExtrpoECALPoints(const Cyber::Track* track, std::vector<TVector3>& extrapo_points); + StatusCode CreateTrackAxis(vector<TVector3>& extrapo_points, std::vector<const Cyber::Calo1DCluster*>& localMaxVCol, + Cyber::CaloHalfCluster* t_track_axis); + StatusCode GetNearby(const std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterV, + const std::vector<TVector3>& extrapo_points, + std::vector<Cyber::CaloHalfCluster*>& t_nearbyHalfClusters, + std::vector<const Cyber::Calo1DCluster*>& t_nearbyLocalMax); + StatusCode LongiConeLinking(const std::vector<TVector3>& extrapo_points, + std::vector<const Cyber::Calo1DCluster*>& nearbyLocalMax, + std::vector<const Cyber::Calo1DCluster*>& cone_axis); + bool isStopLinking(const std::vector<TVector3>& extrapo_points, + const Cyber::Calo1DCluster* final_cone_hit); + TVector2 GetProjectedRelR(const Cyber::Calo1DCluster* m_shower1, const Cyber::Calo1DCluster* m_shower2 ); + TVector2 GetProjectedAxis(const std::vector<TVector3>& extrapo_points, const Cyber::Calo1DCluster* m_shower); + StatusCode CreatConeAxis(CyberDataCol& m_datacol, Cyber::Track* track, std::vector<Cyber::CaloHalfCluster*>& nearbyHalfClusters, + std::vector<const Cyber::Calo1DCluster*>& cone_axis); + +private: + std::vector<Cyber::Track*> m_TrackCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterV; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterU; + + // std::vector<const Cyber::CaloHalfCluster*> m_trackAxisVCol; + // std::vector<const Cyber::CaloHalfCluster*> m_trackAxisUCol; + + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthClusterMergingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthClusterMergingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..f29a7d369b6dc9c5cbd9e50e29628e7b0f4a5051 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthClusterMergingAlg.h @@ -0,0 +1,35 @@ +#ifndef _TRUTHCLUSTERMERGING_ALG_H +#define _TRUTHCLUSTERMERGING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TruthClusterMergingAlg: public Cyber::Algorithm{ +public: + + TruthClusterMergingAlg(){}; + ~TruthClusterMergingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TruthClusterMergingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + +private: + + std::vector<const Cyber::Calo3DCluster*> m_EcalClusterCol; + std::vector<const Cyber::Calo3DCluster*> m_HcalClusterCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> merged_EcalClusterCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> merged_HcalClusterCol; + std::vector<std::shared_ptr<Cyber::PFObject>> merged_CombClusterCol; + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthClusteringAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthClusteringAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..0f13e842b57baf8e8a544e51cc1ba541e815687f --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthClusteringAlg.h @@ -0,0 +1,46 @@ +#ifndef _TRUTHCLUS_ALG_H +#define _TRUTHCLUS_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TruthClusteringAlg: public Cyber::Algorithm{ +public: + + TruthClusteringAlg(){}; + ~TruthClusteringAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TruthClusteringAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode HalfClusterToTowers( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusU, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ); + +private: + + CyberDataCol m_bkCol; + + std::vector<std::shared_ptr<Cyber::Track>> m_TrackCol; + //For ECAL + std::vector<std::shared_ptr<Cyber::CaloUnit>> m_bars; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_1dclusterUCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_1dclusterVCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_halfclusterU; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_halfclusterV; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_towers; + //For HCAL + std::vector<std::shared_ptr<Cyber::CaloHit>> m_hits; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_clusters; + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthEnergySplittingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthEnergySplittingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..aed5ac262587a8034cd66c92c1a0d69ced42a0d8 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthEnergySplittingAlg.h @@ -0,0 +1,39 @@ +#ifndef _TRUTHENERGYSPLITTING_ALG_H +#define _TRUTHENERGYSPLITTING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TruthEnergySplittingAlg: public Cyber::Algorithm{ +public: + + TruthEnergySplittingAlg(){}; + ~TruthEnergySplittingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TruthEnergySplittingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode HalfClusterToTowers( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusU, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ); + +private: + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterU; + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterV; + + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newClusUCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newClusVCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_towerCol; + + CyberDataCol m_bkCol; +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthMatchingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthMatchingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..aa5e66d0dbaac762c5ac58081b1ec49561669a5d --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthMatchingAlg.h @@ -0,0 +1,52 @@ +#ifndef _TRUTHMATCHING_ALG_H +#define _TRUTHMATCHING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TruthMatchingAlg: public Cyber::Algorithm{ +public: + + TruthMatchingAlg(){}; + ~TruthMatchingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TruthMatchingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode TruthMatching( std::vector<const Cyber::CaloHalfCluster*>& m_ClUCol, + std::vector<const Cyber::CaloHalfCluster*>& m_ClVCol, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusters ); + + StatusCode XYClusterMatchingL0( const Cyber::CaloHalfCluster* m_longiClX, + const Cyber::CaloHalfCluster* m_longiClY, + std::shared_ptr<Cyber::Calo3DCluster>& m_clus ); + + StatusCode GetMatchedShowersL0( const Cyber::Calo1DCluster* barShowerX, + const Cyber::Calo1DCluster* barShowerY, + Cyber::Calo2DCluster* outsh); //1*1 + + StatusCode GetMatchedShowersL1( const Cyber::Calo1DCluster* shower1, + std::vector<const Cyber::Calo1DCluster*>& showerNCol, + std::vector<Cyber::Calo2DCluster*>& outshCol ); //1*N + +private: + + std::vector<Cyber::Calo3DCluster*> m_towerCol; + + std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol; + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_clusterCol; + + CyberDataCol m_bkCol; + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthPatternRecAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthPatternRecAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..7470b0eb4276f8f4f7a8004745794b9582b1e523 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthPatternRecAlg.h @@ -0,0 +1,33 @@ +#ifndef _TRUTHPATTERNREC_ALG_H +#define _TRUTHPATTERNREC_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TruthPatternRecAlg: public Cyber::Algorithm{ +public: + + TruthPatternRecAlg(){}; + ~TruthPatternRecAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TruthPatternRecAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + StatusCode OverlapMerging ( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_axisCol ); + +private: + + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterV; + std::vector<Cyber::CaloHalfCluster*> p_HalfClusterU; + +}; +#endif diff --git a/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthTrackMatchingAlg.h b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthTrackMatchingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..7bece5a27a1f4725c90e9f83f857b1b3b5159e84 --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/include/Algorithm/TruthTrackMatchingAlg.h @@ -0,0 +1,37 @@ +#ifndef _TRUTHTRKMATCHING_ALG_H +#define _TRUTHTRKMATCHING_ALG_H + +#include "Tools/Algorithm.h" + +using namespace Cyber; +class TruthTrackMatchingAlg: public Cyber::Algorithm{ +public: + + TruthTrackMatchingAlg(){}; + ~TruthTrackMatchingAlg(){}; + + class Factory : public Cyber::AlgorithmFactory + { + public: + Cyber::Algorithm* CreateAlgorithm() const{ return new TruthTrackMatchingAlg(); } + + }; + + StatusCode ReadSettings(Cyber::Settings& m_settings); + StatusCode Initialize( CyberDataCol& m_datacol ); + StatusCode RunAlgorithm( CyberDataCol& m_datacol ); + StatusCode ClearAlgorithm(); + + //Self defined algorithms + StatusCode SelfAlg1(); + +private: + + std::vector<Cyber::Track*> m_TrackCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterV; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfClusterU; + + + +}; +#endif diff --git a/Reconstruction/CrystalCaloRec/include/PandoraPlusDataCol.h b/Reconstruction/PFA/CyberPFA/include/CyberDataCol.h similarity index 70% rename from Reconstruction/CrystalCaloRec/include/PandoraPlusDataCol.h rename to Reconstruction/PFA/CyberPFA/include/CyberDataCol.h index 03a9676aada6a38fea30301f9e38f343caf6f567..893b1f5adaa1c94b1ca5c63570907d3f2984aad0 100644 --- a/Reconstruction/CrystalCaloRec/include/PandoraPlusDataCol.h +++ b/Reconstruction/PFA/CyberPFA/include/CyberDataCol.h @@ -37,11 +37,11 @@ //#define C 299.79 // unit: mm/ns using namespace std; const double C = 299.79; -class PandoraPlusDataCol{ +class CyberDataCol{ public: - PandoraPlusDataCol() {}; - ~PandoraPlusDataCol() { Clear(); } + CyberDataCol() {}; + ~CyberDataCol() { Clear(); } StatusCode Clear(); //Readin CollectionMap @@ -54,14 +54,14 @@ public: //Self used objects //General objects for all PFA - std::vector<std::shared_ptr<PandoraPlus::Track>> TrackCol; - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::CaloHit>>> map_CaloHit; //Hit - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::CaloUnit>>> map_BarCol; - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>> map_1DCluster; - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>> map_HalfCluster; - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::Calo2DCluster>>> map_2DCluster; - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>> map_CaloCluster; //Cluster - std::map<std::string, std::vector<std::shared_ptr<PandoraPlus::PFObject>>> map_PFObjects; + std::vector<std::shared_ptr<Cyber::Track>> TrackCol; + std::map<std::string, std::vector<std::shared_ptr<Cyber::CaloHit>>> map_CaloHit; //Hit + std::map<std::string, std::vector<std::shared_ptr<Cyber::CaloUnit>>> map_BarCol; + std::map<std::string, std::vector<std::shared_ptr<Cyber::Calo1DCluster>>> map_1DCluster; + std::map<std::string, std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>> map_HalfCluster; + std::map<std::string, std::vector<std::shared_ptr<Cyber::Calo2DCluster>>> map_2DCluster; + std::map<std::string, std::vector<std::shared_ptr<Cyber::Calo3DCluster>>> map_CaloCluster; //Cluster + std::map<std::string, std::vector<std::shared_ptr<Cyber::PFObject>>> map_PFObjects; //Energy calibration service SmartIF<ICrystalEcalSvc> EnergyCorrSvc; diff --git a/Reconstruction/CrystalCaloRec/include/PandoraPlusPFAlg.h b/Reconstruction/PFA/CyberPFA/include/CyberPFAlg.h similarity index 97% rename from Reconstruction/CrystalCaloRec/include/PandoraPlusPFAlg.h rename to Reconstruction/PFA/CyberPFA/include/CyberPFAlg.h index b5836d94ce99df0903d75671d50737ccd9f13517..4406f848c713c054b25ef02f178f7e2336e6a337 100644 --- a/Reconstruction/CrystalCaloRec/include/PandoraPlusPFAlg.h +++ b/Reconstruction/PFA/CyberPFA/include/CyberPFAlg.h @@ -14,7 +14,7 @@ #include "podio/CollectionBase.h" #include "podio/ROOTFrameWriter.h" -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" #include "Tools/MCParticleCreator.h" #include "Tools/TrackCreator.h" #include "Tools/CaloHitsCreator.h" @@ -51,15 +51,15 @@ #include <cstdlib> -using namespace PandoraPlus; +using namespace Cyber; using namespace std; -class PandoraPlusPFAlg : public GaudiAlgorithm +class CyberPFAlg : public GaudiAlgorithm { public: - PandoraPlusPFAlg(const std::string& name, ISvcLocator* svcLoc); + CyberPFAlg(const std::string& name, ISvcLocator* svcLoc); /** Called at the begin of the job before anything is read. * Use to initialize the processor, e.g. book histograms. @@ -85,7 +85,7 @@ protected: std::map<std::string, dd4hep::DDSegmentation::BitFieldCoder*> map_readout_decoder; //DataCollection: moved into execute() to ensure everything can be cleand after one event. - //PandoraPlusDataCol m_DataCol; + //CyberDataCol m_DataCol; //Creators and their setting @@ -105,7 +105,7 @@ protected: //Algorithm for PFA - PandoraPlus::AlgorithmManager m_algorithmManager; + Cyber::AlgorithmManager m_algorithmManager; //Readin collection names @@ -291,6 +291,8 @@ protected: FloatVec m_trkstate_d0, m_trkstate_z0, m_trkstate_phi, m_trkstate_tanL, m_trkstate_omega, m_trkstate_kappa; FloatVec m_trkstate_refx, m_trkstate_refy, m_trkstate_refz; IntVec m_trkstate_tag, m_trkstate_location, m_type; + FloatVec m_trkstate_x_ECAL, m_trkstate_y_ECAL, m_trkstate_z_ECAL, m_trkstate_x_HCAL, m_trkstate_y_HCAL, m_trkstate_z_HCAL; + IntVec m_trkstate_tag_ECAL, m_trkstate_tag_HCAL; // yyy: output PFO information TTree *t_PFO; @@ -315,7 +317,7 @@ protected: void ClearTrack(); void ClearPFO(); // yyy - double GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<PandoraPlus::CaloUnit>>& barcol); - double GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<PandoraPlus::CaloHit>>& hitcol); + double GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<Cyber::CaloUnit>>& barcol); + double GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<Cyber::CaloHit>>& hitcol); }; #endif diff --git a/Reconstruction/CrystalCaloRec/include/Objects/Calo1DCluster.h b/Reconstruction/PFA/CyberPFA/include/Objects/Calo1DCluster.h similarity index 55% rename from Reconstruction/CrystalCaloRec/include/Objects/Calo1DCluster.h rename to Reconstruction/PFA/CyberPFA/include/Objects/Calo1DCluster.h index 5b74ef4912c1ed7b6d695e9fea547a63e7f591c7..e37529e1ec94e3349b91f8b228c4a665934d9f68 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/Calo1DCluster.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/Calo1DCluster.h @@ -8,26 +8,26 @@ #include "Objects/CaloUnit.h" -namespace PandoraPlus{ +namespace Cyber{ class Calo1DCluster{ public: Calo1DCluster() {}; - Calo1DCluster( std::vector<const PandoraPlus::CaloUnit*> _bars, std::vector<const PandoraPlus::CaloUnit*> _seeds) + Calo1DCluster( std::vector<const Cyber::CaloUnit*> _bars, std::vector<const Cyber::CaloUnit*> _seeds) : Bars(_bars), Seeds(_seeds) {}; ~Calo1DCluster() { Clear(); } void Clear(); void Clean(); void Check(); - std::shared_ptr<PandoraPlus::Calo1DCluster> Clone() const; + std::shared_ptr<Cyber::Calo1DCluster> Clone() const; inline bool operator == (const Calo1DCluster &x) const{ return ( Bars == x.getBars() ); } - bool isNeighbor(const PandoraPlus::CaloUnit* m_bar) const; - bool inCluster(const PandoraPlus::CaloUnit* iBar) const; + bool isNeighbor(const Cyber::CaloUnit* m_bar) const; + bool inCluster(const Cyber::CaloUnit* iBar) const; void sortByPos() { std::sort(Bars.begin(), Bars.end()); } double getEnergy() const; @@ -38,11 +38,11 @@ namespace PandoraPlus{ double getScndMoment() const; int getNseeds() const { return Seeds.size(); } - std::vector<const PandoraPlus::CaloUnit*> getBars() const { return Bars; } - std::vector<const PandoraPlus::CaloUnit*> getCluster() const { return Bars; } - std::vector<const PandoraPlus::CaloUnit*> getSeeds() const { return Seeds; } - std::vector< const PandoraPlus::Calo1DCluster* > getCousinClusters() const { return CousinClusters; } - std::vector< const PandoraPlus::Calo1DCluster* > getChildClusters() const { return ChildClusters; } + std::vector<const Cyber::CaloUnit*> getBars() const { return Bars; } + std::vector<const Cyber::CaloUnit*> getCluster() const { return Bars; } + std::vector<const Cyber::CaloUnit*> getSeeds() const { return Seeds; } + std::vector< const Cyber::Calo1DCluster* > getCousinClusters() const { return CousinClusters; } + std::vector< const Cyber::Calo1DCluster* > getChildClusters() const { return ChildClusters; } bool getGlobalRange( double& xmin, double& ymin, double& zmin, double& xmax, double& ymax, double& zmax ) const; int getLeftEdge(); int getRightEdge(); @@ -51,13 +51,13 @@ namespace PandoraPlus{ edm4hep::MCParticle getLeadingMCP() const; float getLeadingMCPweight() const; - void addUnit(const PandoraPlus::CaloUnit* _bar ); - void addSeed(const PandoraPlus::CaloUnit* _seed ) { Seeds.push_back(_seed); } - void setBars( std::vector<const PandoraPlus::CaloUnit*> _bars ) { Bars = _bars; } - void setSeeds( std::vector<const PandoraPlus::CaloUnit*> _seeds) { Seeds = _seeds; } - void addCousinCluster( const PandoraPlus::Calo1DCluster* clus ) { CousinClusters.push_back(clus); } - void addChildCluster( const PandoraPlus::Calo1DCluster* clus ) { ChildClusters.push_back(clus); } - void deleteCousinCluster( const PandoraPlus::Calo1DCluster* _cl ); + void addUnit(const Cyber::CaloUnit* _bar ); + void addSeed(const Cyber::CaloUnit* _seed ) { Seeds.push_back(_seed); } + void setBars( std::vector<const Cyber::CaloUnit*> _bars ) { Bars = _bars; } + void setSeeds( std::vector<const Cyber::CaloUnit*> _seeds) { Seeds = _seeds; } + void addCousinCluster( const Cyber::Calo1DCluster* clus ) { CousinClusters.push_back(clus); } + void addChildCluster( const Cyber::Calo1DCluster* clus ) { ChildClusters.push_back(clus); } + void deleteCousinCluster( const Cyber::Calo1DCluster* _cl ); void addLinkedMCP( std::pair<edm4hep::MCParticle, float> _pair ) { MCParticleWeight.push_back(_pair); } void setLinkedMCP( std::vector<std::pair<edm4hep::MCParticle, float>> _pairVec ) { MCParticleWeight.clear(); MCParticleWeight = _pairVec; } void setSeed(); //Set the most energitic unit as seed, Eseed>5 MeV (hardcoded). @@ -68,15 +68,15 @@ namespace PandoraPlus{ std::vector< std::vector<int> > getTowerID() const { return towerID; } private: - std::vector<const PandoraPlus::CaloUnit*> Bars; - std::vector<const PandoraPlus::CaloUnit*> Seeds; + std::vector<const Cyber::CaloUnit*> Bars; + std::vector<const Cyber::CaloUnit*> Seeds; double Energy; TVector3 pos; std::vector< std::vector<int> > towerID; //[module, stave] - std::vector< const PandoraPlus::Calo1DCluster* > CousinClusters; - std::vector< const PandoraPlus::Calo1DCluster* > ChildClusters; + std::vector< const Cyber::Calo1DCluster* > CousinClusters; + std::vector< const Cyber::Calo1DCluster* > ChildClusters; std::vector< std::pair<edm4hep::MCParticle, float> > MCParticleWeight; }; diff --git a/Reconstruction/CrystalCaloRec/include/Objects/Calo2DCluster.h b/Reconstruction/PFA/CyberPFA/include/Objects/Calo2DCluster.h similarity index 96% rename from Reconstruction/CrystalCaloRec/include/Objects/Calo2DCluster.h rename to Reconstruction/PFA/CyberPFA/include/Objects/Calo2DCluster.h index 88bdd2ae6854f9a6608cdce5920384743e85be7e..796bb27447427602244c8fe0cf7768a6abf25ff5 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/Calo2DCluster.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/Calo2DCluster.h @@ -5,7 +5,7 @@ #include "Objects/CaloUnit.h" #include "Objects/Calo1DCluster.h" -namespace PandoraPlus { +namespace Cyber { class CaloHit; class Calo2DCluster { @@ -22,7 +22,7 @@ namespace PandoraPlus { return ( barUCol == x.getBarUCol() && barVCol == x.getBarVCol()); } - bool isNeighbor(const PandoraPlus::Calo1DCluster* m_1dcluster) const; + bool isNeighbor(const Cyber::Calo1DCluster* m_1dcluster) const; int getDlayer() const { if(barUCol.size()>0) return barUCol[0]->getDlayer(); else if(barVCol.size()>0) return barVCol[0]->getDlayer(); else return -99; } std::vector< std::vector<int> > getTowerID() const { return towerID; } diff --git a/Reconstruction/CrystalCaloRec/include/Objects/Calo3DCluster.h b/Reconstruction/PFA/CyberPFA/include/Objects/Calo3DCluster.h similarity index 68% rename from Reconstruction/CrystalCaloRec/include/Objects/Calo3DCluster.h rename to Reconstruction/PFA/CyberPFA/include/Objects/Calo3DCluster.h index 5036e0257586be8cae4391cfc9ef0c03a42c34cc..57483abc7380e2bd152750ab0b4da9e67a9d6dae 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/Calo3DCluster.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/Calo3DCluster.h @@ -7,7 +7,7 @@ //#include "Objects/CaloTower.h" #include "Tools/TrackFitInEcal.h" -namespace PandoraPlus { +namespace Cyber { class Calo3DCluster { public: @@ -19,25 +19,25 @@ namespace PandoraPlus { void Check(); void Clear2DClusters() { m_2dclusters.clear(); }; void CleanLongiClusters(); - std::shared_ptr<PandoraPlus::Calo3DCluster> Clone() const; + std::shared_ptr<Cyber::Calo3DCluster> Clone() const; inline bool operator == (const Calo3DCluster &x) const{ return ( m_2dclusters == x.getCluster() ); } std::vector< std::vector<int> > getTowerID() const { return towerID; } - //bool isNeighbor(const PandoraPlus::Calo2DCluster* m_2dcluster) const; - std::vector<const PandoraPlus::CaloHit*> getCaloHits() const { return hits; } + //bool isNeighbor(const Cyber::Calo2DCluster* m_2dcluster) const; + std::vector<const Cyber::CaloHit*> getCaloHits() const { return hits; } std::vector<const Calo2DCluster*> getCluster() const { return m_2dclusters; } std::vector<const Calo1DCluster*> getLocalMaxUCol(std::string name) const; std::vector<const Calo1DCluster*> getLocalMaxVCol(std::string name) const; - std::map<std::string, std::vector<const PandoraPlus::Calo1DCluster*> > getLocalMaxUMap() const { return map_localMaxU; } - std::map<std::string, std::vector<const PandoraPlus::Calo1DCluster*> > getLocalMaxVMap() const { return map_localMaxV; } + std::map<std::string, std::vector<const Cyber::Calo1DCluster*> > getLocalMaxUMap() const { return map_localMaxU; } + std::map<std::string, std::vector<const Cyber::Calo1DCluster*> > getLocalMaxVMap() const { return map_localMaxV; } std::vector<const CaloHalfCluster*> getHalfClusterUCol(std::string name) const; std::vector<const CaloHalfCluster*> getHalfClusterVCol(std::string name) const; - std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > getHalfClusterUMap() const { return map_halfClusUCol; } - std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > getHalfClusterVMap() const { return map_halfClusVCol; } - std::vector<const PandoraPlus::Track*> getAssociatedTracks() const { return m_TrackCol; } + std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > getHalfClusterUMap() const { return map_halfClusUCol; } + std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > getHalfClusterVMap() const { return map_halfClusVCol; } + std::vector<const Cyber::Track*> getAssociatedTracks() const { return m_TrackCol; } std::vector< std::pair<edm4hep::MCParticle, float> > getLinkedMCP() const { return MCParticleWeight; } std::vector< std::pair<edm4hep::MCParticle, float> > getLinkedMCPfromHFCluster(std::string name); std::vector< std::pair<edm4hep::MCParticle, float> > getLinkedMCPfromHit(); @@ -57,7 +57,7 @@ namespace PandoraPlus { double getDepthToECALSurface() const; int getType() const { return type; } - void setCaloHits( std::vector<const PandoraPlus::CaloHit*> _hits ) { hits = _hits; } + void setCaloHits( std::vector<const Cyber::CaloHit*> _hits ) { hits = _hits; } void setCaloHitsFrom2DCluster(); void setTowers(std::vector<const Calo3DCluster*> _t) { m_towers = _t; } void setHalfClusters( std::string name1, std::vector<const CaloHalfCluster*>& _clU, @@ -74,32 +74,32 @@ namespace PandoraPlus { void addTowerID( std::vector<int> id ) { towerID.push_back(id); } void addUnit(const Calo2DCluster* _2dcluster); - void addHit(const PandoraPlus::CaloHit* _hit) { hits.push_back(_hit); }; + void addHit(const Cyber::CaloHit* _hit) { hits.push_back(_hit); }; void addTower( const Calo3DCluster* _tower ) { m_towers.push_back(_tower); } void addHalfClusterU( std::string name, const CaloHalfCluster* _clU ) { map_halfClusUCol[name].push_back(_clU); } void addHalfClusterV( std::string name, const CaloHalfCluster* _clV ) { map_halfClusVCol[name].push_back(_clV); } void addLocalMaxU( std::string name, const Calo1DCluster* _shU ) { map_localMaxU[name].push_back(_shU); } void addLocalMaxV( std::string name, const Calo1DCluster* _shV ) { map_localMaxV[name].push_back(_shV); } - void addAssociatedTrack(const PandoraPlus::Track* _track){ m_TrackCol.push_back(_track); } + void addAssociatedTrack(const Cyber::Track* _track){ m_TrackCol.push_back(_track); } void addLinkedMCP( std::pair<edm4hep::MCParticle, float> _pair ) { MCParticleWeight.push_back(_pair); } void setLinkedMCP( std::vector<std::pair<edm4hep::MCParticle, float>> _pairVec ) { MCParticleWeight.clear(); MCParticleWeight = _pairVec; } - void mergeCluster( const PandoraPlus::Calo3DCluster* _clus ); + void mergeCluster( const Cyber::Calo3DCluster* _clus ); //void FitProfile(); void FitAxis(); //void FitAxisHit(); - bool isHCALNeighbor(const PandoraPlus::CaloHit* m_hit) const; + bool isHCALNeighbor(const Cyber::CaloHit* m_hit) const; private: - std::vector<const PandoraPlus::CaloHit*> hits; - std::vector<const PandoraPlus::Calo2DCluster*> m_2dclusters; + std::vector<const Cyber::CaloHit*> hits; + std::vector<const Cyber::Calo2DCluster*> m_2dclusters; std::vector<const Calo3DCluster*> m_towers; - std::map<std::string, std::vector<const PandoraPlus::Calo1DCluster*> > map_localMaxU; - std::map<std::string, std::vector<const PandoraPlus::Calo1DCluster*> > map_localMaxV; - std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > map_halfClusUCol; - std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > map_halfClusVCol; - std::vector<const PandoraPlus::Track*> m_TrackCol; + std::map<std::string, std::vector<const Cyber::Calo1DCluster*> > map_localMaxU; + std::map<std::string, std::vector<const Cyber::Calo1DCluster*> > map_localMaxV; + std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > map_halfClusUCol; + std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > map_halfClusVCol; + std::vector<const Cyber::Track*> m_TrackCol; std::vector< std::pair<edm4hep::MCParticle, float> > MCParticleWeight; std::vector< std::vector<int> > towerID; //[module, part, stave] diff --git a/Reconstruction/CrystalCaloRec/include/Objects/CaloHalfCluster.h b/Reconstruction/PFA/CyberPFA/include/Objects/CaloHalfCluster.h similarity index 71% rename from Reconstruction/CrystalCaloRec/include/Objects/CaloHalfCluster.h rename to Reconstruction/PFA/CyberPFA/include/Objects/CaloHalfCluster.h index 116efd047e4925686f50556565b0fbd7213690d6..8486c16e57d85fd3ff38c42863a2299610ba4132 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/CaloHalfCluster.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/CaloHalfCluster.h @@ -6,7 +6,7 @@ #include "Objects/Track.h" #include "Tools/TrackFitInEcal.h" -namespace PandoraPlus { +namespace Cyber { class Track; class CaloHalfCluster { @@ -21,9 +21,9 @@ namespace PandoraPlus { inline bool operator == (const CaloHalfCluster &x) const{ return m_1dclusters==x.getCluster(); } - std::shared_ptr<PandoraPlus::CaloHalfCluster> Clone() const; + std::shared_ptr<Cyber::CaloHalfCluster> Clone() const; - bool isNeighbor(const PandoraPlus::Calo1DCluster* m_1dcluster) const; + bool isNeighbor(const Cyber::Calo1DCluster* m_1dcluster) const; double getEnergy() const; TVector3 getPos() const; @@ -44,9 +44,9 @@ namespace PandoraPlus { std::vector<const Calo1DCluster*> getClusterInLayer(int _layer) const; std::vector<const CaloHalfCluster*> getHalfClusterCol(std::string name) const; std::vector<const CaloHalfCluster*> getAllHalfClusterCol() const; - std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > getHalfClusterMap() const {return map_halfClusCol; } - std::map<std::string, std::vector<const PandoraPlus::Calo1DCluster*> > getLocalMaxMap() const {return map_localMax; } - std::vector<const PandoraPlus::Track*> getAssociatedTracks() const { return m_TrackCol; } + std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > getHalfClusterMap() const {return map_halfClusCol; } + std::map<std::string, std::vector<const Cyber::Calo1DCluster*> > getLocalMaxMap() const {return map_localMax; } + std::vector<const Cyber::Track*> getAssociatedTracks() const { return m_TrackCol; } std::vector< std::pair<edm4hep::MCParticle, float> > getLinkedMCP() const { return MCParticleWeight; } std::vector< std::pair<edm4hep::MCParticle, float> > getLinkedMCPfromUnit(); edm4hep::MCParticle getLeadingMCP() const; @@ -65,17 +65,17 @@ namespace PandoraPlus { void addUnit(const Calo1DCluster* _1dcluster); void deleteUnit(const Calo1DCluster* _1dcluster); void setLocalMax( std::string name, std::vector<const Calo1DCluster*> _col) { map_localMax[name]=_col; } - void setHalfClusters( std::string name, std::vector<const PandoraPlus::CaloHalfCluster*>& _cl) { map_halfClusCol[name]=_cl; } - void addHalfCluster(std::string name, const PandoraPlus::CaloHalfCluster* _cl) { map_halfClusCol[name].push_back(_cl); } - void addCousinCluster( const PandoraPlus::CaloHalfCluster* _cl ) { map_halfClusCol["CousinCluster"].push_back(_cl); } - void deleteCousinCluster( const PandoraPlus::CaloHalfCluster* _cl ); + void setHalfClusters( std::string name, std::vector<const Cyber::CaloHalfCluster*>& _cl) { map_halfClusCol[name]=_cl; } + void addHalfCluster(std::string name, const Cyber::CaloHalfCluster* _cl) { map_halfClusCol[name].push_back(_cl); } + void addCousinCluster( const Cyber::CaloHalfCluster* _cl ) { map_halfClusCol["CousinCluster"].push_back(_cl); } + void deleteCousinCluster( const Cyber::CaloHalfCluster* _cl ); void setHoughPars(double _a, double _r) { Hough_alpha=_a; Hough_rho=_r; } void setIntercept(double _in) { Hough_intercept=_in; } void mergeHalfCluster( const CaloHalfCluster* clus ); void addTowerID(int _m, int _p, int _s) { std::vector<int> id(3); id[0] = _m; id[1] = _p; id[2] = _s; towerID.push_back(id); } void addTowerID(std::vector<int> id) { towerID.push_back(id); } void setTowerID(std::vector<int> id) { towerID.clear(); towerID.push_back(id); } - void addAssociatedTrack(const PandoraPlus::Track* _track){ m_TrackCol.push_back(_track); } + void addAssociatedTrack(const Cyber::Track* _track){ m_TrackCol.push_back(_track); } void addLinkedMCP( std::pair<edm4hep::MCParticle, float> _pair ) { MCParticleWeight.push_back(_pair); } void setLinkedMCP( std::vector<std::pair<edm4hep::MCParticle, float>> _pairVec ) { MCParticleWeight.clear(); MCParticleWeight = _pairVec; } void mergeClusterInLayer(); @@ -92,14 +92,14 @@ namespace PandoraPlus { double Hough_rho; double Hough_intercept; std::vector<const Calo1DCluster*> m_1dclusters; - std::map<std::string, std::vector<const PandoraPlus::Calo1DCluster*> > map_localMax; - std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > map_halfClusCol; - std::vector<const PandoraPlus::Track*> m_TrackCol; + std::map<std::string, std::vector<const Cyber::Calo1DCluster*> > map_localMax; + std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > map_halfClusCol; + std::vector<const Cyber::Track*> m_TrackCol; std::vector< std::pair<edm4hep::MCParticle, float> > MCParticleWeight; TrackFitInEcal* track = new TrackFitInEcal(); - static bool compLayer( const PandoraPlus::Calo1DCluster* hit1, const PandoraPlus::Calo1DCluster* hit2 ) + static bool compLayer( const Cyber::Calo1DCluster* hit1, const Cyber::Calo1DCluster* hit2 ) { return hit1->getDlayer() < hit2->getDlayer(); } }; diff --git a/Reconstruction/CrystalCaloRec/include/Objects/CaloHit.h b/Reconstruction/PFA/CyberPFA/include/Objects/CaloHit.h similarity index 92% rename from Reconstruction/CrystalCaloRec/include/Objects/CaloHit.h rename to Reconstruction/PFA/CyberPFA/include/Objects/CaloHit.h index ecb6565c149474d03acb81f4e1cd3d0d77c210e0..2b8917f8df9a7765f0c5ab4d77a7762a3c943dd1 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/CaloHit.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/CaloHit.h @@ -6,7 +6,7 @@ #include "edm4hep/CalorimeterHit.h" #include "Objects/Calo2DCluster.h" -namespace PandoraPlus{ +namespace Cyber{ class Calo2DCluster; class CaloHit{ @@ -33,7 +33,7 @@ namespace PandoraPlus{ void setPosition( TVector3 _vec ) { position=_vec; } void setModule(int _m ) { module = _m; } void setLayer(int _l) { layer = _l; } - void setParentShower( PandoraPlus::Calo2DCluster* _p ) { ParentShower=_p; } + void setParentShower( Cyber::Calo2DCluster* _p ) { ParentShower=_p; } void addLinkedMCP( std::pair<edm4hep::MCParticle, float> _pair ) {MCParticleWeight.push_back(_pair); } void setLinkedMCP( std::vector<std::pair<edm4hep::MCParticle, float>> _pairVec ) { MCParticleWeight.clear(); MCParticleWeight = _pairVec; } @@ -44,7 +44,7 @@ namespace PandoraPlus{ TVector3 position; double energy; edm4hep::CalorimeterHit m_hit; - PandoraPlus::Calo2DCluster* ParentShower; + Cyber::Calo2DCluster* ParentShower; std::vector< std::pair<edm4hep::MCParticle, float> > MCParticleWeight; }; diff --git a/Reconstruction/CrystalCaloRec/include/Objects/CaloUnit.h b/Reconstruction/PFA/CyberPFA/include/Objects/CaloUnit.h similarity index 99% rename from Reconstruction/CrystalCaloRec/include/Objects/CaloUnit.h rename to Reconstruction/PFA/CyberPFA/include/Objects/CaloUnit.h index 96c5d89c002f6468aea06883c3d95dcfd6d4e98d..0ed6d7758b7fa429098220db294aa3633d97abdd 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/CaloUnit.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/CaloUnit.h @@ -5,7 +5,7 @@ #include "edm4hep/MCParticle.h" #include "TVector3.h" -namespace PandoraPlus{ +namespace Cyber{ class CaloUnit{ diff --git a/Reconstruction/CrystalCaloRec/include/Objects/HoughObject.h b/Reconstruction/PFA/CyberPFA/include/Objects/HoughObject.h similarity index 87% rename from Reconstruction/CrystalCaloRec/include/Objects/HoughObject.h rename to Reconstruction/PFA/CyberPFA/include/Objects/HoughObject.h index 03a407ec259aec18ffaa8da887edf3ede8ef4a78..dba958dbbf3fde51ceeca1191a497d25ca3ece5d 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/HoughObject.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/HoughObject.h @@ -6,12 +6,12 @@ #include "TF1.h" -namespace PandoraPlus { +namespace Cyber { class HoughObject{ public: HoughObject() {}; - HoughObject( const PandoraPlus::Calo1DCluster* _localmax, double _cellSize, double _ecal_inner_radius, double _phi=0.); + HoughObject( const Cyber::Calo1DCluster* _localmax, double _cellSize, double _ecal_inner_radius, double _phi=0.); ~HoughObject() { }; @@ -36,7 +36,7 @@ namespace PandoraPlus { int getSlayer() const { return m_local_max->getSlayer(); } double getE() const { return m_local_max->getEnergy(); } double getCellSize() const { return m_cell_size; } - const PandoraPlus::Calo1DCluster* getLocalMax() const { return m_local_max; } + const Cyber::Calo1DCluster* getLocalMax() const { return m_local_max; } void setCellSize(double _cs) { m_cell_size=_cs; } void setCenterPoint(double& _ecal_inner_radius, double _phi=0.); @@ -44,7 +44,7 @@ namespace PandoraPlus { private: - const PandoraPlus::Calo1DCluster* m_local_max; //Local max + const Cyber::Calo1DCluster* m_local_max; //Local max double m_cell_size; TVector2 m_center_point; // center position diff --git a/Reconstruction/CrystalCaloRec/include/Objects/HoughSpace.h b/Reconstruction/PFA/CyberPFA/include/Objects/HoughSpace.h similarity index 95% rename from Reconstruction/CrystalCaloRec/include/Objects/HoughSpace.h rename to Reconstruction/PFA/CyberPFA/include/Objects/HoughSpace.h index 3c3e284826c29466881af307cfbbe991cc07337a..0879b109b947a651d41865027da0601d9aa7ca35 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/HoughSpace.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/HoughSpace.h @@ -7,7 +7,7 @@ using namespace std; -namespace PandoraPlus { +namespace Cyber { class HoughSpace{ public: HoughSpace(){}; diff --git a/Reconstruction/CrystalCaloRec/include/Objects/PFObject.h b/Reconstruction/PFA/CyberPFA/include/Objects/PFObject.h similarity index 91% rename from Reconstruction/CrystalCaloRec/include/Objects/PFObject.h rename to Reconstruction/PFA/CyberPFA/include/Objects/PFObject.h index 889d3d058d6735d07a7eb01e5b3c2b2e48feda6f..ed987610e46d14e724566df3f01e06e84226e366 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/PFObject.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/PFObject.h @@ -4,14 +4,14 @@ #include "Objects/Calo3DCluster.h" #include "Objects/Track.h" -namespace PandoraPlus{ +namespace Cyber{ class PFObject{ public: PFObject () {}; ~PFObject() { Clear(); } void Clear(); - std::shared_ptr<PandoraPlus::PFObject> Clone() const; + std::shared_ptr<Cyber::PFObject> Clone() const; void addTrack(const Track* _track); void addECALCluster(const Calo3DCluster* _ecal_cluster); diff --git a/Reconstruction/CrystalCaloRec/include/Objects/Track.h b/Reconstruction/PFA/CyberPFA/include/Objects/Track.h similarity index 76% rename from Reconstruction/CrystalCaloRec/include/Objects/Track.h rename to Reconstruction/PFA/CyberPFA/include/Objects/Track.h index 49dc55e2109ed9754a51f688ef94ca55a77da2a8..76937799e441ec38bae948f29e25e3f4599bc204 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/Track.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/Track.h @@ -6,7 +6,7 @@ #include "Objects/CaloHalfCluster.h" #include "TVector3.h" -namespace PandoraPlus { +namespace Cyber { class CaloHalfCluster; class Track{ @@ -22,8 +22,8 @@ namespace PandoraPlus { std::vector<TrackState> getTrackStates(std::string name) const; std::vector<TrackState> getAllTrackStates() const; std::map<std::string, std::vector<TrackState> > getTrackStatesMap() const { return m_trackStates; } - std::vector<PandoraPlus::CaloHalfCluster*> getAssociatedHalfClustersU() const { return m_halfClusterUCol; } - std::vector<PandoraPlus::CaloHalfCluster*> getAssociatedHalfClustersV() const { return m_halfClusterVCol; } + std::vector<Cyber::CaloHalfCluster*> getAssociatedHalfClustersU() const { return m_halfClusterUCol; } + std::vector<Cyber::CaloHalfCluster*> getAssociatedHalfClustersV() const { return m_halfClusterVCol; } std::vector< std::pair<edm4hep::MCParticle, float> > getLinkedMCP() const { return MCParticleWeight; } edm4hep::MCParticle getLeadingMCP() const; float getLeadingMCPweight() const; @@ -34,8 +34,8 @@ namespace PandoraPlus { float getCharge() const; void setTrackStates( std::string name, std::vector<TrackState>& _states ) { m_trackStates[name]=_states; } - void addAssociatedHalfClusterU( PandoraPlus::CaloHalfCluster* _cl ) { m_halfClusterUCol.push_back(_cl); } - void addAssociatedHalfClusterV( PandoraPlus::CaloHalfCluster* _cl ) { m_halfClusterVCol.push_back(_cl); } + void addAssociatedHalfClusterU( Cyber::CaloHalfCluster* _cl ) { m_halfClusterUCol.push_back(_cl); } + void addAssociatedHalfClusterV( Cyber::CaloHalfCluster* _cl ) { m_halfClusterVCol.push_back(_cl); } void addLinkedMCP( std::pair<edm4hep::MCParticle, float> _pair ) { MCParticleWeight.push_back(_pair); } void setLinkedMCP( std::vector<std::pair<edm4hep::MCParticle, float>> _pairVec ) { MCParticleWeight.clear(); MCParticleWeight = _pairVec; } @@ -47,8 +47,8 @@ namespace PandoraPlus { static const double B ; //direction of magnetic field and charge need to check std::map<std::string, std::vector<TrackState> > m_trackStates; // name = Input, Ecal, Hcal - std::vector<PandoraPlus::CaloHalfCluster*> m_halfClusterUCol; - std::vector<PandoraPlus::CaloHalfCluster*> m_halfClusterVCol; + std::vector<Cyber::CaloHalfCluster*> m_halfClusterUCol; + std::vector<Cyber::CaloHalfCluster*> m_halfClusterVCol; int m_type; std::vector< std::pair<edm4hep::MCParticle, float> > MCParticleWeight; diff --git a/Reconstruction/CrystalCaloRec/include/Objects/TrackState.h b/Reconstruction/PFA/CyberPFA/include/Objects/TrackState.h similarity index 96% rename from Reconstruction/CrystalCaloRec/include/Objects/TrackState.h rename to Reconstruction/PFA/CyberPFA/include/Objects/TrackState.h index 280404f26f17716f6c82efe4e5593c3ce03fa2ec..979ce3847be59c270583f7b111e4c149d8aac125 100644 --- a/Reconstruction/CrystalCaloRec/include/Objects/TrackState.h +++ b/Reconstruction/PFA/CyberPFA/include/Objects/TrackState.h @@ -2,7 +2,7 @@ #define _TRACKSTATE_H #include "TVector3.h" -namespace PandoraPlus{ +namespace Cyber{ class TrackState{ public: diff --git a/Reconstruction/CrystalCaloRec/include/Tools/Algorithm.h b/Reconstruction/PFA/CyberPFA/include/Tools/Algorithm.h similarity index 82% rename from Reconstruction/CrystalCaloRec/include/Tools/Algorithm.h rename to Reconstruction/PFA/CyberPFA/include/Tools/Algorithm.h index 14cd8fad00408b88a3cba7adb031b0f3e65dc7a2..1eaa8544e4c14b7ea1a2a5f061dd4c02d4743aa8 100644 --- a/Reconstruction/CrystalCaloRec/include/Tools/Algorithm.h +++ b/Reconstruction/PFA/CyberPFA/include/Tools/Algorithm.h @@ -3,9 +3,9 @@ #include "GaudiAlg/GaudiAlgorithm.h" -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" -namespace PandoraPlus{ +namespace Cyber{ class Settings{ public: @@ -27,8 +27,8 @@ namespace PandoraPlus{ virtual ~Algorithm() {}; virtual StatusCode ReadSettings(Settings& m_settings) = 0; - virtual StatusCode Initialize( PandoraPlusDataCol& m_datacol ) = 0; - virtual StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ) = 0; + virtual StatusCode Initialize( CyberDataCol& m_datacol ) = 0; + virtual StatusCode RunAlgorithm( CyberDataCol& m_datacol ) = 0; virtual StatusCode ClearAlgorithm() = 0; diff --git a/Reconstruction/CrystalCaloRec/include/Tools/AlgorithmManager.h b/Reconstruction/PFA/CyberPFA/include/Tools/AlgorithmManager.h similarity index 95% rename from Reconstruction/CrystalCaloRec/include/Tools/AlgorithmManager.h rename to Reconstruction/PFA/CyberPFA/include/Tools/AlgorithmManager.h index 1089aaf14d57c51252ffe7368ba16c4fa182865e..f4c6a33ed20df65e5f486839b6e4e268b703e3dd 100644 --- a/Reconstruction/CrystalCaloRec/include/Tools/AlgorithmManager.h +++ b/Reconstruction/PFA/CyberPFA/include/Tools/AlgorithmManager.h @@ -3,7 +3,7 @@ #include "Tools/Algorithm.h" -namespace PandoraPlus{ +namespace Cyber{ class Algorithm; class AlgorithmFactory; @@ -41,7 +41,7 @@ namespace PandoraPlus{ } //StatusCode CreateAlgorithm(const std::map<std::string, Settings>& m_algorithmSettings); - StatusCode RunAlgorithm( PandoraPlusDataCol& m_datacol ){ + StatusCode RunAlgorithm( CyberDataCol& m_datacol ){ for(auto iter : m_algorithmNames){ cout<<"Processing Algorithm: "<<iter<<endl; m_algorithmMap[iter]->Initialize(m_datacol); diff --git a/Reconstruction/CrystalCaloRec/include/Tools/CaloHitsCreator.h b/Reconstruction/PFA/CyberPFA/include/Tools/CaloHitsCreator.h similarity index 81% rename from Reconstruction/CrystalCaloRec/include/Tools/CaloHitsCreator.h rename to Reconstruction/PFA/CyberPFA/include/Tools/CaloHitsCreator.h index 26b477716fc3edea771d8000cb8c125363bcc031..6069aa5c0c6b9331fc83bdd7fcc180e17313d9e3 100644 --- a/Reconstruction/CrystalCaloRec/include/Tools/CaloHitsCreator.h +++ b/Reconstruction/PFA/CyberPFA/include/Tools/CaloHitsCreator.h @@ -2,13 +2,13 @@ #define ECALHIT_CREATOR_H #include "k4FWCore/DataHandle.h" -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" #include "Tools/Algorithm.h" #include <DDRec/DetectorData.h> #include <DDRec/CellIDPositionConverter.h> #include <DD4hep/Segmentations.h> -namespace PandoraPlus{ +namespace Cyber{ class CaloHitsCreator{ @@ -17,7 +17,7 @@ namespace PandoraPlus{ CaloHitsCreator( const Settings& m_settings ); ~CaloHitsCreator() {}; - StatusCode CreateCaloHits( PandoraPlusDataCol& m_DataCol, + StatusCode CreateCaloHits( CyberDataCol& m_DataCol, std::vector<DataHandle<edm4hep::CalorimeterHitCollection>*>& r_CaloHitCols, std::map<std::string, dd4hep::DDSegmentation::BitFieldCoder*>& map_decoder, std::map<std::string, DataHandle<edm4hep::MCRecoCaloParticleAssociationCollection>*>& map_CaloParticleAssoCol ); @@ -25,12 +25,12 @@ namespace PandoraPlus{ //StatusCode CreateMCParticleCaloHitsAsso( std::vector<DataHandle<edm4hep::CalorimeterHitCollection>*>& r_CaloHitCols, // DataHandle<edm4hep::MCRecoCaloParticleAssociationCollection>* r_MCParticleRecoCaloCol ); - //StatusCode Clustering( PandoraPlusDataCol& m_DataCol ) { return StatusCode::SUCCESS; }; + //StatusCode Clustering( CyberDataCol& m_DataCol ) { return StatusCode::SUCCESS; }; StatusCode Reset() { return StatusCode::SUCCESS; }; private: - const PandoraPlus::Settings settings; + const Cyber::Settings settings; }; }; diff --git a/Reconstruction/CrystalCaloRec/include/Tools/MCParticleCreator.h b/Reconstruction/PFA/CyberPFA/include/Tools/MCParticleCreator.h similarity index 80% rename from Reconstruction/CrystalCaloRec/include/Tools/MCParticleCreator.h rename to Reconstruction/PFA/CyberPFA/include/Tools/MCParticleCreator.h index 9ed7795ed3a93bfb0dc53182bf6d2eae1e7e44ac..43dac58372fe252cf5c568de949439ee165b052f 100644 --- a/Reconstruction/CrystalCaloRec/include/Tools/MCParticleCreator.h +++ b/Reconstruction/PFA/CyberPFA/include/Tools/MCParticleCreator.h @@ -1,10 +1,10 @@ #ifndef MCPARTICLE_CREATOR_H #define MCPARTICLE_CREATOR_H -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" #include "Tools/Algorithm.h" -namespace PandoraPlus{ +namespace Cyber{ class MCParticleCreator{ @@ -14,7 +14,7 @@ namespace PandoraPlus{ MCParticleCreator( const Settings& m_settings ); ~MCParticleCreator() {}; - StatusCode CreateMCParticle( PandoraPlusDataCol& m_DataCol, + StatusCode CreateMCParticle( CyberDataCol& m_DataCol, DataHandle<edm4hep::MCParticleCollection>& r_MCParticleCol ); //StatusCode CreateTrackMCParticleRelation(){ return StatusCode::SUCCESS; }; @@ -26,7 +26,7 @@ namespace PandoraPlus{ StatusCode Reset() { return StatusCode::SUCCESS; }; private: - const PandoraPlus::Settings settings; + const Cyber::Settings settings; }; diff --git a/Reconstruction/CrystalCaloRec/include/Tools/OutputCreator.h b/Reconstruction/PFA/CyberPFA/include/Tools/OutputCreator.h similarity index 87% rename from Reconstruction/CrystalCaloRec/include/Tools/OutputCreator.h rename to Reconstruction/PFA/CyberPFA/include/Tools/OutputCreator.h index 485dc7c21b0dc23d6dcfa66573909502d3da75b7..401e7855956ce04c63ec3cc3bd2deac53a222861 100644 --- a/Reconstruction/CrystalCaloRec/include/Tools/OutputCreator.h +++ b/Reconstruction/PFA/CyberPFA/include/Tools/OutputCreator.h @@ -4,11 +4,11 @@ #include "k4FWCore/DataHandle.h" #include "edm4hep/MutableCalorimeterHit.h" #include "edm4hep/Vector3f.h" -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" #include "Tools/Algorithm.h" //#include "Tools/HelixClassD.h" -namespace PandoraPlus{ +namespace Cyber{ class OutputCreator{ public: @@ -16,7 +16,7 @@ namespace PandoraPlus{ OutputCreator( const Settings& m_settings); ~OutputCreator() {}; - StatusCode CreateOutputCollections( PandoraPlusDataCol& m_DataCol, + StatusCode CreateOutputCollections( CyberDataCol& m_DataCol, DataHandle<edm4hep::CalorimeterHitCollection>& m_outRecHitsHandler, DataHandle<edm4hep::CalorimeterHitCollection>& m_outRecCoreHandler, DataHandle<edm4hep::CalorimeterHitCollection>& m_outRecHcalHitsHandler, @@ -30,7 +30,7 @@ namespace PandoraPlus{ edm4hep::Track TruthTrack(edm4hep::MCParticle _mcp, edm4hep::TrackCollection* _trkCol ); private: - const PandoraPlus::Settings settings; + const Cyber::Settings settings; }; }; diff --git a/Reconstruction/CrystalCaloRec/include/Tools/TrackCreator.h b/Reconstruction/PFA/CyberPFA/include/Tools/TrackCreator.h similarity index 67% rename from Reconstruction/CrystalCaloRec/include/Tools/TrackCreator.h rename to Reconstruction/PFA/CyberPFA/include/Tools/TrackCreator.h index a35cfaa5af79ed9ce46aa4fb12e0ce10155836ac..b1095099df66ccd4f3aed0c0471a4e767ccd19a0 100644 --- a/Reconstruction/CrystalCaloRec/include/Tools/TrackCreator.h +++ b/Reconstruction/PFA/CyberPFA/include/Tools/TrackCreator.h @@ -1,12 +1,12 @@ #ifndef TRACK_CREATOR_H #define TRACK_CREATOR_H -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" #include "Tools/Algorithm.h" #include "Algorithm/TrackExtrapolatingAlg.h" #include "TVector3.h" -namespace PandoraPlus{ +namespace Cyber{ class TrackCreator{ public: @@ -15,20 +15,20 @@ namespace PandoraPlus{ TrackCreator( const Settings& m_settings ); ~TrackCreator() { delete m_TrkExtraAlg; }; - StatusCode CreateTracks( PandoraPlusDataCol& m_DataCol, + StatusCode CreateTracks( CyberDataCol& m_DataCol, std::vector<DataHandle<edm4hep::TrackCollection>*>& r_TrackCols, DataHandle<edm4hep::MCRecoTrackParticleAssociationCollection>* r_MCParticleTrkCol ); - StatusCode CreateTracksFromMCParticle(PandoraPlusDataCol& m_DataCol, + StatusCode CreateTracksFromMCParticle(CyberDataCol& m_DataCol, DataHandle<edm4hep::MCParticleCollection>& r_MCParticleCol); StatusCode Reset(){}; private: - const PandoraPlus::Settings settings; - PandoraPlus::Algorithm* m_TrkExtraAlg; - PandoraPlus::Settings m_TrkExtraSettings; + const Cyber::Settings settings; + Cyber::Algorithm* m_TrkExtraAlg; + Cyber::Settings m_TrkExtraSettings; }; diff --git a/Reconstruction/CrystalCaloRec/include/Tools/TrackFitInEcal.h b/Reconstruction/PFA/CyberPFA/include/Tools/TrackFitInEcal.h similarity index 100% rename from Reconstruction/CrystalCaloRec/include/Tools/TrackFitInEcal.h rename to Reconstruction/PFA/CyberPFA/include/Tools/TrackFitInEcal.h diff --git a/Reconstruction/CrystalCaloRec/script/digi.py b/Reconstruction/PFA/CyberPFA/script/digi.py similarity index 81% rename from Reconstruction/CrystalCaloRec/script/digi.py rename to Reconstruction/PFA/CyberPFA/script/digi.py index b587c61d0a659b86a42a10309f0c96392a497757..6605e2166e33b7335c083b92d788adf0f3d31b68 100644 --- a/Reconstruction/CrystalCaloRec/script/digi.py +++ b/Reconstruction/PFA/CyberPFA/script/digi.py @@ -3,7 +3,7 @@ import os from Gaudi.Configuration import * from Configurables import k4DataSvc -dsvc = k4DataSvc("EventDataSvc", input="Tracking_TDR_o1_v01_Pi-_10GeV.root") +dsvc = k4DataSvc("EventDataSvc", input="Tracking_TDR_o1_v01_E240_nnHgg.root") from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ seed = [12340] @@ -74,7 +74,7 @@ EcalDigi.AttenuationLength = 7e10 EcalDigi.TimeResolution = 0.5 #unit: ns EcalDigi.ChargeThresholdFrac = 0.05 EcalDigi.Debug=1 -EcalDigi.WriteNtuple = 0 +EcalDigi.WriteNtuple = 1 EcalDigi.OutFileName = "Digi_ECAL.root" ######################################### @@ -89,18 +89,32 @@ HcalDigi.CaloMCPAssociationCollection = "HCALBarrelParticleAssoCol" HcalDigi.SkipEvt = 0 HcalDigi.Seed = 2079 #Digitalization parameters -HcalDigi.MIPResponse = 0.01 # 0.5 MeV / MIP -HcalDigi.MIPThreshold = 0.5 # Unit: MIP +HcalDigi.MIPResponse = 0.007126 # MeV / MIP +HcalDigi.MIPThreshold = 0.1 # Unit: MIP HcalDigi.CalibrHCAL = 1. -HcalDigi.Debug=0 -HcalDigi.WriteNtuple = 0 +HcalDigi.UseRealisticDigi = 1 # Flag to use digitization model. +HcalDigi.SiPMPixel = 57600 # 57600 for 6025PE (6*6 mm, 25 um pixel pitch) +HcalDigi.TileNonUniformity = 0.0 +HcalDigi.EffAttenLength = 20. +HcalDigi.ADCError = 0.0 +HcalDigi.MIPADCMean = 80.*30.0 # Light yield 80 pe/mip +HcalDigi.PeADCMean = 30.0 +HcalDigi.PeADCSigma = 0. +HcalDigi.ADCBaselineHG = 0 +HcalDigi.ADCBaselineSigmaHG = 0. +HcalDigi.ADCBaselineLG = 0 +HcalDigi.ADCBaselineSigmaLG = 0. +HcalDigi.ADCHLRatio = 1 +HcalDigi.ADCSwitch = 1e7 +HcalDigi.ADCLimit = 1e7 +HcalDigi.WriteNtuple = 1 HcalDigi.OutFileName = "Digi_HCAL.root" # output from Configurables import PodioOutput out = PodioOutput("outputalg") -out.filename = "CaloDigi_TDR_o1_v01_Pi-_10GeV.root" +out.filename = "CaloDigi_TDR_o1_v01_E240_nnHgg.root" out.outputCommands = ["keep *"] # ApplicationMgr @@ -108,7 +122,7 @@ from Configurables import ApplicationMgr mgr = ApplicationMgr( TopAlg = [podioinput, EcalDigi, HcalDigi, out], EvtSel = 'NONE', - EvtMax = 10, + EvtMax = 3, ExtSvc = [dsvc, rndmengine, rndmgensvc, geosvc], HistogramPersistency = 'ROOT', OutputLevel = ERROR diff --git a/Reconstruction/CrystalCaloRec/script/rec.py b/Reconstruction/PFA/CyberPFA/script/rec.py similarity index 79% rename from Reconstruction/CrystalCaloRec/script/rec.py rename to Reconstruction/PFA/CyberPFA/script/rec.py index cc9ca258beb562836f4fd633ff79ef767a2d38e5..285014010200a69c7af3839248e3156d7e8ab578 100644 --- a/Reconstruction/CrystalCaloRec/script/rec.py +++ b/Reconstruction/PFA/CyberPFA/script/rec.py @@ -1,4 +1,4 @@ -import os +import os, sys from Gaudi.Configuration import * ############## GeomSvc ################# @@ -20,7 +20,7 @@ geomsvc.compact = geometry_path ########### k4DataSvc #################### from Configurables import k4DataSvc -podioevent = k4DataSvc("EventDataSvc", input="CaloDigi_TDR_o1_v01_Pi-_10GeV.root") +podioevent = k4DataSvc("EventDataSvc", input="CaloDigi_TDR_o1_v01_E240_nnHgg.root") ########################################## ########## CEPCSWData ################# @@ -50,34 +50,34 @@ inp.collections = [ "EcalBarrelCollection", ########################################## ######### Reconstruction ################ -from Configurables import PandoraPlusPFAlg -PandoraPlusPFAlg = PandoraPlusPFAlg("PandoraPlusPFAlg") +from Configurables import CyberPFAlg +CyberPFAlg = CyberPFAlg("CyberPFAlg") ##----Global parameters---- -PandoraPlusPFAlg.Seed = 1024 -PandoraPlusPFAlg.BField = 3. -PandoraPlusPFAlg.Debug = 0 -PandoraPlusPFAlg.SkipEvt = 0 -PandoraPlusPFAlg.WriteAna = 1 -PandoraPlusPFAlg.AnaFileName = "RecAnaTuple_TDR_o1_v01_Pi-_10GeV.root" -PandoraPlusPFAlg.UseTruthTrack = 0 -PandoraPlusPFAlg.EcalGlobalCalib = 1.05 -PandoraPlusPFAlg.HcalGlobalCalib = 4.5 +CyberPFAlg.Seed = 1024 +CyberPFAlg.BField = 3. +CyberPFAlg.Debug = 0 +CyberPFAlg.SkipEvt = 0 +CyberPFAlg.WriteAna = 1 +CyberPFAlg.AnaFileName = "RecAnaTuple_TDR_o1_v01_E240_nnHgg.root" +CyberPFAlg.UseTruthTrack = 0 +CyberPFAlg.EcalGlobalCalib = 1.05 +CyberPFAlg.HcalGlobalCalib = 4.5 ##----Readin collections---- -PandoraPlusPFAlg.MCParticleCollection = "MCParticle" -PandoraPlusPFAlg.TrackCollections = ["CompleteTracks"] -PandoraPlusPFAlg.MCRecoTrackParticleAssociationCollection = "CompleteTracksParticleAssociation" -PandoraPlusPFAlg.ECalCaloHitCollections = ["ECALBarrel"] -PandoraPlusPFAlg.ECalReadOutNames = ["EcalBarrelCollection"] -PandoraPlusPFAlg.ECalMCPAssociationName = ["ECALBarrelParticleAssoCol"] -PandoraPlusPFAlg.HCalCaloHitCollections = ["HCALBarrel"] -PandoraPlusPFAlg.HCalReadOutNames = ["HcalBarrelCollection"] -PandoraPlusPFAlg.HCalMCPAssociationName = ["HCALBarrelParticleAssoCol"] +CyberPFAlg.MCParticleCollection = "MCParticle" +CyberPFAlg.TrackCollections = ["CompleteTracks"] +CyberPFAlg.MCRecoTrackParticleAssociationCollection = "CompleteTracksParticleAssociation" +CyberPFAlg.ECalCaloHitCollections = ["ECALBarrel"] +CyberPFAlg.ECalReadOutNames = ["EcalBarrelCollection"] +CyberPFAlg.ECalMCPAssociationName = ["ECALBarrelParticleAssoCol"] +CyberPFAlg.HCalCaloHitCollections = ["HCALBarrel"] +CyberPFAlg.HCalReadOutNames = ["HcalBarrelCollection"] +CyberPFAlg.HCalMCPAssociationName = ["HCALBarrelParticleAssoCol"] ##--- Output collections --- -PandoraPlusPFAlg.OutputPFO = "outputPFO"; +CyberPFAlg.OutputPFO = "outputPFO"; #----Algorithms---- -PandoraPlusPFAlg.AlgList = ["GlobalClusteringAlg", #1 +CyberPFAlg.AlgList = ["GlobalClusteringAlg", #1 "LocalMaxFindingAlg", #2 "TrackMatchingAlg", #3 "HoughClusteringAlg", #4 @@ -89,7 +89,7 @@ PandoraPlusPFAlg.AlgList = ["GlobalClusteringAlg", #1 "TruthClusteringAlg", #15 "TrackClusterConnectingAlg", #16 "PFOReclusteringAlg" ] #17 -PandoraPlusPFAlg.AlgParNames = [ ["InputECALBars","OutputECAL1DClusters","OutputECALHalfClusters"],#1 +CyberPFAlg.AlgParNames = [ ["InputECALBars","OutputECAL1DClusters","OutputECALHalfClusters"],#1 ["OutputLocalMaxName"],#2 ["ReadinLocalMaxName","OutputLongiClusName"],#3 ["ReadinLocalMaxName","LeftLocalMaxName","OutputLongiClusName"],#4 @@ -101,7 +101,7 @@ PandoraPlusPFAlg.AlgParNames = [ ["InputECALBars","OutputECAL1DClusters","Output ["DoECALClustering","DoHCALClustering","InputHCALHits","OutputHCALClusters"], #15 ["ReadinECALClusterName", "ReadinHCALClusterName", "OutputCombPFO"], #16 ["ECALCalib", "HCALCalib", "MinAngleForNeuMerge"] ]#17 -PandoraPlusPFAlg.AlgParTypes = [ ["string","string","string"],#1 +CyberPFAlg.AlgParTypes = [ ["string","string","string"],#1 ["string"],#2 ["string","string"],#3 ["string","string","string"],#4 @@ -113,7 +113,7 @@ PandoraPlusPFAlg.AlgParTypes = [ ["string","string","string"],#1 ["bool","bool","string","string"], #15 ["string","string","string"], #16 ["double","double","double"] ]#17 -PandoraPlusPFAlg.AlgParValues = [ ["BarCol","Cluster1DCol","HalfClusterCol"],#1 +CyberPFAlg.AlgParValues = [ ["BarCol","Cluster1DCol","HalfClusterCol"],#1 ["AllLocalMax"],#2 ["AllLocalMax","TrackAxis"],#3 ["AllLocalMax","LeftLocalMax","HoughAxis"],#4 @@ -132,7 +132,7 @@ PandoraPlusPFAlg.AlgParValues = [ ["BarCol","Cluster1DCol","HalfClusterCol"],#1 ############################################################################## from Configurables import PodioOutput out = PodioOutput("outputalg") -out.filename = "Rec_TDR_o1_v01_Pi-_10GeV.root" +out.filename = "Rec_TDR_o1_v01_E240_nnHgg.root" out.outputCommands = ["keep *"] @@ -140,9 +140,9 @@ out.outputCommands = ["keep *"] from Configurables import ApplicationMgr ApplicationMgr( - TopAlg=[inp, PandoraPlusPFAlg, out ], + TopAlg=[inp, CyberPFAlg, out ], EvtSel="NONE", - EvtMax=10, + EvtMax=3, ExtSvc=[podioevent, geomsvc], #OutputLevel=DEBUG ) diff --git a/Reconstruction/CrystalCaloRec/script/sim.py b/Reconstruction/PFA/CyberPFA/script/sim.py similarity index 70% rename from Reconstruction/CrystalCaloRec/script/sim.py rename to Reconstruction/PFA/CyberPFA/script/sim.py index 3ffd55dac942f2bde67089aa8654a7afec9cfb98..ae9cbd3197c686a54d304c16e4ce7c73706dde0e 100644 --- a/Reconstruction/CrystalCaloRec/script/sim.py +++ b/Reconstruction/PFA/CyberPFA/script/sim.py @@ -41,22 +41,26 @@ from Configurables import SLCIORdr from Configurables import HepMCRdr from Configurables import GenPrinter -gun = GtGunTool("GtGunTool") -gun.PositionXs = [0] -gun.PositionYs = [0] -gun.PositionZs = [0] -gun.Particles = ["pi-"] -gun.EnergyMins = [10] -gun.EnergyMaxs = [10] -gun.ThetaMins = [60] -gun.ThetaMaxs = [120] -gun.PhiMins = [0] -gun.PhiMaxs = [360] - -genprinter = GenPrinter("GenPrinter") +#gun = GtGunTool("GtGunTool") +#gun.PositionXs = [0] +#gun.PositionYs = [0] +#gun.PositionZs = [0] +#gun.Particles = ["pi-"] +#gun.EnergyMins = [10] +#gun.EnergyMaxs = [10] +#gun.ThetaMins = [60] +#gun.ThetaMaxs = [120] +#gun.PhiMins = [0] +#gun.PhiMaxs = [360] +#genprinter = GenPrinter("GenPrinter") + +stdheprdr = StdHepRdr("StdHepRdr") +stdheprdr.Input = "/cefs/data/stdhep/CEPC240/higgs/update_from_LiangHao_1M/data/E240.Pnnh_gg.e0.p0.whizard195/nnh_gg.e0.p0.00001.stdhep" + genalg = GenAlgo("GenAlgo") -genalg.GenTools = ["GtGunTool"] +#genalg.GenTools = ["GtGunTool"] +genalg.GenTools = ["StdHepRdr"] ############################################################################## # Detector Simulation @@ -82,13 +86,18 @@ from Configurables import TimeProjectionChamberSensDetTool tpc_sensdettool = TimeProjectionChamberSensDetTool("TimeProjectionChamberSensDetTool") tpc_sensdettool.TypeOption = 1 -from Configurables import MarlinEvtSeeder -evtseeder = MarlinEvtSeeder("EventSeeder") +from Configurables import CalorimeterSensDetTool +from Configurables import DriftChamberSensDetTool +cal_sensdettool = CalorimeterSensDetTool("CalorimeterSensDetTool") +cal_sensdettool.CalNamesMergeDisable = ["EcalBarrel", "CaloDetectorEndcap", "HcalBarrel", "HcalEndcaps"] +cal_sensdettool.CalNamesApplyBirks = ["EcalBarrel", "CaloDetectorEndcap", "HcalBarrel","HcalEndcaps"] +cal_sensdettool.CalNamesBirksConstants = [0.008415, 0.008415, 0.126, 0.126] # BGO and Glass scintillator + # output from Configurables import PodioOutput out = PodioOutput("outputalg") -out.filename = "Sim_TDR_o1_v01_Pi-_10GeV.root" +out.filename = "Sim_TDR_o1_v01_E240_nnHgg.root" out.outputCommands = ["keep *"] # ApplicationMgr @@ -96,8 +105,8 @@ from Configurables import ApplicationMgr mgr = ApplicationMgr( TopAlg = [genalg, detsimalg, out], EvtSel = 'NONE', - EvtMax = 10, + EvtMax = 3, ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc], HistogramPersistency = 'ROOT', - OutputLevel = ERROR + OutputLevel = INFO ) diff --git a/Reconstruction/CrystalCaloRec/script/tracking.py b/Reconstruction/PFA/CyberPFA/script/tracking.py similarity index 94% rename from Reconstruction/CrystalCaloRec/script/tracking.py rename to Reconstruction/PFA/CyberPFA/script/tracking.py index 38f47ad30cfb343bad4c1fc8e21e6a2dcab218c3..dea774cada721039b31d0588d9fba18964b5bd7a 100644 --- a/Reconstruction/CrystalCaloRec/script/tracking.py +++ b/Reconstruction/PFA/CyberPFA/script/tracking.py @@ -3,7 +3,7 @@ import os from Gaudi.Configuration import * from Configurables import k4DataSvc -dsvc = k4DataSvc("EventDataSvc", input="Sim_TDR_o1_v01_Pi-_10GeV.root") +dsvc = k4DataSvc("EventDataSvc", input="Sim_TDR_o1_v01_E240_nnHgg.root") from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ seed = [12340] @@ -81,8 +81,8 @@ digiSIT.IsStrip = False digiSIT.SimTrackHitCollection = "SITCollection" digiSIT.TrackerHitCollection = sithitname digiSIT.TrackerHitAssociationCollection = "SITTrackerHitAssociation" -digiSIT.ResolutionU = [0.0072] -digiSIT.ResolutionV = [0.086] +digiSIT.ResolutionU = [0.0098] +digiSIT.ResolutionV = [0.0433] digiSIT.UsePlanarTag = True digiSIT.ParameterizeResolution = False digiSIT.ParametersU = [2.29655e-03, 0.965899e-03, 0.584699e-03, 17.0856, 84.566, 12.4695e-03, -0.0643059, 0.168662, 1.87998e-03, 0.514452] @@ -94,8 +94,8 @@ digiSET.IsStrip = False digiSET.SimTrackHitCollection = "SETCollection" digiSET.TrackerHitCollection = sethitname digiSET.TrackerHitAssociationCollection = "SETTrackerHitAssociation" -digiSET.ResolutionU = [0.0072] -digiSET.ResolutionV = [0.086] +digiSET.ResolutionU = [0.005] +digiSET.ResolutionV = [0.021] digiSET.UsePlanarTag = True digiSET.ParameterizeResolution = False digiSET.ParametersU = [2.29655e-03, 0.965899e-03, 0.584699e-03, 17.0856, 84.566, 12.4695e-03, -0.0643059, 0.168662, 1.87998e-03, 0.514452] @@ -155,8 +155,10 @@ tracking.NDivisionsInTheta = 10 tracking.NDivisionsInPhi = 60 tracking.NDivisionsInPhiFTD = 16 tracking.MinDistCutAttach = 50 +# for p=1GeV, theta=10degree, Chi2FitCut = 1500, HelixMaxChi2 = 1000000, Chi2WZ = 0.02 tracking.Chi2FitCut = 200 tracking.MaxChi2PerHit = 200 +tracking.HelixMaxChi2 = 50000 tracking.Chi2WZTriplet = 0.1 tracking.Chi2WZQuartet = 0.1 tracking.Chi2WZSeptet = 0.1 @@ -210,6 +212,7 @@ full.FTDHitToTrackDistance = 5. full.SITHitToTrackDistance = 3. full.SETHitToTrackDistance = 5. full.MinChi2ProbForSiliconTracks = 0 +full.MaxChi2PerHit = 500 #full.OutputLevel = DEBUG from Configurables import TPCDndxAlg @@ -227,6 +230,7 @@ from Configurables import TrueMuonTagAlg tmt = TrueMuonTagAlg("TrueMuonTag") tmt.MCParticleCollection = "MCParticle" tmt.TrackList = ["CompleteTracks"] +tmt.TrackerAssociationList = ["VXDTrackerHitAssociation", "SITTrackerHitAssociation", "SETTrackerHitAssociation", "FTDTrackerHitAssociation", "TPCTrackerHitAss"] tmt.MuonTagEfficiency = 0.95 # muon true tag efficiency, default is 1.0 (100%) tmt.MuonDetTanTheta = 1.2 # muon det barrel/endcap separation tan(theta) #tmt.OutputLevel = DEBUG @@ -234,7 +238,7 @@ tmt.MuonDetTanTheta = 1.2 # muon det barrel/endcap separation tan(theta) # output from Configurables import PodioOutput out = PodioOutput("outputalg") -out.filename = "Tracking_TDR_o1_v01_Pi-_10GeV.root" +out.filename = "Tracking_TDR_o1_v01_E240_nnHgg.root" out.outputCommands = ["keep *"] # ApplicationMgr @@ -242,8 +246,8 @@ from Configurables import ApplicationMgr mgr = ApplicationMgr( TopAlg = [podioinput, digiVXD, digiSIT, digiSET, digiFTD, digiTPC, tracking, forward, subset, clupatra, full, tpr, tpc_dndx, tmt, out], EvtSel = 'NONE', - EvtMax = 10, + EvtMax = 3, ExtSvc = [rndmengine, rndmgensvc, dsvc, evtseeder, geosvc, gearsvc, tracksystemsvc, pidsvc], HistogramPersistency = 'ROOT', - OutputLevel = ERROR + OutputLevel = INFO ) diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/ArborClusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/ArborClusteringAlg.cpp similarity index 99% rename from Reconstruction/CrystalCaloRec/src/Algorithm/ArborClusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/ArborClusteringAlg.cpp index 1d03dcf07449b462283dab4ac3f7f78c290dbcab..a64a8d8ec0bba154108e791d9fc0ccb8bfe9b77c 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/ArborClusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/ArborClusteringAlg.cpp @@ -41,7 +41,7 @@ StatusCode ArborClusteringAlg::Initialize(){ return StatusCode::SUCCESS; } -StatusCode ArborClusteringAlg::RunAlgorithm( ArborClusteringAlg::Settings& m_settings, PandoraPlusDataCol& m_datacol ){ +StatusCode ArborClusteringAlg::RunAlgorithm( ArborClusteringAlg::Settings& m_settings, CyberDataCol& m_datacol ){ settings = m_settings; std::vector<CRDEcalEDM::CRDCaloHit2DShower> m_2DshowerCol; m_2DshowerCol.clear(); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/ArborTreeMergingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/ArborTreeMergingAlg.cpp similarity index 99% rename from Reconstruction/CrystalCaloRec/src/Algorithm/ArborTreeMergingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/ArborTreeMergingAlg.cpp index beade7ae81b709a6a931c27c7b0cd18f9a30f8c6..59981df94c8f978544e207f920a4348dd6df9434 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/ArborTreeMergingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/ArborTreeMergingAlg.cpp @@ -20,7 +20,7 @@ StatusCode ArborTreeMergingAlg::Initialize(){ return StatusCode::SUCCESS; } -StatusCode ArborTreeMergingAlg::RunAlgorithm( ArborTreeMergingAlg::Settings& m_settings, PandoraPlusDataCol& m_datacol){ +StatusCode ArborTreeMergingAlg::RunAlgorithm( ArborTreeMergingAlg::Settings& m_settings, CyberDataCol& m_datacol){ settings = m_settings; std::vector<CRDEcalEDM::CRDCaloHit2DShower> m_2DshowerCol; m_2DshowerCol.clear(); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/AxisMergingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/AxisMergingAlg.cpp similarity index 89% rename from Reconstruction/CrystalCaloRec/src/Algorithm/AxisMergingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/AxisMergingAlg.cpp index 1b43f0fc2b48d01fe48ca2f0cc9b3b006ea23a58..0bc5f5cc924746e8e6b8216fc430e7517909c44b 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/AxisMergingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/AxisMergingAlg.cpp @@ -12,7 +12,7 @@ StatusCode AxisMergingAlg::ReadSettings(Settings& m_settings){ if(settings.map_intPars.find("th_CoreNhit")==settings.map_intPars.end()) settings.map_intPars["th_CoreNhit"] = 3; if(settings.map_floatPars.find("axis_Angle")==settings.map_floatPars.end()) settings.map_floatPars["axis_Angle"] = TMath::Pi()/4.; if(settings.map_floatPars.find("relP_Angle")==settings.map_floatPars.end()) settings.map_floatPars["relP_Angle"] = TMath::Pi()/4.; - if(settings.map_floatPars.find("relP_Dis")==settings.map_floatPars.end()) settings.map_floatPars["relP_Dis"] = 5*PandoraPlus::CaloUnit::barsize; + if(settings.map_floatPars.find("relP_Dis")==settings.map_floatPars.end()) settings.map_floatPars["relP_Dis"] = 5*Cyber::CaloUnit::barsize; if(settings.map_intPars.find("th_Nhit")==settings.map_intPars.end()) settings.map_intPars["th_Nhit"] = 5; if(settings.map_floatPars.find("th_branch_distance")==settings.map_floatPars.end()) settings.map_floatPars["th_branch_distance"] = 30; @@ -22,7 +22,7 @@ StatusCode AxisMergingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode AxisMergingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode AxisMergingAlg::Initialize( CyberDataCol& m_datacol ){ m_axisUCol.clear(); m_axisVCol.clear(); m_newAxisUCol.clear(); @@ -37,7 +37,7 @@ StatusCode AxisMergingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode AxisMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode AxisMergingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //cout << "yyy: ---------------------------- Running Axis MergingAlg -----------------------------------" << endl; if( p_HalfClusterU->size() + p_HalfClusterV->size()==0 ) { @@ -49,7 +49,7 @@ StatusCode AxisMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout << "yyy: Merge axis in U pHalfClusterU" << endl; //Merge axis in HalfClusterU: - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> p_emptyHFClusU; p_emptyHFClusU.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> p_emptyHFClusU; p_emptyHFClusU.clear(); for(int ih=0; ih<p_HalfClusterU->size(); ih++){ m_axisUCol.clear(); m_newAxisUCol.clear(); m_axisUCol = p_HalfClusterU->at(ih)->getAllHalfClusterCol(); @@ -73,7 +73,7 @@ StatusCode AxisMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // cout << " yyy: For p_HalfClusterU[" << ih << "], m_newAxisUCol.size() = " << m_newAxisUCol.size() // << ", if size<2, no need to merge" << endl; if(m_newAxisUCol.size()<2){ //No need to merge, save into OutputAxis. - std::vector<const PandoraPlus::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); + std::vector<const Cyber::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); for(int ic=0; ic<m_newAxisUCol.size(); ic++) tmp_axisCol.push_back(m_newAxisUCol[ic]); p_HalfClusterU->at(ih)->setHalfClusters(settings.map_stringPars["OutputAxisName"], tmp_axisCol); continue; @@ -85,7 +85,7 @@ StatusCode AxisMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //printf(" In HalfClusterU #%d: readin axis size %d \n", ih, m_newAxisUCol.size()); /* -std::map<std::string, std::vector<const PandoraPlus::CaloHalfCluster*> > tmp_HClusMap = p_HalfClusterU->at(ih)->getHalfClusterMap(); +std::map<std::string, std::vector<const Cyber::CaloHalfCluster*> > tmp_HClusMap = p_HalfClusterU->at(ih)->getHalfClusterMap(); cout<<"Print Readin AxisU: "<<endl; for(auto iter : tmp_HClusMap){ cout<<" Axis name: "<<iter.first<<endl; @@ -97,12 +97,15 @@ for(auto iter : tmp_HClusMap){ iter.second[ia]->getCluster()[il]->getPos().y(), iter.second[ia]->getCluster()[il]->getPos().z(), iter.second[ia]->getCluster()[il]->getEnergy(), + iter.second[ia]->getCluster()[il]->getTowerID()[0][0], + iter.second[ia]->getCluster()[il]->getTowerID()[0][1], + iter.second[ia]->getCluster()[il]->getTowerID()[0][2], iter.second[ia]->getCluster()[il]); } cout<<endl; } -*/ -/* + + cout<<"Print Readin AxisU: "<<endl; for(int ia=0; ia<m_newAxisUCol.size(); ia++){ cout<<" Axis #"<<ia<<": type "<<m_newAxisUCol[ia]->getType()<<endl; @@ -111,29 +114,29 @@ for(int il=0 ;il<m_newAxisUCol[ia]->getCluster().size(); il++) m_newAxisUCol[ia]->getCluster()[il]->getPos().x(), m_newAxisUCol[ia]->getCluster()[il]->getPos().y(), m_newAxisUCol[ia]->getCluster()[il]->getPos().z(), + m_newAxisUCol[ia]->getCluster()[il]->getEnergy(), m_newAxisUCol[ia]->getCluster()[il]->getTowerID()[0][0], m_newAxisUCol[ia]->getCluster()[il]->getTowerID()[0][1], m_newAxisUCol[ia]->getCluster()[il]->getTowerID()[0][2], - m_newAxisUCol[ia]->getCluster()[il]->getEnergy(), m_newAxisUCol[ia]->getCluster()[il]); cout<<endl; } */ //Case1: Merge axes associated to the same track. TrkMatchedMerging(m_newAxisUCol); - // cout << " yyy: after TrkMatchedMerging(), axis size = " << m_newAxisUCol.size() << endl; + //cout << " yyy: after TrkMatchedMerging(), axis size = " << m_newAxisUCol.size() << endl; //Case2: Merge axes that share same localMax. OverlapMerging(m_newAxisUCol); - // cout << " yyy: after OverlapMerging(), axis size = " << m_newAxisUCol.size() << endl; + //cout << " yyy: after OverlapMerging(), axis size = " << m_newAxisUCol.size() << endl; // Case3: Merge fake photon to track axis. BranchMerging(m_newAxisUCol); - // cout << " yyy: after BranchMerging(), axis size = " << m_newAxisUCol.size() << endl; + //cout << " yyy: after BranchMerging(), axis size = " << m_newAxisUCol.size() << endl; //Case4: Merge fragments to core axes. FragmentsMerging(m_newAxisUCol); - // cout << " yyy: after FragmentsMerging(), axis size = " << m_newAxisUCol.size() << endl; + //cout << " yyy: after FragmentsMerging(), axis size = " << m_newAxisUCol.size() << endl; //Case4: Merge nearby axes. //ConeMerging(m_newAxisUCol); @@ -178,8 +181,8 @@ cout<<endl; } */ //Check axis quality - std::vector<PandoraPlus::CaloHalfCluster*> tmp_goodAxis; tmp_goodAxis.clear(); - std::vector<PandoraPlus::CaloHalfCluster*> tmp_badAxis; tmp_badAxis.clear(); + std::vector<Cyber::CaloHalfCluster*> tmp_goodAxis; tmp_goodAxis.clear(); + std::vector<Cyber::CaloHalfCluster*> tmp_badAxis; tmp_badAxis.clear(); for(int ic=0; ic<m_newAxisUCol.size(); ic++){ m_newAxisUCol[ic]->getLinkedMCPfromUnit(); if( (m_newAxisUCol[ic]->getType()==100 && m_newAxisUCol[ic]->getCluster().size()>=settings.map_intPars["th_CoreNhit"] ) || @@ -201,7 +204,7 @@ cout<<endl; //SplitOverlapCluster(p_HalfClusterU->at(ih), tmp_goodAxis, m_datacol.map_1DCluster["bk1DCluster"], m_datacol.map_BarCol["bkBar"]); //convert to constant object and save in HalfCluster: - std::vector<const PandoraPlus::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); + std::vector<const Cyber::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); for(int ic=0; ic<tmp_goodAxis.size(); ic++) tmp_axisCol.push_back(tmp_goodAxis[ic]); // for(int ic=0; ic<m_newAxisUCol.size(); ic++) tmp_axisCol.push_back(m_newAxisUCol[ic]); p_HalfClusterU->at(ih)->setHalfClusters(settings.map_stringPars["OutputAxisName"], tmp_axisCol); @@ -211,11 +214,10 @@ cout<<endl; //Merge empty HalfCluster into the existing clusters. for(int ih=0; ih<p_emptyHFClusU.size(); ih++){ if(!p_emptyHFClusU[ih]) continue; - std::vector<PandoraPlus::CaloHalfCluster*> m_HalfCluster; m_HalfCluster.clear(); + std::vector<Cyber::CaloHalfCluster*> m_HalfCluster; m_HalfCluster.clear(); for(int i=0; i<p_HalfClusterU->size(); i++) m_HalfCluster.push_back(p_HalfClusterU->at(i).get()); if(!MergeToClosestCluster(p_emptyHFClusU[ih].get(), m_HalfCluster)){ if(p_emptyHFClusU[ih]->getEnergy()>settings.map_intPars["th_Eclus_low"] || p_emptyHFClusU[ih]->getCluster().size()>settings.map_intPars["th_Nhit_low"]){ -cout<<" Save cluster #"<<ih<<" as empty, energy "<<p_emptyHFClusU[ih]->getEnergy()<<endl; m_datacol.map_HalfCluster["emptyHalfClusterU"].push_back(p_emptyHFClusU[ih]); } } @@ -223,7 +225,7 @@ cout<<" Save cluster #"<<ih<<" as empty, energy "<<p_emptyHFClusU[ih]->getEnerg //cout << "yyy: Merge axis in V pHalfClusterV" << endl; //Merge axis in HalfClusterV: - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> p_emptyHFClusV; p_emptyHFClusV.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> p_emptyHFClusV; p_emptyHFClusV.clear(); for(int ih=0; ih<p_HalfClusterV->size(); ih++){ m_axisVCol.clear(); m_newAxisVCol.clear(); m_axisVCol = p_HalfClusterV->at(ih)->getAllHalfClusterCol(); @@ -246,7 +248,7 @@ cout<<" Save cluster #"<<ih<<" as empty, energy "<<p_emptyHFClusU[ih]->getEnerg // cout << " yyy: For p_HalfClusterV[" << ih << "], m_newAxisVCol.size() = " << m_newAxisVCol.size() // << ", if size<2, no need to merge" << endl; if(m_newAxisVCol.size()<2){ - std::vector<const PandoraPlus::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); + std::vector<const Cyber::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); for(int ic=0; ic<m_newAxisVCol.size(); ic++) tmp_axisCol.push_back(m_newAxisVCol[ic]); p_HalfClusterV->at(ih)->setHalfClusters(settings.map_stringPars["OutputAxisName"], tmp_axisCol); continue; @@ -289,8 +291,8 @@ cout<<" Save cluster #"<<ih<<" as empty, energy "<<p_emptyHFClusU[ih]->getEnerg //cout << " yyy: check axis quality" << endl; //Check axis quality - std::vector<PandoraPlus::CaloHalfCluster*> tmp_goodAxis; tmp_goodAxis.clear(); - std::vector<PandoraPlus::CaloHalfCluster*> tmp_badAxis; tmp_badAxis.clear(); + std::vector<Cyber::CaloHalfCluster*> tmp_goodAxis; tmp_goodAxis.clear(); + std::vector<Cyber::CaloHalfCluster*> tmp_badAxis; tmp_badAxis.clear(); for(int ic=0; ic<m_newAxisVCol.size(); ic++){ m_newAxisVCol[ic]->getLinkedMCPfromUnit(); if( (m_newAxisVCol[ic]->getType()==100 && m_newAxisVCol[ic]->getCluster().size()>=settings.map_intPars["th_CoreNhit"] ) || @@ -312,7 +314,7 @@ cout<<" Save cluster #"<<ih<<" as empty, energy "<<p_emptyHFClusU[ih]->getEnerg //SplitOverlapCluster(p_HalfClusterV->at(ih), tmp_goodAxis, m_datacol.map_1DCluster["bk1DCluster"], m_datacol.map_BarCol["bkBar"]); //convert to constant object and save in HalfCluster: - std::vector<const PandoraPlus::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); + std::vector<const Cyber::CaloHalfCluster*> tmp_axisCol; tmp_axisCol.clear(); for(int ic=0; ic<tmp_goodAxis.size(); ic++) tmp_axisCol.push_back(tmp_goodAxis[ic]); // for(int ic=0; ic<m_newAxisVCol.size(); ic++) tmp_axisCol.push_back(m_newAxisVCol[ic]); p_HalfClusterV->at(ih)->setHalfClusters(settings.map_stringPars["OutputAxisName"], tmp_axisCol); @@ -322,7 +324,7 @@ cout<<" Save cluster #"<<ih<<" as empty, energy "<<p_emptyHFClusU[ih]->getEnerg //Merge empty HalfClusters into the existing cluster. for(int ih=0; ih<p_emptyHFClusV.size(); ih++){ if(!p_emptyHFClusV[ih]) continue; - std::vector<PandoraPlus::CaloHalfCluster*> m_HalfCluster; m_HalfCluster.clear(); + std::vector<Cyber::CaloHalfCluster*> m_HalfCluster; m_HalfCluster.clear(); for(int i=0; i<p_HalfClusterV->size(); i++) m_HalfCluster.push_back(p_HalfClusterV->at(i).get()); if(!MergeToClosestCluster(p_emptyHFClusV[ih].get(), m_HalfCluster)){ if(p_emptyHFClusV[ih]->getEnergy()>settings.map_intPars["th_Eclus_low"] || p_emptyHFClusV[ih]->getCluster().size()>settings.map_intPars["th_Nhit_low"]) @@ -345,14 +347,14 @@ StatusCode AxisMergingAlg::ClearAlgorithm(){ }; -StatusCode AxisMergingAlg::TrkMatchedMerging( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ){ +StatusCode AxisMergingAlg::TrkMatchedMerging( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ){ // cout << " yyy: calling TrkMatchedMerging(), m_axisCol.size()=" << m_axisCol.size() << endl; if(m_axisCol.size()<2) return StatusCode::SUCCESS; for(int iax=0; iax<m_axisCol.size(); iax++){ - std::vector<const PandoraPlus::Track*> m_trkCol = m_axisCol[iax]->getAssociatedTracks(); + std::vector<const Cyber::Track*> m_trkCol = m_axisCol[iax]->getAssociatedTracks(); for(int jax=iax+1; jax<m_axisCol.size(); jax++){ - std::vector<const PandoraPlus::Track*> p_trkCol = m_axisCol[jax]->getAssociatedTracks(); + std::vector<const Cyber::Track*> p_trkCol = m_axisCol[jax]->getAssociatedTracks(); bool fl_match = false; @@ -393,15 +395,15 @@ StatusCode AxisMergingAlg::TrkMatchedMerging( std::vector<PandoraPlus::CaloHalfC }; -StatusCode AxisMergingAlg::OverlapMerging( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ){ +StatusCode AxisMergingAlg::OverlapMerging( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ){ // cout << " yyy: calling OverlapMerging(), m_axisCol.size()=" << m_axisCol.size() << endl; if(m_axisCol.size()<2) return StatusCode::SUCCESS; // cout << " yyy: first interate" << endl; for(int iax=0; iax<m_axisCol.size(); iax++){ - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax]; + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; for(int jax=iax+1; jax<m_axisCol.size(); jax++){ - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax]; + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax]; // Do not merge two different track axes if ( m_axis->getAssociatedTracks().size()>0 && p_axis->getAssociatedTracks().size()>0 ) continue; @@ -457,9 +459,9 @@ StatusCode AxisMergingAlg::OverlapMerging( std::vector<PandoraPlus::CaloHalfClus // cout << " yyy: second interate" << endl; //iterate for(int iax=0; iax<m_axisCol.size(); iax++){ - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax]; + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; for(int jax=iax+1; jax<m_axisCol.size(); jax++){ - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax]; + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax]; // Do not merge two different track axes if ( m_axis->getAssociatedTracks().size()>0 && p_axis->getAssociatedTracks().size()>0 ) continue; @@ -518,30 +520,40 @@ StatusCode AxisMergingAlg::OverlapMerging( std::vector<PandoraPlus::CaloHalfClus }; -StatusCode AxisMergingAlg::BranchMerging( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ){ - // cout << " yyy: calling BranchMerging(), m_axisCol.size()=" << m_axisCol.size() << endl; +StatusCode AxisMergingAlg::BranchMerging( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ){ + //cout << " yyy: calling BranchMerging(), m_axisCol.size()=" << m_axisCol.size() << endl; + + if(m_axisCol.size()<2) return StatusCode::SUCCESS; + // for(int iax=0; iax<m_axisCol.size(); iax++){ // select track axis + // cout<<" current iax "<<iax<<", remain axis col size "<<m_axisCol.size()<<endl; + // const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; + // cout<<" Axis type: "<<m_axis->getType()<<endl; + // } + // Merge fake Hough axis to track axis std::sort( m_axisCol.begin(), m_axisCol.end(), compLayer ); for(int iax=0; iax<m_axisCol.size(); iax++){ // select track axis - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax]; + + //cout<<" current iax "<<iax<<", remain axis col size "<<m_axisCol.size()<<endl; + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; if (m_axis->getType()<10000){ - // cout << "yyy: m_axisCol[" << iax << "] is not a track axis. skip" << endl; + //cout << "yyy: m_axisCol[" << iax << "] is not a track axis. skip" << endl; continue; } for(int jax=0; jax<m_axisCol.size(); jax++){ // select Hough axis if(jax==iax) continue; - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax]; + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax]; if (p_axis->getType()>=10000) continue; // Do not merge two track axis if (p_axis->getType()/100%100<1){ - // cout << "yyy: m_axisCol[" << jax << "] is not a Hough axis. skip" << endl; + //cout << "yyy: m_axisCol[" << jax << "] is not a Hough axis. skip" << endl; continue; } - +//cout<<"Check axis pair: "<<iax<<", "<<jax<<endl; // // Determine if two axes are close to each other // bool is_close = false; // for(int ibar=0; ibar<m_axis->getCluster().size(); ibar++){ @@ -567,8 +579,8 @@ StatusCode AxisMergingAlg::BranchMerging( std::vector<PandoraPlus::CaloHalfClust double y0 = m_axis->getEnergyCenter().y(); double distance = TMath::Abs( x0*TMath::Cos(hough_alpha) + y0*TMath::Sin(hough_alpha) - hough_rho ); - // cout << " yyy:V rho = " << hough_rho << ", alpha = " << hough_alpha << ", x0 = " << x0 << ", y0 = " << y0 << endl; - // cout << " distanceV = " << distance << endl; + //cout << " yyy:V rho = " << hough_rho << ", alpha = " << hough_alpha << ", x0 = " << x0 << ", y0 = " << y0 << endl; + //cout << " distanceV = " << distance << endl; if (distance<settings.map_floatPars["th_branch_distance"]){ m_axisCol[iax]->mergeHalfCluster( m_axisCol[jax] ); @@ -584,31 +596,31 @@ StatusCode AxisMergingAlg::BranchMerging( std::vector<PandoraPlus::CaloHalfClust // U plane else{ int m_module = m_axis->getEnergyCenterTower()[0]; - // cout << " yyy:branceU: m_module = " << m_module << endl; + //cout << " yyy:branceU: m_module = " << m_module << endl; int p_module = p_axis->getTowerID()[0][0]; - // cout << " yyy:branceU: p_module = " << p_module << endl; + //cout << " yyy:branceU: p_module = " << p_module << endl; // Do not merge the two axis in two different modules //if (m_module != p_module) continue; TVector3 t_pos = m_axis->getEnergyCenter(); // cout << " yyy:branceU: t_pos = " << t_pos.x() << ", " << t_pos.y() << ", " << t_pos.z() << endl; - t_pos.RotateZ( TMath::TwoPi()/PandoraPlus::CaloUnit::Nmodule*(int(PandoraPlus::CaloUnit::Nmodule*3./4.)-m_module) ); + t_pos.RotateZ( TMath::TwoPi()/Cyber::CaloUnit::Nmodule*(int(Cyber::CaloUnit::Nmodule*3./4.)-m_module) ); // cout << " yyy:branceU: t_pos after rotate to module 6 = " << t_pos.x() << ", " << t_pos.y() << ", " << t_pos.z() << endl; double x0 = t_pos.x(); double y0 = t_pos.z(); double distance = TMath::Abs( x0*TMath::Cos(hough_alpha) + y0*TMath::Sin(hough_alpha) - hough_rho ); - // cout << " yyy:U rho = " << hough_rho << ", alpha = " << hough_alpha << ", x0 = " << x0 << ", z0 = " << y0 << endl; - // cout << " distanceU = " << distance << endl; + //cout << " yyy:U rho = " << hough_rho << ", alpha = " << hough_alpha << ", x0 = " << x0 << ", z0 = " << y0 << endl; + //cout << " distanceU = " << distance << endl; if (distance<settings.map_floatPars["th_branch_distance"]){ m_axisCol[iax]->mergeHalfCluster( m_axisCol[jax] ); int axis_type = m_axisCol[iax]->getType() + m_axisCol[jax]->getType(); m_axisCol[iax]->setType(axis_type); m_axisCol.erase(m_axisCol.begin()+jax); + //cout << " yyy: axis " << jax << " is merged into axis " << iax << endl; jax--; if(iax>jax+1) iax--; - // cout << " yyy: axis " << jax << " is merged into axis " << iax << endl; } @@ -618,10 +630,13 @@ StatusCode AxisMergingAlg::BranchMerging( std::vector<PandoraPlus::CaloHalfClust } m_axis=nullptr; } + + + return StatusCode::SUCCESS; } -StatusCode AxisMergingAlg::FragmentsMerging( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ){ +StatusCode AxisMergingAlg::FragmentsMerging( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ){ // cout << " yyy: calling FragmentsMerging(), m_axisCol.size()=" << m_axisCol.size() << endl; if(m_axisCol.size()<2) return StatusCode::SUCCESS; @@ -643,7 +658,7 @@ StatusCode AxisMergingAlg::FragmentsMerging( std::vector<PandoraPlus::CaloHalfCl //Merge fragments to core. std::sort( m_axisCol.begin(), m_axisCol.end(), compLayer ); for(int iax=0; iax<m_axisCol.size(); iax++){ - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax]; + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; //Define the Core: Hough+Nhit || Trk+Hough || Trk+Cone. //cout<<" Readin core axis #"<<iax<<" type: "<<m_axis->getType()<<", Nclus: "<<m_axis->getCluster().size(); if( !( (m_axis->getType()==100 && m_axis->getCluster().size()>=settings.map_intPars["th_CoreNhit"] ) || @@ -654,7 +669,7 @@ StatusCode AxisMergingAlg::FragmentsMerging( std::vector<PandoraPlus::CaloHalfCl for(int jax=0; jax<m_axisCol.size(); jax++){ if(jax==iax) continue; - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax]; + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax]; //Do not merge 2 cores. if( (p_axis->getType()==100 && p_axis->getCluster().size()>=settings.map_intPars["th_CoreNhit"] ) || p_axis->getType()>100 ){ @@ -753,14 +768,14 @@ StatusCode AxisMergingAlg::FragmentsMerging( std::vector<PandoraPlus::CaloHalfCl }; -StatusCode AxisMergingAlg::ConeMerging( std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ){ +StatusCode AxisMergingAlg::ConeMerging( std::vector<Cyber::CaloHalfCluster*>& m_axisCol ){ if(m_axisCol.size()<2) return StatusCode::SUCCESS; std::sort( m_axisCol.begin(), m_axisCol.end(), compLayer ); for(int iax=0; iax<m_axisCol.size(); iax++){ - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax]; + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; for(int jax=iax+1; jax<m_axisCol.size(); jax++){ - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax]; + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax]; //printf(" Layer range: axis %d: [%d, %d], axis %d: [%d, %d] \n", iax, m_axis->getBeginningDlayer(), m_axis->getEndDlayer(), jax, p_axis->getBeginningDlayer(), p_axis->getEndDlayer()); @@ -809,9 +824,9 @@ StatusCode AxisMergingAlg::ConeMerging( std::vector<PandoraPlus::CaloHalfCluster //iterate for(int iax=0; iax<m_axisCol.size(); iax++){ - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax]; + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax]; for(int jax=iax+1; jax<m_axisCol.size(); jax++){ - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax]; + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax]; TVector3 m_beginPoint = m_axis->getClusterInLayer( m_axis->getBeginningDlayer() )[0]->getPos(); TVector3 m_endPoint = m_axis->getClusterInLayer( m_axis->getEndDlayer() )[0]->getPos(); @@ -856,7 +871,7 @@ StatusCode AxisMergingAlg::ConeMerging( std::vector<PandoraPlus::CaloHalfCluster }; -bool AxisMergingAlg::MergeToClosestCluster( PandoraPlus::CaloHalfCluster* m_badaxis, std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol ){ +bool AxisMergingAlg::MergeToClosestCluster( Cyber::CaloHalfCluster* m_badaxis, std::vector<Cyber::CaloHalfCluster*>& m_axisCol ){ if(m_axisCol.size()==0){ //m_axisCol.push_back(m_badaxis); // cout << " yyy: no good axis, treat the bad axis as good axis" << endl; @@ -884,10 +899,10 @@ bool AxisMergingAlg::MergeToClosestCluster( PandoraPlus::CaloHalfCluster* m_bada }; /* -StatusCode AxisMergingAlg::SplitOverlapCluster( std::shared_ptr<PandoraPlus::CaloHalfCluster>& m_HFClus, - std::vector<PandoraPlus::CaloHalfCluster*>& m_axisCol, - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& bk_1Dclus, - std::vector<std::shared_ptr<PandoraPlus::CaloUnit>>& bk_Unit){ +StatusCode AxisMergingAlg::SplitOverlapCluster( std::shared_ptr<Cyber::CaloHalfCluster>& m_HFClus, + std::vector<Cyber::CaloHalfCluster*>& m_axisCol, + std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& bk_1Dclus, + std::vector<std::shared_ptr<Cyber::CaloUnit>>& bk_Unit){ if(m_axisCol.size()<2) return StatusCode::SUCCESS; @@ -940,8 +955,8 @@ StatusCode AxisMergingAlg::SplitOverlapCluster( std::shared_ptr<PandoraPlus::Cal for(int i1d=0; i1d<m_clus2_back.size(); i1d++) aveEn2 += m_clus2_back[i1d]->getEnergy(); aveEn2 = aveEn2/(m_clus2_front.size()+m_clus2_back.size()); - std::shared_ptr<PandoraPlus::Calo1DCluster> m_splitCl1 = std::make_shared<PandoraPlus::Calo1DCluster>(); - std::shared_ptr<PandoraPlus::Calo1DCluster> m_splitCl2 = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_splitCl1 = std::make_shared<Cyber::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_splitCl2 = std::make_shared<Cyber::Calo1DCluster>(); for(int ib=0; ib<m_overlapCl[io]->getBars().size(); ib++){ auto bar1 = m_overlapCl[io]->getBars()[ib]->Clone(); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/ClusterMergingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/ClusterMergingAlg.cpp similarity index 73% rename from Reconstruction/CrystalCaloRec/src/Algorithm/ClusterMergingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/ClusterMergingAlg.cpp index c0dcbf9a9f0edb475b40195f81568e330444682d..1f6295ca0d3bf3c1f89ca42d83d940c3e5aa245a 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/ClusterMergingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/ClusterMergingAlg.cpp @@ -11,12 +11,12 @@ StatusCode ClusterMergingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode ClusterMergingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode ClusterMergingAlg::Initialize( CyberDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode ClusterMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode ClusterMergingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ return StatusCode::SUCCESS; diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/ConeClustering2DAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/ConeClustering2DAlg.cpp similarity index 84% rename from Reconstruction/CrystalCaloRec/src/Algorithm/ConeClustering2DAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/ConeClustering2DAlg.cpp index 4696277c301dd1a4a0aee80970915340aaad678c..05feb26dddbc66cf8deff076d3f19bd00f520bfc 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/ConeClustering2DAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/ConeClustering2DAlg.cpp @@ -19,7 +19,7 @@ StatusCode ConeClustering2DAlg::ReadSettings(Settings& m_settings){ }; -StatusCode ConeClustering2DAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode ConeClustering2DAlg::Initialize( CyberDataCol& m_datacol ){ p_HalfClusterU.clear(); p_HalfClusterV.clear(); @@ -32,15 +32,15 @@ StatusCode ConeClustering2DAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; } -StatusCode ConeClustering2DAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode ConeClustering2DAlg::RunAlgorithm( CyberDataCol& m_datacol ){ if( (p_HalfClusterU.size()+p_HalfClusterV.size())<1 ){ std::cout << "ConeClustering2DAlg: No HalfCluster input"<<std::endl; return StatusCode::SUCCESS; } - std::vector<PandoraPlus::CaloHalfCluster*> tmp_longiClusCol; tmp_longiClusCol.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> > m_orderedLocalMax; + std::vector<Cyber::CaloHalfCluster*> tmp_longiClusCol; tmp_longiClusCol.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*> > m_orderedLocalMax; //cout<<" ConeClustering: Input HalfCluster size "<<p_HalfClusterU.size()<<", "<<p_HalfClusterV.size()<<endl; @@ -113,21 +113,21 @@ StatusCode ConeClustering2DAlg::ClearAlgorithm(){ } -StatusCode ConeClustering2DAlg::LongiConeLinking( std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> >& orderedShower, - std::vector<PandoraPlus::CaloHalfCluster*>& ClusterCol, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& bk_HFclus ) +StatusCode ConeClustering2DAlg::LongiConeLinking( std::map<int, std::vector<const Cyber::Calo1DCluster*> >& orderedShower, + std::vector<Cyber::CaloHalfCluster*>& ClusterCol, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& bk_HFclus ) { if(orderedShower.size()==0) return StatusCode::SUCCESS; - vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_clusCol; m_clusCol.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*>>::iterator iter = orderedShower.begin(); + vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_clusCol; m_clusCol.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*>>::iterator iter = orderedShower.begin(); //In first layer: initial clusters. All showers in the first layer are regarded as cluster seed. //cluster initial direction = R. - std::vector<const PandoraPlus::Calo1DCluster*> ShowersinFirstLayer; ShowersinFirstLayer.clear(); + std::vector<const Cyber::Calo1DCluster*> ShowersinFirstLayer; ShowersinFirstLayer.clear(); ShowersinFirstLayer = iter->second; for(int i=0;i<ShowersinFirstLayer.size(); i++){ if(iter->first < settings.map_floatPars["th_beginLayer"] || iter->first > settings.map_floatPars["th_stopLayer"] ) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_clus = std::make_shared<Cyber::CaloHalfCluster>(); m_clus->addUnit(ShowersinFirstLayer[i]); m_clus->setType(1); m_clusCol.push_back(m_clus); @@ -137,11 +137,11 @@ StatusCode ConeClustering2DAlg::LongiConeLinking( std::map<int, std::vector<con for(iter; iter!=orderedShower.end(); iter++){ if(iter->first < settings.map_floatPars["th_beginLayer"] || iter->first > settings.map_floatPars["th_stopLayer"] ) continue; - std::vector<const PandoraPlus::Calo1DCluster*> ShowersinLayer = iter->second; + std::vector<const Cyber::Calo1DCluster*> ShowersinLayer = iter->second; //cout<<" In Layer "<<iter->first<<": hit size "<<ShowersinLayer.size()<<endl; for(int ic=0; ic<m_clusCol.size(); ic++){ - const PandoraPlus::Calo1DCluster* shower_in_clus = m_clusCol[ic].get()->getCluster().back(); + const Cyber::Calo1DCluster* shower_in_clus = m_clusCol[ic].get()->getCluster().back(); if(!shower_in_clus) continue; for(int is=0; is<ShowersinLayer.size(); is++){ TVector2 relR = GetProjectedRelR(shower_in_clus, ShowersinLayer[is]); //Return vec: 1->2. @@ -160,7 +160,7 @@ StatusCode ConeClustering2DAlg::LongiConeLinking( std::map<int, std::vector<con if(ShowersinLayer.size()>0){ for(int i=0;i<ShowersinLayer.size(); i++){ - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_clus = std::make_shared<Cyber::CaloHalfCluster>(); m_clus->addUnit(ShowersinLayer[i]); m_clus->setType(1); m_clusCol.push_back(m_clus); @@ -178,7 +178,7 @@ StatusCode ConeClustering2DAlg::LongiConeLinking( std::map<int, std::vector<con -TVector2 ConeClustering2DAlg::GetProjectedAxis( const PandoraPlus::CaloHalfCluster* m_shower ){ +TVector2 ConeClustering2DAlg::GetProjectedAxis( const Cyber::CaloHalfCluster* m_shower ){ TVector2 axis(0., 0.); TVector3 m_axis = m_shower->getAxis(); if( m_shower->getSlayer()==1 ) axis.Set(m_axis.x(), m_axis.y()); //For V-bars: (x, y) @@ -188,14 +188,14 @@ TVector2 ConeClustering2DAlg::GetProjectedAxis( const PandoraPlus::CaloHalfClust return axis; } -TVector2 ConeClustering2DAlg::GetProjectedRelR( const PandoraPlus::Calo1DCluster* m_shower1, const PandoraPlus::Calo1DCluster* m_shower2 ){ +TVector2 ConeClustering2DAlg::GetProjectedRelR( const Cyber::Calo1DCluster* m_shower1, const Cyber::Calo1DCluster* m_shower2 ){ TVector2 paxis1, paxis2; if(m_shower1->getSlayer()==1){ //For V-bars paxis1.Set(m_shower1->getPos().x(), m_shower1->getPos().y()); paxis2.Set(m_shower2->getPos().x(), m_shower2->getPos().y()); } else{ - float rotAngle = -m_shower1->getTowerID()[0][0]*TMath::TwoPi()/PandoraPlus::CaloUnit::Nmodule; + float rotAngle = -m_shower1->getTowerID()[0][0]*TMath::TwoPi()/Cyber::CaloUnit::Nmodule; TVector3 raw_pos1 = m_shower1->getPos(); TVector3 raw_pos2 = m_shower2->getPos(); raw_pos1.RotateZ(rotAngle); raw_pos2.RotateZ(rotAngle); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/ConeClusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/ConeClusteringAlg.cpp similarity index 81% rename from Reconstruction/CrystalCaloRec/src/Algorithm/ConeClusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/ConeClusteringAlg.cpp index 95d6f440291a1d540452cfec9d99f6133c01c483..c60300f5694ce5ee11dcc5decbf4d07be618e1f6 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/ConeClusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/ConeClusteringAlg.cpp @@ -29,26 +29,26 @@ StatusCode ConeClusteringAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode ConeClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode ConeClusteringAlg::Initialize( CyberDataCol& m_datacol ){ return StatusCode::SUCCESS; } -StatusCode ConeClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol){ +StatusCode ConeClusteringAlg::RunAlgorithm( CyberDataCol& m_datacol){ - std::vector<std::shared_ptr<PandoraPlus::CaloHit>> m_hitCol; m_hitCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHit>> m_hitCol; m_hitCol.clear(); //Get readin info if(settings.map_stringPars["ReadinHit"] == "EcalTransShower"){ - std::vector<std::shared_ptr<PandoraPlus::Calo2DCluster>>* p_Tshowers = &(m_datacol.map_2DCluster["EcalShowerInLayer"]); + std::vector<std::shared_ptr<Cyber::Calo2DCluster>>* p_Tshowers = &(m_datacol.map_2DCluster["EcalShowerInLayer"]); if(p_Tshowers->size()==0){ std::cout<<"Warning: Empty input in ConeClusteringAlg. Please check previous algorithm!"<<endl; return StatusCode::SUCCESS; } //Convert transShower to hit for(int is=0; is<p_Tshowers->size(); is++){ - std::shared_ptr<PandoraPlus::CaloHit> m_hit = std::make_shared<PandoraPlus::CaloHit>(); + std::shared_ptr<Cyber::CaloHit> m_hit = std::make_shared<Cyber::CaloHit>(); m_hit->setEnergy( p_Tshowers->at(is)->getEnergy() ); m_hit->setPosition( p_Tshowers->at(is)->getPos() ); m_hit->setLayer( p_Tshowers->at(is)->getDlayer() ); @@ -71,13 +71,13 @@ cout<<"ConeClustering: End Print"<<endl; */ //Store the ordered hits. - std::map<int, std::vector<const PandoraPlus::CaloHit*> > m_orderedHit; m_orderedHit.clear(); //map<layer, showers> + std::map<int, std::vector<const Cyber::CaloHit*> > m_orderedHit; m_orderedHit.clear(); //map<layer, showers> for(int ih=0;ih<m_hitCol.size();ih++) m_orderedHit[m_hitCol[ih]->getLayer()].push_back(m_hitCol[ih].get()); //Longitudinal linking - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_clusterCol; m_clusterCol.clear(); + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_clusterCol; m_clusterCol.clear(); LongiConeLinking( m_orderedHit, m_clusterCol ); for(int icl=0; icl<m_clusterCol.size(); icl++) m_clusterCol[icl]->getLinkedMCPfromHit(); m_datacol.map_CaloCluster["bk3DCluster"].insert( m_datacol.map_CaloCluster["bk3DCluster"].end(), m_clusterCol.begin(), m_clusterCol.end() ); @@ -87,8 +87,8 @@ cout<<" Cluster size: "<<m_clusterCol.size()<<endl; //Check cluster quality. /* - std::vector<PandoraPlus::Calo3DCluster*> goodClus; - std::vector<PandoraPlus::Calo3DCluster*> badClus; + std::vector<Cyber::Calo3DCluster*> goodClus; + std::vector<Cyber::Calo3DCluster*> badClus; for(int icl=0; icl<m_clusterCol.size(); icl++){ if( m_clusterCol[icl]->getCaloHits().size() >= settings.map_floatPars["fl_GoodClusLevel"]) goodClus.push_back(m_clusterCol[icl]); else badClus.push_back(m_clusterCol[icl]); @@ -117,8 +117,8 @@ StatusCode ConeClusteringAlg::ClearAlgorithm(){ return StatusCode::SUCCESS; } -StatusCode ConeClusteringAlg::LongiConeLinking( const std::map<int, std::vector<const PandoraPlus::CaloHit*> >& orderedHit, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& ClusterCol) +StatusCode ConeClusteringAlg::LongiConeLinking( const std::map<int, std::vector<const Cyber::CaloHit*> >& orderedHit, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& ClusterCol) { if(orderedHit.size()==0) return StatusCode::SUCCESS; @@ -126,9 +126,9 @@ StatusCode ConeClusteringAlg::LongiConeLinking( const std::map<int, std::vector auto iter = orderedHit.begin(); //In first layer: initial clusters. All showers in the first layer are regarded as cluster seed. //cluster initial direction = R. - std::vector<const PandoraPlus::CaloHit*> HitsinFirstLayer = iter->second; + std::vector<const Cyber::CaloHit*> HitsinFirstLayer = iter->second; for(int i=0;i<HitsinFirstLayer.size(); i++){ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->addHit(HitsinFirstLayer[i]); ClusterCol.push_back(m_clus); } @@ -139,17 +139,17 @@ StatusCode ConeClusteringAlg::LongiConeLinking( const std::map<int, std::vector //Use different cone angle for 1->2/2->3 and 3->n case //Loop later layers for(iter; iter!=orderedHit.end(); iter++){ - std::vector<const PandoraPlus::CaloHit*> HitsinLayer = iter->second; + std::vector<const Cyber::CaloHit*> HitsinLayer = iter->second; //cout<<" In Layer: "<<iter->first<<" Hit size: "<<HitsinLayer.size()<<endl; for(int is=0; is<HitsinLayer.size(); is++){ - const PandoraPlus::CaloHit* m_hit = HitsinLayer[is]; + const Cyber::CaloHit* m_hit = HitsinLayer[is]; //printf(" New Hit: (%.3f, %.3f, %.3f), Layer %d \n", m_hit->getPosition().x(), m_hit->getPosition().y(), m_hit->getPosition().z(), m_hit->getLayer() ); //cout<<" Cluster size: "<<ClusterCol.size()<<endl; for(int ic=0; ic<ClusterCol.size(); ic++ ){ int m_Nhits = ClusterCol[ic]->getCaloHits().size(); - const PandoraPlus::CaloHit* hit_in_clus = ClusterCol[ic]->getCaloHits().back(); + const Cyber::CaloHit* hit_in_clus = ClusterCol[ic]->getCaloHits().back(); TVector3 relR_vec = m_hit->getPosition() - hit_in_clus->getPosition(); //printf(" New hit: (%.2f, %.2f, %.2f), Cluster last: (%.2f, %.2f, %.2f, %d), Cluster axis: (%.2f, %.2f, %.2f) \n", // m_hit->getPosition().x(), m_hit->getPosition().y(),m_hit->getPosition().z(), @@ -168,7 +168,7 @@ StatusCode ConeClusteringAlg::LongiConeLinking( const std::map<int, std::vector }//end loop showers in layer. if(HitsinLayer.size()>0){ for(int i=0;i<HitsinLayer.size(); i++){ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->addHit(HitsinLayer[i]); ClusterCol.push_back(m_clus); }}//end new cluster @@ -179,13 +179,13 @@ StatusCode ConeClusteringAlg::LongiConeLinking( const std::map<int, std::vector } /* -StatusCode ConeClusteringAlg::MergeGoodClusters( std::vector<PandoraPlus::Calo3DCluster*>& m_clusCol ){ +StatusCode ConeClusteringAlg::MergeGoodClusters( std::vector<Cyber::Calo3DCluster*>& m_clusCol ){ return StatusCode::SUCCESS; } -StatusCode ConeClusteringAlg::MergeBadToGoodCluster( std::vector<PandoraPlus::Calo3DCluster*>& m_goodClusCol, PandoraPlus::Calo3DCluster* m_badClus ){ - PandoraPlus::Calo3DCluster* m_clus = GetClosestGoodCluster( m_goodClusCol, m_badClus ); +StatusCode ConeClusteringAlg::MergeBadToGoodCluster( std::vector<Cyber::Calo3DCluster*>& m_goodClusCol, Cyber::Calo3DCluster* m_badClus ){ + Cyber::Calo3DCluster* m_clus = GetClosestGoodCluster( m_goodClusCol, m_badClus ); if(!m_clus) return StatusCode::FAILURE; auto iter = find( m_goodClusCol.begin(), m_goodClusCol.end(), m_clus ); @@ -197,10 +197,10 @@ StatusCode ConeClusteringAlg::MergeBadToGoodCluster( std::vector<PandoraPlus::Ca -PandoraPlus::Calo3DCluster* ConeClusteringAlg::GetClosestGoodCluster( std::vector< PandoraPlus::Calo3DCluster* >& m_goodClusCol, PandoraPlus::Calo3DCluster* m_badClus ){ +Cyber::Calo3DCluster* ConeClusteringAlg::GetClosestGoodCluster( std::vector< Cyber::Calo3DCluster* >& m_goodClusCol, Cyber::Calo3DCluster* m_badClus ){ TVector3 m_clusCent = m_badClus->getShowerCenter(); - PandoraPlus::Calo3DCluster* m_clus = nullptr; + Cyber::Calo3DCluster* m_clus = nullptr; double minTheta=999; for(int i=0;i<m_goodClusCol.size();i++){ TVector3 vec_goodClus = m_goodClusCol[i]->getShowerCenter(); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/EnergySplittingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/EnergySplittingAlg.cpp similarity index 90% rename from Reconstruction/CrystalCaloRec/src/Algorithm/EnergySplittingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/EnergySplittingAlg.cpp index 58f00c70e8a620a32bfd69498abf838f298c990b..3708f8e910652eaebce03bdc6481e85a240fc072 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/EnergySplittingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/EnergySplittingAlg.cpp @@ -21,7 +21,7 @@ StatusCode EnergySplittingAlg::ReadSettings(Settings& m_settings){ }; -StatusCode EnergySplittingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode EnergySplittingAlg::Initialize( CyberDataCol& m_datacol ){ m_axisUCol.clear(); m_axisVCol.clear(); m_newClusUCol.clear(); @@ -48,7 +48,7 @@ StatusCode EnergySplittingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ } -StatusCode EnergySplittingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode EnergySplittingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //Input: HalfCluster (with 1D clusters and HoughAxis) //Output: Create Towers for the matching. @@ -59,7 +59,7 @@ StatusCode EnergySplittingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; } m_towerCol.clear(); - std::vector<PandoraPlus::CaloHalfCluster*> tmp_newClusUCol, tmp_newClusVCol; + std::vector<Cyber::CaloHalfCluster*> tmp_newClusUCol, tmp_newClusVCol; HalfClusterToTowers( tmp_newClusUCol, tmp_newClusVCol, p_emptyHalfClusterU, p_emptyHalfClusterV, m_towerCol ); m_datacol.map_CaloCluster[settings.map_stringPars["OutputTowerName"]] = m_towerCol; @@ -121,9 +121,9 @@ cout<<"Empty half cluster energy "<<tmp_totE_U<<", "<<tmp_totE_V<<endl; // Loop for 1DClusters. m_1dShowerUCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> m_1dclusCol = p_HalfClusterU[ih]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> m_1dclusCol = p_HalfClusterU[ih]->getCluster(); for(int icl=0; icl<m_1dclusCol.size(); icl++){ - std::vector<const PandoraPlus::CaloUnit*> m_bars = m_1dclusCol[icl]->getBars(); + std::vector<const Cyber::CaloUnit*> m_bars = m_1dclusCol[icl]->getBars(); //Find the seed with axis in 1DCluster: for(auto iaxis: m_axisUCol){ @@ -140,14 +140,14 @@ cout<<"Empty half cluster energy "<<tmp_totE_U<<", "<<tmp_totE_V<<endl; if(findSeed) break; if(m_bars[ib]->getcellID()==iseed->getBars()[0]->getcellID()) {findSeed=true; break; } } - if(findSeed) const_cast<PandoraPlus::Calo1DCluster*>(m_1dclusCol[icl])->addSeed( iseed->getBars()[0] ); + if(findSeed) const_cast<Cyber::Calo1DCluster*>(m_1dclusCol[icl])->addSeed( iseed->getBars()[0] ); } } - //if(m_1dclusCol[icl]->getNseeds()==0) const_cast<PandoraPlus::Calo1DCluster*>(m_1dclusCol[icl])->setSeed(); + //if(m_1dclusCol[icl]->getNseeds()==0) const_cast<Cyber::Calo1DCluster*>(m_1dclusCol[icl])->setSeed(); //Split cluster to showers - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> tmp_showers; tmp_showers.clear(); + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> tmp_showers; tmp_showers.clear(); ClusterSplitting( m_1dclusCol[icl], tmp_showers ); //if(tmp_showers.size()==0) continue; m_1dShowerUCol.insert( m_1dShowerUCol.end(), tmp_showers.begin(), tmp_showers.end() ); @@ -177,7 +177,7 @@ cout<<"Empty half cluster energy "<<tmp_totE_U<<", "<<tmp_totE_V<<endl; //cout<<" HalfClusterU #"<<ih<<": total En after shower cleaning "<<tmp_En<<endl; // Longitudinal linking: update clusters' energy. - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> tmp_newClus; tmp_newClus.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> tmp_newClus; tmp_newClus.clear(); LongitudinalLinking(m_1dShowerUCol, m_axisUCol, tmp_newClus); m_newClusUCol.insert(m_newClusUCol.end(), tmp_newClus.begin(), tmp_newClus.end()); @@ -196,11 +196,11 @@ cout<<"Empty half cluster energy "<<tmp_totE_U<<", "<<tmp_totE_V<<endl; else m_axisVCol = p_HalfClusterV[ih]->getHalfClusterCol(settings.map_stringPars["ReadinAxisName"]); m_1dShowerVCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> m_1dclusCol = p_HalfClusterV[ih]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> m_1dclusCol = p_HalfClusterV[ih]->getCluster(); //cout<<"1D Cluster size: "<<m_1dclusCol.size()<<", axis size: "<<m_axisVCol.size()<<endl; for(int icl=0; icl<m_1dclusCol.size(); icl++){ - std::vector<const PandoraPlus::CaloUnit*> m_bars = m_1dclusCol[icl]->getBars(); + std::vector<const Cyber::CaloUnit*> m_bars = m_1dclusCol[icl]->getBars(); //cout<<" In 1DCluster #"<<icl<<": layer = "<<m_1dclusCol[icl]->getDlayer(); //Find the seed with axis in 1DCluster: @@ -211,14 +211,14 @@ cout<<"Empty half cluster energy "<<tmp_totE_U<<", "<<tmp_totE_V<<endl; continue; } if(find( m_bars.begin(), m_bars.end(), iseed->getBars()[0]) != m_bars.end()) - const_cast<PandoraPlus::Calo1DCluster*>(m_1dclusCol[icl])->addSeed( iseed->getBars()[0] ); + const_cast<Cyber::Calo1DCluster*>(m_1dclusCol[icl])->addSeed( iseed->getBars()[0] ); } } //cout<<", matched seed size "<<m_1dclusCol[icl]->getNseeds()<<endl; - //if(m_1dclusCol[icl]->getNseeds()==0) const_cast<PandoraPlus::Calo1DCluster*>(m_1dclusCol[icl])->setSeed(); + //if(m_1dclusCol[icl]->getNseeds()==0) const_cast<Cyber::Calo1DCluster*>(m_1dclusCol[icl])->setSeed(); //Split cluster to showers - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> tmp_showers; tmp_showers.clear(); + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> tmp_showers; tmp_showers.clear(); ClusterSplitting( m_1dclusCol[icl], tmp_showers ); //cout<<" In 1DCluster #"<<icl<<": splitted into "<<tmp_showers.size ()<<" showers: "; //for(int is=0; is<tmp_showers.size(); is++){ @@ -342,7 +342,7 @@ cout<<endl; //Make tower m_towerCol.clear(); - std::vector<PandoraPlus::CaloHalfCluster*> tmp_newClusUCol, tmp_newClusVCol; + std::vector<Cyber::CaloHalfCluster*> tmp_newClusUCol, tmp_newClusVCol; tmp_newClusUCol.clear(); tmp_newClusVCol.clear(); for(int icl=0; icl<m_newClusUCol.size(); icl++) tmp_newClusUCol.push_back( m_newClusUCol[icl].get() ); for(int icl=0; icl<m_newClusVCol.size(); icl++) tmp_newClusVCol.push_back( m_newClusVCol[icl].get() ); @@ -379,9 +379,9 @@ StatusCode EnergySplittingAlg::ClearAlgorithm(){ } -StatusCode EnergySplittingAlg::LongitudinalLinking( std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& m_showers, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_oldClusCol, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_newClusCol ) +StatusCode EnergySplittingAlg::LongitudinalLinking( std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& m_showers, + std::vector<const Cyber::CaloHalfCluster*>& m_oldClusCol, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_newClusCol ) { if(m_showers.size()==0 || m_oldClusCol.size()==0) return StatusCode::SUCCESS; @@ -397,12 +397,12 @@ StatusCode EnergySplittingAlg::LongitudinalLinking( std::vector<std::shared_ptr< //Update old Hough clusters for(int ic=0; ic<m_oldClusCol.size(); ic++){ - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newClus = std::make_shared<Cyber::CaloHalfCluster>(); for(int is=0; is<m_oldClusCol[ic]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* m_shower = m_oldClusCol[ic]->getCluster()[is]; + const Cyber::Calo1DCluster* m_shower = m_oldClusCol[ic]->getCluster()[is]; - const PandoraPlus::Calo1DCluster* m_selshower = NULL; + const Cyber::Calo1DCluster* m_selshower = NULL; bool fl_foundshower = false; for(int js=0; js<m_showers.size(); js++){ bool fl_inTower = false; @@ -442,7 +442,7 @@ for(int ih=0; ih<m_newClusCol.size(); ih++){ } */ - std::vector<const PandoraPlus::Calo1DCluster*> m_leftshowers; m_leftshowers.clear(); + std::vector<const Cyber::Calo1DCluster*> m_leftshowers; m_leftshowers.clear(); for(int ish=0; ish<m_showers.size(); ish++){ bool fl_inclus = false; for(int icl=0; icl<m_newClusCol.size(); icl++){ @@ -493,23 +493,23 @@ for(int ih=0; ih<m_newClusCol.size(); ih++){ } -StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::CaloHalfCluster*>& m_halfClusU, - std::vector<PandoraPlus::CaloHalfCluster*>& m_halfClusV, - std::vector<PandoraPlus::CaloHalfCluster*>& m_emptyClusU, - std::vector<PandoraPlus::CaloHalfCluster*>& m_emptyClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ) +StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<Cyber::CaloHalfCluster*>& m_halfClusU, + std::vector<Cyber::CaloHalfCluster*>& m_halfClusV, + std::vector<Cyber::CaloHalfCluster*>& m_emptyClusU, + std::vector<Cyber::CaloHalfCluster*>& m_emptyClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ) { //cout<<" HalfClusterToTowers: Input halfcluster size "<<m_halfClusU.size()<<", "<<m_halfClusV.size()<<endl; //cout<<" Input empty cluster size "<<m_emptyClusU.size()<<", "<<m_emptyClusV.size()<<endl; m_towers.clear(); - std::map<std::vector<int>, std::vector<const PandoraPlus::Calo2DCluster*> > map_2DCluster; - std::map<std::vector<int>, std::vector<PandoraPlus::CaloHalfCluster*> > map_HalfClusterU; - std::map<std::vector<int>, std::vector<PandoraPlus::CaloHalfCluster*> > map_HalfClusterV; + std::map<std::vector<int>, std::vector<const Cyber::Calo2DCluster*> > map_2DCluster; + std::map<std::vector<int>, std::vector<Cyber::CaloHalfCluster*> > map_HalfClusterU; + std::map<std::vector<int>, std::vector<Cyber::CaloHalfCluster*> > map_HalfClusterV; - std::map<std::vector<int>, std::vector<PandoraPlus::CaloHalfCluster*> > map_emptyHalfClusterU; - std::map<std::vector<int>, std::vector<PandoraPlus::CaloHalfCluster*> > map_emptyHalfClusterV; + std::map<std::vector<int>, std::vector<Cyber::CaloHalfCluster*> > map_emptyHalfClusterU; + std::map<std::vector<int>, std::vector<Cyber::CaloHalfCluster*> > map_emptyHalfClusterV; //Assign the empty clusters into tower for(int il=0; il<m_emptyClusU.size(); il++){ @@ -535,11 +535,11 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal } //CaloHalfCluster covers towers: Loop check showers. - std::map<std::vector<int>, PandoraPlus::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); + std::map<std::vector<int>, Cyber::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); for(int is=0; is<m_halfClusU[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; - std::map<std::vector<int>, PandoraPlus::Calo1DCluster* > tmp_1DClusMaps; tmp_1DClusMaps.clear(); + std::map<std::vector<int>, Cyber::Calo1DCluster* > tmp_1DClusMaps; tmp_1DClusMaps.clear(); for(int ib=0; ib<p_shower->getBars().size(); ib++){ std::vector<int> towerID(2); towerID[0] = p_shower->getBars()[ib]->getModule(); @@ -550,7 +550,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal tmp_1DClusMaps[towerID]->setIDInfo(); } else{ - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_clus = std::make_shared<Cyber::Calo1DCluster>(); tmp_clus->addUnit( p_shower->getBars()[ib] ); tmp_clus->setIDInfo(); tmp_1DClusMaps[towerID] = tmp_clus.get(); @@ -577,7 +577,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal tmp_LongiClusMaps[towerID]->setTowerID( towerID ); } else{ - std::shared_ptr<PandoraPlus::CaloHalfCluster> tmp_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> tmp_clus = std::make_shared<Cyber::CaloHalfCluster>(); tmp_clus->addUnit( iter.second ); tmp_clus->setTowerID( towerID ); tmp_LongiClusMaps[towerID] = tmp_clus.get(); @@ -634,11 +634,11 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal } //CaloHalfCluster covers towers: Loop check showers. - std::map<std::vector<int>, PandoraPlus::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); + std::map<std::vector<int>, Cyber::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); for(int is=0; is<m_halfClusV[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; - std::map<std::vector<int>, PandoraPlus::Calo1DCluster* > tmp_1DClusMaps; tmp_1DClusMaps.clear(); + std::map<std::vector<int>, Cyber::Calo1DCluster* > tmp_1DClusMaps; tmp_1DClusMaps.clear(); for(int ib=0; ib<p_shower->getBars().size(); ib++){ std::vector<int> towerID(2); towerID[0] = p_shower->getBars()[ib]->getModule(); @@ -649,7 +649,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal tmp_1DClusMaps[towerID]->setIDInfo(); } else{ - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_clus = std::make_shared<Cyber::Calo1DCluster>(); tmp_clus->addUnit( p_shower->getBars()[ib] ); tmp_clus->setIDInfo(); tmp_1DClusMaps[towerID] = tmp_clus.get(); @@ -676,7 +676,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal tmp_LongiClusMaps[towerID]->setTowerID( towerID ); } else{ - std::shared_ptr<PandoraPlus::CaloHalfCluster> tmp_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> tmp_clus = std::make_shared<Cyber::CaloHalfCluster>(); tmp_clus->addUnit( iter.second ); tmp_clus->setTowerID( towerID ); tmp_LongiClusMaps[towerID] = tmp_clus.get(); @@ -726,12 +726,12 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal continue; } - std::vector<PandoraPlus::CaloHalfCluster*> p_halfClusU = iterU.second; - std::vector<PandoraPlus::CaloHalfCluster*> p_halfClusV = map_HalfClusterV[iterU.first]; + std::vector<Cyber::CaloHalfCluster*> p_halfClusU = iterU.second; + std::vector<Cyber::CaloHalfCluster*> p_halfClusV = map_HalfClusterV[iterU.first]; //Get ordered showers for looping in layers. - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*>> m_orderedShowerU; m_orderedShowerU.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*>> m_orderedShowerV; m_orderedShowerV.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*>> m_orderedShowerU; m_orderedShowerU.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*>> m_orderedShowerV; m_orderedShowerV.clear(); for(int ic=0; ic<p_halfClusU.size(); ic++){ for(int is=0; is<p_halfClusU.at(ic)->getCluster().size(); is++) @@ -745,10 +745,10 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal //Create super-layers (block) - std::vector<const PandoraPlus::Calo2DCluster*> m_blocks; m_blocks.clear(); + std::vector<const Cyber::Calo2DCluster*> m_blocks; m_blocks.clear(); for(auto &iter1 : m_orderedShowerU){ if( m_orderedShowerV.find( iter1.first )==m_orderedShowerV.end() ) continue; - std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_block = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> tmp_block = std::make_shared<Cyber::Calo2DCluster>(); for(int is=0; is<iter1.second.size(); is++) tmp_block->addUnit( iter1.second.at(is) ); for(int is=0; is<m_orderedShowerV[iter1.first].size(); is++) tmp_block->addUnit( m_orderedShowerV[iter1.first].at(is) ); tmp_block->setTowerID( iterU.first ); @@ -768,7 +768,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal std::vector<int> m_towerID = iter.first; //printf(" In tower: [%d, %d, %d] \n", m_towerID[0], m_towerID[1], m_towerID[2]); //Check cousin clusters: - std::vector<PandoraPlus::CaloHalfCluster*> m_HFClusUInTower = map_HalfClusterU[m_towerID]; + std::vector<Cyber::CaloHalfCluster*> m_HFClusUInTower = map_HalfClusterU[m_towerID]; for(auto &m_HFclus : m_HFClusUInTower){ std::vector<const CaloHalfCluster*> tmp_delClus; tmp_delClus.clear(); for(int ics=0; ics<m_HFclus->getHalfClusterCol("CousinCluster").size(); ics++){ @@ -780,7 +780,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal for(int ics=0; ics<tmp_delClus.size(); ics++) m_HFclus->deleteCousinCluster( tmp_delClus[ics] ); } - std::vector<PandoraPlus::CaloHalfCluster*> m_HFClusVInTower = map_HalfClusterV[m_towerID]; + std::vector<Cyber::CaloHalfCluster*> m_HFClusVInTower = map_HalfClusterV[m_towerID]; for(auto &m_HFclus : m_HFClusVInTower){ std::vector<const CaloHalfCluster*> tmp_delClus; tmp_delClus.clear(); for(int ics=0; ics<m_HFclus->getHalfClusterCol("CousinCluster").size(); ics++){ @@ -792,8 +792,8 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal for(int ics=0; ics<tmp_delClus.size(); ics++) m_HFclus->deleteCousinCluster( tmp_delClus[ics] ); } - std::vector<const PandoraPlus::CaloHalfCluster*> const_emptyClusU; const_emptyClusU.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> const_emptyClusV; const_emptyClusV.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_emptyClusU; const_emptyClusU.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_emptyClusV; const_emptyClusV.clear(); if(map_emptyHalfClusterU.find(m_towerID)!=map_emptyHalfClusterU.end()){ for(int icl=0; icl<map_emptyHalfClusterU[m_towerID].size(); icl++){ map_emptyHalfClusterU[m_towerID][icl]->getLinkedMCPfromUnit(); @@ -811,12 +811,12 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal //cout<<" Found empty half cluster size: "<<const_emptyClusU.size()<<", "<<const_emptyClusV.size()<<endl; //Convert to const - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); for(int ics=0; ics<m_HFClusUInTower.size(); ics++){ m_HFClusUInTower[ics]->getLinkedMCPfromUnit(); const_HFClusU.push_back(m_HFClusUInTower[ics]); } for(int ics=0; ics<m_HFClusVInTower.size(); ics++){ m_HFClusVInTower[ics]->getLinkedMCPfromUnit(); const_HFClusV.push_back(m_HFClusVInTower[ics]); } - std::shared_ptr<PandoraPlus::Calo3DCluster> m_tower = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_tower = std::make_shared<Cyber::Calo3DCluster>(); //printf(" Creating tower: [%d, %d, %d] \n", m_towerID[0], m_towerID[1], m_towerID[2]); m_tower->addTowerID( m_towerID ); for(int i2d=0; i2d<map_2DCluster[m_towerID].size(); i2d++) m_tower->addUnit(map_2DCluster[m_towerID][i2d]); @@ -837,8 +837,8 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal continue; } - std::vector<const PandoraPlus::CaloHalfCluster*> const_emptyClusU; const_emptyClusU.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> const_emptyClusV; const_emptyClusV.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_emptyClusU; const_emptyClusU.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_emptyClusV; const_emptyClusV.clear(); for(int icl=0; icl<map_emptyHalfClusterU[m_towerID].size(); icl++){ map_emptyHalfClusterU[m_towerID][icl]->getLinkedMCPfromUnit(); const_emptyClusU.push_back(map_emptyHalfClusterU[m_towerID][icl]); @@ -850,7 +850,7 @@ StatusCode EnergySplittingAlg::HalfClusterToTowers( std::vector<PandoraPlus::Cal } //map_emptyHalfClusterV.erase(m_towerID); - std::shared_ptr<PandoraPlus::Calo3DCluster> m_tower = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_tower = std::make_shared<Cyber::Calo3DCluster>(); m_tower->addTowerID( m_towerID ); m_tower->setHalfClusters( "emptyHalfClusterU", const_emptyClusU, "emptyHalfClusterV", const_emptyClusV ); @@ -909,7 +909,7 @@ cout<<endl; } -StatusCode EnergySplittingAlg::ClusterSplitting(const PandoraPlus::Calo1DCluster* m_cluster, std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& outshCol ){ +StatusCode EnergySplittingAlg::ClusterSplitting(const Cyber::Calo1DCluster* m_cluster, std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& outshCol ){ //cout<<"ClusterSplitting: input cluster seed size = "<<m_cluster->getSeeds().size()<<endl; //cout<<"ClusterSplitting: input bar size = "<<m_cluster->getBars().size()<<endl; @@ -943,7 +943,7 @@ StatusCode EnergySplittingAlg::ClusterSplitting(const PandoraPlus::Calo1DCluster //Separated bars: else if( m_cluster->getNseeds()>=m_cluster->getBars().size() ){ for(int ish=0; ish<m_cluster->getNseeds(); ish++){ - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->addUnit(m_cluster->getSeeds()[ish]); shower->addSeed(m_cluster->getSeeds()[ish]); shower->setIDInfo(); @@ -1034,7 +1034,7 @@ StatusCode EnergySplittingAlg::ClusterSplitting(const PandoraPlus::Calo1DCluster //for(int is=0;is<Nshower;is++) SeedPos[is] = m_cluster->getSeeds()[is]->getPosition(); for(int is=0;is<Nshower;is++){ //cout<<" In shower #"<<is<<endl; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); int iseed=-1; int icount=0; double _Emax = -99; @@ -1055,7 +1055,7 @@ StatusCode EnergySplittingAlg::ClusterSplitting(const PandoraPlus::Calo1DCluster if(iseed<0) { std::cout<<"ERROR: Can not find seed(max energy bar) in this shower! Nbars = "<<Nbars<<". Please Check!"<<std::endl; continue; } //if( (Bars[iseed]->getPosition()-SeedPos[is]).Mag()>15 ) { std::cout<<"ERROR: MaxEnergy bar is too far with original seed! Please Check! iSeed = "<<iseed<<std::endl; } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->addSeed(Bars[iseed]); shower->setIDInfo(); @@ -1068,7 +1068,7 @@ StatusCode EnergySplittingAlg::ClusterSplitting(const PandoraPlus::Calo1DCluster } -StatusCode EnergySplittingAlg::SplitOverlapCluster( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_HFClusCol ){ +StatusCode EnergySplittingAlg::SplitOverlapCluster( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_HFClusCol ){ if(m_HFClusCol.size()<2) return StatusCode::SUCCESS; @@ -1121,8 +1121,8 @@ StatusCode EnergySplittingAlg::SplitOverlapCluster( std::vector<std::shared_ptr< for(int i1d=0; i1d<m_clus2_back.size(); i1d++) aveEn2 += m_clus2_back[i1d]->getEnergy(); aveEn2 = aveEn2/(m_clus2_front.size()+m_clus2_back.size()); - std::shared_ptr<PandoraPlus::Calo1DCluster> m_splitCl1 = std::make_shared<PandoraPlus::Calo1DCluster>(); - std::shared_ptr<PandoraPlus::Calo1DCluster> m_splitCl2 = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_splitCl1 = std::make_shared<Cyber::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_splitCl2 = std::make_shared<Cyber::Calo1DCluster>(); for(int ib=0; ib<m_overlapCl[io]->getBars().size(); ib++){ auto bar1 = m_overlapCl[io]->getBars()[ib]->Clone(); @@ -1163,7 +1163,7 @@ StatusCode EnergySplittingAlg::SplitOverlapCluster( std::vector<std::shared_ptr< } -StatusCode EnergySplittingAlg::MergeToClosestCluster( PandoraPlus::Calo1DCluster* iclus, std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& clusvec ){ +StatusCode EnergySplittingAlg::MergeToClosestCluster( Cyber::Calo1DCluster* iclus, std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& clusvec ){ int cLedge = iclus->getLeftEdge(); int cRedge = iclus->getRightEdge(); @@ -1200,8 +1200,8 @@ StatusCode EnergySplittingAlg::MergeToClosestCluster( PandoraPlus::Calo1DCluster } -StatusCode EnergySplittingAlg::MergeToClosestCluster( const PandoraPlus::Calo1DCluster* m_shower, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_clusters ) +StatusCode EnergySplittingAlg::MergeToClosestCluster( const Cyber::Calo1DCluster* m_shower, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_clusters ) { if(m_clusters.size()==0) return StatusCode::SUCCESS; @@ -1246,7 +1246,7 @@ StatusCode EnergySplittingAlg::MergeToClosestCluster( const PandoraPlus::Calo1DC } -void EnergySplittingAlg::CalculateInitialEseed( const std::vector<const PandoraPlus::CaloUnit*>& Seeds, const TVector3* pos, double* Eseed){ +void EnergySplittingAlg::CalculateInitialEseed( const std::vector<const Cyber::CaloUnit*>& Seeds, const TVector3* pos, double* Eseed){ //Calculate Eseed by solving a linear function: // [ f(11) .. f(1mu) .. ] [E_seed 1 ] [E_bar 1] // [ .. .. .. .. ] * [... ] = [... ] diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/EnergyTimeMatchingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/EnergyTimeMatchingAlg.cpp similarity index 86% rename from Reconstruction/CrystalCaloRec/src/Algorithm/EnergyTimeMatchingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/EnergyTimeMatchingAlg.cpp index 2bfc0c2a783c30c23b408ed5c1283416f48f4e4a..f08cb99f5418b67adf3c1f67e00ae90a678b6f5d 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/EnergyTimeMatchingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/EnergyTimeMatchingAlg.cpp @@ -27,7 +27,7 @@ StatusCode EnergyTimeMatchingAlg::ReadSettings(Settings& m_settings){ }; -StatusCode EnergyTimeMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode EnergyTimeMatchingAlg::Initialize( CyberDataCol& m_datacol ){ m_HFClusUCol.clear(); m_HFClusVCol.clear(); m_clusterCol.clear(); @@ -43,12 +43,12 @@ StatusCode EnergyTimeMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ }; -StatusCode EnergyTimeMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode EnergyTimeMatchingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ m_clusterCol.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> m_leftHFClusterUCol; - std::vector<const PandoraPlus::CaloHalfCluster*> m_leftHFClusterVCol; + std::vector<const Cyber::CaloHalfCluster*> m_leftHFClusterUCol; + std::vector<const Cyber::CaloHalfCluster*> m_leftHFClusterVCol; //Loop for towers: for(int it=0; it<m_towerCol.size(); it++){ @@ -105,9 +105,9 @@ StatusCode EnergyTimeMatchingAlg::ClearAlgorithm(){ } -StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusterCol ) +StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusterCol ) { const int NclusU = m_HFClusUCol.size(); @@ -122,11 +122,11 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH //cout<<endl; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> tmp_clusters; tmp_clusters.clear(); + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> tmp_clusters; tmp_clusters.clear(); if(NclusU==0 || NclusV==0) return StatusCode::SUCCESS; else if(NclusU==1 && NclusV==1){ - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(m_HFClusUCol[0], m_HFClusVCol[0], tmp_clus); tmp_clusters.push_back(tmp_clus); } @@ -136,12 +136,12 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH //Split the HalfClusterU into NclusV part for(int icl=0; icl<NclusV; icl++){ - std::shared_ptr<PandoraPlus::CaloHalfCluster> newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> newClus = std::make_shared<Cyber::CaloHalfCluster>(); double frac = m_HFClusVCol[icl]->getEnergy()/sumE_V; for(int ish=0; ish<m_HFClusUCol[0]->getCluster().size(); ish++){ - const PandoraPlus::Calo1DCluster* p_shower = m_HFClusUCol[0]->getCluster()[ish]; + const Cyber::Calo1DCluster* p_shower = m_HFClusUCol[0]->getCluster()[ish]; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); for(int ibar=0; ibar<p_shower->getCluster().size(); ibar++){ auto bar = p_shower->getCluster()[ibar]->Clone(); bar->setQ(bar->getQ1()*frac, bar->getQ2()*frac ); @@ -149,7 +149,7 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH m_bkCol.map_BarCol["bkBar"].push_back(bar); } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->setSeed(); shower->setIDInfo(); @@ -166,7 +166,7 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH m_bkCol.map_HalfCluster["bkHalfCluster"].push_back(newClus); //Match the splitted HalfClusterU and HalfClusterV[icl] - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(newClus.get(), m_HFClusVCol[icl], tmp_clus); tmp_clusters.push_back(tmp_clus); } @@ -178,12 +178,12 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH //Split the HalfClusterV into NclusU part for(int icl=0; icl<NclusU; icl++){ - std::shared_ptr<PandoraPlus::CaloHalfCluster> newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> newClus = std::make_shared<Cyber::CaloHalfCluster>(); double frac = m_HFClusUCol[icl]->getEnergy()/sumE_U; for(int ish=0; ish<m_HFClusVCol[0]->getCluster().size(); ish++){ - const PandoraPlus::Calo1DCluster* p_shower = m_HFClusVCol[0]->getCluster()[ish]; + const Cyber::Calo1DCluster* p_shower = m_HFClusVCol[0]->getCluster()[ish]; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); for(int ibar=0; ibar<p_shower->getCluster().size(); ibar++){ auto bar = p_shower->getCluster()[ibar]->Clone(); bar->setQ(bar->getQ1()*frac, bar->getQ2()*frac ); @@ -191,7 +191,7 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH m_bkCol.map_BarCol["bkBar"].push_back(bar); } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->setSeed(); shower->setIDInfo(); @@ -208,7 +208,7 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH m_bkCol.map_HalfCluster["bkHalfCluster"].push_back(newClus); //Match the splitted HalfClusterU and HalfClusterV[icl] - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(m_HFClusUCol[icl], newClus.get(), tmp_clus); tmp_clusters.push_back(tmp_clus); @@ -467,8 +467,8 @@ StatusCode EnergyTimeMatchingAlg::Matching( std::vector<const PandoraPlus::CaloH } -StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol, +StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol, vector<vector<int>>& matrix ) { @@ -488,15 +488,15 @@ StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const Pa } else{ //Fill the matrix with track info - std::vector<const PandoraPlus::Track*> m_linkedTrk; m_linkedTrk.clear(); + std::vector<const Cyber::Track*> m_linkedTrk; m_linkedTrk.clear(); for(int icl=0; icl<m_HFClusUCol.size(); ++icl){ - std::vector<const PandoraPlus::Track*> tmp_linkedTrk = m_HFClusUCol[icl]->getAssociatedTracks(); + std::vector<const Cyber::Track*> tmp_linkedTrk = m_HFClusUCol[icl]->getAssociatedTracks(); if(tmp_linkedTrk.size()==0) continue; m_linkedTrk.insert(m_linkedTrk.end(), tmp_linkedTrk.begin(), tmp_linkedTrk.end() ); } for(int icl=0; icl<m_HFClusVCol.size(); ++icl){ - std::vector<const PandoraPlus::Track*> tmp_linkedTrk = m_HFClusVCol[icl]->getAssociatedTracks(); + std::vector<const Cyber::Track*> tmp_linkedTrk = m_HFClusVCol[icl]->getAssociatedTracks(); if(tmp_linkedTrk.size()==0) continue; m_linkedTrk.insert(m_linkedTrk.end(), tmp_linkedTrk.begin(), tmp_linkedTrk.end()); } @@ -505,7 +505,7 @@ StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const Pa int indexU = -1; int indexV = -1; for(int icl=0; icl<m_HFClusUCol.size(); ++icl){ - std::vector<const PandoraPlus::Track*> m_linkedTrkU = m_HFClusUCol[icl]->getAssociatedTracks(); + std::vector<const Cyber::Track*> m_linkedTrkU = m_HFClusUCol[icl]->getAssociatedTracks(); if(m_linkedTrkU.size()==0) continue; if(find(m_linkedTrkU.begin(), m_linkedTrkU.end(), m_linkedTrk[itrk])!=m_linkedTrkU.end()){ indexU = icl; @@ -514,7 +514,7 @@ StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const Pa } for(int icl=0; icl<m_HFClusVCol.size(); ++icl){ - std::vector<const PandoraPlus::Track*> m_linkedTrkV = m_HFClusVCol[icl]->getAssociatedTracks(); + std::vector<const Cyber::Track*> m_linkedTrkV = m_HFClusVCol[icl]->getAssociatedTracks(); if(m_linkedTrkV.size()==0) continue; if(find(m_linkedTrkV.begin(), m_linkedTrkV.end(), m_linkedTrk[itrk])!=m_linkedTrkV.end()){ indexV = icl; @@ -531,8 +531,8 @@ StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const Pa for(int jcl=0; jcl<m_HFClusVCol.size(); ++jcl){ if(m_HFClusVCol[jcl]->getHalfClusterCol("CousinCluster").size()==0) continue; - std::vector<const PandoraPlus::CaloHalfCluster*> m_cousinU = m_HFClusUCol[icl]->getHalfClusterCol("CousinCluster"); - std::vector<const PandoraPlus::CaloHalfCluster*> m_cousinV = m_HFClusVCol[jcl]->getHalfClusterCol("CousinCluster"); + std::vector<const Cyber::CaloHalfCluster*> m_cousinU = m_HFClusUCol[icl]->getHalfClusterCol("CousinCluster"); + std::vector<const Cyber::CaloHalfCluster*> m_cousinV = m_HFClusVCol[jcl]->getHalfClusterCol("CousinCluster"); //Make map: <towerID, (E_clU - E_clV)/mean(E_clU, E_clV) > std::map<std::vector<int>, pair<float, float>> map_pairE; map_pairE.clear(); @@ -568,8 +568,8 @@ StatusCode EnergyTimeMatchingAlg::PatternMatrixCalculation( std::vector<const Pa } -StatusCode EnergyTimeMatchingAlg::Chi2MatrixCalculation( std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*> m_HFClusVCol, +StatusCode EnergyTimeMatchingAlg::Chi2MatrixCalculation( std::vector<const Cyber::CaloHalfCluster*> m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*> m_HFClusVCol, vector<vector<double>>& matrix, std::vector< std::pair<int, int> >& chi2order) { @@ -600,10 +600,10 @@ StatusCode EnergyTimeMatchingAlg::Chi2MatrixCalculation( std::vector<const Pando // std::cout << std::endl; //} - int Nlayer = PandoraPlus::CaloUnit::Nlayer; + int Nlayer = Cyber::CaloUnit::Nlayer; for(int il=0; il<Nlayer; il++){ - std::vector<std::vector<const PandoraPlus::Calo1DCluster*>> tmp_showerU(NclusU); - std::vector<std::vector<const PandoraPlus::Calo1DCluster*>> tmp_showerV(NclusV); + std::vector<std::vector<const Cyber::Calo1DCluster*>> tmp_showerU(NclusU); + std::vector<std::vector<const Cyber::Calo1DCluster*>> tmp_showerV(NclusV); for(int icl=0; icl<NclusU; icl++){ for(int jcl=0; jcl<NclusV; jcl++){ tmp_showerU[icl] = m_HFClusUCol[icl]->getClusterInLayer(il+1); @@ -656,8 +656,8 @@ StatusCode EnergyTimeMatchingAlg::Chi2MatrixCalculation( std::vector<const Pando return StatusCode::SUCCESS; } -vector<vector<double>> EnergyTimeMatchingAlg::GetClusterChi2Map( std::vector<std::vector<const PandoraPlus::Calo1DCluster*>>& barShowerUCol, - std::vector<std::vector<const PandoraPlus::Calo1DCluster*>>& barShowerVCol ) +vector<vector<double>> EnergyTimeMatchingAlg::GetClusterChi2Map( std::vector<std::vector<const Cyber::Calo1DCluster*>>& barShowerUCol, + std::vector<std::vector<const Cyber::Calo1DCluster*>>& barShowerVCol ) { @@ -678,7 +678,7 @@ vector<vector<double>> EnergyTimeMatchingAlg::GetClusterChi2Map( std::vector<std TVector3 Ctower(0,0,0); for(int ish=0; ish<barShowerUCol.size(); ish++){ if(barShowerUCol[ish].size()==0) continue; - rotAngle = -(barShowerUCol[ish][0]->getBars())[0]->getModule()*TMath::TwoPi()/PandoraPlus::CaloUnit::Nmodule; + rotAngle = -(barShowerUCol[ish][0]->getBars())[0]->getModule()*TMath::TwoPi()/Cyber::CaloUnit::Nmodule; Ctower.SetX( (barShowerUCol[ish][0]->getBars())[0]->getPosition().x() ); Ctower.SetY( (barShowerUCol[ish][0]->getBars())[0]->getPosition().y() ); } @@ -690,8 +690,8 @@ vector<vector<double>> EnergyTimeMatchingAlg::GetClusterChi2Map( std::vector<std for(int ix=0;ix<NclusU;ix++){ for(int iy=0;iy<NclusV;iy++){ - std::vector<const PandoraPlus::Calo1DCluster*> clusterU = barShowerUCol[ix]; - std::vector<const PandoraPlus::Calo1DCluster*> clusterV = barShowerVCol[iy]; + std::vector<const Cyber::Calo1DCluster*> clusterU = barShowerUCol[ix]; + std::vector<const Cyber::Calo1DCluster*> clusterV = barShowerVCol[iy]; if(clusterU.size()==0){ double totE_V = 0; @@ -712,8 +712,8 @@ vector<vector<double>> EnergyTimeMatchingAlg::GetClusterChi2Map( std::vector<std for(int icx=0; icx<clusterU.size(); icx++){ for(int icy=0; icy<clusterV.size(); icy++){ - const PandoraPlus::Calo1DCluster* showerX = clusterU[icx]; - const PandoraPlus::Calo1DCluster* showerY = clusterV[icy]; + const Cyber::Calo1DCluster* showerX = clusterU[icx]; + const Cyber::Calo1DCluster* showerY = clusterV[icy]; double Ex = showerX->getEnergy(); double Ey = showerY->getEnergy(); @@ -870,9 +870,9 @@ StatusCode EnergyTimeMatchingAlg::leastSquares(const vector<vector<int>>& A, con } StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<double>> Ematrix, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_HFClusUCol, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_HFClusVCol, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusterCol) + std::vector<const Cyber::CaloHalfCluster*>& m_HFClusUCol, + std::vector<const Cyber::CaloHalfCluster*>& m_HFClusVCol, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusterCol) { int NclusU = m_HFClusUCol.size(); @@ -881,7 +881,7 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl std::cout<<"ERROR: Empty readin HalfCluster! "<<NclusU<<", "<<NclusV<<endl; } else if(NclusU==1 && NclusV==1){ - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(m_HFClusUCol[0], m_HFClusVCol[0], tmp_clus); m_clusterCol.push_back(tmp_clus); } @@ -900,13 +900,13 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl double fracU = Ematrix[icl][jcl]/sumE_U[jcl]; if(fracU==0) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> newClusU = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> newClusU = std::make_shared<Cyber::CaloHalfCluster>(); if(fracU==1) newClusU = m_HFClusUCol[jcl]->Clone(); else{ for(int ish=0; ish<m_HFClusUCol[jcl]->getCluster().size(); ish++){ - const PandoraPlus::Calo1DCluster* p_shower = m_HFClusUCol[jcl]->getCluster()[ish]; + const Cyber::Calo1DCluster* p_shower = m_HFClusUCol[jcl]->getCluster()[ish]; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); for(int ibar=0; ibar<p_shower->getCluster().size(); ibar++){ auto bar = p_shower->getCluster()[ibar]->Clone(); bar->setQ(bar->getQ1()*fracU, bar->getQ2()*fracU ); @@ -914,7 +914,7 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl m_bkCol.map_BarCol["bkBar"].push_back(bar); } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->setSeed(); shower->setIDInfo(); @@ -930,15 +930,15 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl newClusU->setType(m_HFClusUCol[jcl]->getType()); } - std::shared_ptr<PandoraPlus::CaloHalfCluster> newClusV = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> newClusV = std::make_shared<Cyber::CaloHalfCluster>(); double fracV = Ematrix[icl][jcl]/sumE_V[icl]; if(fracV==0) continue; if(fracV==1) newClusV = m_HFClusVCol[icl]->Clone(); else{ for(int ish=0; ish<m_HFClusVCol[icl]->getCluster().size(); ish++){ - const PandoraPlus::Calo1DCluster* p_shower = m_HFClusVCol[icl]->getCluster()[ish]; + const Cyber::Calo1DCluster* p_shower = m_HFClusVCol[icl]->getCluster()[ish]; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); for(int ibar=0; ibar<p_shower->getCluster().size(); ibar++){ auto bar = p_shower->getCluster()[ibar]->Clone(); bar->setQ(bar->getQ1()*fracV, bar->getQ2()*fracV ); @@ -946,7 +946,7 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl m_bkCol.map_BarCol["bkBar"].push_back(bar); } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->setSeed(); shower->setIDInfo(); @@ -964,7 +964,7 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl m_bkCol.map_HalfCluster["bkHalfCluster"].push_back(newClusU); m_bkCol.map_HalfCluster["bkHalfCluster"].push_back(newClusV); - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(newClusU.get(), newClusV.get(), tmp_clus); m_clusterCol.push_back(tmp_clus); }} @@ -975,9 +975,9 @@ StatusCode EnergyTimeMatchingAlg::ClusterBuilding( std::vector<std::vector<doubl //Longitudinal cluster: 1*1 -StatusCode EnergyTimeMatchingAlg::XYClusterMatchingL0( const PandoraPlus::CaloHalfCluster* m_longiClU, - const PandoraPlus::CaloHalfCluster* m_longiClV, - std::shared_ptr<PandoraPlus::Calo3DCluster>& m_clus ) +StatusCode EnergyTimeMatchingAlg::XYClusterMatchingL0( const Cyber::CaloHalfCluster* m_longiClU, + const Cyber::CaloHalfCluster* m_longiClV, + std::shared_ptr<Cyber::Calo3DCluster>& m_clus ) { //cout<<" Cluster matching for case: 1 * 1. Input HalfCluster En: "<<m_longiClU->getEnergy()<<", "<<m_longiClV->getEnergy()<<endl; //cout<<" Print 1DShower En in HalfClusterU: "<<endl; @@ -989,8 +989,8 @@ StatusCode EnergyTimeMatchingAlg::XYClusterMatchingL0( const PandoraPlus::CaloHa std::vector<int> layerindex; layerindex.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> > map_showersUinlayer; map_showersUinlayer.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> > map_showersVinlayer; map_showersVinlayer.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*> > map_showersUinlayer; map_showersUinlayer.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*> > map_showersVinlayer; map_showersVinlayer.clear(); for(int is=0; is<m_longiClU->getCluster().size(); is++){ int m_layer = m_longiClU->getCluster()[is]->getDlayer(); @@ -1004,8 +1004,8 @@ StatusCode EnergyTimeMatchingAlg::XYClusterMatchingL0( const PandoraPlus::CaloHa } for(int il=0; il<layerindex.size(); il++){ - std::vector<const PandoraPlus::Calo1DCluster*> m_showerXcol = map_showersUinlayer[layerindex[il]]; - std::vector<const PandoraPlus::Calo1DCluster*> m_showerYcol = map_showersVinlayer[layerindex[il]]; + std::vector<const Cyber::Calo1DCluster*> m_showerXcol = map_showersUinlayer[layerindex[il]]; + std::vector<const Cyber::Calo1DCluster*> m_showerYcol = map_showersVinlayer[layerindex[il]]; //cout<<" Print 1D showers in layer "<<layerindex[il]<<endl; //cout<<" ShowerU size = "<<m_showerXcol.size()<<endl; @@ -1013,21 +1013,21 @@ StatusCode EnergyTimeMatchingAlg::XYClusterMatchingL0( const PandoraPlus::CaloHa //cout<<" ShowerV size = "<<m_showerYcol.size()<<endl; //for(int a=0; a<m_showerYcol.size(); a++) printf(" #%d shower: En %.3f, address %p \n", a, m_showerYcol[a]->getEnergy(), m_showerYcol[a]); - std::vector<PandoraPlus::Calo2DCluster*> m_showerinlayer; m_showerinlayer.clear(); + std::vector<Cyber::Calo2DCluster*> m_showerinlayer; m_showerinlayer.clear(); if(m_showerXcol.size()==0 || m_showerYcol.size()==0) continue; //else if(m_showerXcol.size()==0){ - // std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + // std::shared_ptr<Cyber::Calo2DCluster> tmp_shower = std::make_shared<Cyber::Calo2DCluster>(); // GetMatchedShowerFromEmpty(m_showerYcol[0], m_longiClU, tmp_shower.get()); // //m_showerinlayer.push_back(tmp_shower.get()); // //m_bkCol.map_2DCluster["bk2DCluster"].push_back(tmp_shower); //} //else if(m_showerYcol.size()==0){ - // std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + // std::shared_ptr<Cyber::Calo2DCluster> tmp_shower = std::make_shared<Cyber::Calo2DCluster>(); // GetMatchedShowerFromEmpty(m_showerXcol[0], m_longiClU, tmp_shower.get()); //} else if(m_showerXcol.size()==1 && m_showerYcol.size()==1){ - std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> tmp_shower = std::make_shared<Cyber::Calo2DCluster>(); GetMatchedShowersL0(m_showerXcol[0], m_showerYcol[0], tmp_shower.get()); m_showerinlayer.push_back(tmp_shower.get()); m_bkCol.map_2DCluster["bk2DCluster"].push_back(tmp_shower); @@ -1058,12 +1058,12 @@ StatusCode EnergyTimeMatchingAlg::XYClusterMatchingL0( const PandoraPlus::CaloHa } -StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1DCluster* barShowerU, - const PandoraPlus::Calo1DCluster* barShowerV, - PandoraPlus::Calo2DCluster* outsh ) +StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL0( const Cyber::Calo1DCluster* barShowerU, + const Cyber::Calo1DCluster* barShowerV, + Cyber::Calo2DCluster* outsh ) { - std::vector<const PandoraPlus::CaloHit*> m_digiCol; m_digiCol.clear(); + std::vector<const Cyber::CaloHit*> m_digiCol; m_digiCol.clear(); int NbarsX = barShowerU->getBars().size(); int NbarsY = barShowerV->getBars().size(); if(NbarsX==0 || NbarsY==0){ std::cout<<"WARNING: empty DigiHitsCol returned!"<<std::endl; return StatusCode::SUCCESS; } @@ -1072,7 +1072,7 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1D int _layer = barShowerU->getDlayer(); int _module = barShowerU->getTowerID()[0][0]; - float rotAngle = -_module*TMath::TwoPi()/PandoraPlus::CaloUnit::Nmodule; + float rotAngle = -_module*TMath::TwoPi()/Cyber::CaloUnit::Nmodule; for(int ibar=0;ibar<NbarsX;ibar++){ double En_x = barShowerU->getBars()[ibar]->getEnergy(); @@ -1088,7 +1088,7 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1D p_hit.RotateZ(-rotAngle); double m_Ehit = En_x*En_y/barShowerV->getEnergy() + En_x*En_y/barShowerU->getEnergy(); //Create new CaloHit - std::shared_ptr<PandoraPlus::CaloHit> hit = std::make_shared<PandoraPlus::CaloHit>(); + std::shared_ptr<Cyber::CaloHit> hit = std::make_shared<Cyber::CaloHit>(); hit->setcellID(_module, _layer); hit->setPosition(p_hit); hit->setEnergy(m_Ehit); @@ -1106,9 +1106,9 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1D } -StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1DCluster* shower1, - std::vector<const PandoraPlus::Calo1DCluster*>& showerNCol, - std::vector<PandoraPlus::Calo2DCluster*>& outshCol ) +StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL1( const Cyber::Calo1DCluster* shower1, + std::vector<const Cyber::Calo1DCluster*>& showerNCol, + std::vector<Cyber::Calo2DCluster*>& outshCol ) { //cout<<" GetMatchedShowersL1: input shower size: 1 * "<<showerNCol.size()<<endl; outshCol.clear(); @@ -1121,10 +1121,10 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1D for(int is=0;is<NshY;is++){ EshY[is] = showerNCol[is]->getEnergy(); totE_shY += EshY[is]; } for(int is=0;is<NshY;is++){ double wi_E = EshY[is]/totE_shY; - std::shared_ptr<PandoraPlus::Calo1DCluster> m_splitshower1 = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_splitshower1 = std::make_shared<Cyber::Calo1DCluster>(); m_bkCol.map_1DCluster["bk1DCluster"].push_back( m_splitshower1 ); - std::shared_ptr<PandoraPlus::CaloUnit> m_wiseed = nullptr; + std::shared_ptr<Cyber::CaloUnit> m_wiseed = nullptr; if(shower1->getSeeds().size()>0) m_wiseed = shower1->getSeeds()[0]->Clone(); else{ cout<<"ERROR: Input shower has no seed! Check! Use the most energitic bar as seed. bar size: "<<shower1->getBars().size()<<endl; double m_maxE = -99; @@ -1137,9 +1137,9 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1D m_wiseed->setQ( wi_E*m_wiseed->getQ1(), wi_E*m_wiseed->getQ2() ); m_bkCol.map_BarCol["bkBar"].push_back( m_wiseed ); - std::vector<const PandoraPlus::CaloUnit*> m_wibars; m_wibars.clear(); + std::vector<const Cyber::CaloUnit*> m_wibars; m_wibars.clear(); for(int ib=0;ib<shower1->getBars().size();ib++){ - std::shared_ptr<PandoraPlus::CaloUnit> m_wibar = shower1->getBars()[ib]->Clone(); + std::shared_ptr<Cyber::CaloUnit> m_wibar = shower1->getBars()[ib]->Clone(); m_wibar->setQ(wi_E*m_wibar->getQ1(), wi_E*m_wibar->getQ2()); m_wibars.push_back(m_wibar.get()); m_bkCol.map_BarCol["bkBar"].push_back( m_wibar ); @@ -1147,7 +1147,7 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1D m_splitshower1->setBars( m_wibars ); m_splitshower1->addSeed( m_wiseed.get() ); m_splitshower1->setIDInfo(); - std::shared_ptr<PandoraPlus::Calo2DCluster> m_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> m_shower = std::make_shared<Cyber::Calo2DCluster>(); if(_slayer==0 ) GetMatchedShowersL0( m_splitshower1.get(), showerNCol[is], m_shower.get() ); else GetMatchedShowersL0( showerNCol[is], m_splitshower1.get(), m_shower.get() ); @@ -1160,7 +1160,7 @@ StatusCode EnergyTimeMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1D -StatusCode EnergyTimeMatchingAlg::ClusterReconnecting( std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusterCol ){ +StatusCode EnergyTimeMatchingAlg::ClusterReconnecting( std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusterCol ){ /* cout<<"Print 3DClusters"<<endl; for(int ic=0; ic<m_clusterCol.size(); ic++){ @@ -1232,8 +1232,8 @@ for(int ic=0; ic<m_clusterCol.size(); ic++){ m_clusterCol[jc].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster").size()==0 ) continue; //cout<<" Cluster jc "<<jc<<" also has parent, start check"<<endl; /* - std::vector<const PandoraPlus::CaloHalfCluster*> m_cousinU = m_clusterCol[ic].get()->getHalfClusterUCol("LinkedLongiCluster")[0]->getHalfClusterCol("CousinCluster"); - std::vector<const PandoraPlus::CaloHalfCluster*> m_cousinV = m_clusterCol[ic].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("CousinCluster"); + std::vector<const Cyber::CaloHalfCluster*> m_cousinU = m_clusterCol[ic].get()->getHalfClusterUCol("LinkedLongiCluster")[0]->getHalfClusterCol("CousinCluster"); + std::vector<const Cyber::CaloHalfCluster*> m_cousinV = m_clusterCol[ic].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("CousinCluster"); if( find(m_cousinU.begin(), m_cousinU.end(), m_clusterCol[jc].get()->getHalfClusterUCol("LinkedLongiCluster")[0] )!=m_cousinU.end() && find(m_cousinV.begin(), m_cousinV.end(), m_clusterCol[jc].get()->getHalfClusterVCol("LinkedLongiCluster")[0] )!=m_cousinV.end() && m_clusterCol[ic].get()->getShowerCenter().Angle( m_clusterCol[jc].get()->getShowerCenter() )<0.05 ){ //3deg, ~10cm in ECAL. @@ -1266,10 +1266,10 @@ for(int ic=0; ic<m_clusterCol.size(); ic++){ continue; } - const PandoraPlus::CaloHalfCluster* m_parentU1 = m_clusterCol[ic].get()->getHalfClusterUCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; - const PandoraPlus::CaloHalfCluster* m_parentV1 = m_clusterCol[ic].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; - const PandoraPlus::CaloHalfCluster* m_parentU2 = m_clusterCol[jc].get()->getHalfClusterUCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; - const PandoraPlus::CaloHalfCluster* m_parentV2 = m_clusterCol[jc].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; + const Cyber::CaloHalfCluster* m_parentU1 = m_clusterCol[ic].get()->getHalfClusterUCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; + const Cyber::CaloHalfCluster* m_parentV1 = m_clusterCol[ic].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; + const Cyber::CaloHalfCluster* m_parentU2 = m_clusterCol[jc].get()->getHalfClusterUCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; + const Cyber::CaloHalfCluster* m_parentV2 = m_clusterCol[jc].get()->getHalfClusterVCol("LinkedLongiCluster")[0]->getHalfClusterCol("ParentCluster")[0]; if(m_parentU1==m_parentU2 && m_parentV1==m_parentV2 && m_clusterCol[ic].get()->getShowerCenter().Angle( m_clusterCol[jc].get()->getShowerCenter() )<0.05){ //cout<<" In pair ("<<ic<<", "<<jc<<"): merge "<<endl; m_clusterCol[ic].get()->mergeCluster( m_clusterCol[jc].get() ); @@ -1284,7 +1284,7 @@ for(int ic=0; ic<m_clusterCol.size(); ic++){ // Type3: merge clusters linked to the same track. for(int ic=0; ic<m_clusterCol.size() && m_clusterCol.size()>1; ic++){ if(m_clusterCol[ic].get()->getAssociatedTracks().size()==0) continue; - std::vector<const PandoraPlus::Track*> m_trkCol = m_clusterCol[ic].get()->getAssociatedTracks(); + std::vector<const Cyber::Track*> m_trkCol = m_clusterCol[ic].get()->getAssociatedTracks(); for(int jc=ic+1; jc<m_clusterCol.size(); jc++){ if(m_clusterCol[jc].get()->getAssociatedTracks().size()==0) continue; @@ -1308,8 +1308,8 @@ for(int ic=0; ic<m_clusterCol.size(); ic++){ //cout<<" ClusterReconnecting: Cluster size after track check: "<<m_clusterCol.size()<<endl; /* //Check the clusters with the same ChildHFCluster: re-matching. - //std::multimap<const CaloHalfCluster*, std::shared_ptr<PandoraPlus::Calo3DCluster>> map_linkedClusters; map_linkedClusters.clear(); - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> Cluster_needMatch; Cluster_needMatch.clear(); + //std::multimap<const CaloHalfCluster*, std::shared_ptr<Cyber::Calo3DCluster>> map_linkedClusters; map_linkedClusters.clear(); + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> Cluster_needMatch; Cluster_needMatch.clear(); for(int ic=0; ic<m_clusterCol.size(); ic++){ std::vector<const CaloHalfCluster*> m_HFClusU = m_clusterCol[ic].get()->getHalfClusterUCol("LinkedLongiCluster"); std::vector<const CaloHalfCluster*> m_HFClusV = m_clusterCol[ic].get()->getHalfClusterVCol("LinkedLongiCluster"); @@ -1347,7 +1347,7 @@ cout<<" Total child cluster size: ("<<m_ChildClU.size()<<", "<<m_ChildClV.size( do{ for(int icl=0; icl<m_ChildClU.size(); icl++){ std::vector<const CaloHalfCluster*> tmp_cousin = m_ChildClU[icl]->getHalfClusterCol("CousinCluster"); - std::shared_ptr<PandoraPlus::CaloHalfCluster> merged_HFClU = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> merged_HFClU = std::make_shared<Cyber::CaloHalfCluster>(); merged_HFClU->mergeHalfCluster(m_ChildClU[icl]); merged_HFClU.get()->addHalfCluster("ChildCluster", m_ChildClU[icl]); @@ -1376,7 +1376,7 @@ cout<<" left child cluster size: "<<m_ChildClU.size()<<endl; do{ for(int icl=0; icl<m_ChildClV.size(); icl++){ std::vector<const CaloHalfCluster*> tmp_cousin = m_ChildClV[icl]->getHalfClusterCol("CousinCluster"); - std::shared_ptr<PandoraPlus::CaloHalfCluster> merged_HFClV = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> merged_HFClV = std::make_shared<Cyber::CaloHalfCluster>(); merged_HFClV->mergeHalfCluster(m_ChildClV[icl]); merged_HFClV.get()->addHalfCluster("ChildCluster", m_ChildClV[icl]); for(auto cl_V : tmp_cousin){ @@ -1399,30 +1399,30 @@ cout<<" left child cluster size: "<<m_ChildClU.size()<<endl; }while(m_ChildClV.size()!=0); cout<<" Merged HFCluster size: ("<<m_mergedClusU.size()<<", "<<m_mergedClusV.size()<<endl; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> newClusters; newClusters.clear(); + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> newClusters; newClusters.clear(); if(m_mergedClusU.size()==0 || m_mergedClusV.size()==0) return StatusCode::SUCCESS; else if( m_mergedClusU.size()==1 && m_mergedClusV.size()==1 ){ - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(m_mergedClusU[0], m_mergedClusV[0], tmp_clus); newClusters.push_back(tmp_clus); } else if( m_mergedClusU.size()==1 ){ - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> emptyCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> emptyCol; XYClusterMatchingL1(m_mergedClusU[0], m_mergedClusV, emptyCol); newClusters.insert( newClusters.end(), emptyCol.begin(), emptyCol.end() ); } else if( m_mergedClusV.size()==1 ){ - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> emptyCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> emptyCol; XYClusterMatchingL1(m_mergedClusV[0], m_mergedClusU, emptyCol); newClusters.insert( newClusters.end(), emptyCol.begin(), emptyCol.end() ); } else if( m_mergedClusU.size()==m_mergedClusV.size() ){ - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> emptyCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> emptyCol; XYClusterMatchingL2(m_mergedClusU, m_mergedClusV, emptyCol); newClusters.insert( newClusters.end(), emptyCol.begin(), emptyCol.end() ); } else{ - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> emptyCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> emptyCol; XYClusterMatchingL3(m_mergedClusU, m_mergedClusV, emptyCol); newClusters.insert( newClusters.end(), emptyCol.begin(), emptyCol.end() ); } diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/ExampleAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/ExampleAlg.cpp similarity index 90% rename from Reconstruction/CrystalCaloRec/src/Algorithm/ExampleAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/ExampleAlg.cpp index 2a3c5b76ac4d6630c7e722d3ae7b7e0ea85f0ddf..cf4b6c1dd0489430e49e42463bced77aaadbeb76 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/ExampleAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/ExampleAlg.cpp @@ -14,13 +14,13 @@ StatusCode ExampleAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode ExampleAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode ExampleAlg::Initialize( CyberDataCol& m_datacol ){ std::cout<<"Initialize ExampleAlg"<<std::endl; return StatusCode::SUCCESS; }; -StatusCode ExampleAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode ExampleAlg::RunAlgorithm( CyberDataCol& m_datacol ){ std::cout<<"Excute ExampleAlg"<<std::endl; std::cout<<" Run SelfAlg1"<<std::endl; SelfAlg1(); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/GlobalClusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/GlobalClusteringAlg.cpp similarity index 91% rename from Reconstruction/CrystalCaloRec/src/Algorithm/GlobalClusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/GlobalClusteringAlg.cpp index 4efcfae2a6e91f953bc52e98993efb3622fbc11d..47086387910564ded6176ec616e19cfc65e56c5b 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/GlobalClusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/GlobalClusteringAlg.cpp @@ -2,9 +2,9 @@ #define GLOBALCLUSTERING_ALG_C #include "Algorithm/GlobalClusteringAlg.h" -using namespace PandoraPlus; +using namespace Cyber; -StatusCode GlobalClusteringAlg::ReadSettings(PandoraPlus::Settings& m_settings){ +StatusCode GlobalClusteringAlg::ReadSettings(Cyber::Settings& m_settings){ settings = m_settings; if(settings.map_floatPars.find("unit_threshold")==settings.map_floatPars.end()) settings.map_floatPars["unit_threshold"] = 0.001; if(settings.map_stringPars.find("InputECALBars")==settings.map_stringPars.end()) settings.map_stringPars["InputECALBars"] = "BarCol"; @@ -13,7 +13,7 @@ StatusCode GlobalClusteringAlg::ReadSettings(PandoraPlus::Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode GlobalClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode GlobalClusteringAlg::Initialize( CyberDataCol& m_datacol ){ m_bars.clear(); m_processbars.clear(); m_restbars.clear(); @@ -27,7 +27,7 @@ StatusCode GlobalClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode GlobalClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode GlobalClusteringAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //system("/cefs/higgs/songwz/winter22/CEPCSW/workarea/memory/memory_test.sh cluster_begin"); //time_t time_cb; //time(&time_cb); @@ -55,8 +55,8 @@ StatusCode GlobalClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ m_datacol.map_HalfCluster["bkHalfCluster"].insert(m_datacol.map_HalfCluster["bkHalfCluster"].end(), m_halfclusters.begin(), m_halfclusters.end()); - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_HalfClusterV; m_HalfClusterV.clear(); - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_HalfClusterU; m_HalfClusterU.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_HalfClusterV; m_HalfClusterV.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_HalfClusterU; m_HalfClusterU.clear(); for(int i=0; i<m_halfclusters.size() && m_halfclusters[i]; i++){ m_halfclusters[i]->setType(0); if(m_halfclusters[i]->getSlayer()==0 && m_halfclusters[i]->getCluster().size()>0) diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/HcalClusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/HcalClusteringAlg.cpp similarity index 83% rename from Reconstruction/CrystalCaloRec/src/Algorithm/HcalClusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/HcalClusteringAlg.cpp index 31b1bcc5b2b621286e59febfbbfe9e74de7b75b2..a7a97680828c12d34397cced5e8d63b6a1009b83 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/HcalClusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/HcalClusteringAlg.cpp @@ -2,9 +2,9 @@ #define HCALCLUSTERING_ALG_C #include "Algorithm/HcalClusteringAlg.h" -using namespace PandoraPlus; +using namespace Cyber; -StatusCode HcalClusteringAlg::ReadSettings(PandoraPlus::Settings& m_settings){ +StatusCode HcalClusteringAlg::ReadSettings(Cyber::Settings& m_settings){ settings = m_settings; if(settings.map_stringPars.find("InputHCALHits")==settings.map_stringPars.end()) settings.map_stringPars["InputHCALHits"] = "HCALBarrel"; @@ -21,28 +21,28 @@ StatusCode HcalClusteringAlg::ReadSettings(PandoraPlus::Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode HcalClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode HcalClusteringAlg::Initialize( CyberDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode HcalClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode HcalClusteringAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //Readin data from DataCol: -// std::vector<PandoraPlus::CaloHit*> m_hcalHits; +// std::vector<Cyber::CaloHit*> m_hcalHits; // m_hcalHits.clear(); // for(int ih=0; ih<m_datacol.map_CaloHit["HCALBarrel"].size(); ih++) // m_hcalHits.push_back( m_datacol.map_CaloHit["HCALBarrel"][ih].get() ); // //ordered hits by layer -// std::map<int, std::vector<PandoraPlus::CaloHit*> > m_orderedHit; +// std::map<int, std::vector<Cyber::CaloHit*> > m_orderedHit; // m_orderedHit.clear(); // for(int ih=0;ih<m_hcalHits.size();ih++) // m_orderedHit[m_hcalHits[ih]->getLayer()].push_back(m_hcalHits[ih]); - std::vector<PandoraPlus::CaloHit*> m_hcalHits; + std::vector<Cyber::CaloHit*> m_hcalHits; m_hcalHits.clear(); for(int ih=0; ih<m_datacol.map_CaloHit[settings.map_stringPars["InputHCALHits"]].size(); ih++) m_hcalHits.push_back( m_datacol.map_CaloHit[settings.map_stringPars["InputHCALHits"]][ih].get() ); - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_clusterCol; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_clusterCol; m_clusterCol.clear(); // LongiConeLinking( m_orderedHit, m_clusterCol ); @@ -67,8 +67,8 @@ StatusCode HcalClusteringAlg::ClearAlgorithm(){ return StatusCode::SUCCESS; }; -StatusCode HcalClusteringAlg::LongiConeLinking( const std::map<int, std::vector<PandoraPlus::CaloHit*> >& orderedHit, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster> >& ClusterCol) +StatusCode HcalClusteringAlg::LongiConeLinking( const std::map<int, std::vector<Cyber::CaloHit*> >& orderedHit, + std::vector<std::shared_ptr<Cyber::Calo3DCluster> >& ClusterCol) { if(orderedHit.size()==0) return StatusCode::SUCCESS; @@ -76,9 +76,9 @@ StatusCode HcalClusteringAlg::LongiConeLinking( const std::map<int, std::vector auto iter = orderedHit.begin(); //In first layer: initial clusters. All showers in the first layer are regarded as cluster seed. //cluster initial direction = R. - std::vector<PandoraPlus::CaloHit*> HitsinFirstLayer = iter->second; + std::vector<Cyber::CaloHit*> HitsinFirstLayer = iter->second; for(int i=0;i<HitsinFirstLayer.size(); i++){ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->addHit(HitsinFirstLayer[i]); ClusterCol.push_back(m_clus); } @@ -89,17 +89,17 @@ StatusCode HcalClusteringAlg::LongiConeLinking( const std::map<int, std::vector //Use different cone angle for 1->2/2->3 and 3->n case //Loop later layers for(iter; iter!=orderedHit.end(); iter++){ - std::vector<PandoraPlus::CaloHit*> HitsinLayer = iter->second; + std::vector<Cyber::CaloHit*> HitsinLayer = iter->second; //cout<<" In Layer: "<<iter->first<<" Hit size: "<<HitsinLayer.size()<<endl; for(int is=0; is<HitsinLayer.size(); is++){ - PandoraPlus::CaloHit* m_hit = HitsinLayer[is]; + Cyber::CaloHit* m_hit = HitsinLayer[is]; //printf(" New Hit: (%.3f, %.3f, %.3f), Layer %d \n", m_hit->getPosition().x(), m_hit->getPosition().y(), m_hit->getPosition().z(), m_hit->getLayer() ); //cout<<" Cluster size: "<<ClusterCol.size()<<endl; for(int ic=0; ic<ClusterCol.size(); ic++ ){ int m_Nhits = ClusterCol[ic]->getCaloHits().size(); - const PandoraPlus::CaloHit* hit_in_clus = ClusterCol[ic]->getCaloHits().back(); + const Cyber::CaloHit* hit_in_clus = ClusterCol[ic]->getCaloHits().back(); TVector3 relR_vec = m_hit->getPosition() - hit_in_clus->getPosition(); //printf(" New hit: (%.2f, %.2f, %.2f), Cluster last: (%.2f, %.2f, %.2f, %d), Cluster axis: (%.2f, %.2f, %.2f) \n", // m_hit->getPosition().x(), m_hit->getPosition().y(),m_hit->getPosition().z(), @@ -118,7 +118,7 @@ StatusCode HcalClusteringAlg::LongiConeLinking( const std::map<int, std::vector }//end loop showers in layer. if(HitsinLayer.size()>0){ for(int i=0;i<HitsinLayer.size(); i++){ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->addHit(HitsinLayer[i]); ClusterCol.push_back(m_clus); }}//end new cluster diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/HoughClusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/HoughClusteringAlg.cpp similarity index 86% rename from Reconstruction/CrystalCaloRec/src/Algorithm/HoughClusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/HoughClusteringAlg.cpp index ba9bbde8e6333a774e14dbf11020bce1b5334519..db69d13a16eaf1032906fa0c27ad8b73b9023e56 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/HoughClusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/HoughClusteringAlg.cpp @@ -8,7 +8,7 @@ #include "TCanvas.h" using namespace std; -StatusCode HoughClusteringAlg::ReadSettings(PandoraPlus::Settings& m_settings){ +StatusCode HoughClusteringAlg::ReadSettings(Cyber::Settings& m_settings){ settings = m_settings; // ECAL geometry settings @@ -78,7 +78,7 @@ StatusCode HoughClusteringAlg::ReadSettings(PandoraPlus::Settings& m_settings){ return StatusCode::SUCCESS; } -StatusCode HoughClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode HoughClusteringAlg::Initialize( CyberDataCol& m_datacol ){ p_HalfClusterU.clear(); p_HalfClusterV.clear(); @@ -93,7 +93,7 @@ StatusCode HoughClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; } -StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode HoughClusteringAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //if( (p_HalfClusterU.size()+p_HalfClusterV.size())<1 ){ // std::cout << "HoughClusteringAlg: No HalfCluster input"<<std::endl; @@ -106,11 +106,11 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout<<"Readin HalfCluster size: "<<p_HalfClusterV.size()<<", "<<p_HalfClusterU.size()<<endl; - //std::vector<const PandoraPlus::CaloHalfCluster*> m_refHFClusVCol; m_refHFClusVCol.clear(); + //std::vector<const Cyber::CaloHalfCluster*> m_refHFClusVCol; m_refHFClusVCol.clear(); // Processing V(xy) plane for(int it=0; it<p_HalfClusterV.size(); it++){ // process each HalfCluster respectively m_localMaxVCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMaxVCol = p_HalfClusterV[it]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> tmp_localMaxVCol = p_HalfClusterV[it]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int il=0; il<tmp_localMaxVCol.size(); il++){ if(tmp_localMaxVCol[il]->getDlayer()<=settings.map_intPars["th_Layers"]) @@ -125,9 +125,9 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout<<" HoughClusteringAlg: Find Hough axis in HalfCluster "<<it<<". Local maximum size V = "<<m_localMaxVCol.size()<<endl; // cout<<" HoughClusteringAlg: Creating m_HoughObjectsV"<<endl; - std::vector<PandoraPlus::HoughObject> m_HoughObjectsV; m_HoughObjectsV.clear(); + std::vector<Cyber::HoughObject> m_HoughObjectsV; m_HoughObjectsV.clear(); for(int il=0; il<m_localMaxVCol.size(); il++){ - PandoraPlus::HoughObject m_obj(m_localMaxVCol[il], PandoraPlus::CaloUnit::barsize, PandoraPlus::CaloUnit::ecal_innerR); + Cyber::HoughObject m_obj(m_localMaxVCol[il], Cyber::CaloUnit::barsize, Cyber::CaloUnit::ecal_innerR); m_HoughObjectsV.push_back(m_obj); } //cout<<" HoughClusteringAlg: HoughObjectV size "<<m_HoughObjectsV.size()<<endl; @@ -136,7 +136,7 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ HoughTransformation(m_HoughObjectsV); // cout<<" HoughClusteringAlg: Creating hough_spaceV"<<endl; - PandoraPlus::HoughSpace hough_spaceV(settings.map_floatPars["alpha_lowV"], settings.map_floatPars["alpha_highV"], + Cyber::HoughSpace hough_spaceV(settings.map_floatPars["alpha_lowV"], settings.map_floatPars["alpha_highV"], settings.map_floatPars["bin_width_alphaV"], settings.map_intPars["Nbins_alphaV"], settings.map_floatPars["rho_low"], settings.map_floatPars["rho_high"], settings.map_floatPars["bin_width_rho"], settings.map_intPars["Nbins_rho"]); @@ -153,13 +153,13 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout << " HoughClusteringAlg: final output m_longiClusVCol.size() = " << m_longiClusVCol.size() << endl; m_datacol.map_HalfCluster["bkHalfCluster"].insert( m_datacol.map_HalfCluster["bkHalfCluster"].end(), m_longiClusVCol.begin(), m_longiClusVCol.end() ); - std::vector<const PandoraPlus::CaloHalfCluster*> m_constHoughCluster; m_constHoughCluster.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> left_localMaxVCol; left_localMaxVCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> m_houghMax; m_houghMax.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_constHoughCluster; m_constHoughCluster.clear(); + std::vector<const Cyber::Calo1DCluster*> left_localMaxVCol; left_localMaxVCol.clear(); + std::vector<const Cyber::Calo1DCluster*> m_houghMax; m_houghMax.clear(); for(int is=0; is<tmp_localMaxVCol.size(); is++){ bool fl_incluster = false; for(int ic=0; ic<m_longiClusVCol.size(); ic++){ - std::vector<const PandoraPlus::Calo1DCluster*> p_showers = m_longiClusVCol[ic]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> p_showers = m_longiClusVCol[ic]->getCluster(); if( find(p_showers.begin(), p_showers.end(), tmp_localMaxVCol[is])!=p_showers.end() ) { fl_incluster = true; break; } } if(!fl_incluster && find(left_localMaxVCol.begin(), left_localMaxVCol.end(), tmp_localMaxVCol[is])==left_localMaxVCol.end() ) left_localMaxVCol.push_back(tmp_localMaxVCol[is]); @@ -183,7 +183,7 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // Processing U(r-phi) plane for(int it=0; it<p_HalfClusterU.size(); it++){ // process each HalfCluster respectively m_localMaxUCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMaxUCol = p_HalfClusterU[it]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> tmp_localMaxUCol = p_HalfClusterU[it]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int il=0; il<tmp_localMaxUCol.size(); il++){ if(tmp_localMaxUCol[il]->getDlayer()<=settings.map_intPars["th_Layers"]) @@ -198,9 +198,9 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout<<" HoughClusteringAlg: Find Hough axis in HalfCluster "<<it<<". Local maximum size U = "<<m_localMaxUCol.size()<<endl; // cout<<" HoughClusteringAlg: Creating m_HoughObjectsU"<<endl; - std::vector<PandoraPlus::HoughObject> m_HoughObjectsU; m_HoughObjectsU.clear(); + std::vector<Cyber::HoughObject> m_HoughObjectsU; m_HoughObjectsU.clear(); for(int il=0; il<m_localMaxUCol.size(); il++){ - PandoraPlus::HoughObject m_obj(m_localMaxUCol[il], PandoraPlus::CaloUnit::barsize, PandoraPlus::CaloUnit::ecal_innerR); + Cyber::HoughObject m_obj(m_localMaxUCol[il], Cyber::CaloUnit::barsize, Cyber::CaloUnit::ecal_innerR); m_HoughObjectsU.push_back(m_obj); } //cout<<" HoughClusteringAlg: HoughObjectU size "<<m_HoughObjectsU.size()<<endl; @@ -209,7 +209,7 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ HoughTransformation(m_HoughObjectsU); // cout<<" HoughClusteringAlg: Creating hough_spaceU"<<endl; - PandoraPlus::HoughSpace hough_spaceU(settings.map_floatPars["alpha_lowU"], settings.map_floatPars["alpha_highU"], + Cyber::HoughSpace hough_spaceU(settings.map_floatPars["alpha_lowU"], settings.map_floatPars["alpha_highU"], settings.map_floatPars["bin_width_alphaU"], settings.map_intPars["Nbins_alphaU"], settings.map_floatPars["rho_low"], settings.map_floatPars["rho_high"], settings.map_floatPars["bin_width_rho"], settings.map_intPars["Nbins_rho"]); @@ -225,13 +225,13 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout << " HoughClusteringAlg: final output m_longiClusUCol.size() = " << m_longiClusUCol.size() << endl; m_datacol.map_HalfCluster["bkHalfCluster"].insert( m_datacol.map_HalfCluster["bkHalfCluster"].end(), m_longiClusUCol.begin(), m_longiClusUCol.end() ); - std::vector<const PandoraPlus::CaloHalfCluster*> m_constHoughCluster; m_constHoughCluster.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> left_localMaxUCol; left_localMaxUCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> m_houghMax; m_houghMax.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_constHoughCluster; m_constHoughCluster.clear(); + std::vector<const Cyber::Calo1DCluster*> left_localMaxUCol; left_localMaxUCol.clear(); + std::vector<const Cyber::Calo1DCluster*> m_houghMax; m_houghMax.clear(); for(int is=0; is<tmp_localMaxUCol.size(); is++){ bool fl_incluster = false; for(int ic=0; ic<m_longiClusUCol.size(); ic++){ - std::vector<const PandoraPlus::Calo1DCluster*> p_showers = m_longiClusUCol[ic]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> p_showers = m_longiClusUCol[ic]->getCluster(); if( find(p_showers.begin(), p_showers.end(), tmp_localMaxUCol[is])!=p_showers.end() ) { fl_incluster = true; break; } } if(!fl_incluster && find(left_localMaxUCol.begin(), left_localMaxUCol.end(), tmp_localMaxUCol[is])==left_localMaxUCol.end() ) left_localMaxUCol.push_back(tmp_localMaxUCol[is]); @@ -256,7 +256,7 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ /* for(int it=0; it<p_HalfClusterU.size(); it++){ m_localMaxUCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMaxUCol = p_HalfClusterU[it]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> tmp_localMaxUCol = p_HalfClusterU[it]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int il=0; il<tmp_localMaxUCol.size(); il++){ if(tmp_localMaxUCol[il]->getDlayer()<=settings.map_intPars["th_Layers"]) @@ -268,12 +268,12 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ } //cout<<" HoughClusteringAlg: Find Hough axis in HalfCluster "<<it<<". Local maximum size U = "<<m_localMaxUCol.size()<<endl; - std::map<int, std::vector<PandoraPlus::HoughObject> > map_HoughObjectsU_module; map_HoughObjectsU_module.clear(); - std::map<int, std::vector<PandoraPlus::HoughObject> > map_HoughObjectsU_crack; map_HoughObjectsU_crack.clear(); + std::map<int, std::vector<Cyber::HoughObject> > map_HoughObjectsU_module; map_HoughObjectsU_module.clear(); + std::map<int, std::vector<Cyber::HoughObject> > map_HoughObjectsU_crack; map_HoughObjectsU_crack.clear(); for(int il=0; il<m_localMaxUCol.size(); il++){ int module = m_localMaxUCol[il]->getTowerID()[0][0]; - PandoraPlus::HoughObject m_obj(m_localMaxUCol[il], PandoraPlus::CaloUnit::barsize, PandoraPlus::CaloUnit::ecal_innerR); + Cyber::HoughObject m_obj(m_localMaxUCol[il], Cyber::CaloUnit::barsize, Cyber::CaloUnit::ecal_innerR); map_HoughObjectsU_module[module].push_back(m_obj); } for(int iref=0; iref<m_refHFClusVCol.size(); iref++){ @@ -292,7 +292,7 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ if( (m_localMaxUCol[il]->getTowerID()[0][0]==iCrack && m_localMaxUCol[il]->getTowerID()[0][1]==4) || (iCrack!=7 && m_localMaxUCol[il]->getTowerID()[0][0]==iCrack+1 && m_localMaxUCol[il]->getTowerID()[0][1]==1) || (iCrack==7 && m_localMaxUCol[il]->getTowerID()[0][0]==0 && m_localMaxUCol[il]->getTowerID()[0][1]==1)){ - PandoraPlus::HoughObject m_obj(m_localMaxUCol[il], PandoraPlus::CaloUnit::barsize, PandoraPlus::CaloUnit::ecal_innerR, tmp_phi); + Cyber::HoughObject m_obj(m_localMaxUCol[il], Cyber::CaloUnit::barsize, Cyber::CaloUnit::ecal_innerR, tmp_phi); map_HoughObjectsU_crack[iCrack].push_back(m_obj); } } @@ -312,10 +312,10 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ for(auto &icrack: map_HoughObjectsU_crack) HoughTransformation(icrack.second); //Fill Hough space - std::map<int, PandoraPlus::HoughSpace> hough_spacesU_module; - std::map<int, PandoraPlus::HoughSpace> hough_spacesU_crack; + std::map<int, Cyber::HoughSpace> hough_spacesU_module; + std::map<int, Cyber::HoughSpace> hough_spacesU_crack; for(auto &imodule: map_HoughObjectsU_module){ - PandoraPlus::HoughSpace hspaceU(settings.map_floatPars["alpha_lowU"], settings.map_floatPars["alpha_highU"], + Cyber::HoughSpace hspaceU(settings.map_floatPars["alpha_lowU"], settings.map_floatPars["alpha_highU"], settings.map_floatPars["bin_width_alphaU"], settings.map_intPars["Nbins_alphaU"], settings.map_floatPars["rho_low"], settings.map_floatPars["rho_high"], settings.map_floatPars["bin_width_rho"], settings.map_intPars["Nbins_rho"]); @@ -323,7 +323,7 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ hough_spacesU_module[imodule.first] = hspaceU; } for(auto &icrack: map_HoughObjectsU_crack){ - PandoraPlus::HoughSpace hspaceU(settings.map_floatPars["alpha_lowU"], settings.map_floatPars["alpha_highU"], + Cyber::HoughSpace hspaceU(settings.map_floatPars["alpha_lowU"], settings.map_floatPars["alpha_highU"], settings.map_floatPars["bin_width_alphaU"], settings.map_intPars["Nbins_alphaU"], settings.map_floatPars["rho_low"], settings.map_floatPars["rho_high"], settings.map_floatPars["bin_width_rho"], settings.map_intPars["Nbins_rho"]); @@ -348,13 +348,13 @@ StatusCode HoughClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // printf(" Axis #%d: hit size %d, type %d, address %p \n", i, m_longiClusUCol[i]->getCluster().size(), m_longiClusUCol[i]->getType(), m_longiClusUCol[i].get() ); //} - std::vector<const PandoraPlus::CaloHalfCluster*> m_constHoughCluster; m_constHoughCluster.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> left_localMaxUCol; left_localMaxUCol.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> m_houghMax; m_houghMax.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_constHoughCluster; m_constHoughCluster.clear(); + std::vector<const Cyber::Calo1DCluster*> left_localMaxUCol; left_localMaxUCol.clear(); + std::vector<const Cyber::Calo1DCluster*> m_houghMax; m_houghMax.clear(); for(int is=0; is<tmp_localMaxUCol.size(); is++){ bool fl_incluster = false; for(int ic=0; ic<m_longiClusUCol.size(); ic++){ - std::vector<const PandoraPlus::Calo1DCluster*> p_showers = m_longiClusUCol[ic]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> p_showers = m_longiClusUCol[ic]->getCluster(); if( find(p_showers.begin(), p_showers.end(), tmp_localMaxUCol[is])!=p_showers.end() ) { fl_incluster = true; break; } } if(!fl_incluster && find(left_localMaxUCol.begin(), left_localMaxUCol.end(), tmp_localMaxUCol[is])==left_localMaxUCol.end() ) left_localMaxUCol.push_back(tmp_localMaxUCol[is]); @@ -388,7 +388,7 @@ StatusCode HoughClusteringAlg::ClearAlgorithm(){ }; -StatusCode HoughClusteringAlg::HoughTransformation(std::vector<PandoraPlus::HoughObject>& Hobjects){ +StatusCode HoughClusteringAlg::HoughTransformation(std::vector<Cyber::HoughObject>& Hobjects){ if(Hobjects.size()<settings.map_intPars["th_peak"]) return StatusCode::SUCCESS; // range of alpha of different lines @@ -541,7 +541,7 @@ StatusCode HoughClusteringAlg::SetLineRange(int module, int slayer, double *rang } // SetLineRange() end */ -StatusCode HoughClusteringAlg::FillHoughSpace(vector<PandoraPlus::HoughObject>& Hobjects, PandoraPlus::HoughSpace& Hspace){ +StatusCode HoughClusteringAlg::FillHoughSpace(vector<Cyber::HoughObject>& Hobjects, Cyber::HoughSpace& Hspace){ // Fill Hough space // Loop Hough objects @@ -630,17 +630,17 @@ StatusCode HoughClusteringAlg::FillHoughSpace(vector<PandoraPlus::HoughObject>& } // FillHoughSpace() end -StatusCode HoughClusteringAlg::ClusterFinding(vector<PandoraPlus::HoughObject>& Hobjects, PandoraPlus::HoughSpace& Hspace, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_longiClusCol ){ +StatusCode HoughClusteringAlg::ClusterFinding(vector<Cyber::HoughObject>& Hobjects, Cyber::HoughSpace& Hspace, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_longiClusCol ){ if(Hobjects.size()==0) return StatusCode::SUCCESS; map< pair<int, int>, set<int> > Hough_bins = Hspace.getHoughBins(); // transform candidate to longicluster - vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_clusCol; m_clusCol.clear(); + vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_clusCol; m_clusCol.clear(); for(auto ihb : Hough_bins){ if(ihb.second.size()<settings.map_intPars["th_peak"]) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_clus = std::make_shared<Cyber::CaloHalfCluster>(); for(auto it = (ihb.second).begin(); it!=(ihb.second).end(); it++){ m_clus->addUnit(Hobjects[*it].getLocalMax()); } @@ -666,7 +666,7 @@ StatusCode HoughClusteringAlg::ClusterFinding(vector<PandoraPlus::HoughObject>& } // ClusterFinding() end -StatusCode HoughClusteringAlg::CleanClusters( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_longiClusCol){ +StatusCode HoughClusteringAlg::CleanClusters( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_longiClusCol){ if(m_longiClusCol.size()==0) return StatusCode::SUCCESS; @@ -691,10 +691,10 @@ StatusCode HoughClusteringAlg::CleanClusters( std::vector<std::shared_ptr<Pandor for(int ih=0; ih<m_nhit-1; ih++){ if(m_longiClusCol[ic].get()->getCluster()[ih+1]->getDlayer() - m_longiClusCol[ic].get()->getCluster()[ih]->getDlayer() > 2){ - //PandoraPlus::CaloHalfCluster* clus_head = new PandoraPlus::CaloHalfCluster(); - //PandoraPlus::CaloHalfCluster* clus_tail = new PandoraPlus::CaloHalfCluster(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> clus_head = std::make_shared<PandoraPlus::CaloHalfCluster>(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> clus_tail = std::make_shared<PandoraPlus::CaloHalfCluster>(); + //Cyber::CaloHalfCluster* clus_head = new Cyber::CaloHalfCluster(); + //Cyber::CaloHalfCluster* clus_tail = new Cyber::CaloHalfCluster(); + std::shared_ptr<Cyber::CaloHalfCluster> clus_head = std::make_shared<Cyber::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> clus_tail = std::make_shared<Cyber::CaloHalfCluster>(); for(int jh=0; jh<=ih; jh++) clus_head->addUnit( m_longiClusCol[ic].get()->getCluster()[jh]); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/LocalMaxFindingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/LocalMaxFindingAlg.cpp similarity index 77% rename from Reconstruction/CrystalCaloRec/src/Algorithm/LocalMaxFindingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/LocalMaxFindingAlg.cpp index 7d261a890277f969024a17fbe9cfb04a50858a0f..2c2968c2b056074dd32e13df2e4dc458fbff26e3 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/LocalMaxFindingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/LocalMaxFindingAlg.cpp @@ -2,9 +2,9 @@ #define _LOCALMAXFINDING_ALG_C #include "Algorithm/LocalMaxFindingAlg.h" -using namespace PandoraPlus; +using namespace Cyber; -StatusCode LocalMaxFindingAlg::ReadSettings(PandoraPlus::Settings& m_settings){ +StatusCode LocalMaxFindingAlg::ReadSettings(Cyber::Settings& m_settings){ settings = m_settings; if(settings.map_floatPars.find("Eth_localMax")==settings.map_floatPars.end()) settings.map_floatPars["Eth_localMax"] = 0.005; @@ -13,7 +13,7 @@ StatusCode LocalMaxFindingAlg::ReadSettings(PandoraPlus::Settings& m_settings){ return StatusCode::SUCCESS; } -StatusCode LocalMaxFindingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode LocalMaxFindingAlg::Initialize( CyberDataCol& m_datacol ){ p_HalfClusU = NULL; p_HalfClusV = NULL; @@ -25,17 +25,17 @@ StatusCode LocalMaxFindingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ } -StatusCode LocalMaxFindingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol){ +StatusCode LocalMaxFindingAlg::RunAlgorithm( CyberDataCol& m_datacol){ if(!p_HalfClusU || !p_HalfClusV) {std::cout<<"ERROR: No HalfClusters in present data collection! "<<std::endl; return StatusCode::FAILURE; } for(int iu = 0; iu<p_HalfClusU->size(); iu++){ std::vector<const Calo1DCluster*> m_1dClusCol = p_HalfClusU->at(iu).get()->getCluster(); - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> ptr_localMax; ptr_localMax.clear(); + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> ptr_localMax; ptr_localMax.clear(); for(int i1d=0; i1d<m_1dClusCol.size(); i1d++) GetLocalMax(m_1dClusCol[i1d], ptr_localMax); - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMax; tmp_localMax.clear(); + std::vector<const Cyber::Calo1DCluster*> tmp_localMax; tmp_localMax.clear(); for(auto iter : ptr_localMax){ iter->getLinkedMCPfromUnit(); tmp_localMax.push_back(iter.get()); @@ -49,10 +49,10 @@ StatusCode LocalMaxFindingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol){ for(int iv=0; iv<p_HalfClusV->size(); iv++){ std::vector<const Calo1DCluster*> m_1dClusCol = p_HalfClusV->at(iv).get()->getCluster(); - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> ptr_localMax; ptr_localMax.clear(); + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> ptr_localMax; ptr_localMax.clear(); for(int i1d=0; i1d<m_1dClusCol.size(); i1d++) GetLocalMax(m_1dClusCol[i1d], ptr_localMax); - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMax; tmp_localMax.clear(); + std::vector<const Cyber::Calo1DCluster*> tmp_localMax; tmp_localMax.clear(); for(auto iter : ptr_localMax){ iter->getLinkedMCPfromUnit(); tmp_localMax.push_back(iter.get()); @@ -73,16 +73,16 @@ StatusCode LocalMaxFindingAlg::ClearAlgorithm(){ return StatusCode::SUCCESS; } -StatusCode LocalMaxFindingAlg::GetLocalMax( const PandoraPlus::Calo1DCluster* m_1dClus, - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>>& m_output){ +StatusCode LocalMaxFindingAlg::GetLocalMax( const Cyber::Calo1DCluster* m_1dClus, + std::vector<std::shared_ptr<Cyber::Calo1DCluster>>& m_output){ if(m_1dClus->getBars().size()==0) return StatusCode::SUCCESS; - std::vector<const PandoraPlus::CaloUnit*> m_barCol = m_1dClus->getBars(); + std::vector<const Cyber::CaloUnit*> m_barCol = m_1dClus->getBars(); //cout<<" LocalMaxFindingAlg::GetLocalMax: Input bar collection size: "<<m_barCol.size()<<endl; - std::vector<const PandoraPlus::CaloUnit*> localMaxCol; localMaxCol.clear(); + std::vector<const Cyber::CaloUnit*> localMaxCol; localMaxCol.clear(); GetLocalMaxBar( m_barCol, localMaxCol ); @@ -90,7 +90,7 @@ StatusCode LocalMaxFindingAlg::GetLocalMax( const PandoraPlus::Calo1DCluster* m_ //cout<<" Transfer bar to barShower"<<endl; for(int j=0; j<localMaxCol.size(); j++){ - std::shared_ptr<PandoraPlus::Calo1DCluster> m_shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_shower = std::make_shared<Cyber::Calo1DCluster>(); m_shower->addUnit( localMaxCol[j] ); m_output.push_back(m_shower); } @@ -101,10 +101,10 @@ StatusCode LocalMaxFindingAlg::GetLocalMax( const PandoraPlus::Calo1DCluster* m_ return StatusCode::SUCCESS; } -StatusCode LocalMaxFindingAlg::GetLocalMaxBar( std::vector<const PandoraPlus::CaloUnit*>& barCol, std::vector<const PandoraPlus::CaloUnit*>& localMaxCol ){ +StatusCode LocalMaxFindingAlg::GetLocalMaxBar( std::vector<const Cyber::CaloUnit*>& barCol, std::vector<const Cyber::CaloUnit*>& localMaxCol ){ //std::sort( barCol.begin(), barCol.end(), compBar ); for(int ib=0; ib<barCol.size(); ib++){ - std::vector<const PandoraPlus::CaloUnit*> m_neighbors = getNeighbors( barCol[ib], barCol ); + std::vector<const Cyber::CaloUnit*> m_neighbors = getNeighbors( barCol[ib], barCol ); if( m_neighbors.size()==0 && barCol[ib]->getEnergy()>settings.map_floatPars["Eth_localMax"] ) { localMaxCol.push_back( barCol[ib] ); continue; } @@ -124,8 +124,8 @@ StatusCode LocalMaxFindingAlg::GetLocalMaxBar( std::vector<const PandoraPlus::Ca } -std::vector<const PandoraPlus::CaloUnit*> LocalMaxFindingAlg::getNeighbors( const PandoraPlus::CaloUnit* seed, std::vector<const PandoraPlus::CaloUnit*>& barCol){ - std::vector<const PandoraPlus::CaloUnit*> m_neighbor; m_neighbor.clear(); +std::vector<const Cyber::CaloUnit*> LocalMaxFindingAlg::getNeighbors( const Cyber::CaloUnit* seed, std::vector<const Cyber::CaloUnit*>& barCol){ + std::vector<const Cyber::CaloUnit*> m_neighbor; m_neighbor.clear(); for(int i=0;i<barCol.size();i++){ bool fl_neighbor = false; if( seed->getModule()==barCol[i]->getModule() && diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/PFOCreatingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/PFOCreatingAlg.cpp similarity index 80% rename from Reconstruction/CrystalCaloRec/src/Algorithm/PFOCreatingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/PFOCreatingAlg.cpp index 1d044542744bab60294e964020614b672392e9f2..8fe0dd3c105670f620e2156a432ea0c44818ea8b 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/PFOCreatingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/PFOCreatingAlg.cpp @@ -21,7 +21,7 @@ StatusCode PFOCreatingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode PFOCreatingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode PFOCreatingAlg::Initialize( CyberDataCol& m_datacol ){ m_tracks.clear(); m_ecal_clusters.clear(); m_hcal_clusters.clear(); @@ -40,7 +40,7 @@ StatusCode PFOCreatingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode PFOCreatingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ std::cout << "yyy: Running PFOCreatingAlg" << std::endl; if(m_tracks.size()==0 && m_ecal_clusters.size()==0 && m_hcal_clusters.size()==0){ @@ -50,7 +50,7 @@ StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // Create PFO with ECAl clusters. If a ECAL cluster is a charged cluster, connect HCAL clusters using extrapolated points for(int ie=0; ie<m_ecal_clusters.size(); ie++){ - std::vector<const PandoraPlus::Track*> ecal_cls_track = m_ecal_clusters[ie]->getAssociatedTracks(); + std::vector<const Cyber::Track*> ecal_cls_track = m_ecal_clusters[ie]->getAssociatedTracks(); if(ecal_cls_track.size()>1){ std::cout << "Error! " << ecal_cls_track.size() << " tracks associated to one ECAL cluster!" << std::endl; continue; @@ -58,11 +58,11 @@ StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // Charged cluster in ECAL (A cluster with a track) if(ecal_cls_track.size()==1){ - std::vector<PandoraPlus::Calo3DCluster*> hcal_clus_candidate; + std::vector<Cyber::Calo3DCluster*> hcal_clus_candidate; hcal_clus_candidate.clear(); GetChargedHCALCandidates(ecal_cls_track[0], m_hcal_clusters, hcal_clus_candidate); - std::shared_ptr<PandoraPlus::PFObject> tmp_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_pfo = std::make_shared<Cyber::PFObject>(); tmp_pfo->addTrack(ecal_cls_track[0]); tmp_pfo->addECALCluster(m_ecal_clusters[ie]); for(int ic=0; ic<hcal_clus_candidate.size(); ic++){ @@ -77,7 +77,7 @@ StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // Neutral cluster in ECAL (A cluster without track) else if(ecal_cls_track.size()==0){ // Create PFO with only a ECAL cluster - std::shared_ptr<PandoraPlus::PFObject> tmp_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_pfo = std::make_shared<Cyber::PFObject>(); tmp_pfo->addECALCluster(m_ecal_clusters[ie]); m_pfobjects.push_back(tmp_pfo); @@ -90,7 +90,7 @@ StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // Create PFO with only tracks for(int it=0; it<m_tracks.size(); it++){ - std::shared_ptr<PandoraPlus::PFObject> tmp_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_pfo = std::make_shared<Cyber::PFObject>(); tmp_pfo->addTrack(m_tracks[it]); m_pfobjects.push_back(tmp_pfo); } @@ -103,7 +103,7 @@ StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ int pfo_index = -1; for(int ip=0; ip<m_pfobjects.size(); ip++){ - std::vector<const PandoraPlus::Calo3DCluster*> pf_ecal_clus = m_pfobjects[ip].get()->getECALClusters(); + std::vector<const Cyber::Calo3DCluster*> pf_ecal_clus = m_pfobjects[ip].get()->getECALClusters(); for(int ie=0; ie<pf_ecal_clus.size(); ie++){ TVector3 ecal_clus_pos = pf_ecal_clus[ie]->getShowerCenter(); @@ -119,7 +119,7 @@ StatusCode PFOCreatingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ m_pfobjects[pfo_index].get()->addHCALCluster(m_hcal_clusters[ih]); } else{ - std::shared_ptr<PandoraPlus::PFObject> tmp_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_pfo = std::make_shared<Cyber::PFObject>(); tmp_pfo->addHCALCluster(m_hcal_clusters[ih]); m_pfobjects.push_back(tmp_pfo); } @@ -142,9 +142,9 @@ StatusCode PFOCreatingAlg::ClearAlgorithm(){ return StatusCode::SUCCESS; } -StatusCode PFOCreatingAlg::GetChargedHCALCandidates(const PandoraPlus::Track* _track, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clusters, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clus_candidate) +StatusCode PFOCreatingAlg::GetChargedHCALCandidates(const Cyber::Track* _track, + std::vector<Cyber::Calo3DCluster*>& _hcal_clusters, + std::vector<Cyber::Calo3DCluster*>& _hcal_clus_candidate) { std::vector<TrackState> hcal_trk_states = _track->getTrackStates("Hcal"); if(hcal_trk_states.size()==0) @@ -180,9 +180,9 @@ StatusCode PFOCreatingAlg::GetChargedHCALCandidates(const PandoraPlus::Track* _t } } -StatusCode PFOCreatingAlg::GetNearbyHCALCandidates( PandoraPlus::Calo3DCluster* _ecal_cluster, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clusters, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clus_candidate) +StatusCode PFOCreatingAlg::GetNearbyHCALCandidates( Cyber::Calo3DCluster* _ecal_cluster, + std::vector<Cyber::Calo3DCluster*>& _hcal_clusters, + std::vector<Cyber::Calo3DCluster*>& _hcal_clus_candidate) { TVector3 ecal_pos = _ecal_cluster->getShowerCenter(); for(int ih=0; ih<_hcal_clusters.size(); ih++){ @@ -197,7 +197,7 @@ StatusCode PFOCreatingAlg::GetNearbyHCALCandidates( PandoraPlus::Calo3DCluster* return StatusCode::SUCCESS; } -bool PFOCreatingAlg::isReachOuterMostECAL(PandoraPlus::Calo3DCluster* _ecal_cluster) +bool PFOCreatingAlg::isReachOuterMostECAL(Cyber::Calo3DCluster* _ecal_cluster) { // A neutral cluster may deposits energy into HCAL if its cluster in ECAL reach the outermost boundary. // In this case, it hits the last layer of ECAL or hit the boundary of different modules. @@ -257,18 +257,18 @@ template<typename T1, typename T2> StatusCode CleanUsedElement(T1 _used_element, return StatusCode::SUCCESS; } -StatusCode PFOCreatingAlg::CreateLeftPFO(std::vector<PandoraPlus::Track*>& _tracks, - std::vector<PandoraPlus::Calo3DCluster*>& _hcal_clusters, - std::vector<std::shared_ptr<PandoraPlus::PFObject>>& _pfobjects) +StatusCode PFOCreatingAlg::CreateLeftPFO(std::vector<Cyber::Track*>& _tracks, + std::vector<Cyber::Calo3DCluster*>& _hcal_clusters, + std::vector<std::shared_ptr<Cyber::PFObject>>& _pfobjects) { for(int it=0; it<_tracks.size(); it++){ - std::shared_ptr<PandoraPlus::PFObject> tmp_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_pfo = std::make_shared<Cyber::PFObject>(); tmp_pfo->addTrack(_tracks[it]); _pfobjects.push_back(tmp_pfo); } for(int ih=0; ih<_hcal_clusters.size(); ih++){ - std::shared_ptr<PandoraPlus::PFObject> tmp_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_pfo = std::make_shared<Cyber::PFObject>(); tmp_pfo->addHCALCluster(_hcal_clusters[ih]); _pfobjects.push_back(tmp_pfo); } diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/PFOReclusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/PFOReclusteringAlg.cpp similarity index 87% rename from Reconstruction/CrystalCaloRec/src/Algorithm/PFOReclusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/PFOReclusteringAlg.cpp index 32a50d6131f2be0ed0102e41f18902078dd9c56f..acc9165da38f61223c3e9a4f84610054da499633 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/PFOReclusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/PFOReclusteringAlg.cpp @@ -22,17 +22,17 @@ StatusCode PFOReclusteringAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode PFOReclusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode PFOReclusteringAlg::Initialize( CyberDataCol& m_datacol ){ p_PFObjects = nullptr; p_PFObjects = &(m_datacol.map_PFObjects[settings.map_stringPars["ReadinPFOName"]]); return StatusCode::SUCCESS; }; -StatusCode PFOReclusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode PFOReclusteringAlg::RunAlgorithm( CyberDataCol& m_datacol ){ - std::vector< std::shared_ptr<PandoraPlus::PFObject> > m_chargedPFOs; - std::vector< std::shared_ptr<PandoraPlus::PFObject> > m_neutralPFOs; + std::vector< std::shared_ptr<Cyber::PFObject> > m_chargedPFOs; + std::vector< std::shared_ptr<Cyber::PFObject> > m_neutralPFOs; for(int ipfo=0; ipfo<p_PFObjects->size(); ipfo++){ if(p_PFObjects->at(ipfo)->getTracks().size()==0) m_neutralPFOs.push_back( p_PFObjects->at(ipfo) ); @@ -40,6 +40,7 @@ StatusCode PFOReclusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ } std::sort(m_chargedPFOs.begin(), m_chargedPFOs.end(), compTrkP); +/* double totE_Ecal = 0; double totE_Hcal = 0; cout<<"Readin PFO: "<<p_PFObjects->size()<<", charged "<<m_chargedPFOs.size()<<", neutral "<<m_neutralPFOs.size()<<endl; @@ -61,11 +62,11 @@ StatusCode PFOReclusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ totE_Hcal += m_chargedPFOs[i]->getHCALClusterEnergy(); } cout<<"-----Charged cluster Ecal total energy: "<<totE_Ecal<<", Hcal total energy: "<<totE_Hcal<<endl; - +*/ //If P_trk < E_cluster, create a virtual neutral PFO. ReCluster_SplitFromChg(m_chargedPFOs, m_neutralPFOs); - +/* totE_Ecal = 0; totE_Hcal = 0; cout<<"After split from Ch: charged "<<m_chargedPFOs.size()<<", neutral "<<m_neutralPFOs.size()<<", total "<<p_PFObjects->size()<<endl; @@ -87,7 +88,7 @@ StatusCode PFOReclusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ totE_Hcal += m_chargedPFOs[i]->getHCALClusterEnergy(); } cout<<"-----Charged cluster Ecal total energy: "<<totE_Ecal<<", Hcal total energy: "<<totE_Hcal<<endl; - +*/ //If P_trk > E_cluster, merge nearby neutral PFO into the charged. ReCluster_MergeToChg(m_chargedPFOs, m_neutralPFOs); @@ -95,7 +96,7 @@ StatusCode PFOReclusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ m_datacol.map_CaloHit["bkHit"].insert( m_datacol.map_CaloHit["bkHit"].end(), m_bkCol.map_CaloHit["bkHit"].begin(), m_bkCol.map_CaloHit["bkHit"].end() ); m_datacol.map_CaloCluster["bk3DCluster"].insert( m_datacol.map_CaloCluster["bk3DCluster"].end(), m_bkCol.map_CaloCluster["bk3DCluster"].begin(), m_bkCol.map_CaloCluster["bk3DCluster"].end() ); m_datacol.map_PFObjects["bkPFO"].insert( m_datacol.map_PFObjects["bkPFO"].end(), m_bkCol.map_PFObjects["bkPFO"].begin(), m_bkCol.map_PFObjects["bkPFO"].end() ); - +/* totE_Ecal = 0; totE_Hcal = 0; cout<<"After merge all virtual to Ch: charged "<<m_chargedPFOs.size()<<", neutral "<<m_neutralPFOs.size()<<", total "<<p_PFObjects->size()<<endl; @@ -117,7 +118,7 @@ StatusCode PFOReclusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ totE_Hcal += m_chargedPFOs[i]->getHCALClusterEnergy(); } cout<<"-----Charged cluster Ecal total energy: "<<totE_Ecal<<", Hcal total energy: "<<totE_Hcal<<endl; - +*/ m_chargedPFOs.clear(); m_neutralPFOs.clear(); @@ -132,8 +133,8 @@ StatusCode PFOReclusteringAlg::ClearAlgorithm(){ }; -StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_chargedPFOs, - std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_neutralPFOs ){ +StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr<Cyber::PFObject> >& m_chargedPFOs, + std::vector< std::shared_ptr<Cyber::PFObject> >& m_neutralPFOs ){ //Merge real neutral PFOs for(int ic=0; ic<m_chargedPFOs.size(); ic++){ @@ -158,9 +159,9 @@ StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr //cout<<" Do charged PFO merge. "<<endl; // All HCAL clusters in the neutral PFO - std::vector<const PandoraPlus::Calo3DCluster*> all_neutral_HCAL_clus; + std::vector<const Cyber::Calo3DCluster*> all_neutral_HCAL_clus; for(int ip=0; ip<m_neutralPFOs.size(); ip++){ - std::vector<const PandoraPlus::Calo3DCluster*> tmp_HCAL_clus = m_neutralPFOs[ip]->getHCALClusters(); + std::vector<const Cyber::Calo3DCluster*> tmp_HCAL_clus = m_neutralPFOs[ip]->getHCALClusters(); all_neutral_HCAL_clus.insert(all_neutral_HCAL_clus.end(), tmp_HCAL_clus.begin(), tmp_HCAL_clus.end()); } //cout<<" Neutral HCAL cluster size "<<all_neutral_HCAL_clus.size()<<endl; @@ -178,7 +179,7 @@ StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr //printf(" charged cluster trk pos: [%.3f, %.3f, %.3f] \n", trackclus_pos.x(), trackclus_pos.y(), trackclus_pos.z()); int loop_count = 0; - std::vector<const PandoraPlus::Calo3DCluster*> skip_clus; + std::vector<const Cyber::Calo3DCluster*> skip_clus; while(delta_energy < 0){ loop_count++; if(loop_count>all_neutral_HCAL_clus.size()+10){ @@ -215,7 +216,7 @@ StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr // Remove this HCAL cluster from neutral PFO bool is_found = false; for(int in=0; in<m_neutralPFOs.size(); in++){ - std::vector<const PandoraPlus::Calo3DCluster*> neutral_cluster = m_neutralPFOs[in]->getHCALClusters(); + std::vector<const Cyber::Calo3DCluster*> neutral_cluster = m_neutralPFOs[in]->getHCALClusters(); int tmp_index=-1; for(int ii=0; ii<neutral_cluster.size(); ii++){ if (all_neutral_HCAL_clus[clus_index]==neutral_cluster[ii]){ @@ -252,7 +253,7 @@ StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr } } - +/* double totE_Ecal = 0; double totE_Hcal = 0; cout<<"After merge real neu to Ch: charged "<<m_chargedPFOs.size()<<", neutral "<<m_neutralPFOs.size()<<", total "<<p_PFObjects->size()<<endl; @@ -274,7 +275,7 @@ StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr totE_Hcal += m_chargedPFOs[i]->getHCALClusterEnergy(); } cout<<"-----Charged cluster Ecal total energy: "<<totE_Ecal<<", Hcal total energy: "<<totE_Hcal<<endl; - +*/ //Merge virtual neutral PFOs created from splitting. @@ -295,23 +296,21 @@ StatusCode PFOReclusteringAlg::ReCluster_MergeToChg(std::vector< std::shared_ptr double sigmaE = settings.map_floatPars["EnergyRes"] * sqrt(track_energy); double delta_energy = ECAL_energy + HCAL_energy - track_energy; -cout<<" ReCluster_MergeToChg: In ChPFO #"<<ic<<": Ptrk = "<<track_energy<<", Eecal = "<<ECAL_energy<<", Ehcal = "<<HCAL_energy<<", deltaE = "<<delta_energy<<", sigmaE = "<<sigmaE<<endl; if(delta_energy > settings.map_floatPars["VirtualMergeSigma"]*sigmaE) continue; -cout<<" Do charged PFO merge. "<<endl; // Virtual HCAL clusters in the neutral PFO - std::vector<const PandoraPlus::Calo3DCluster*> all_neutral_HCAL_clus; all_neutral_HCAL_clus.clear(); + std::vector<const Cyber::Calo3DCluster*> all_neutral_HCAL_clus; all_neutral_HCAL_clus.clear(); for(int ip=0; ip<m_neutralPFOs.size(); ip++){ - std::vector<const PandoraPlus::Calo3DCluster*> tmp_HCAL_clus = m_neutralPFOs[ip]->getHCALClusters(); + std::vector<const Cyber::Calo3DCluster*> tmp_HCAL_clus = m_neutralPFOs[ip]->getHCALClusters(); if(tmp_HCAL_clus.size()!=1) continue; if(tmp_HCAL_clus[0]->getType()!=-1) continue; all_neutral_HCAL_clus.push_back(tmp_HCAL_clus[0]); } -cout<<" Virtual HCAL cluster size "<<all_neutral_HCAL_clus.size()<<", print them: "<<endl; -for(int aa=0; aa<all_neutral_HCAL_clus.size(); aa++){ - printf(" #%d: pos (%.3f, %.3f, %.3f), En %.3f, Nhit %d, type %d \n", aa, all_neutral_HCAL_clus[aa]->getHitCenter().x(), all_neutral_HCAL_clus[aa]->getHitCenter().y(), all_neutral_HCAL_clus[aa]->getHitCenter().z(), all_neutral_HCAL_clus[aa]->getHitsE()*settings.map_floatPars["HCALCalib"], all_neutral_HCAL_clus[aa]->getCaloHits().size(), all_neutral_HCAL_clus[aa]->getType() ); -} +//cout<<" Virtual HCAL cluster size "<<all_neutral_HCAL_clus.size()<<", print them: "<<endl; +//for(int aa=0; aa<all_neutral_HCAL_clus.size(); aa++){ +// printf(" #%d: pos (%.3f, %.3f, %.3f), En %.3f, Nhit %d, type %d \n", aa, all_neutral_HCAL_clus[aa]->getHitCenter().x(), all_neutral_HCAL_clus[aa]->getHitCenter().y(), all_neutral_HCAL_clus[aa]->getHitCenter().z(), all_neutral_HCAL_clus[aa]->getHitsE()*settings.map_floatPars["HCALCalib"], all_neutral_HCAL_clus[aa]->getCaloHits().size(), all_neutral_HCAL_clus[aa]->getType() ); +//} TVector3 trackclus_pos(0, 0, 0); if(m_chargedPFOs[ic]->getTracks()[0]->getTrackStates("Hcal").size()>0){ @@ -338,10 +337,10 @@ for(int aa=0; aa<all_neutral_HCAL_clus.size(); aa++){ trackclus_pos = trackclus_pos*(1./HCAL_energy); } - printf(" charged cluster trk pos: [%.3f, %.3f, %.3f] \n", trackclus_pos.x(), trackclus_pos.y(), trackclus_pos.z()); +// printf(" charged cluster trk pos: [%.3f, %.3f, %.3f] \n", trackclus_pos.x(), trackclus_pos.y(), trackclus_pos.z()); int loop_count = 0; - std::vector<const PandoraPlus::Calo3DCluster*> skip_clus; + std::vector<const Cyber::Calo3DCluster*> skip_clus; while(delta_energy < sigmaE*settings.map_floatPars["VirtualMergeSigma"]-(1e-6)){ loop_count++; if(loop_count>all_neutral_HCAL_clus.size()+10){ @@ -360,12 +359,12 @@ for(int aa=0; aa<all_neutral_HCAL_clus.size(); aa++){ clus_index = in; } } -cout<<" In Loop "<<loop_count<<": current deltaE = "<<delta_energy<<", closest virtual cluster index "<<clus_index<<endl; +// cout<<" In Loop "<<loop_count<<": current deltaE = "<<delta_energy<<", closest virtual cluster index "<<clus_index<<endl; if(clus_index<0) break; // No neutral Hcal cluster to be merged double tmp_delta_E = delta_energy + settings.map_floatPars["HCALCalib"]*all_neutral_HCAL_clus[clus_index]->getHitsE(); -cout<<" If include this cluster: new deltaE "<<tmp_delta_E<<", merge = "<<(tmp_delta_E > sigmaE * settings.map_floatPars["VirtualMergeSigma"])<<endl; +// cout<<" If include this cluster: new deltaE "<<tmp_delta_E<<", merge = "<<(tmp_delta_E > sigmaE * settings.map_floatPars["VirtualMergeSigma"])<<endl; if(tmp_delta_E > sigmaE * settings.map_floatPars["VirtualMergeSigma"]){ double absorbed_energy = sigmaE*settings.map_floatPars["VirtualMergeSigma"] - delta_energy; delta_energy = delta_energy + absorbed_energy; @@ -373,10 +372,10 @@ cout<<" If include this cluster: new deltaE "<<tmp_delta_E<<", merge = "<<(tm //Create a new virtual neutral cluster with energy = absorbed_energy. - std::shared_ptr<PandoraPlus::CaloHit> m_hit = all_neutral_HCAL_clus[clus_index]->getCaloHits()[0]->Clone(); + std::shared_ptr<Cyber::CaloHit> m_hit = all_neutral_HCAL_clus[clus_index]->getCaloHits()[0]->Clone(); m_hit->setEnergy(absorbed_energy/settings.map_floatPars["HCALCalib"]); - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->addHit(m_hit.get()); m_clus->setType(-1); @@ -395,10 +394,10 @@ cout<<" If include this cluster: new deltaE "<<tmp_delta_E<<", merge = "<<(tm if(tmp_HCAL_clus[0]->getType()!=-1) continue; if(tmp_HCAL_clus[0]==all_neutral_HCAL_clus[clus_index]){ - std::shared_ptr<PandoraPlus::CaloHit> m_newhit = all_neutral_HCAL_clus[clus_index]->getCaloHits()[0]->Clone(); + std::shared_ptr<Cyber::CaloHit> m_newhit = all_neutral_HCAL_clus[clus_index]->getCaloHits()[0]->Clone(); m_newhit->setEnergy(all_neutral_HCAL_clus[clus_index]->getHitsE() - absorbed_energy/settings.map_floatPars["HCALCalib"] ); - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newclus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_newclus = std::make_shared<Cyber::Calo3DCluster>(); m_newclus->addHit(m_newhit.get()); m_newclus->setType(-1); @@ -437,7 +436,7 @@ cout<<" If include this cluster: new deltaE "<<tmp_delta_E<<", merge = "<<(tm // Remove this HCAL cluster from neutral PFO bool is_found = false; for(int in=0; in<m_neutralPFOs.size(); in++){ - std::vector<const PandoraPlus::Calo3DCluster*> neutral_cluster = m_neutralPFOs[in]->getHCALClusters(); + std::vector<const Cyber::Calo3DCluster*> neutral_cluster = m_neutralPFOs[in]->getHCALClusters(); int tmp_index=-1; for(int ii=0; ii<neutral_cluster.size(); ii++){ if (all_neutral_HCAL_clus[clus_index]==neutral_cluster[ii]){ @@ -446,13 +445,13 @@ cout<<" If include this cluster: new deltaE "<<tmp_delta_E<<", merge = "<<(tm } } if (tmp_index==-1) continue; -cout<<" Remove a neutral cluster: En "<<settings.map_floatPars["HCALCalib"]*neutral_cluster[tmp_index]->getHitsE()<<endl; +// cout<<" Remove a neutral cluster: En "<<settings.map_floatPars["HCALCalib"]*neutral_cluster[tmp_index]->getHitsE()<<endl; neutral_cluster.erase(neutral_cluster.begin()+tmp_index); m_neutralPFOs[in]->setHCALCluster(neutral_cluster); if(m_neutralPFOs[in]->getTracks().size() + m_neutralPFOs[in]->getECALClusters().size() + m_neutralPFOs[in]->getHCALClusters().size()==0){ -cout<<" Remove a neutral PFO: ECAL En "<<m_neutralPFOs[in]->getECALClusterEnergy()<<", HCAL En "<<m_neutralPFOs[in]->getHCALClusterEnergy()<<endl; +// cout<<" Remove a neutral PFO: ECAL En "<<m_neutralPFOs[in]->getECALClusterEnergy()<<", HCAL En "<<m_neutralPFOs[in]->getHCALClusterEnergy()<<endl; auto iter = find(p_PFObjects->begin(), p_PFObjects->end(), m_neutralPFOs[in]); if(iter==p_PFObjects->end()){ std::cout<<"ERROR: can not find this neutral PFO in p_PFObjects. "<<std::endl; @@ -481,8 +480,8 @@ cout<<" Remove a neutral PFO: ECAL En "<<m_neutralPFOs[in]->getECALClusterEnerg }; -StatusCode PFOReclusteringAlg::ReCluster_SplitFromChg( std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_chargedPFOs, - std::vector< std::shared_ptr<PandoraPlus::PFObject> >& m_neutralPFOs ){ +StatusCode PFOReclusteringAlg::ReCluster_SplitFromChg( std::vector< std::shared_ptr<Cyber::PFObject> >& m_chargedPFOs, + std::vector< std::shared_ptr<Cyber::PFObject> >& m_neutralPFOs ){ for(int ipfo=0; ipfo<m_chargedPFOs.size(); ipfo++){ if(m_chargedPFOs[ipfo]->getECALClusters().size()==0 && m_chargedPFOs[ipfo]->getHCALClusters().size()==0) continue; @@ -511,15 +510,15 @@ StatusCode PFOReclusteringAlg::ReCluster_SplitFromChg( std::vector< std::shared_ tmp_pos += settings.map_floatPars["HCALCalib"] * m_chargedPFOs[ipfo]->getHCALClusters()[ic]->getHitsE() * m_chargedPFOs[ipfo]->getHCALClusters()[ic]->getHitCenter(); tmp_pos = tmp_pos*(1./(ECAL_energy+HCAL_energy)); - std::shared_ptr<PandoraPlus::CaloHit> m_hit = std::make_shared<PandoraPlus::CaloHit>(); + std::shared_ptr<Cyber::CaloHit> m_hit = std::make_shared<Cyber::CaloHit>(); m_hit->setPosition( tmp_pos ); m_hit->setEnergy( delta_energy/settings.map_floatPars["HCALCalib"] ); - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->addHit(m_hit.get()); m_clus->setType(-1); - std::shared_ptr<PandoraPlus::PFObject> m_pfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> m_pfo = std::make_shared<Cyber::PFObject>(); m_pfo->addHCALCluster( m_clus.get() ); //cout<<"Create a new Neutral PFO: energy "<<m_pfo->getHCALClusterEnergy()<<endl; @@ -533,9 +532,9 @@ StatusCode PFOReclusteringAlg::ReCluster_SplitFromChg( std::vector< std::shared_ //cout<<"[FY debug] Hcal energy scale = "<<m_HcalEnScale<<endl; //Create new HCAL cluster - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newclus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_newclus = std::make_shared<Cyber::Calo3DCluster>(); for(int ic=0; ic<m_chargedPFOs[ipfo]->getHCALClusters().size(); ic++){ - std::vector<const PandoraPlus::CaloHit*> tmp_hits = m_chargedPFOs[ipfo]->getHCALClusters()[ic]->getCaloHits(); + std::vector<const Cyber::CaloHit*> tmp_hits = m_chargedPFOs[ipfo]->getHCALClusters()[ic]->getCaloHits(); for(int ih=0; ih<tmp_hits.size(); ih++){ std::shared_ptr<CaloHit> tmp_newhit = tmp_hits[ih]->Clone(); tmp_newhit->setEnergy( tmp_newhit->getEnergy()*m_HcalEnScale ); @@ -548,8 +547,8 @@ StatusCode PFOReclusteringAlg::ReCluster_SplitFromChg( std::vector< std::shared_ //cout<<"[FY debug] new HCAL cluster: hit size "<<m_newclus->getCaloHits().size()<<", total energy "<<m_newclus->getHitsE()<<endl; //Create a new PFO - std::shared_ptr<PandoraPlus::PFObject> m_newpfo = m_chargedPFOs[ipfo]->Clone(); - std::vector<const PandoraPlus::Calo3DCluster*> tmp_clusvec; tmp_clusvec.clear(); + std::shared_ptr<Cyber::PFObject> m_newpfo = m_chargedPFOs[ipfo]->Clone(); + std::vector<const Cyber::Calo3DCluster*> tmp_clusvec; tmp_clusvec.clear(); tmp_clusvec.push_back(m_newclus.get()); m_newpfo->setHCALCluster(tmp_clusvec); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TrackClusterConnectingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackClusterConnectingAlg.cpp similarity index 87% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TrackClusterConnectingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TrackClusterConnectingAlg.cpp index 324c9d187594dacd957d4ac231ce399b806e279b..fa79d1c3acce328f0653a2e2f8ef02e5f9cad3cb 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TrackClusterConnectingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackClusterConnectingAlg.cpp @@ -25,7 +25,7 @@ StatusCode TrackClusterConnectingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TrackClusterConnectingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TrackClusterConnectingAlg::Initialize( CyberDataCol& m_datacol ){ m_EcalClusters.clear(); m_HcalClusters.clear(); m_tracks.clear(); @@ -54,7 +54,7 @@ StatusCode TrackClusterConnectingAlg::Initialize( PandoraPlusDataCol& m_datacol return StatusCode::SUCCESS; }; -StatusCode TrackClusterConnectingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TrackClusterConnectingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //Readin: tracks, ECAL clusters and HCAL clusters. //Output: PFObject @@ -66,7 +66,7 @@ StatusCode TrackClusterConnectingAlg::RunAlgorithm( PandoraPlusDataCol& m_dataco //cout<<" TrackClusterConnectingAlg: After ECAL charged fragment absorption: cluster size "<<m_absorbedEcal.size()<<endl; //2. Create PFObject with ECAL cluster and track - std::vector<const PandoraPlus::Calo3DCluster*> tmp_constClus; + std::vector<const Cyber::Calo3DCluster*> tmp_constClus; for(int ic=0; ic<m_absorbedEcal.size(); ic++) tmp_constClus.push_back(m_absorbedEcal[ic].get()); PFOCreating(tmp_constClus, m_tracks, m_PFObjects); @@ -110,9 +110,9 @@ StatusCode TrackClusterConnectingAlg::ClearAlgorithm(){ -StatusCode TrackClusterConnectingAlg::PFOCreating( std::vector<const PandoraPlus::Calo3DCluster*>& m_clusters, - std::vector<const PandoraPlus::Track*>& m_trks, - std::vector<std::shared_ptr<PandoraPlus::PFObject>>& m_PFOs ){ +StatusCode TrackClusterConnectingAlg::PFOCreating( std::vector<const Cyber::Calo3DCluster*>& m_clusters, + std::vector<const Cyber::Track*>& m_trks, + std::vector<std::shared_ptr<Cyber::PFObject>>& m_PFOs ){ //cout<<" PFOCreating: Track size "<<m_trks.size()<<", Cluster size "<<m_clusters.size()<<endl; //for(int ic=0; ic<m_clusters.size(); ic++){ @@ -121,13 +121,13 @@ StatusCode TrackClusterConnectingAlg::PFOCreating( std::vector<const PandoraPlus // else cout<<endl; //} - std::vector<const PandoraPlus::Track*> m_leftTrks = m_trks; + std::vector<const Cyber::Track*> m_leftTrks = m_trks; for(int ic=0; ic<m_clusters.size(); ic++){ - std::shared_ptr<PandoraPlus::PFObject> m_newPFO = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> m_newPFO = std::make_shared<Cyber::PFObject>(); m_newPFO->addECALCluster( m_clusters[ic] ); - std::vector<const PandoraPlus::Track*> m_trkInClus = m_clusters[ic]->getAssociatedTracks(); + std::vector<const Cyber::Track*> m_trkInClus = m_clusters[ic]->getAssociatedTracks(); if(m_trkInClus.size()!=0){ m_newPFO->addTrack( m_trkInClus[0] ); auto iter = find(m_leftTrks.begin(), m_leftTrks.end(), m_trkInClus[0]); @@ -140,7 +140,7 @@ StatusCode TrackClusterConnectingAlg::PFOCreating( std::vector<const PandoraPlus } for(int itrk=0; itrk<m_leftTrks.size(); itrk++){ - std::shared_ptr<PandoraPlus::PFObject> m_newPFO = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> m_newPFO = std::make_shared<Cyber::PFObject>(); m_newPFO->addTrack( m_leftTrks[itrk] ); m_PFOs.push_back(m_newPFO); m_bkCol.map_PFObjects["bkPFO"].push_back(m_newPFO); @@ -150,9 +150,9 @@ StatusCode TrackClusterConnectingAlg::PFOCreating( std::vector<const PandoraPlus } -StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const PandoraPlus::Calo3DCluster*>& m_clusters, - std::vector<const PandoraPlus::Track*>& m_trks, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_newclusCol){ +StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Cyber::Calo3DCluster*>& m_clusters, + std::vector<const Cyber::Track*>& m_trks, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_newclusCol){ //cout<<" In EcalChFragAbsorption: Input track size "<<m_trks.size()<<", cluster size "<<m_clusters.size()<<endl; //for(int ic=0; ic<m_clusters.size(); ic++){ // cout<<" ECAL Cluster #"<<ic<<": En = "<<m_clusters[ic]->getLongiE()<<", track size "<<m_clusters[ic]->getAssociatedTracks().size()<<endl; @@ -160,7 +160,7 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa //1. Absorb neutral clusters to the nearby tracks - std::map<const PandoraPlus::Track*, int> m_matchedTrkMap; + std::map<const Cyber::Track*, int> m_matchedTrkMap; for(int ic=0; ic<m_clusters.size(); ic++){ for(int itrk=0; itrk<m_clusters[ic]->getAssociatedTracks().size(); itrk++){ if( find(m_trks.begin(), m_trks.end(), m_clusters[ic]->getAssociatedTracks()[itrk])!=m_trks.end() ) @@ -191,17 +191,17 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa //} if( clusEn<settings.map_floatPars["th_ChFragEn"] && clusDepth>settings.map_floatPars["th_ChFragDepth"] && minR2trk<settings.map_floatPars["th_ChFragMinR"]){ - const PandoraPlus::Track* p_selTrk = m_trks[index]; //Closest track to this cluster. + const Cyber::Track* p_selTrk = m_trks[index]; //Closest track to this cluster. if( m_matchedTrkMap.find(p_selTrk)==m_matchedTrkMap.end() ){ //This track does not match to any existing charged cluster - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newclus = m_clusters[ic]->Clone(); + std::shared_ptr<Cyber::Calo3DCluster> m_newclus = m_clusters[ic]->Clone(); m_newclus->addAssociatedTrack(p_selTrk); m_newclusCol.push_back( m_newclus ); m_bkCol.map_CaloCluster["bk3DCluster"].push_back(m_newclus); } else{ int tmp_index = m_matchedTrkMap[p_selTrk]; - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newclus = m_clusters[tmp_index]->Clone(); + std::shared_ptr<Cyber::Calo3DCluster> m_newclus = m_clusters[tmp_index]->Clone(); m_newclus->mergeCluster(m_clusters[ic]); m_newclusCol.push_back( m_newclus ); m_matchedTrkMap.erase(p_selTrk); @@ -209,7 +209,7 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa } } else{ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newclus = m_clusters[ic]->Clone(); + std::shared_ptr<Cyber::Calo3DCluster> m_newclus = m_clusters[ic]->Clone(); m_newclusCol.push_back( m_newclus ); m_bkCol.map_CaloCluster["bk3DCluster"].push_back(m_newclus); } @@ -217,7 +217,7 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa } for(auto iter: m_matchedTrkMap){ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newclus = m_clusters[iter.second]->Clone(); + std::shared_ptr<Cyber::Calo3DCluster> m_newclus = m_clusters[iter.second]->Clone(); m_newclusCol.push_back( m_newclus ); m_bkCol.map_CaloCluster["bk3DCluster"].push_back(m_newclus); } @@ -226,7 +226,7 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa //Merge clusters if linked to the same track for(int ic=0; ic<m_newclusCol.size() && m_newclusCol.size()>1; ic++){ if(m_newclusCol[ic].get()->getAssociatedTracks().size()==0) continue; - std::vector<const PandoraPlus::Track*> m_trkCol = m_newclusCol[ic].get()->getAssociatedTracks(); + std::vector<const Cyber::Track*> m_trkCol = m_newclusCol[ic].get()->getAssociatedTracks(); for(int jc=ic+1; jc<m_newclusCol.size(); jc++){ if(m_newclusCol[jc].get()->getAssociatedTracks().size()==0) continue; @@ -254,8 +254,8 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa //} //2. Find the shower vertex, absorb nearby neutral clusters (in a cone) into it. - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_newChCluster; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_newNeuCluster; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_newChCluster; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_newNeuCluster; for(int icl=0; icl<m_newclusCol.size(); icl++){ if(m_newclusCol[icl]->getAssociatedTracks().size()==0 ) m_newNeuCluster.push_back(m_newclusCol[icl]); else m_newChCluster.push_back(m_newclusCol[icl]); @@ -292,10 +292,10 @@ StatusCode TrackClusterConnectingAlg::EcalChFragAbsorption( std::vector<const Pa }; -StatusCode TrackClusterConnectingAlg::HcalExtrapolatingMatch(std::vector<const PandoraPlus::Calo3DCluster*>& m_clusters, std::vector<std::shared_ptr<PandoraPlus::PFObject>>& m_PFOs){ +StatusCode TrackClusterConnectingAlg::HcalExtrapolatingMatch(std::vector<const Cyber::Calo3DCluster*>& m_clusters, std::vector<std::shared_ptr<Cyber::PFObject>>& m_PFOs){ for(int ic=0; ic<m_clusters.size(); ic++){ - std::vector<const PandoraPlus::CaloHit*> hcal_hits = m_clusters[ic]->getCaloHits(); + std::vector<const Cyber::CaloHit*> hcal_hits = m_clusters[ic]->getCaloHits(); //cout<<"HCAL Cluster #"<<ic<<": Nhit "<<hcal_hits.size()<<", En "<<m_clusters[ic]->getHitsE()<<endl; bool isInPfo = false; @@ -342,7 +342,7 @@ StatusCode TrackClusterConnectingAlg::HcalExtrapolatingMatch(std::vector<const P //If HCAL cluster is not linked to any existing PFO: create a new one. if(!isInPfo){ //cout<<" Create a new neutral PFO "<<endl; - std::shared_ptr<PandoraPlus::PFObject> m_newPFO = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> m_newPFO = std::make_shared<Cyber::PFObject>(); m_newPFO->addHCALCluster( m_clusters[ic] ); m_PFOs.push_back(m_newPFO); m_bkCol.map_PFObjects["bkPFO"].push_back(m_newPFO); @@ -353,7 +353,7 @@ StatusCode TrackClusterConnectingAlg::HcalExtrapolatingMatch(std::vector<const P } -double TrackClusterConnectingAlg::GetMinR2Trk( const PandoraPlus::Calo3DCluster* p_clus, const PandoraPlus::Track* m_trk){ +double TrackClusterConnectingAlg::GetMinR2Trk( const Cyber::Calo3DCluster* p_clus, const Cyber::Track* m_trk){ if(!p_clus || !m_trk) return 99999; double minR = 99999; diff --git a/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackExtrapolatingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackExtrapolatingAlg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f0effa6889a74f139c3bcceedeffccd09c7bf2c --- /dev/null +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackExtrapolatingAlg.cpp @@ -0,0 +1,371 @@ +#ifndef _TRACKEXTRAPOLATING_ALG_C +#define _TRACKEXTRAPOLATING_ALG_C + +#include "TVector2.h" + +#include "Algorithm/TrackExtrapolatingAlg.h" +#include "Objects/Track.h" +#include "Objects/TrackState.h" + +using namespace TMath; +using namespace std; + +StatusCode TrackExtrapolatingAlg::ReadSettings(Settings& m_settings){ + settings = m_settings; + + //Initialize parameters + // ECAL parameters + if(settings.map_floatPars.find("ECAL_innermost_distance")==settings.map_floatPars.end()) + settings.map_floatPars["ECAL_innermost_distance"] = 1830; + if(settings.map_floatPars.find("ECAL_outermost_distance")==settings.map_floatPars.end()) + settings.map_floatPars["ECAL_outermost_distance"] = 1830+300; + if(settings.map_intPars.find("ECAL_Nlayers")==settings.map_intPars.end()) + settings.map_intPars["ECAL_Nlayers"] = 28; + if(settings.map_floatPars.find("ECAL_layer_width")==settings.map_floatPars.end()) + settings.map_floatPars["ECAL_layer_width"] = 10; + if(settings.map_floatPars.find("ECAL_half_length")==settings.map_floatPars.end()) + settings.map_floatPars["ECAL_half_length"] = 2900; + // HCAL parameters + if(settings.map_floatPars.find("HCAL_innermost_distance")==settings.map_floatPars.end()) + settings.map_floatPars["HCAL_innermost_distance"] = 2140; + if(settings.map_floatPars.find("HCAL_outermost_distance")==settings.map_floatPars.end()) + settings.map_floatPars["HCAL_outermost_distance"] = 3455; + if(settings.map_intPars.find("HCAL_Nlayers")==settings.map_intPars.end()) + settings.map_intPars["HCAL_Nlayers"] = 48; + if(settings.map_floatPars.find("HCAL_layer_width")==settings.map_floatPars.end()) + settings.map_floatPars["HCAL_layer_width"] = 26.61; + if(settings.map_floatPars.find("HCAL_sensitive_distance")==settings.map_floatPars.end()) + settings.map_floatPars["HCAL_sensitive_distance"] = 22.81; // distance between sensitive material and front face of each layer + if(settings.map_floatPars.find("HCAL_half_length")==settings.map_floatPars.end()) + settings.map_floatPars["HCAL_half_length"] = 3230; + + if(settings.map_intPars.find("Nmodule")==settings.map_intPars.end()) + settings.map_intPars["Nmodule"] = 32; + if(settings.map_floatPars.find("B_field")==settings.map_floatPars.end()) + settings.map_floatPars["B_field"] = 3.0; + + if(settings.map_intPars.find("Input_track")==settings.map_intPars.end()) + settings.map_intPars["Input_track"] = 0; // 0: reconstructed tracks. 1: MC particle track + + return StatusCode::SUCCESS; +}; + + +StatusCode TrackExtrapolatingAlg::Initialize( CyberDataCol& m_datacol ){ + std::cout<<"Initialize TrackExtrapolatingAlg"<<std::endl; + + return StatusCode::SUCCESS; +}; + + +StatusCode TrackExtrapolatingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ +//std::cout<<"---oooOO0OOooo--- Excuting TrackExtrapolatingAlg ---oooOO0OOooo---"<<std::endl; + + std::vector<std::shared_ptr<Cyber::Track>>* p_tracks = &(m_datacol.TrackCol); + + std::vector<float> ECAL_layer_radius; // Layer radius from ECAL innermost distance to outermost distance; spacing: ECAL_layer_width/2 + std::vector<float> HCAL_layer_radius; + GetLayerRadius(ECAL_layer_radius, HCAL_layer_radius); + + for(int itrk=0; itrk<p_tracks->size(); itrk++){ + // Only tracks that reach ECAL should be processed. + if(!IsReachECAL( p_tracks->at(itrk).get() )) continue; + + // get track state at calorimeter + Cyber::TrackState CALO_trk_state; + GetTrackStateAtCalo(p_tracks->at(itrk).get(), CALO_trk_state); + + ExtrapolateByRadius(ECAL_layer_radius, HCAL_layer_radius, CALO_trk_state, p_tracks->at(itrk).get()); + } // end loop tracks + + + p_tracks = nullptr; + return StatusCode::SUCCESS; +}; // RunAlgorithm end + + +StatusCode TrackExtrapolatingAlg::ClearAlgorithm(){ + std::cout<<"End run TrackExtrapolatingAlg. Clean it."<<std::endl; + + return StatusCode::SUCCESS; +}; + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +StatusCode TrackExtrapolatingAlg::GetLayerRadius(std::vector<float> & ECAL_layer_radius, std::vector<float> & HCAL_layer_radius){ + // ECAL + float tmp_ecal_radius = settings.map_floatPars["ECAL_innermost_distance"] + 0.5*settings.map_floatPars["ECAL_layer_width"]; + while(tmp_ecal_radius < settings.map_floatPars["ECAL_outermost_distance"]){ + ECAL_layer_radius.push_back(tmp_ecal_radius); + tmp_ecal_radius += 0.5 * settings.map_floatPars["ECAL_layer_width"]; + } + + // HCAL + float tmp_hcal_radius = settings.map_floatPars["HCAL_innermost_distance"] + 0.5*settings.map_floatPars["HCAL_layer_width"]; + while(tmp_hcal_radius < settings.map_floatPars["HCAL_outermost_distance"]){ + HCAL_layer_radius.push_back(tmp_hcal_radius); + tmp_hcal_radius += 0.5 * settings.map_floatPars["HCAL_layer_width"]; + } + + return StatusCode::SUCCESS; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +bool TrackExtrapolatingAlg::IsReachECAL(Cyber::Track * track){ + if(settings.map_intPars["Input_track"] == 0){ + // The track is reconstructed in ECAL. If the track reach ECAL, it should have track state at calorimeter + std::vector<TrackState> input_trackstates = track->getTrackStates("Input"); + int count=0; + TVector3 t_vec; + for(int i=0; i<input_trackstates.size(); i++){ + if(input_trackstates[i].location==Cyber::TrackState::AtCalorimeter){ + count++; + t_vec = input_trackstates[i].referencePoint; + break; + } + } + if(count==0){ + // The track has no track state at calorimeter + return false; + } + if( Abs(Abs(t_vec.Z())-settings.map_floatPars["ECAL_half_length"]) < 1.0 ){ + // The track escape from endcap + return false; + } + + return true; + } + else if(settings.map_intPars["Input_track"] == 1){ + // The track is from MC particle as ideal helix. + // The pT should large enough to reach ECAL. The pz should not be so large that it escape from endcap + std::vector<TrackState> input_trackstates = track->getTrackStates("Input"); + if(input_trackstates.size()==0){ + std::cout << "Error! No track state!" << std::endl; + return false; + } + + TrackState IP_trk_state; + for(int i=0; i<input_trackstates.size(); i++){ + if(input_trackstates[i].location==Cyber::TrackState::AtIP) + IP_trk_state = input_trackstates[i]; + break; + } + + TVector3 ref_point = IP_trk_state.referencePoint; + double rho = GetRho(IP_trk_state); + double r_max = TMath::Sqrt(ref_point.X()*ref_point.X() + ref_point.Y()*ref_point.Y()) + rho*2; + + if(r_max<settings.map_floatPars["ECAL_innermost_distance"]){ return false; } + + return true; + } + else{ + std::cout << "Error, wrong source of input tracks for TrackExtrapolatingAlg!" << std:: endl; + return false; + } + +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +StatusCode TrackExtrapolatingAlg::GetTrackStateAtCalo(Cyber::Track * track, + Cyber::TrackState & trk_state_at_calo){ + std::vector<TrackState> input_trackstates = track->getTrackStates("Input"); + + if(settings.map_intPars["Input_track"] == 0){ + for(int its=0; its<input_trackstates.size(); its++){ + if(input_trackstates[its].location==Cyber::TrackState::AtCalorimeter){ + trk_state_at_calo=input_trackstates[its]; + break; + } + } + } + else if((settings.map_intPars["Input_track"] == 1)){ + for(int its=0; its<input_trackstates.size(); its++){ + if(input_trackstates[its].location==Cyber::TrackState::AtIP){ + trk_state_at_calo=input_trackstates[its]; + break; + } + } + } + else{ + std::cout << "Error, wrong source of input tracks for TrackExtrapolatingAlg!" << std:: endl; + } + + return StatusCode::SUCCESS; + +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +StatusCode TrackExtrapolatingAlg::ExtrapolateByRadius( const std::vector<float> & ECAL_layer_radius, std::vector<float> & HCAL_layer_radius, + const Cyber::TrackState & CALO_trk_state, Cyber::Track* p_track){ + // Extrapolate points to circles with specific radius + float rho = GetRho(CALO_trk_state); + TVector2 center = GetCenterOfCircle(CALO_trk_state, rho); + float alpha0 = GetRefAlpha0(CALO_trk_state, center); + + std::vector<float> ECAL_delta_phi = GetDeltaPhi(rho, center, alpha0, ECAL_layer_radius, CALO_trk_state); + std::vector<float> HCAL_delta_phi = GetDeltaPhi(rho, center, alpha0, HCAL_layer_radius, CALO_trk_state); + + std::vector<TVector3> ECAL_ext_points = GetExtrapoPoints("ECAL", rho, center, alpha0, CALO_trk_state, ECAL_delta_phi); + std::vector<TVector3> HCAL_ext_points = GetExtrapoPoints("HCAL", rho, center, alpha0, CALO_trk_state, HCAL_delta_phi); + + // Sort Extrapolated points + std::vector<TrackState> t_ECAL_states; + for(int ip=0; ip<ECAL_ext_points.size(); ip++){ + TrackState t_state = CALO_trk_state; + t_state.location = Cyber::TrackState::AtOther; + t_state.referencePoint = ECAL_ext_points[ip]; + // Note GetExtrapolatedPhi0 is not same as the definition of phi0 in TrackState + t_state.phi0 = GetExtrapolatedPhi0(CALO_trk_state.Kappa, CALO_trk_state.phi0, center, ECAL_ext_points[ip]); + t_ECAL_states.push_back(t_state); + } + // std::sort(t_ECAL_states.begin(), t_ECAL_states.end(), SortByPhi0); + p_track->setTrackStates("Ecal", t_ECAL_states); + + std::vector<TrackState> t_HCAL_states; + for(int ip=0; ip<HCAL_ext_points.size(); ip++){ + TrackState t_state = CALO_trk_state; + t_state.location = Cyber::TrackState::AtOther; + t_state.referencePoint = HCAL_ext_points[ip]; + // Note GetExtrapolatedPhi0 is not same as the definition of phi0 in TrackState + t_state.phi0 = GetExtrapolatedPhi0(CALO_trk_state.Kappa, CALO_trk_state.phi0, center, HCAL_ext_points[ip]); + t_HCAL_states.push_back(t_state); + } + // std::sort(t_HCAL_states.begin(), t_HCAL_states.end(), SortByPhi0); + p_track->setTrackStates("Hcal", t_HCAL_states); + + return StatusCode::SUCCESS; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +float TrackExtrapolatingAlg::GetRho(const Cyber::TrackState & trk_state){ + float rho = Abs(1000. / (0.3*settings.map_floatPars["B_field"]*trk_state.Kappa)); + return rho; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +TVector2 TrackExtrapolatingAlg::GetCenterOfCircle(const Cyber::TrackState & trk_state, const float & rho){ + float phi; + if(trk_state.Kappa>=0) phi = trk_state.phi0 - Pi()/2; + else phi = trk_state.phi0 + Pi()/2; + + float xc = trk_state.referencePoint.X() + ((rho+trk_state.D0)*Cos(phi)); + float yc = trk_state.referencePoint.Y() + ((rho+trk_state.D0)*Sin(phi)); + TVector2 center(xc, yc); + return center; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +float TrackExtrapolatingAlg::GetRefAlpha0(const Cyber::TrackState & trk_state, const TVector2 & center){ + float deltaX = trk_state.referencePoint.X() - center.X(); + float deltaY = trk_state.referencePoint.Y() - center.Y(); + float alpha0 = ATan2(deltaY, deltaX); + return alpha0; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +std::vector<float> TrackExtrapolatingAlg::GetDeltaPhi(float rho, TVector2 center, float alpha0, vector<float> layer_radius, const Cyber::TrackState & CALO_trk_state){ + std::vector<float> delta_phi; + + for(int il=0; il<layer_radius.size(); il++){ + float param0 = (Power(layer_radius[il], 2) - center.Mod2() - Power(rho, 2)) / (2 * rho * center.Mod()); + if(Abs(param0)>1) continue; + float t_as = ASin(param0); + + float param1 = ATan2(center.X(), center.Y()); + + float layer_delta_phi1 = t_as - alpha0 - param1; + float layer_delta_phi2; + if(t_as<0) layer_delta_phi2 = -Pi() - t_as - alpha0 - param1; + else layer_delta_phi2 = Pi() - t_as - alpha0 - param1; + + while(layer_delta_phi1>Pi()) layer_delta_phi1 = layer_delta_phi1 - 2*Pi(); + while(layer_delta_phi1<-Pi()) layer_delta_phi1 = layer_delta_phi1 + 2*Pi(); + while(layer_delta_phi2>Pi()) layer_delta_phi2 = layer_delta_phi2 - 2*Pi(); + while(layer_delta_phi2<-Pi()) layer_delta_phi2 = layer_delta_phi2 + 2*Pi(); + + if(CALO_trk_state.Kappa < 0){ + delta_phi.push_back(layer_delta_phi1); + } + else if(CALO_trk_state.Kappa > 0){ + delta_phi.push_back(layer_delta_phi2); + } + else{ + std::cout << "TrackExtrapolatingAlg: Error! Kappa=0!" << std::endl; + } + + } + + return delta_phi; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +std::vector<TVector3> TrackExtrapolatingAlg::GetExtrapoPoints(std::string calo_name, + float rho, TVector2 center, float alpha0, + const Cyber::TrackState & CALO_trk_state, + const std::vector<float>& delta_phi){ + std::vector<TVector3> ext_points; + for(int ip=0; ip<delta_phi.size(); ip++){ + float x = center.X() + (rho*Cos(alpha0+delta_phi[ip])); + float y = center.Y() + (rho*Sin(alpha0+delta_phi[ip])); + float z; + if(CALO_trk_state.Kappa > 0){ + z = CALO_trk_state.referencePoint.Z() + CALO_trk_state.Z0 - + (delta_phi[ip]*rho*CALO_trk_state.tanLambda); + }else{ + z = CALO_trk_state.referencePoint.Z() + CALO_trk_state.Z0 + + (delta_phi[ip]*rho*CALO_trk_state.tanLambda); + } + + if(calo_name=="ECAL"){ + if(Abs(z)>settings.map_floatPars["ECAL_half_length"]) continue; + if(Sqrt(x*x+y*y) > settings.map_floatPars["ECAL_outermost_distance"]) continue; + if(Sqrt(x*x+y*y) < settings.map_floatPars["ECAL_innermost_distance"]) continue; + } + else if(calo_name=="HCAL"){ + if(Abs(z)>settings.map_floatPars["HCAL_half_length"]) continue; + if(Sqrt(x*x+y*y) > settings.map_floatPars["HCAL_outermost_distance"]) continue; + } + else continue; + + TVector3 extp(x,y,z); + ext_points.push_back(extp); + } + + return ext_points; +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +bool TrackExtrapolatingAlg::IsReturn(float rho, TVector2 & center){ + float farest = rho + center.Mod(); + if (farest < settings.map_floatPars["ECAL_outermost_distance"]/Cos(Pi()/settings.map_intPars["Nmodule"])+100) {return true;} + else{return false;} +} + + +// ...oooOO0OOooo......oooOO0OOooo......oooOO0OOooo... +float TrackExtrapolatingAlg::GetExtrapolatedPhi0(float Kappa, float ECAL_phi0, TVector2 center, TVector3 ext_point){ + // Note: phi0 of extrapolated points is (phi of velocity at extrapolated point) - (phi of velocity at ECAL front face) + TVector2 ext_point_xy(ext_point.X(), ext_point.Y()); + TVector2 ext2center = center - ext_point_xy; + float ext_phi0; + if(Kappa>=0) ext_phi0 = ext2center.Phi() + TMath::Pi()/2.; + else ext_phi0 = ext2center.Phi() - TMath::Pi()/2.; + + float phi0 = ext_phi0 - ECAL_phi0; + while(phi0 < -Pi()) phi0 = phi0 + 2*Pi(); + while(phi0 > Pi()) phi0 = phi0 - 2*Pi(); + return phi0; +} + + +#endif diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TrackMatchingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackMatchingAlg.cpp similarity index 82% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TrackMatchingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TrackMatchingAlg.cpp index b5c93e61cbf49bf4f2ef3672e175f8a31312c7e0..05ec8a4bd398c03a9a0e511929f8b7d7988eef9f 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TrackMatchingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TrackMatchingAlg.cpp @@ -4,7 +4,7 @@ #include "Algorithm/TrackMatchingAlg.h" -StatusCode TrackMatchingAlg::ReadSettings(PandoraPlus::Settings& m_settings){ +StatusCode TrackMatchingAlg::ReadSettings(Cyber::Settings& m_settings){ settings = m_settings; // ECAL geometry settings // Note: Bar half length is also geometry parameter, but obtained from the function GetBarHalfLength() @@ -31,7 +31,7 @@ StatusCode TrackMatchingAlg::ReadSettings(PandoraPlus::Settings& m_settings){ } -StatusCode TrackMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TrackMatchingAlg::Initialize( CyberDataCol& m_datacol ){ m_TrackCol.clear(); p_HalfClusterV = nullptr; p_HalfClusterU = nullptr; @@ -46,7 +46,7 @@ StatusCode TrackMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ } -StatusCode TrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TrackMatchingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ std::cout << "---oooOO0OOooo---Excuting TrackMatchingAlg---oooOO0OOooo---"<<std::endl; // Associate tracks to HalfClusters. // This association is a many-to-many relationship: @@ -70,10 +70,10 @@ StatusCode TrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ for(int ihc=0; ihc<p_HalfClusterV->size(); ihc++){ // loop HalfClusterV // Get local max of the HalfCluster - std::vector<const PandoraPlus::Calo1DCluster*> localMaxColV = p_HalfClusterV->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxColV = p_HalfClusterV->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); //cout<<" In HalfClusterV #"<<ihc<<": localMax size "<<localMaxColV.size()<<endl; // Track axis candidate. - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_track_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> t_track_axis = std::make_shared<Cyber::CaloHalfCluster>(); CreateTrackAxis(extrapo_points, localMaxColV, t_track_axis.get()); // If the track does not match the Halfcluster, the track axis candidate will have no 1DCluster @@ -89,11 +89,11 @@ StatusCode TrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ for(int ihc=0; ihc<p_HalfClusterU->size(); ihc++){ // loop HalfClusterU // Get local max of the HalfCluster - std::vector<const PandoraPlus::Calo1DCluster*> localMaxColU = p_HalfClusterU->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxColU = p_HalfClusterU->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); //cout<<" In HalfClusterU #"<<ihc<<": localMax size "<<localMaxColU.size()<<endl; // Track axis candidate. - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_track_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> t_track_axis = std::make_shared<Cyber::CaloHalfCluster>(); CreateTrackAxis(extrapo_points, localMaxColU, t_track_axis.get()); // If the track do not match the Halfcluster, the track axis candidate will have no 1DCluster @@ -112,36 +112,36 @@ StatusCode TrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //std::cout << "For track " << itrk << ", pT = " << pT <<", using Cone method" << std::endl; // Get local max and HalfCluster near the extrapolated points - std::vector<PandoraPlus::CaloHalfCluster*> t_nearbyHalfClustersV; t_nearbyHalfClustersV.clear(); - std::vector<PandoraPlus::CaloHalfCluster*> t_nearbyHalfClustersU; t_nearbyHalfClustersU.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> t_nearbyLocalMaxV; t_nearbyLocalMaxV.clear(); - std::vector<const PandoraPlus::Calo1DCluster*> t_nearbyLocalMaxU; t_nearbyLocalMaxU.clear(); + std::vector<Cyber::CaloHalfCluster*> t_nearbyHalfClustersV; t_nearbyHalfClustersV.clear(); + std::vector<Cyber::CaloHalfCluster*> t_nearbyHalfClustersU; t_nearbyHalfClustersU.clear(); + std::vector<const Cyber::Calo1DCluster*> t_nearbyLocalMaxV; t_nearbyLocalMaxV.clear(); + std::vector<const Cyber::Calo1DCluster*> t_nearbyLocalMaxU; t_nearbyLocalMaxU.clear(); GetNearby(p_HalfClusterV, extrapo_points, t_nearbyHalfClustersV, t_nearbyLocalMaxV); GetNearby(p_HalfClusterU, extrapo_points, t_nearbyHalfClustersU, t_nearbyLocalMaxU); // V plane - std::vector<const PandoraPlus::Calo1DCluster*> t_cone_axisV; t_cone_axisV.clear(); + std::vector<const Cyber::Calo1DCluster*> t_cone_axisV; t_cone_axisV.clear(); LongiConeLinking(extrapo_points, t_nearbyLocalMaxV, t_cone_axisV); CreatConeAxis(m_datacol, m_TrackCol[itrk], t_nearbyHalfClustersV, t_cone_axisV); // U plane // Sort local max by their modules - //std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> > m_orderedLocalMaxU; // key: module of the bar + //std::map<int, std::vector<const Cyber::Calo1DCluster*> > m_orderedLocalMaxU; // key: module of the bar //m_orderedLocalMaxU.clear(); //for(int is=0; is<t_nearbyLocalMaxU.size(); is++) // m_orderedLocalMaxU[t_nearbyLocalMaxU[is]->getTowerID()[0][0]].push_back(t_nearbyLocalMaxU[is]); //// linking - //std::vector<const PandoraPlus::Calo1DCluster*> merged_cone_axisU; merged_cone_axisU.clear(); + //std::vector<const Cyber::Calo1DCluster*> merged_cone_axisU; merged_cone_axisU.clear(); //for (auto it = m_orderedLocalMaxU.begin(); it != m_orderedLocalMaxU.end(); ++it){ - // std::vector<const PandoraPlus::Calo1DCluster*> moduled_localMaxU = it->second; - // std::vector<const PandoraPlus::Calo1DCluster*> t_cone_axisU; t_cone_axisU.clear(); + // std::vector<const Cyber::Calo1DCluster*> moduled_localMaxU = it->second; + // std::vector<const Cyber::Calo1DCluster*> t_cone_axisU; t_cone_axisU.clear(); // LongiConeLinking(extrapo_points, moduled_localMaxU, t_cone_axisU); // merged_cone_axisU.insert(merged_cone_axisU.end(), t_cone_axisU.begin(), t_cone_axisU.end()); //} //CreatConeAxis(m_datacol, m_TrackCol[itrk], t_nearbyHalfClustersU, merged_cone_axisU); // U plane - std::vector<const PandoraPlus::Calo1DCluster*> t_cone_axisU; t_cone_axisU.clear(); + std::vector<const Cyber::Calo1DCluster*> t_cone_axisU; t_cone_axisU.clear(); LongiConeLinking(extrapo_points, t_nearbyLocalMaxU, t_cone_axisU); CreatConeAxis(m_datacol, m_TrackCol[itrk], t_nearbyHalfClustersU, t_cone_axisU); @@ -152,10 +152,10 @@ StatusCode TrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ } // end loop tracks //Loop track to check the associated cluster: merge clusters if they are associated to the same track. - std::vector<PandoraPlus::CaloHalfCluster*> tmp_deleteClus; tmp_deleteClus.clear(); + std::vector<Cyber::CaloHalfCluster*> tmp_deleteClus; tmp_deleteClus.clear(); for(auto &itrk : m_TrackCol){ - std::vector<PandoraPlus::CaloHalfCluster*> m_matchedUCol = itrk->getAssociatedHalfClustersU(); - std::vector<PandoraPlus::CaloHalfCluster*> m_matchedVCol = itrk->getAssociatedHalfClustersV(); + std::vector<Cyber::CaloHalfCluster*> m_matchedUCol = itrk->getAssociatedHalfClustersU(); + std::vector<Cyber::CaloHalfCluster*> m_matchedVCol = itrk->getAssociatedHalfClustersV(); // std::cout << "yyy: Before merge, m_matchedVCol.size() = " << m_matchedVCol.size() << std::endl; for(int imc=0; imc<m_matchedVCol.size(); imc++){ @@ -231,8 +231,8 @@ StatusCode TrackMatchingAlg::ClearAlgorithm(){ } -StatusCode TrackMatchingAlg::GetExtrpoECALPoints(const PandoraPlus::Track* track, std::vector<TVector3>& extrapo_points){ - std::vector<PandoraPlus::TrackState> ecal_track_states = track->getTrackStates("Ecal"); +StatusCode TrackMatchingAlg::GetExtrpoECALPoints(const Cyber::Track* track, std::vector<TVector3>& extrapo_points){ + std::vector<Cyber::TrackState> ecal_track_states = track->getTrackStates("Ecal"); for(int its=0; its<ecal_track_states.size(); its++){ extrapo_points.push_back(ecal_track_states[its].referencePoint); } @@ -241,8 +241,8 @@ StatusCode TrackMatchingAlg::GetExtrpoECALPoints(const PandoraPlus::Track* track } -StatusCode TrackMatchingAlg::CreateTrackAxis(vector<TVector3>& extrapo_points, std::vector<const PandoraPlus::Calo1DCluster*>& localMaxCol, - PandoraPlus::CaloHalfCluster* t_track_axis){ +StatusCode TrackMatchingAlg::CreateTrackAxis(vector<TVector3>& extrapo_points, std::vector<const Cyber::Calo1DCluster*>& localMaxCol, + Cyber::CaloHalfCluster* t_track_axis){ if(localMaxCol.size()==0 || extrapo_points.size()==0) return StatusCode::SUCCESS; int t_slayer = localMaxCol[0]->getSlayer(); @@ -253,7 +253,7 @@ StatusCode TrackMatchingAlg::CreateTrackAxis(vector<TVector3>& extrapo_points, s // distance from the extrpolated point to the center of the local max bar TVector3 distance = extrapo_points[ipt] - localMaxCol[ilm]->getPos(); if( TMath::Abs(distance.Z()) < (localMaxCol[ilm]->getBars()[0]->getBarLength())/2. && - distance.Perp() < PandoraPlus::CaloUnit::barsize ) { + distance.Perp() < Cyber::CaloUnit::barsize ) { t_track_axis->addUnit(localMaxCol[ilm]); } else { continue; } @@ -264,9 +264,9 @@ StatusCode TrackMatchingAlg::CreateTrackAxis(vector<TVector3>& extrapo_points, s for(int ilm=0; ilm<localMaxCol.size(); ilm++){ TVector3 lm_pos = localMaxCol[ilm]->getPos(); float barLength = localMaxCol[ilm]->getBars()[0]->getBarLength(); - if( fabs(extrapo_points[ipt].z()-lm_pos.z()) < PandoraPlus::CaloUnit::barsize && - fabs(extrapo_points[ipt].Phi()-lm_pos.Phi()) < barLength/2./PandoraPlus::CaloUnit::ecal_innerR && - fabs(extrapo_points[ipt].Perp()-lm_pos.Perp()) < PandoraPlus::CaloUnit::barsize ){ + if( fabs(extrapo_points[ipt].z()-lm_pos.z()) < Cyber::CaloUnit::barsize && + fabs(extrapo_points[ipt].Phi()-lm_pos.Phi()) < barLength/2./Cyber::CaloUnit::ecal_innerR && + fabs(extrapo_points[ipt].Perp()-lm_pos.Perp()) < Cyber::CaloUnit::barsize ){ t_track_axis->addUnit(localMaxCol[ilm]); } else { continue; } @@ -278,19 +278,19 @@ StatusCode TrackMatchingAlg::CreateTrackAxis(vector<TVector3>& extrapo_points, s } -StatusCode TrackMatchingAlg::GetNearby(const std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>* p_HalfCluster, +StatusCode TrackMatchingAlg::GetNearby(const std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>* p_HalfCluster, const std::vector<TVector3>& extrapo_points, - std::vector<PandoraPlus::CaloHalfCluster*>& t_nearbyHalfClusters, - std::vector<const PandoraPlus::Calo1DCluster*>& t_nearbyLocalMax){ + std::vector<Cyber::CaloHalfCluster*>& t_nearbyHalfClusters, + std::vector<const Cyber::Calo1DCluster*>& t_nearbyLocalMax){ // std::cout << "calling TrackMatchingAlg::GetNearby()" << std::endl; if(p_HalfCluster->size()==0 || extrapo_points.size()==0) return StatusCode::SUCCESS; - std::set<PandoraPlus::CaloHalfCluster*> set_nearbyHalfClusters; + std::set<Cyber::CaloHalfCluster*> set_nearbyHalfClusters; int slayer = p_HalfCluster->at(0).get()->getSlayer(); if(slayer==1){ // V plane for(int ihc=0; ihc<p_HalfCluster->size(); ihc++){ - std::vector<const PandoraPlus::Calo1DCluster*> localMaxCol = p_HalfCluster->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxCol = p_HalfCluster->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int ilm=0; ilm<localMaxCol.size(); ilm++){ for(int ipt=0; ipt<extrapo_points.size(); ipt++){ TVector3 distance(extrapo_points[ipt] - localMaxCol[ilm]->getPos()); @@ -305,13 +305,13 @@ StatusCode TrackMatchingAlg::GetNearby(const std::vector<std::shared_ptr<Pandora } }else{ // U plane for(int ihc=0; ihc<p_HalfCluster->size(); ihc++){ - std::vector<const PandoraPlus::Calo1DCluster*> localMaxCol = p_HalfCluster->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxCol = p_HalfCluster->at(ihc).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int ilm=0; ilm<localMaxCol.size(); ilm++){ for(int ipt=0; ipt<extrapo_points.size(); ipt++){ TVector3 lm_pos = localMaxCol[ilm]->getPos(); float barLength = localMaxCol[ilm]->getBars()[0]->getBarLength(); if( fabs(extrapo_points[ipt].z()-lm_pos.z()) < settings.map_floatPars["ConeNearByDistance"] && - fabs(extrapo_points[ipt].Phi()-lm_pos.Phi()) < barLength/2./PandoraPlus::CaloUnit::ecal_innerR && + fabs(extrapo_points[ipt].Phi()-lm_pos.Phi()) < barLength/2./Cyber::CaloUnit::ecal_innerR && fabs(extrapo_points[ipt].Perp()-lm_pos.Perp()) < settings.map_floatPars["ConeNearByDistance"] ){ t_nearbyLocalMax.push_back(localMaxCol[ilm]); set_nearbyHalfClusters.insert(p_HalfCluster->at(ihc).get()); @@ -327,8 +327,8 @@ StatusCode TrackMatchingAlg::GetNearby(const std::vector<std::shared_ptr<Pandora StatusCode TrackMatchingAlg::LongiConeLinking(const std::vector<TVector3>& extrapo_points, - std::vector<const PandoraPlus::Calo1DCluster*>& nearbyLocalMax, - std::vector<const PandoraPlus::Calo1DCluster*>& cone_axis){ + std::vector<const Cyber::Calo1DCluster*>& nearbyLocalMax, + std::vector<const Cyber::Calo1DCluster*>& cone_axis){ // std::cout<<"yyy: calling longiConeLinking()"<<std::endl; if(nearbyLocalMax.size()==0 || extrapo_points.size()==0) return StatusCode::SUCCESS; @@ -372,7 +372,7 @@ StatusCode TrackMatchingAlg::LongiConeLinking(const std::vector<TVector3>& extra TVector3 lm_pos = nearbyLocalMax[il]->getPos(); float barLength = nearbyLocalMax[il]->getBars()[0]->getBarLength(); float distance_2d = sqrt( pow(extrapo_points[ip].z()-lm_pos.z(), 2) + pow(extrapo_points[ip].Perp()-lm_pos.Perp(), 2) ); - if( fabs(extrapo_points[ip].Phi()-lm_pos.Phi()) < barLength/2./PandoraPlus::CaloUnit::ecal_innerR && + if( fabs(extrapo_points[ip].Phi()-lm_pos.Phi()) < barLength/2./Cyber::CaloUnit::ecal_innerR && distance_2d < settings.map_floatPars["ConeSeedDistance"] && distance_2d < min_distance) { @@ -395,7 +395,7 @@ StatusCode TrackMatchingAlg::LongiConeLinking(const std::vector<TVector3>& extra // Linking while(nearbyLocalMax.size()>0){ // std::cout<<" yyy: nearbyLocalMax.size()="<<nearbyLocalMax.size()<<", linking it!"<<std::endl; - const PandoraPlus::Calo1DCluster* shower_in_axis = cone_axis.back(); + const Cyber::Calo1DCluster* shower_in_axis = cone_axis.back(); if(!shower_in_axis) break; if(isStopLinking(extrapo_points, shower_in_axis)) break; @@ -442,7 +442,7 @@ StatusCode TrackMatchingAlg::LongiConeLinking(const std::vector<TVector3>& extra bool TrackMatchingAlg::isStopLinking( const std::vector<TVector3>& extrapo_points, - const PandoraPlus::Calo1DCluster* final_cone_hit){ + const Cyber::Calo1DCluster* final_cone_hit){ double slayer = final_cone_hit->getSlayer(); if(slayer==1){ @@ -470,7 +470,7 @@ bool TrackMatchingAlg::isStopLinking( const std::vector<TVector3>& extrapo_point } -TVector2 TrackMatchingAlg::GetProjectedRelR( const PandoraPlus::Calo1DCluster* m_shower1, const PandoraPlus::Calo1DCluster* m_shower2 ){ +TVector2 TrackMatchingAlg::GetProjectedRelR( const Cyber::Calo1DCluster* m_shower1, const Cyber::Calo1DCluster* m_shower2 ){ TVector2 paxis1, paxis2; if(m_shower1->getSlayer()==1){ //For V-bars paxis1.Set(m_shower1->getPos().x(), m_shower1->getPos().y()); @@ -491,7 +491,7 @@ TVector2 TrackMatchingAlg::GetProjectedRelR( const PandoraPlus::Calo1DCluster* m } -TVector2 TrackMatchingAlg::GetProjectedAxis(const std::vector<TVector3>& extrapo_points, const PandoraPlus::Calo1DCluster* m_shower){ +TVector2 TrackMatchingAlg::GetProjectedAxis(const std::vector<TVector3>& extrapo_points, const Cyber::Calo1DCluster* m_shower){ int min_index=0; TVector2 distance(999., 999.); if( m_shower->getSlayer()==1 ){ // V plane @@ -545,17 +545,17 @@ TVector2 TrackMatchingAlg::GetProjectedAxis(const std::vector<TVector3>& extrapo } -StatusCode TrackMatchingAlg::CreatConeAxis(PandoraPlusDataCol& m_datacol, PandoraPlus::Track* track, std::vector<PandoraPlus::CaloHalfCluster*>& nearbyHalfClusters, - std::vector<const PandoraPlus::Calo1DCluster*>& cone_axis){ +StatusCode TrackMatchingAlg::CreatConeAxis(CyberDataCol& m_datacol, Cyber::Track* track, std::vector<Cyber::CaloHalfCluster*>& nearbyHalfClusters, + std::vector<const Cyber::Calo1DCluster*>& cone_axis){ // std::cout<<"yyy: Calling CreateConeAxis()"<<std::endl; if(nearbyHalfClusters.size()==0 || cone_axis.size()==0) return StatusCode::SUCCESS; for(int ihc=0; ihc<nearbyHalfClusters.size(); ihc++){ - std::vector<const PandoraPlus::Calo1DCluster*> localMaxCol = nearbyHalfClusters[ihc]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxCol = nearbyHalfClusters[ihc]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); // std::cout<<" yyy: for nearbyHalfClusters["<<ihc<<"], localMax are:" // Track axis candidate. - // PandoraPlus::CaloHalfCluster* t_track_axis = new PandoraPlus::CaloHalfCluster(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_track_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + // Cyber::CaloHalfCluster* t_track_axis = new Cyber::CaloHalfCluster(); + std::shared_ptr<Cyber::CaloHalfCluster> t_track_axis = std::make_shared<Cyber::CaloHalfCluster>(); for(int ica=0; ica<cone_axis.size(); ica++){ if( find(localMaxCol.begin(), localMaxCol.end(), cone_axis[ica]) != localMaxCol.end()){ t_track_axis->addUnit(cone_axis[ica]); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthClusterMergingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthClusterMergingAlg.cpp similarity index 92% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TruthClusterMergingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TruthClusterMergingAlg.cpp index 47abdaa13dd3016850040fbf1fbc93ce858ade0a..1e1471892df6ca3382572e65b1777282d1e56aba 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthClusterMergingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthClusterMergingAlg.cpp @@ -20,7 +20,7 @@ StatusCode TruthClusterMergingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TruthClusterMergingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthClusterMergingAlg::Initialize( CyberDataCol& m_datacol ){ for(int icl=0; icl<m_datacol.map_CaloCluster[settings.map_stringPars["ReadinECALClusters"]].size(); icl++) m_EcalClusterCol.push_back(m_datacol.map_CaloCluster[settings.map_stringPars["ReadinECALClusters"]][icl].get()); @@ -43,7 +43,7 @@ StatusCode TruthClusterMergingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode TruthClusterMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthClusterMergingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //cout<<" TruthClusterMergingAlg: input ECAL cluster size "<<m_EcalClusterCol.size()<<", HCAL cluster size "<<m_HcalClusterCol.size()<<endl; //cout<<" Print ECAL cluster energy: "<<endl; @@ -53,8 +53,8 @@ StatusCode TruthClusterMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ) //for(int ic=0; ic<m_HcalClusterCol.size(); ic++) // cout<<" #"<<ic<<" En = "<<m_HcalClusterCol[ic]->getHitsE()<<endl; - std::map<edm4hep::MCParticle, std::vector<const PandoraPlus::Calo3DCluster*>> map_ClusterCol_Ecal; - std::map<edm4hep::MCParticle, std::vector<const PandoraPlus::Calo3DCluster*>> map_ClusterCol_Hcal; + std::map<edm4hep::MCParticle, std::vector<const Cyber::Calo3DCluster*>> map_ClusterCol_Ecal; + std::map<edm4hep::MCParticle, std::vector<const Cyber::Calo3DCluster*>> map_ClusterCol_Hcal; for(int ic=0; ic<m_EcalClusterCol.size(); ic++){ auto mcp = m_EcalClusterCol[ic]->getLeadingMCP(); map_ClusterCol_Ecal[mcp].push_back( m_EcalClusterCol[ic] ); @@ -124,12 +124,12 @@ StatusCode TruthClusterMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ) for(auto& iter: map_ClusterCol_Ecal){ auto mcp = iter.first; - std::vector<const PandoraPlus::Calo3DCluster*> m_linkedEcalClus = iter.second; - std::vector<const PandoraPlus::Calo3DCluster*> m_linkedHcalClus = map_ClusterCol_Hcal[mcp]; + std::vector<const Cyber::Calo3DCluster*> m_linkedEcalClus = iter.second; + std::vector<const Cyber::Calo3DCluster*> m_linkedHcalClus = map_ClusterCol_Hcal[mcp]; if(m_linkedEcalClus.size()==0 && m_linkedHcalClus.size()==0) continue; - std::shared_ptr<PandoraPlus::PFObject> tmp_newpfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> tmp_newpfo = std::make_shared<Cyber::PFObject>(); double Emax = -99; int index = -1; for(int ic=0; ic<m_linkedEcalClus.size(); ic++){ @@ -139,7 +139,7 @@ StatusCode TruthClusterMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ) index = ic; } } - const PandoraPlus::Track* p_EcalLeadingTrk = nullptr; + const Cyber::Track* p_EcalLeadingTrk = nullptr; if(index>=0 && m_linkedEcalClus[index]->getAssociatedTracks().size()>0) p_EcalLeadingTrk = m_linkedEcalClus[index]->getAssociatedTracks()[0]; Emax = -99; index = -1; @@ -150,7 +150,7 @@ StatusCode TruthClusterMergingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ) index = ic; } } - const PandoraPlus::Track* p_HcalLeadingTrk = nullptr; + const Cyber::Track* p_HcalLeadingTrk = nullptr; if(index>=0 && m_linkedHcalClus[index]->getAssociatedTracks().size()>0) p_HcalLeadingTrk = m_linkedHcalClus[index]->getAssociatedTracks()[0]; if(!p_EcalLeadingTrk && p_HcalLeadingTrk) tmp_newpfo->addTrack(p_HcalLeadingTrk); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthClusteringAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthClusteringAlg.cpp similarity index 88% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TruthClusteringAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TruthClusteringAlg.cpp index cff2ea5eabe8fc42deda1206c634cd81d4eeefb0..ea4b7c117c69cb2e5481c7c96c8e05b75c43b98e 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthClusteringAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthClusteringAlg.cpp @@ -29,7 +29,7 @@ StatusCode TruthClusteringAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TruthClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthClusteringAlg::Initialize( CyberDataCol& m_datacol ){ m_TrackCol.clear(); m_bars.clear(); m_1dclusterUCol.clear(); @@ -49,13 +49,13 @@ StatusCode TruthClusteringAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode TruthClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthClusteringAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //ECAL clustering if(settings.map_boolPars["DoECALClustering"]){ //cout<<"Input bar size: "<<m_bars.size()<<endl; - std::map<edm4hep::MCParticle, std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> > map_barCol; map_barCol.clear(); + std::map<edm4hep::MCParticle, std::vector<std::shared_ptr<Cyber::CaloUnit>> > map_barCol; map_barCol.clear(); for(int ibar=0; ibar<m_bars.size(); ibar++){ if(settings.map_boolPars["UseSplit"]){ std::vector< std::pair<edm4hep::MCParticle, float> > m_linkVec = m_bars[ibar]->getLinkedMCP(); @@ -95,17 +95,17 @@ StatusCode TruthClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ for(auto& iter: map_barCol){ - std::map<int, std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> > m_orderedBars; m_orderedBars.clear(); + std::map<int, std::vector<std::shared_ptr<Cyber::CaloUnit>> > m_orderedBars; m_orderedBars.clear(); for(int ibar=0; ibar<iter.second.size(); ibar++) m_orderedBars[iter.second[ibar]->getDlayer()].push_back(iter.second[ibar]); //cout<<" MCP "<<iter.first.getPDG()<<" covers "<<m_orderedBars.size()<<"layers "<<endl; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_new1DClusUCol; m_new1DClusUCol.clear(); - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_new1DClusVCol; m_new1DClusVCol.clear(); + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_new1DClusUCol; m_new1DClusUCol.clear(); + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_new1DClusVCol; m_new1DClusVCol.clear(); for(auto& iter_bar: m_orderedBars){ - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_new1dclusterU = std::make_shared<PandoraPlus::Calo1DCluster>(); - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_new1dclusterV = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_new1dclusterU = std::make_shared<Cyber::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_new1dclusterV = std::make_shared<Cyber::Calo1DCluster>(); for(int ibar=0; ibar<iter_bar.second.size(); ibar++){ if(iter_bar.second[ibar]->getSlayer()==0) tmp_new1dclusterU->addUnit( iter_bar.second[ibar].get() ); if(iter_bar.second[ibar]->getSlayer()==1) tmp_new1dclusterV->addUnit( iter_bar.second[ibar].get() ); @@ -136,8 +136,8 @@ StatusCode TruthClusteringAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ m_1dclusterUCol.insert(m_1dclusterUCol.end(), m_new1DClusUCol.begin(), m_new1DClusUCol.end()); m_1dclusterVCol.insert(m_1dclusterVCol.end(), m_new1DClusVCol.begin(), m_new1DClusVCol.end()); - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newHFClusterU = std::make_shared<PandoraPlus::CaloHalfCluster>(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newHFClusterV = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newHFClusterU = std::make_shared<Cyber::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newHFClusterV = std::make_shared<Cyber::CaloHalfCluster>(); for(int i1d=0; i1d<m_new1DClusUCol.size(); i1d++) m_newHFClusterU->addUnit(m_new1DClusUCol[i1d].get()); for(int i1d=0; i1d<m_new1DClusVCol.size(); i1d++) @@ -224,7 +224,7 @@ cout<<endl; //HCAL clustering if(settings.map_boolPars["DoHCALClustering"]){ //cout<<"Input HCAL hit size "<<m_hits.size()<<endl; - std::map<edm4hep::MCParticle, std::vector<std::shared_ptr<PandoraPlus::CaloHit>> > map_hitCol; map_hitCol.clear(); + std::map<edm4hep::MCParticle, std::vector<std::shared_ptr<Cyber::CaloHit>> > map_hitCol; map_hitCol.clear(); for(int ihit=0; ihit<m_hits.size(); ihit++){ if(settings.map_boolPars["UseSplit"]){ std::vector< std::pair<edm4hep::MCParticle, float> > m_linkVec = m_hits[ihit]->getLinkedMCP(); @@ -267,7 +267,7 @@ cout<<endl; //} for(auto& iter: map_hitCol){ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_newCluster = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_newCluster = std::make_shared<Cyber::Calo3DCluster>(); for(int ihit=0; ihit<iter.second.size(); ihit++) m_newCluster->addHit( iter.second[ihit].get() ); m_newCluster->getLinkedMCPfromHit(); m_clusters.push_back(m_newCluster); @@ -309,15 +309,15 @@ StatusCode TruthClusteringAlg::ClearAlgorithm(){ return StatusCode::SUCCESS; }; -StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusU, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ){ +StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusU, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ){ m_towers.clear(); - std::map<std::vector<int>, std::vector<const PandoraPlus::CaloUnit*>> map_barCol; map_barCol.clear(); + std::map<std::vector<int>, std::vector<const Cyber::CaloUnit*>> map_barCol; map_barCol.clear(); for(int il=0; il<m_halfClusU.size(); il++){ for(int is=0; is<m_halfClusU[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; for(int ibar=0; ibar<p_shower->getBars().size(); ibar++){ std::vector<int> barID(2); barID[0] = p_shower->getBars()[ibar]->getModule(); @@ -328,7 +328,7 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< } for(int il=0; il<m_halfClusV.size(); il++){ for(int is=0; is<m_halfClusV[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; for(int ibar=0; ibar<p_shower->getBars().size(); ibar++){ std::vector<int> barID(2); barID[0] = p_shower->getBars()[ibar]->getModule(); @@ -346,12 +346,12 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< //Re-build the objects in tower for(auto& itower: map_barCol){ - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newHFClusUCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newHFClusVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo2DCluster>> m_new2DClusCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newHFClusUCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newHFClusVCol; + std::vector<std::shared_ptr<Cyber::Calo2DCluster>> m_new2DClusCol; //Get map for MCP-bars - std::map<edm4hep::MCParticle, std::vector<const PandoraPlus::CaloUnit*> > map_matchBar; + std::map<edm4hep::MCParticle, std::vector<const Cyber::CaloUnit*> > map_matchBar; for(int ibar=0; ibar<itower.second.size(); ibar++){ edm4hep::MCParticle mcp = itower.second[ibar]->getLeadingMCP(); map_matchBar[mcp].push_back(itower.second[ibar]); @@ -364,11 +364,11 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< //for(int ibar=0; ibar<iter.second.size(); ibar++){ //printf(" cellID (%d, %d, %d, %d, %d, %d), En %.3f \n", iter.second[ibar]->getModule(), iter.second[ibar]->getPart(), iter.second[ibar]->getStave(), iter.second[ibar]->getDlayer(), iter.second[ibar]->getSlayer(), iter.second[ibar]->getBar(), iter.second[ibar]->getEnergy()); //} - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_new1DClusUCol; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_new1DClusVCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_new1DClusUCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_new1DClusVCol; //Ordered bars - std::map<int, std::vector<const PandoraPlus::CaloUnit*> > m_orderedBars; m_orderedBars.clear(); + std::map<int, std::vector<const Cyber::CaloUnit*> > m_orderedBars; m_orderedBars.clear(); for(int ibar=0; ibar<iter.second.size(); ibar++) m_orderedBars[iter.second[ibar]->getDlayer()].push_back(iter.second[ibar]); @@ -378,8 +378,8 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< for(auto& iter_bar: m_orderedBars){ //cout<<" In layer #"<<iter_bar.first<<": bar size "<<iter_bar.second.size()<<endl; - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_new1dclusterU = std::make_shared<PandoraPlus::Calo1DCluster>(); - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_new1dclusterV = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_new1dclusterU = std::make_shared<Cyber::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_new1dclusterV = std::make_shared<Cyber::Calo1DCluster>(); for(int ibar=0; ibar<iter_bar.second.size(); ibar++){ if(iter_bar.second[ibar]->getSlayer()==0) tmp_new1dclusterU->addUnit( iter_bar.second[ibar] ); if(iter_bar.second[ibar]->getSlayer()==1) tmp_new1dclusterV->addUnit( iter_bar.second[ibar] ); @@ -399,7 +399,7 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< m_bkCol.map_1DCluster["bk1DCluster"].push_back(tmp_new1dclusterV); } if(tmp_new1dclusterU && tmp_new1dclusterV && tmp_new1dclusterU->getBars().size()>0 && tmp_new1dclusterV->getBars().size()>0){ - std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_block = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> tmp_block = std::make_shared<Cyber::Calo2DCluster>(); for(int ibar=0; ibar<iter_bar.second.size(); ibar++) tmp_block->addBar(iter_bar.second[ibar]); tmp_block->addUnit(tmp_new1dclusterU.get()); tmp_block->addUnit(tmp_new1dclusterV.get()); @@ -412,8 +412,8 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< //cout<<", 2DClus size "<<m_new2DClusCol.size()<<endl; //Half cluster - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newHFClusterU = std::make_shared<PandoraPlus::CaloHalfCluster>(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newHFClusterV = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newHFClusterU = std::make_shared<Cyber::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newHFClusterV = std::make_shared<Cyber::CaloHalfCluster>(); for(int i1d=0; i1d<m_new1DClusUCol.size(); i1d++) m_newHFClusterU->addUnit(m_new1DClusUCol[i1d].get()); for(int i1d=0; i1d<m_new1DClusVCol.size(); i1d++) @@ -428,12 +428,12 @@ StatusCode TruthClusteringAlg::HalfClusterToTowers( std::vector<std::shared_ptr< } //printf(" In tower [%d, %d, %d] HFClus size (%d, %d) \n", itower.first[0], itower.first[1], itower.first[2], m_newHFClusUCol.size(), m_newHFClusVCol.size()); //Form a tower - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); for(int ics=0; ics<m_newHFClusUCol.size(); ics++){ const_HFClusU.push_back(m_newHFClusUCol[ics].get()); } for(int ics=0; ics<m_newHFClusVCol.size(); ics++){ const_HFClusV.push_back(m_newHFClusVCol[ics].get()); } - std::shared_ptr<PandoraPlus::Calo3DCluster> m_tower = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_tower = std::make_shared<Cyber::Calo3DCluster>(); m_tower->addTowerID(itower.first); for(int i2d=0; i2d<m_new2DClusCol.size(); i2d++) m_tower->addUnit(m_new2DClusCol[i2d].get()); m_tower->setHalfClusters( settings.map_stringPars["OutputECALHalfClusters"]+"U", const_HFClusU, diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthEnergySplittingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthEnergySplittingAlg.cpp similarity index 85% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TruthEnergySplittingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TruthEnergySplittingAlg.cpp index c2f10d5f5662b445956f9550d2a865cd33641ab5..ceb323bb792eff19d17804a7f54ec6aaeb92005f 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthEnergySplittingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthEnergySplittingAlg.cpp @@ -18,7 +18,7 @@ StatusCode TruthEnergySplittingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TruthEnergySplittingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthEnergySplittingAlg::Initialize( CyberDataCol& m_datacol ){ p_HalfClusterU.clear(); p_HalfClusterV.clear(); @@ -34,24 +34,24 @@ StatusCode TruthEnergySplittingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode TruthEnergySplittingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthEnergySplittingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //cout<<" TruthEnergySplittingAlg: readin HFCluster size "<<p_HalfClusterU.size()<<", "<<p_HalfClusterV.size()<<endl; for(int ih=0; ih<p_HalfClusterU.size(); ih++){ - std::vector<const PandoraPlus::CaloHalfCluster*> m_axisUCol; + std::vector<const Cyber::CaloHalfCluster*> m_axisUCol; if( settings.map_stringPars["ReadinAxisName"] == "AllAxis" ) m_axisUCol = p_HalfClusterU[ih]->getAllHalfClusterCol(); else m_axisUCol = p_HalfClusterU[ih]->getHalfClusterCol(settings.map_stringPars["ReadinAxisName"]); - std::vector<const PandoraPlus::Calo1DCluster*> m_1dclusCol = p_HalfClusterU[ih]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> m_1dclusCol = p_HalfClusterU[ih]->getCluster(); //cout<<" In HFU #"<<ih<<": axis size "<<m_axisUCol.size()<<", 1DCluster size "<<m_1dclusCol.size()<<endl; for(int iax=0; iax<m_axisUCol.size(); iax++){ edm4hep::MCParticle truthMCP_axis = m_axisUCol[iax]->getLeadingMCP(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newClus = std::make_shared<Cyber::CaloHalfCluster>(); //cout<<" Axis #"<<iax<<": track size "<<m_axisUCol[iax]->getAssociatedTracks().size()<<", truth MC pid "<<truthMCP_axis.getPDG()<<endl; for(int ish=0; ish<m_1dclusCol.size(); ish++){ - std::shared_ptr<PandoraPlus::Calo1DCluster> m_shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_shower = std::make_shared<Cyber::Calo1DCluster>(); //cout<<" 1D cluster #"<<ish<<": bar size "<<m_1dclusCol[ish]->getBars().size(); for(int ibar=0; ibar<m_1dclusCol[ish]->getBars().size(); ibar++){ auto truthMap = m_1dclusCol[ish]->getBars()[ibar]->getLinkedMCP(); @@ -105,20 +105,20 @@ StatusCode TruthEnergySplittingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol //cout<<" Splitted HFClusterU size after merging "<<m_newClusUCol.size()<<endl; for(int ih=0; ih<p_HalfClusterV.size(); ih++){ - std::vector<const PandoraPlus::CaloHalfCluster*> m_axisVCol; + std::vector<const Cyber::CaloHalfCluster*> m_axisVCol; if( settings.map_stringPars["ReadinAxisName"] == "AllAxis" ) m_axisVCol = p_HalfClusterV[ih]->getAllHalfClusterCol(); else m_axisVCol = p_HalfClusterV[ih]->getHalfClusterCol(settings.map_stringPars["ReadinAxisName"]); - std::vector<const PandoraPlus::Calo1DCluster*> m_1dclusCol = p_HalfClusterV[ih]->getCluster(); + std::vector<const Cyber::Calo1DCluster*> m_1dclusCol = p_HalfClusterV[ih]->getCluster(); //cout<<" In HFV #"<<ih<<": axis size "<<m_axisVCol.size()<<", 1DCluster size "<<m_1dclusCol.size()<<endl; for(int iax=0; iax<m_axisVCol.size(); iax++){ edm4hep::MCParticle truthMCP_axis = m_axisVCol[iax]->getLeadingMCP(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newClus = std::make_shared<Cyber::CaloHalfCluster>(); //cout<<" Axis #"<<iax<<": track size "<<m_axisVCol[iax]->getAssociatedTracks().size()<<", truth MC pid "<<truthMCP_axis.getPDG()<<endl; for(int ish=0; ish<m_1dclusCol.size(); ish++){ - std::shared_ptr<PandoraPlus::Calo1DCluster> m_shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_shower = std::make_shared<Cyber::Calo1DCluster>(); for(int ibar=0; ibar<m_1dclusCol[ish]->getBars().size(); ibar++){ auto truthMap = m_1dclusCol[ish]->getBars()[ibar]->getLinkedMCP(); for(auto& iter: truthMap){ @@ -245,16 +245,16 @@ StatusCode TruthEnergySplittingAlg::ClearAlgorithm(){ -StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusU, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ) +StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusU, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ) { m_towers.clear(); - std::map<std::vector<int>, std::vector<const PandoraPlus::Calo2DCluster*> > map_2DCluster; - std::map<std::vector<int>, std::vector<PandoraPlus::CaloHalfCluster*> > map_HalfClusterU; - std::map<std::vector<int>, std::vector<PandoraPlus::CaloHalfCluster*> > map_HalfClusterV; + std::map<std::vector<int>, std::vector<const Cyber::Calo2DCluster*> > map_2DCluster; + std::map<std::vector<int>, std::vector<Cyber::CaloHalfCluster*> > map_HalfClusterU; + std::map<std::vector<int>, std::vector<Cyber::CaloHalfCluster*> > map_HalfClusterV; //Split CaloHalfClusterU for(int il=0; il<m_halfClusU.size(); il++){ @@ -269,9 +269,9 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared } //CaloHalfCluster covers towers: Loop check showers. - std::map<std::vector<int>, PandoraPlus::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); + std::map<std::vector<int>, Cyber::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); for(int is=0; is<m_halfClusU[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; if(p_shower->getSeeds().size()==0){ std::cout<<" HalfClusterToTowers ERROR: No Seed in 1DShower, Check! "<<std::endl; @@ -286,7 +286,7 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared tmp_LongiClusMaps[seedID]->setTowerID( seedID ); } else{ - std::shared_ptr<PandoraPlus::CaloHalfCluster> tmp_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> tmp_clus = std::make_shared<Cyber::CaloHalfCluster>(); tmp_clus->addUnit( p_shower ); tmp_clus->setTowerID( seedID ); tmp_LongiClusMaps[seedID] = tmp_clus.get(); @@ -337,9 +337,9 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared } //CaloHalfCluster covers towers: Loop check showers. - std::map<std::vector<int>, PandoraPlus::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); + std::map<std::vector<int>, Cyber::CaloHalfCluster* > tmp_LongiClusMaps; tmp_LongiClusMaps.clear(); for(int is=0; is<m_halfClusV[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; if(p_shower->getSeeds().size()==0){ std::cout<<" HalfClusterToTowers ERROR: No Seed in 1DShower, Check! "<<std::endl; continue; @@ -353,7 +353,7 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared tmp_LongiClusMaps[seedID]->setTowerID( seedID ); } else{ - std::shared_ptr<PandoraPlus::CaloHalfCluster> tmp_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> tmp_clus = std::make_shared<Cyber::CaloHalfCluster>(); tmp_clus->addUnit( p_shower ); tmp_clus->setTowerID( seedID ); tmp_LongiClusMaps[seedID] = tmp_clus.get(); @@ -399,12 +399,12 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared continue; } - std::vector<PandoraPlus::CaloHalfCluster*> p_halfClusU = iterU.second; - std::vector<PandoraPlus::CaloHalfCluster*> p_halfClusV = map_HalfClusterV[iterU.first]; + std::vector<Cyber::CaloHalfCluster*> p_halfClusU = iterU.second; + std::vector<Cyber::CaloHalfCluster*> p_halfClusV = map_HalfClusterV[iterU.first]; //Get ordered showers for looping in layers. - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*>> m_orderedShowerU; m_orderedShowerU.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*>> m_orderedShowerV; m_orderedShowerV.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*>> m_orderedShowerU; m_orderedShowerU.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*>> m_orderedShowerV; m_orderedShowerV.clear(); for(int ic=0; ic<p_halfClusU.size(); ic++){ for(int is=0; is<p_halfClusU.at(ic)->getCluster().size(); is++) @@ -418,10 +418,10 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared //Create super-layers (block) - std::vector<const PandoraPlus::Calo2DCluster*> m_blocks; m_blocks.clear(); + std::vector<const Cyber::Calo2DCluster*> m_blocks; m_blocks.clear(); for(auto &iter1 : m_orderedShowerU){ if( m_orderedShowerV.find( iter1.first )==m_orderedShowerV.end() ) continue; - std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_block = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> tmp_block = std::make_shared<Cyber::Calo2DCluster>(); for(int is=0; is<iter1.second.size(); is++) tmp_block->addUnit( iter1.second.at(is) ); for(int is=0; is<m_orderedShowerV[iter1.first].size(); is++) tmp_block->addUnit( m_orderedShowerV[iter1.first].at(is) ); tmp_block->setTowerID( iterU.first ); @@ -441,7 +441,7 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared std::vector<int> m_towerID = iter.first; //printf(" In tower: [%d, %d, %d] \n", m_towerID[0], m_towerID[1], m_towerID[2]); //Check cousin clusters: - std::vector<PandoraPlus::CaloHalfCluster*> m_HFClusUInTower = map_HalfClusterU[m_towerID]; + std::vector<Cyber::CaloHalfCluster*> m_HFClusUInTower = map_HalfClusterU[m_towerID]; for(auto &m_HFclus : m_HFClusUInTower){ std::vector<const CaloHalfCluster*> tmp_delClus; tmp_delClus.clear(); //printf(" Check the cousin of HFClus %p: cousin size %d \n",m_HFclus, m_HFclus->getHalfClusterCol("CousinCluster").size()); @@ -457,7 +457,7 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared for(int ics=0; ics<tmp_delClus.size(); ics++) m_HFclus->deleteCousinCluster( tmp_delClus[ics] ); } - std::vector<PandoraPlus::CaloHalfCluster*> m_HFClusVInTower = map_HalfClusterV[m_towerID]; + std::vector<Cyber::CaloHalfCluster*> m_HFClusVInTower = map_HalfClusterV[m_towerID]; for(auto &m_HFclus : m_HFClusVInTower){ std::vector<const CaloHalfCluster*> tmp_delClus; tmp_delClus.clear(); //printf(" Check the cousin of HFClus %p: cousin size %d \n",m_HFclus, m_HFclus->getHalfClusterCol("CousinCluster").size()); @@ -474,12 +474,12 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared } //Convert to const - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); for(int ics=0; ics<m_HFClusUInTower.size(); ics++){ m_HFClusUInTower[ics]->getLinkedMCPfromUnit(); const_HFClusU.push_back(m_HFClusUInTower[ics]); } for(int ics=0; ics<m_HFClusVInTower.size(); ics++){ m_HFClusVInTower[ics]->getLinkedMCPfromUnit(); const_HFClusV.push_back(m_HFClusVInTower[ics]); } - std::shared_ptr<PandoraPlus::Calo3DCluster> m_tower = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_tower = std::make_shared<Cyber::Calo3DCluster>(); //printf("Creating tower: [%d, %d, %d] \n", m_towerID[0], m_towerID[1], m_towerID[2]); m_tower->addTowerID( m_towerID ); for(int i2d=0; i2d<map_2DCluster[m_towerID].size(); i2d++) m_tower->addUnit(map_2DCluster[m_towerID][i2d]); @@ -495,15 +495,15 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared /* -StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusU, - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_halfClusV, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_towers ){ +StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusU, + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_halfClusV, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_towers ){ m_towers.clear(); - std::map<std::vector<int>, std::vector<const PandoraPlus::CaloUnit*>> map_barCol; map_barCol.clear(); + std::map<std::vector<int>, std::vector<const Cyber::CaloUnit*>> map_barCol; map_barCol.clear(); for(int il=0; il<m_halfClusU.size(); il++){ for(int is=0; is<m_halfClusU[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusU[il]->getCluster()[is]; for(int ibar=0; ibar<p_shower->getBars().size(); ibar++){ std::vector<int> barID(3); barID[0] = p_shower->getBars()[ibar]->getModule(); @@ -515,7 +515,7 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared } for(int il=0; il<m_halfClusV.size(); il++){ for(int is=0; is<m_halfClusV[il]->getCluster().size(); is++){ - const PandoraPlus::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; + const Cyber::Calo1DCluster* p_shower = m_halfClusV[il]->getCluster()[is]; for(int ibar=0; ibar<p_shower->getBars().size(); ibar++){ std::vector<int> barID(3); barID[0] = p_shower->getBars()[ibar]->getModule(); @@ -528,12 +528,12 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared //Re-build the objects in tower for(auto& itower: map_barCol){ - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newHFClusUCol; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newHFClusVCol; - std::vector<std::shared_ptr<PandoraPlus::Calo2DCluster>> m_new2DClusCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newHFClusUCol; + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newHFClusVCol; + std::vector<std::shared_ptr<Cyber::Calo2DCluster>> m_new2DClusCol; //Get map for MCP-bars - std::map<edm4hep::MCParticle, std::vector<const PandoraPlus::CaloUnit*> > map_matchBar; + std::map<edm4hep::MCParticle, std::vector<const Cyber::CaloUnit*> > map_matchBar; for(int ibar=0; ibar<itower.second.size(); ibar++){ edm4hep::MCParticle mcp = itower.second[ibar]->getLeadingMCP(); map_matchBar[mcp].push_back(itower.second[ibar]); @@ -545,19 +545,19 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared //for(int ibar=0; ibar<iter.second.size(); ibar++){ //printf(" cellID (%d, %d, %d, %d, %d, %d), En %.3f \n", iter.second[ibar]->getModule(), iter.second[ibar]->getPart(), iter.second[ibar]->getStave(), iter.second[ibar]->getDlayer(), iter.second[ibar]->getSlayer(), iter.second[ibar]->getBar(), iter.second[ibar]->getEnergy()); //} - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_new1DClusUCol; - std::vector<std::shared_ptr<PandoraPlus::Calo1DCluster>> m_new1DClusVCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_new1DClusUCol; + std::vector<std::shared_ptr<Cyber::Calo1DCluster>> m_new1DClusVCol; //Ordered bars - std::map<int, std::vector<const PandoraPlus::CaloUnit*> > m_orderedBars; m_orderedBars.clear(); + std::map<int, std::vector<const Cyber::CaloUnit*> > m_orderedBars; m_orderedBars.clear(); for(int ibar=0; ibar<iter.second.size(); ibar++) m_orderedBars[iter.second[ibar]->getDlayer()].push_back(iter.second[ibar]); //1D&2D cluster for(auto& iter_bar: m_orderedBars){ //cout<<" In layer #"<<iter_bar.first<<": bar size "<<iter_bar.second.size()<<endl; - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_new1dclusterU = std::make_shared<PandoraPlus::Calo1DCluster>(); - std::shared_ptr<PandoraPlus::Calo1DCluster> tmp_new1dclusterV = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_new1dclusterU = std::make_shared<Cyber::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> tmp_new1dclusterV = std::make_shared<Cyber::Calo1DCluster>(); for(int ibar=0; ibar<iter_bar.second.size(); ibar++){ if(iter_bar.second[ibar]->getSlayer()==0) tmp_new1dclusterU->addUnit( iter_bar.second[ibar] ); if(iter_bar.second[ibar]->getSlayer()==1) tmp_new1dclusterV->addUnit( iter_bar.second[ibar] ); @@ -577,7 +577,7 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared m_bkCol.map_1DCluster["bk1DCluster"].push_back(tmp_new1dclusterV); } if(tmp_new1dclusterU && tmp_new1dclusterV && tmp_new1dclusterU->getBars().size()>0 && tmp_new1dclusterV->getBars().size()>0){ - std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_block = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> tmp_block = std::make_shared<Cyber::Calo2DCluster>(); for(int ibar=0; ibar<iter_bar.second.size(); ibar++) tmp_block->addBar(iter_bar.second[ibar]); tmp_block->addUnit(tmp_new1dclusterU.get()); tmp_block->addUnit(tmp_new1dclusterV.get()); @@ -589,8 +589,8 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared //cout<<" 1DClusU size "<<m_new1DClusUCol.size()<<", 1DClusV size "<<m_new1DClusVCol.size(); //cout<<", 2DClus size "<<m_new2DClusCol.size()<<endl; //Half cluster - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newHFClusterU = std::make_shared<PandoraPlus::CaloHalfCluster>(); - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_newHFClusterV = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newHFClusterU = std::make_shared<Cyber::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> m_newHFClusterV = std::make_shared<Cyber::CaloHalfCluster>(); for(int i1d=0; i1d<m_new1DClusUCol.size(); i1d++) m_newHFClusterU->addUnit(m_new1DClusUCol[i1d].get()); for(int i1d=0; i1d<m_new1DClusVCol.size(); i1d++) @@ -605,12 +605,12 @@ StatusCode TruthEnergySplittingAlg::HalfClusterToTowers( std::vector<std::shared } //Form a tower - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusU; const_HFClusU.clear(); + std::vector<const Cyber::CaloHalfCluster*> const_HFClusV; const_HFClusV.clear(); for(int ics=0; ics<m_newHFClusUCol.size(); ics++){ const_HFClusU.push_back(m_newHFClusUCol[ics].get()); } for(int ics=0; ics<m_newHFClusVCol.size(); ics++){ const_HFClusV.push_back(m_newHFClusVCol[ics].get()); } - std::shared_ptr<PandoraPlus::Calo3DCluster> m_tower = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> m_tower = std::make_shared<Cyber::Calo3DCluster>(); m_tower->addTowerID(itower.first); for(int i2d=0; i2d<m_new2DClusCol.size(); i2d++) m_tower->addUnit(m_new2DClusCol[i2d].get()); m_tower->setHalfClusters( settings.map_stringPars["OutputClusName"]+"U", const_HFClusU, diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthMatchingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthMatchingAlg.cpp similarity index 82% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TruthMatchingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TruthMatchingAlg.cpp index ee4f5064a7358204cac5bfc6b4d7d73dac5af873..26d26f6e6741c59ecef0af2b494228beb2123144 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthMatchingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthMatchingAlg.cpp @@ -14,7 +14,7 @@ StatusCode TruthMatchingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TruthMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthMatchingAlg::Initialize( CyberDataCol& m_datacol ){ std::cout<<"Initialize TruthMatchingAlg"<<std::endl; m_HFClusUCol.clear(); @@ -30,12 +30,12 @@ StatusCode TruthMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ return StatusCode::SUCCESS; }; -StatusCode TruthMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthMatchingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //cout<<"TruthMatchingAlg: readin tower size "<<m_towerCol.size()<<endl; for(int it=0; it<m_towerCol.size(); it++){ - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> tmp_clusters; tmp_clusters.clear(); + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> tmp_clusters; tmp_clusters.clear(); m_HFClusUCol = m_towerCol.at(it)->getHalfClusterUCol(settings.map_stringPars["ReadinHFClusterName"]+"U"); m_HFClusVCol = m_towerCol.at(it)->getHalfClusterVCol(settings.map_stringPars["ReadinHFClusterName"]+"V"); //cout<<" In tower #"<<it<<": HFCluster size "<<m_HFClusUCol.size()<<", "<<m_HFClusVCol.size()<<endl; @@ -87,13 +87,13 @@ StatusCode TruthMatchingAlg::ClearAlgorithm(){ }; -StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloHalfCluster*>& m_ClUCol, - std::vector<const PandoraPlus::CaloHalfCluster*>& m_ClVCol, - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>>& m_clusters ) +StatusCode TruthMatchingAlg::TruthMatching( std::vector<const Cyber::CaloHalfCluster*>& m_ClUCol, + std::vector<const Cyber::CaloHalfCluster*>& m_ClVCol, + std::vector<std::shared_ptr<Cyber::Calo3DCluster>>& m_clusters ) { if(m_ClUCol.size()==0 || m_ClVCol.size()==0) return StatusCode::SUCCESS; - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_truthESClUCol; m_truthESClUCol.clear(); - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_truthESClVCol; m_truthESClVCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_truthESClUCol; m_truthESClUCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_truthESClVCol; m_truthESClVCol.clear(); //cout<<" Input HFCluster size "<<m_ClUCol.size()<<", "<<m_ClVCol.size()<<endl; @@ -113,12 +113,12 @@ StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloH for(auto& iter: truthMap ){ if(iter.second<0.05) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> newClus = std::make_shared<Cyber::CaloHalfCluster>(); //Copy and reweight 1D showers in HFCluster for(int ish=0; ish<m_ClUCol[icl]->getCluster().size(); ish++){ - const PandoraPlus::Calo1DCluster* p_shower = m_ClUCol[icl]->getCluster()[ish]; + const Cyber::Calo1DCluster* p_shower = m_ClUCol[icl]->getCluster()[ish]; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); for(int ibar=0; ibar<p_shower->getCluster().size(); ibar++){ auto bar = p_shower->getCluster()[ibar]->Clone(); bar->setQ(bar->getQ1()*iter.second, bar->getQ2()*iter.second ); @@ -128,7 +128,7 @@ StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloH m_bkCol.map_BarCol["bkBar"].push_back(bar); } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->setSeed(); shower->setIDInfo(); @@ -180,12 +180,12 @@ StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloH for(auto iter: truthMap ){ if(iter.second<0.05) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> newClus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> newClus = std::make_shared<Cyber::CaloHalfCluster>(); //Copy and reweight 1D showers in HFCluster for(int ish=0; ish<m_ClVCol[icl]->getCluster().size(); ish++){ - const PandoraPlus::Calo1DCluster* p_shower = m_ClVCol[icl]->getCluster()[ish]; + const Cyber::Calo1DCluster* p_shower = m_ClVCol[icl]->getCluster()[ish]; - std::vector<const PandoraPlus::CaloUnit*> Bars; Bars.clear(); + std::vector<const Cyber::CaloUnit*> Bars; Bars.clear(); for(int ibar=0; ibar<p_shower->getCluster().size(); ibar++){ auto bar = p_shower->getCluster()[ibar]->Clone(); bar->setQ(bar->getQ1()*iter.second, bar->getQ2()*iter.second ); @@ -194,7 +194,7 @@ StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloH Bars.push_back(bar.get()); m_bkCol.map_BarCol["bkBar"].push_back(bar); } - std::shared_ptr<PandoraPlus::Calo1DCluster> shower = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> shower = std::make_shared<Cyber::Calo1DCluster>(); shower->setBars(Bars); shower->setSeed(); shower->setIDInfo(); @@ -234,7 +234,7 @@ StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloH for(int icl=0; icl<m_truthESClUCol.size(); icl++){ for(int jcl=0; jcl<m_truthESClVCol.size(); jcl++){ if(m_truthESClUCol[icl]->getLeadingMCP() == m_truthESClVCol[jcl]->getLeadingMCP()){ - std::shared_ptr<PandoraPlus::Calo3DCluster> tmp_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> tmp_clus = std::make_shared<Cyber::Calo3DCluster>(); XYClusterMatchingL0(m_truthESClUCol[icl].get(), m_truthESClVCol[jcl].get(), tmp_clus); m_clusters.push_back(tmp_clus); } @@ -246,9 +246,9 @@ StatusCode TruthMatchingAlg::TruthMatching( std::vector<const PandoraPlus::CaloH //Longitudinal cluster: 1*1 -StatusCode TruthMatchingAlg::XYClusterMatchingL0( const PandoraPlus::CaloHalfCluster* m_longiClU, - const PandoraPlus::CaloHalfCluster* m_longiClV, - std::shared_ptr<PandoraPlus::Calo3DCluster>& m_clus ) +StatusCode TruthMatchingAlg::XYClusterMatchingL0( const Cyber::CaloHalfCluster* m_longiClU, + const Cyber::CaloHalfCluster* m_longiClV, + std::shared_ptr<Cyber::Calo3DCluster>& m_clus ) { /* cout<<" XYClusterMatchingL0: print input HFClusterU. "; @@ -279,8 +279,8 @@ cout<<endl; */ std::vector<int> layerindex; layerindex.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> > map_showersUinlayer; map_showersUinlayer.clear(); - std::map<int, std::vector<const PandoraPlus::Calo1DCluster*> > map_showersVinlayer; map_showersVinlayer.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*> > map_showersUinlayer; map_showersUinlayer.clear(); + std::map<int, std::vector<const Cyber::Calo1DCluster*> > map_showersVinlayer; map_showersVinlayer.clear(); for(int is=0; is<m_longiClU->getCluster().size(); is++){ int m_layer = m_longiClU->getCluster()[is]->getDlayer(); @@ -296,25 +296,25 @@ cout<<endl; //cout<<" in XYClusterMatchingL0: "<<layerindex.size()<<" layer need matching"<<endl; for(int il=0; il<layerindex.size(); il++){ - std::vector<const PandoraPlus::Calo1DCluster*> m_showerXcol = map_showersUinlayer[layerindex[il]]; - std::vector<const PandoraPlus::Calo1DCluster*> m_showerYcol = map_showersVinlayer[layerindex[il]]; + std::vector<const Cyber::Calo1DCluster*> m_showerXcol = map_showersUinlayer[layerindex[il]]; + std::vector<const Cyber::Calo1DCluster*> m_showerYcol = map_showersVinlayer[layerindex[il]]; - std::vector<PandoraPlus::Calo2DCluster*> m_showerinlayer; m_showerinlayer.clear(); + std::vector<Cyber::Calo2DCluster*> m_showerinlayer; m_showerinlayer.clear(); //cout<<" in layer "<<layerindex[il]<<": 1D shower size ("<<m_showerXcol.size()<<", "<<m_showerYcol.size()<<"). "<<endl; if(m_showerXcol.size()==0 || m_showerYcol.size()==0) continue; //else if(m_showerXcol.size()==0){ - // std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + // std::shared_ptr<Cyber::Calo2DCluster> tmp_shower = std::make_shared<Cyber::Calo2DCluster>(); // GetMatchedShowerFromEmpty(m_showerYcol[0], m_longiClU, tmp_shower.get()); // //m_showerinlayer.push_back(tmp_shower.get()); // //m_bkCol.map_2DCluster["bk2DCluster"].push_back(tmp_shower); //} //else if(m_showerYcol.size()==0){ - // std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + // std::shared_ptr<Cyber::Calo2DCluster> tmp_shower = std::make_shared<Cyber::Calo2DCluster>(); // GetMatchedShowerFromEmpty(m_showerXcol[0], m_longiClU, tmp_shower.get()); //} else if(m_showerXcol.size()==1 && m_showerYcol.size()==1){ - std::shared_ptr<PandoraPlus::Calo2DCluster> tmp_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> tmp_shower = std::make_shared<Cyber::Calo2DCluster>(); GetMatchedShowersL0(m_showerXcol[0], m_showerYcol[0], tmp_shower.get()); m_showerinlayer.push_back(tmp_shower.get()); m_bkCol.map_2DCluster["bk2DCluster"].push_back(tmp_shower); @@ -342,13 +342,13 @@ cout<<endl; } -StatusCode TruthMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1DCluster* barShowerU, - const PandoraPlus::Calo1DCluster* barShowerV, - PandoraPlus::Calo2DCluster* outsh ) +StatusCode TruthMatchingAlg::GetMatchedShowersL0( const Cyber::Calo1DCluster* barShowerU, + const Cyber::Calo1DCluster* barShowerV, + Cyber::Calo2DCluster* outsh ) { //cout<<" In GetMatchedShowersL0"<<endl; - std::vector<const PandoraPlus::CaloHit*> m_digiCol; m_digiCol.clear(); + std::vector<const Cyber::CaloHit*> m_digiCol; m_digiCol.clear(); int NbarsX = barShowerU->getBars().size(); int NbarsY = barShowerV->getBars().size(); if(NbarsX==0 || NbarsY==0){ std::cout<<"WARNING: empty DigiHitsCol returned!"<<std::endl; return StatusCode::SUCCESS; } @@ -356,7 +356,7 @@ StatusCode TruthMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1DClust //if(barShowerU->getTowerID().size()==0) { barShowerU->setIDInfo(); } int _module = barShowerU->getTowerID()[0][0]; - float rotAngle = -_module*TMath::TwoPi()/PandoraPlus::CaloUnit::Nmodule; + float rotAngle = -_module*TMath::TwoPi()/Cyber::CaloUnit::Nmodule; for(int ibar=0;ibar<NbarsX;ibar++){ double En_x = barShowerU->getBars()[ibar]->getEnergy(); @@ -372,7 +372,7 @@ StatusCode TruthMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1DClust p_hit.RotateZ(-rotAngle); double m_Ehit = En_x*En_y/barShowerV->getEnergy() + En_x*En_y/barShowerU->getEnergy(); //Create new CaloHit - std::shared_ptr<PandoraPlus::CaloHit> hit = std::make_shared<PandoraPlus::CaloHit>(); + std::shared_ptr<Cyber::CaloHit> hit = std::make_shared<Cyber::CaloHit>(); //hit.setCellID(0); hit->setPosition(p_hit); hit->setEnergy(m_Ehit); @@ -390,9 +390,9 @@ StatusCode TruthMatchingAlg::GetMatchedShowersL0( const PandoraPlus::Calo1DClust } -StatusCode TruthMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1DCluster* shower1, - std::vector<const PandoraPlus::Calo1DCluster*>& showerNCol, - std::vector<PandoraPlus::Calo2DCluster*>& outshCol ) +StatusCode TruthMatchingAlg::GetMatchedShowersL1( const Cyber::Calo1DCluster* shower1, + std::vector<const Cyber::Calo1DCluster*>& showerNCol, + std::vector<Cyber::Calo2DCluster*>& outshCol ) { //cout<<" GetMatchedShowersL1: input shower size: 1 * "<<showerNCol.size()<<endl; outshCol.clear(); @@ -405,10 +405,10 @@ StatusCode TruthMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1DClust for(int is=0;is<NshY;is++){ EshY[is] = showerNCol[is]->getEnergy(); totE_shY += EshY[is]; } for(int is=0;is<NshY;is++){ double wi_E = EshY[is]/totE_shY; - std::shared_ptr<PandoraPlus::Calo1DCluster> m_splitshower1 = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> m_splitshower1 = std::make_shared<Cyber::Calo1DCluster>(); m_bkCol.map_1DCluster["bk1DCluster"].push_back( m_splitshower1 ); - std::shared_ptr<PandoraPlus::CaloUnit> m_wiseed = nullptr; + std::shared_ptr<Cyber::CaloUnit> m_wiseed = nullptr; if(shower1->getSeeds().size()>0) m_wiseed = shower1->getSeeds()[0]->Clone(); else{ cout<<"ERROR: Input shower has no seed! Check! Use the most energitic bar as seed. bar size: "<<shower1->getBars().size()<<endl; double m_maxE = -99; @@ -421,9 +421,9 @@ StatusCode TruthMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1DClust m_wiseed->setQ( wi_E*m_wiseed->getQ1(), wi_E*m_wiseed->getQ2() ); m_bkCol.map_BarCol["bkBar"].push_back( m_wiseed ); - std::vector<const PandoraPlus::CaloUnit*> m_wibars; m_wibars.clear(); + std::vector<const Cyber::CaloUnit*> m_wibars; m_wibars.clear(); for(int ib=0;ib<shower1->getBars().size();ib++){ - std::shared_ptr<PandoraPlus::CaloUnit> m_wibar = shower1->getBars()[ib]->Clone(); + std::shared_ptr<Cyber::CaloUnit> m_wibar = shower1->getBars()[ib]->Clone(); m_wibar->setQ(wi_E*m_wibar->getQ1(), wi_E*m_wibar->getQ2()); m_wibars.push_back(m_wibar.get()); m_bkCol.map_BarCol["bkBar"].push_back( m_wibar ); @@ -431,7 +431,7 @@ StatusCode TruthMatchingAlg::GetMatchedShowersL1( const PandoraPlus::Calo1DClust m_splitshower1->setBars( m_wibars ); m_splitshower1->addSeed( m_wiseed.get() ); m_splitshower1->setIDInfo(); - std::shared_ptr<PandoraPlus::Calo2DCluster> m_shower = std::make_shared<PandoraPlus::Calo2DCluster>(); + std::shared_ptr<Cyber::Calo2DCluster> m_shower = std::make_shared<Cyber::Calo2DCluster>(); if(_slayer==0 ) GetMatchedShowersL0( m_splitshower1.get(), showerNCol[is], m_shower.get() ); else GetMatchedShowersL0( showerNCol[is], m_splitshower1.get(), m_shower.get() ); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthPatternRecAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthPatternRecAlg.cpp similarity index 88% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TruthPatternRecAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TruthPatternRecAlg.cpp index 6e13132cccf11d8e92cda0a2d4f7eb5f0f36a8bf..27587287b428e7a226b1e027d76302850ef64d56 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthPatternRecAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthPatternRecAlg.cpp @@ -24,7 +24,7 @@ StatusCode TruthPatternRecAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TruthPatternRecAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthPatternRecAlg::Initialize( CyberDataCol& m_datacol ){ p_HalfClusterU.clear(); p_HalfClusterV.clear(); @@ -37,13 +37,13 @@ StatusCode TruthPatternRecAlg::Initialize( PandoraPlusDataCol& m_datacol ){ }; -StatusCode TruthPatternRecAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthPatternRecAlg::RunAlgorithm( CyberDataCol& m_datacol ){ //cout<<" TruthPatternRecAlg: Input HFCluster size ("<<p_HalfClusterU.size()<<", "<<p_HalfClusterV.size()<<") "<<endl; for(int ihc=0; ihc<p_HalfClusterU.size(); ihc++){ std::map<edm4hep::MCParticle, std::vector<const Calo1DCluster*>> TruthAxesMap; - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMaxUCol = p_HalfClusterU[ihc]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> tmp_localMaxUCol = p_HalfClusterU[ihc]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int ilm=0; ilm<tmp_localMaxUCol.size(); ilm++){ edm4hep::MCParticle mcp_lm = tmp_localMaxUCol[ilm]->getLeadingMCP(); TruthAxesMap[mcp_lm].push_back(tmp_localMaxUCol[ilm]); @@ -54,11 +54,11 @@ StatusCode TruthPatternRecAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // printf(" MCP id %d: localMax size %d \n", iter.first.getPDG(), iter.second.size()); //Create axes from MCPMap. - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> axisCol; axisCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> axisCol; axisCol.clear(); for(auto& iter : TruthAxesMap){ if(iter.second.size()==0) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> t_axis = std::make_shared<Cyber::CaloHalfCluster>(); for(int icl=0; icl<iter.second.size(); icl++) t_axis->addUnit(iter.second[icl]); t_axis->setType(100); t_axis->getLinkedMCPfromUnit(); @@ -75,7 +75,7 @@ StatusCode TruthPatternRecAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ for(int ihc=0; ihc<p_HalfClusterV.size(); ihc++){ std::map<edm4hep::MCParticle, std::vector<const Calo1DCluster*>> TruthAxesMap; - std::vector<const PandoraPlus::Calo1DCluster*> tmp_localMaxVCol = p_HalfClusterV[ihc]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> tmp_localMaxVCol = p_HalfClusterV[ihc]->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); for(int ilm=0; ilm<tmp_localMaxVCol.size(); ilm++){ edm4hep::MCParticle mcp_lm = tmp_localMaxVCol[ilm]->getLeadingMCP(); TruthAxesMap[mcp_lm].push_back(tmp_localMaxVCol[ilm]); @@ -86,11 +86,11 @@ StatusCode TruthPatternRecAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ // printf(" MCP id %d: localMax size %d \n", iter.first.getPDG(), iter.second.size()); //Create axes from MCPMap. - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> axisCol; axisCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> axisCol; axisCol.clear(); for(auto& iter : TruthAxesMap){ if(iter.second.size()==0) continue; - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> t_axis = std::make_shared<Cyber::CaloHalfCluster>(); for(int icl=0; icl<iter.second.size(); icl++) t_axis->addUnit(iter.second[icl]); t_axis->setType(100); t_axis->getLinkedMCPfromUnit(); @@ -106,7 +106,7 @@ StatusCode TruthPatternRecAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ if(settings.map_boolPars["DoAxisMerging"]){ for(int ihc=0; ihc<p_HalfClusterU.size(); ihc++){ - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newAxisCol; m_newAxisCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newAxisCol; m_newAxisCol.clear(); std::vector<const CaloHalfCluster*> m_recAxis = p_HalfClusterU[ihc]->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); std::vector<const CaloHalfCluster*> m_trkAxis = p_HalfClusterU[ihc]->getHalfClusterCol(settings.map_stringPars["ReadinAxisName"]); @@ -130,7 +130,7 @@ StatusCode TruthPatternRecAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ } for(int ihc=0; ihc<p_HalfClusterV.size(); ihc++){ - std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>> m_newAxisCol; m_newAxisCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHalfCluster>> m_newAxisCol; m_newAxisCol.clear(); std::vector<const CaloHalfCluster*> m_recAxis = p_HalfClusterV[ihc]->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); std::vector<const CaloHalfCluster*> m_trkAxis = p_HalfClusterV[ihc]->getHalfClusterCol(settings.map_stringPars["ReadinAxisName"]); @@ -170,13 +170,13 @@ StatusCode TruthPatternRecAlg::ClearAlgorithm(){ }; -StatusCode TruthPatternRecAlg::OverlapMerging( std::vector<std::shared_ptr<PandoraPlus::CaloHalfCluster>>& m_axisCol ){ +StatusCode TruthPatternRecAlg::OverlapMerging( std::vector<std::shared_ptr<Cyber::CaloHalfCluster>>& m_axisCol ){ if(m_axisCol.size()<2) return StatusCode::SUCCESS; for(int iax=0; iax<m_axisCol.size(); iax++){ - const PandoraPlus::CaloHalfCluster* m_axis = m_axisCol[iax].get(); + const Cyber::CaloHalfCluster* m_axis = m_axisCol[iax].get(); for(int jax=iax+1; jax<m_axisCol.size(); jax++){ - const PandoraPlus::CaloHalfCluster* p_axis = m_axisCol[jax].get(); + const Cyber::CaloHalfCluster* p_axis = m_axisCol[jax].get(); std::vector<const Calo1DCluster*> tmp_localMax = p_axis->getCluster(); diff --git a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthTrackMatchingAlg.cpp b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthTrackMatchingAlg.cpp similarity index 78% rename from Reconstruction/CrystalCaloRec/src/Algorithm/TruthTrackMatchingAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/Algorithm/TruthTrackMatchingAlg.cpp index 09a7d046aa1cfa4fa8bbd91eb1820c471cf59445..a2b9d0dfc042bee5e5dde21a9389077510db520b 100644 --- a/Reconstruction/CrystalCaloRec/src/Algorithm/TruthTrackMatchingAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Algorithm/TruthTrackMatchingAlg.cpp @@ -17,7 +17,7 @@ StatusCode TruthTrackMatchingAlg::ReadSettings(Settings& m_settings){ return StatusCode::SUCCESS; }; -StatusCode TruthTrackMatchingAlg::Initialize( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthTrackMatchingAlg::Initialize( CyberDataCol& m_datacol ){ m_TrackCol.clear(); p_HalfClusterV = nullptr; p_HalfClusterU = nullptr; @@ -31,7 +31,7 @@ cout<<"TruthTrackMatchingAlg: Input track size "<<m_TrackCol.size()<<", HFCluste return StatusCode::SUCCESS; }; -StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ +StatusCode TruthTrackMatchingAlg::RunAlgorithm( CyberDataCol& m_datacol ){ if( m_TrackCol.size()==0) return StatusCode::SUCCESS; for(int itrk=0; itrk<m_TrackCol.size(); itrk++){ @@ -43,10 +43,10 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //Loop in HFCluster U for(int ihf=0; ihf<p_HalfClusterU->size(); ihf++){ //Get Local max of the HalfCluster - std::vector<const PandoraPlus::Calo1DCluster*> localMaxColU = p_HalfClusterU->at(ihf).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxColU = p_HalfClusterU->at(ihf).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); //Loop for the localMax: - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> t_axis = std::make_shared<Cyber::CaloHalfCluster>(); for(int ilm=0; ilm<localMaxColU.size(); ilm++){ edm4hep::MCParticle mcp_lm = localMaxColU[ilm]->getLeadingMCP(); if(mcp_lm==mcp_trk) @@ -70,10 +70,10 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //Loop in HFCluster V for(int ihf=0; ihf<p_HalfClusterV->size(); ihf++){ //Get Local max of the HalfCluster - std::vector<const PandoraPlus::Calo1DCluster*> localMaxColV = p_HalfClusterV->at(ihf).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::Calo1DCluster*> localMaxColV = p_HalfClusterV->at(ihf).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); //Loop for the localMax: - std::shared_ptr<PandoraPlus::CaloHalfCluster> t_axis = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> t_axis = std::make_shared<Cyber::CaloHalfCluster>(); for(int ilm=0; ilm<localMaxColV.size(); ilm++){ edm4hep::MCParticle mcp_lm = localMaxColV[ilm]->getLeadingMCP(); if(mcp_lm==mcp_trk) @@ -98,10 +98,10 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //cout<<"Check HFClusters linked to the same track"<<endl; //Loop track to check the associated cluster: merge clusters if they are associated to the same track. - std::vector<PandoraPlus::CaloHalfCluster*> tmp_deleteClus; tmp_deleteClus.clear(); + std::vector<Cyber::CaloHalfCluster*> tmp_deleteClus; tmp_deleteClus.clear(); for(auto &itrk : m_TrackCol){ - std::vector<PandoraPlus::CaloHalfCluster*> m_matchedUCol = itrk->getAssociatedHalfClustersU(); - std::vector<PandoraPlus::CaloHalfCluster*> m_matchedVCol = itrk->getAssociatedHalfClustersV(); + std::vector<Cyber::CaloHalfCluster*> m_matchedUCol = itrk->getAssociatedHalfClustersU(); + std::vector<Cyber::CaloHalfCluster*> m_matchedVCol = itrk->getAssociatedHalfClustersV(); //cout<<" In track "<<itrk<<": linked HFU size "<<m_matchedUCol.size()<<", linked HFV size "<<m_matchedVCol.size()<<endl; if( m_matchedUCol.size()>1 ){ @@ -136,8 +136,8 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ //Clean the duplicated axes for(int ihc=0; ihc<p_HalfClusterU->size(); ihc++){ - std::vector<const PandoraPlus::CaloHalfCluster*> m_axis = p_HalfClusterU->at(ihc)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedAxis; m_mergedAxis.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_axis = p_HalfClusterU->at(ihc)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); + std::vector<const Cyber::CaloHalfCluster*> m_mergedAxis; m_mergedAxis.clear(); //cout<<" In HFCluster #"<<ihc<<": track axis size "<<m_axis.size(); if(m_axis.size()<=1){ @@ -145,7 +145,7 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ continue; } - std::map<const PandoraPlus::Track*, std::vector<const PandoraPlus::CaloHalfCluster*>> map_trk; map_trk.clear(); + std::map<const Cyber::Track*, std::vector<const Cyber::CaloHalfCluster*>> map_trk; map_trk.clear(); for(int iax=0; iax<m_axis.size(); iax++){ if(m_axis[iax]->getAssociatedTracks().size()==0){ m_mergedAxis.push_back(m_axis[iax]); @@ -165,7 +165,7 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ m_mergedAxis.push_back(itrk.second[0]); continue; } - PandoraPlus::CaloHalfCluster* p_axis = const_cast<PandoraPlus::CaloHalfCluster*>(itrk.second[0]); + Cyber::CaloHalfCluster* p_axis = const_cast<Cyber::CaloHalfCluster*>(itrk.second[0]); for(int iax=1; iax<itrk.second.size(); iax++) p_axis->mergeHalfCluster(itrk.second[iax]); m_mergedAxis.push_back(p_axis); } @@ -175,8 +175,8 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ } for(int ihc=0; ihc<p_HalfClusterV->size(); ihc++){ - std::vector<const PandoraPlus::CaloHalfCluster*> m_axis = p_HalfClusterV->at(ihc)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedAxis; m_mergedAxis.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_axis = p_HalfClusterV->at(ihc)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); + std::vector<const Cyber::CaloHalfCluster*> m_mergedAxis; m_mergedAxis.clear(); //cout<<" In HFCluster #"<<ihc<<": track axis size "<<m_axis.size(); if(m_axis.size()<=1){ @@ -184,7 +184,7 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ continue; } - std::map<const PandoraPlus::Track*, std::vector<const PandoraPlus::CaloHalfCluster*>> map_trk; map_trk.clear(); + std::map<const Cyber::Track*, std::vector<const Cyber::CaloHalfCluster*>> map_trk; map_trk.clear(); for(int iax=0; iax<m_axis.size(); iax++){ if(m_axis[iax]->getAssociatedTracks().size()==0){ m_mergedAxis.push_back(m_axis[iax]); @@ -204,7 +204,7 @@ StatusCode TruthTrackMatchingAlg::RunAlgorithm( PandoraPlusDataCol& m_datacol ){ m_mergedAxis.push_back(itrk.second[0]); continue; } - PandoraPlus::CaloHalfCluster* p_axis = const_cast<PandoraPlus::CaloHalfCluster*>(itrk.second[0]); + Cyber::CaloHalfCluster* p_axis = const_cast<Cyber::CaloHalfCluster*>(itrk.second[0]); for(int iax=1; iax<itrk.second.size(); iax++) p_axis->mergeHalfCluster(itrk.second[iax]); m_mergedAxis.push_back(p_axis); } @@ -220,9 +220,9 @@ cout<<"Track size: "<<m_TrackCol.size()<<endl; cout<<"Print HalfClusters and axis"<<endl; cout<<" HalfClusterU size: "<<p_HalfClusterU->size()<<endl; for(int i=0; i<p_HalfClusterU->size(); i++){ - std::vector<const PandoraPlus::Calo1DCluster*> m_1dcluster = p_HalfClusterU->at(i)->getCluster(); - std::vector<const PandoraPlus::Calo1DCluster*> m_localMax = p_HalfClusterU->at(i).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); - std::vector<const PandoraPlus::CaloHalfCluster*> m_axis = p_HalfClusterU->at(i)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); + std::vector<const Cyber::Calo1DCluster*> m_1dcluster = p_HalfClusterU->at(i)->getCluster(); + std::vector<const Cyber::Calo1DCluster*> m_localMax = p_HalfClusterU->at(i).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::CaloHalfCluster*> m_axis = p_HalfClusterU->at(i)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); printf(" In HalfCluster #%d: 1D cluster size %d, localMax size %d, axis size %d \n", i, m_1dcluster.size(), m_localMax.size(), m_axis.size()); for(int iax=0; iax<m_axis.size(); iax++){ @@ -238,9 +238,9 @@ for(int i=0; i<p_HalfClusterU->size(); i++){ cout<<" HalfClusterV size: "<<p_HalfClusterV->size()<<endl; for(int i=0; i<p_HalfClusterV->size(); i++){ - std::vector<const PandoraPlus::Calo1DCluster*> m_1dcluster = p_HalfClusterV->at(i)->getCluster(); - std::vector<const PandoraPlus::Calo1DCluster*> m_localMax = p_HalfClusterV->at(i).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); - std::vector<const PandoraPlus::CaloHalfCluster*> m_axis = p_HalfClusterV->at(i)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); + std::vector<const Cyber::Calo1DCluster*> m_1dcluster = p_HalfClusterV->at(i)->getCluster(); + std::vector<const Cyber::Calo1DCluster*> m_localMax = p_HalfClusterV->at(i).get()->getLocalMaxCol(settings.map_stringPars["ReadinLocalMaxName"]); + std::vector<const Cyber::CaloHalfCluster*> m_axis = p_HalfClusterV->at(i)->getHalfClusterCol(settings.map_stringPars["OutputLongiClusName"]); printf(" In HalfCluster #%d: 1D cluster size %d, localMax size %d, axis size %d \n", i, m_1dcluster.size(), m_localMax.size(), m_axis.size()); for(int iax=0; iax<m_axis.size(); iax++){ diff --git a/Reconstruction/CrystalCaloRec/src/PandoraPlusDataCol.cpp b/Reconstruction/PFA/CyberPFA/src/CyberDataCol.cpp similarity index 87% rename from Reconstruction/CrystalCaloRec/src/PandoraPlusDataCol.cpp rename to Reconstruction/PFA/CyberPFA/src/CyberDataCol.cpp index 5ee658b9e9b0a5c586951a543d8b5b77f52e13ee..d6e2216fb2f390e4b679ba23277bd1b3cb773aa8 100644 --- a/Reconstruction/CrystalCaloRec/src/PandoraPlusDataCol.cpp +++ b/Reconstruction/PFA/CyberPFA/src/CyberDataCol.cpp @@ -1,9 +1,9 @@ #ifndef _PANDORAPLUS_DATA_C #define _PANDORAPLUS_DATA_C -#include "PandoraPlusDataCol.h" +#include "CyberDataCol.h" -StatusCode PandoraPlusDataCol::Clear(){ +StatusCode CyberDataCol::Clear(){ collectionMap_MC.clear(); collectionMap_CaloHit.clear(); collectionMap_Vertex.clear(); diff --git a/Reconstruction/CrystalCaloRec/src/PandoraPlusPFAlg.cpp b/Reconstruction/PFA/CyberPFA/src/CyberPFAlg.cpp similarity index 94% rename from Reconstruction/CrystalCaloRec/src/PandoraPlusPFAlg.cpp rename to Reconstruction/PFA/CyberPFA/src/CyberPFAlg.cpp index de6314aeae6c2cc401cc74193cfe0a63eb94e33f..06158fed9d5503a566b1eb1f801e14b20bcd39dd 100644 --- a/Reconstruction/CrystalCaloRec/src/PandoraPlusPFAlg.cpp +++ b/Reconstruction/PFA/CyberPFA/src/CyberPFAlg.cpp @@ -1,7 +1,7 @@ #ifndef PANDORAPLUS_ALG_C #define PANDORAPLUS_ALG_C -#include "PandoraPlusPFAlg.h" +#include "CyberPFAlg.h" // #include <fstream> // #include <ctime> @@ -9,20 +9,20 @@ using namespace std; using namespace dd4hep; -int PandoraPlus::CaloUnit::Nmodule = 32; -int PandoraPlus::CaloUnit::Nstave = 15; -int PandoraPlus::CaloUnit::Nlayer = 14; -int PandoraPlus::CaloUnit::NbarPhi_odd[14] = {39, 39, 39, 39, 37, 37, 37, 37, 37, 35, 35, 35, 35, 33}; -int PandoraPlus::CaloUnit::NbarPhi_even[14] = {29, 29, 31, 31, 33, 35, 35, 37, 37, 39, 41, 41, 43, 43}; -int PandoraPlus::CaloUnit::NbarZ = 36; -//int PandoraPlus::CaloUnit::over_module[28] = {13,15,16,18,19,21,22,24,25,26,28,29,30,32,33,35,36,38,39,41,42,43,45,46}; -//int PandoraPlus::CaloUnit::over_module_set = 2; -float PandoraPlus::CaloUnit::barsize = 10.; //mm -float PandoraPlus::CaloUnit::ecal_innerR = 1830; //mm +int Cyber::CaloUnit::Nmodule = 32; +int Cyber::CaloUnit::Nstave = 15; +int Cyber::CaloUnit::Nlayer = 14; +int Cyber::CaloUnit::NbarPhi_odd[14] = {39, 39, 39, 39, 37, 37, 37, 37, 37, 35, 35, 35, 35, 33}; +int Cyber::CaloUnit::NbarPhi_even[14] = {29, 29, 31, 31, 33, 35, 35, 37, 37, 39, 41, 41, 43, 43}; +int Cyber::CaloUnit::NbarZ = 36; +//int Cyber::CaloUnit::over_module[28] = {13,15,16,18,19,21,22,24,25,26,28,29,30,32,33,35,36,38,39,41,42,43,45,46}; +//int Cyber::CaloUnit::over_module_set = 2; +float Cyber::CaloUnit::barsize = 10.; //mm +float Cyber::CaloUnit::ecal_innerR = 1830; //mm -DECLARE_COMPONENT( PandoraPlusPFAlg ) +DECLARE_COMPONENT( CyberPFAlg ) -PandoraPlusPFAlg::PandoraPlusPFAlg(const std::string& name, ISvcLocator* svcLoc) +CyberPFAlg::CyberPFAlg(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc), _nEvt(0) { @@ -38,7 +38,7 @@ PandoraPlusPFAlg::PandoraPlusPFAlg(const std::string& name, ISvcLocator* svcLoc) } -StatusCode PandoraPlusPFAlg::initialize() +StatusCode CyberPFAlg::initialize() { //Initialize global settings m_GlobalSettings.map_floatPars["BField"] = m_BField; @@ -146,10 +146,10 @@ StatusCode PandoraPlusPFAlg::initialize() //Initialize services m_geosvc = service<IGeomSvc>("GeomSvc"); - if ( !m_geosvc ) throw "PandoraPlusPFAlg :Failed to find GeomSvc ..."; + if ( !m_geosvc ) throw "CyberPFAlg :Failed to find GeomSvc ..."; m_energycorsvc = service<ICrystalEcalSvc>("CrystalEcalEnergyCorrectionSvc"); - if ( !m_energycorsvc ) throw "PandoraPlusPFAlg :Failed to find CrystalEcalEnergyCorrectionSvc ..."; + if ( !m_energycorsvc ) throw "CyberPFAlg :Failed to find CrystalEcalEnergyCorrectionSvc ..."; //m_energycorsvc->initialize(); for(unsigned int i=0; i<name_CaloReadout.size(); i++){ @@ -163,7 +163,7 @@ StatusCode PandoraPlusPFAlg::initialize() } rndm.SetSeed(m_seed); - std::cout<<"PandoraPlusPFAlg::initialize"<<std::endl; + std::cout<<"CyberPFAlg::initialize"<<std::endl; //Output collections @@ -612,6 +612,14 @@ StatusCode PandoraPlusPFAlg::initialize() t_Track->Branch("m_trkstate_refz", &m_trkstate_refz); t_Track->Branch("m_trkstate_location", &m_trkstate_location); t_Track->Branch("m_trkstate_tag", &m_trkstate_tag); + t_Track->Branch("m_trkstate_x_ECAL", &m_trkstate_x_ECAL); + t_Track->Branch("m_trkstate_y_ECAL", &m_trkstate_y_ECAL); + t_Track->Branch("m_trkstate_z_ECAL", &m_trkstate_z_ECAL); + t_Track->Branch("m_trkstate_tag_ECAL", &m_trkstate_tag_ECAL); + t_Track->Branch("m_trkstate_x_HCAL", &m_trkstate_x_HCAL); + t_Track->Branch("m_trkstate_y_HCAL", &m_trkstate_y_HCAL); + t_Track->Branch("m_trkstate_z_HCAL", &m_trkstate_z_HCAL); + t_Track->Branch("m_trkstate_tag_HCAL", &m_trkstate_tag_HCAL); //PFOs t_PFO->Branch("pfo_tag", &pfo_tag); @@ -643,18 +651,18 @@ StatusCode PandoraPlusPFAlg::initialize() return GaudiAlgorithm::initialize(); } -StatusCode PandoraPlusPFAlg::execute() +StatusCode CyberPFAlg::execute() { // clock_t yyy_start, yyy_endrec, yyy_endfill; // yyy_start = clock(); // 记录开始时间 - if(_nEvt==0) std::cout<<"PandoraPlusPFAlg::execute Start"<<std::endl; + if(_nEvt==0) std::cout<<"CyberPFAlg::execute Start"<<std::endl; std::cout<<"Processing event: "<<_nEvt<<std::endl; if(_nEvt<m_Nskip){ _nEvt++; return GaudiAlgorithm::initialize(); } //InitializeForNewEvent(); - PandoraPlusDataCol m_DataCol; + CyberDataCol m_DataCol; m_DataCol.Clear(); m_DataCol.EnergyCorrSvc = m_energycorsvc; @@ -744,7 +752,7 @@ cout<<"Write tuples"<<endl; } } - std::vector<PandoraPlus::CaloHit*> m_hcalHitsCol; m_hcalHitsCol.clear(); + std::vector<Cyber::CaloHit*> m_hcalHitsCol; m_hcalHitsCol.clear(); for(int ih=0; ih<m_DataCol.map_CaloHit["HCALBarrel"].size(); ih++) m_hcalHitsCol.push_back( m_DataCol.map_CaloHit["HCALBarrel"][ih].get() ); @@ -776,7 +784,7 @@ cout<<"Write tuples"<<endl; //Save localMax ClearLocalMax(); - std::vector<PandoraPlus::CaloHalfCluster*> m_halfclusters; m_halfclusters.clear(); + std::vector<Cyber::CaloHalfCluster*> m_halfclusters; m_halfclusters.clear(); for(int i=0; i<m_DataCol.map_HalfCluster["HalfClusterColU"].size(); i++) m_halfclusters.push_back( m_DataCol.map_HalfCluster["HalfClusterColU"][i].get() ); @@ -894,8 +902,8 @@ cout<<"Write tuples"<<endl; } t_Layers->Fill(); - std::vector<const PandoraPlus::CaloHalfCluster*> m_halfclusterV; m_halfclusterV.clear(); - std::vector<const PandoraPlus::CaloHalfCluster*> m_halfclusterU; m_halfclusterU.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_halfclusterV; m_halfclusterV.clear(); + std::vector<const Cyber::CaloHalfCluster*> m_halfclusterU; m_halfclusterU.clear(); for(int i=0; i<m_DataCol.map_HalfCluster["HalfClusterColU"].size(); i++){ m_halfclusterU.push_back( m_DataCol.map_HalfCluster["HalfClusterColU"][i].get() ); } @@ -907,7 +915,7 @@ cout<<"Write tuples"<<endl; int houghU_index=0; int houghV_index=0; for(int i=0; i<m_halfclusterU.size(); i++){ // loop half cluster U - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("HoughAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("HoughAxis"); for(int ita=0; ita<m_mergedaxisU.size(); ita++){ // loop axis U // General information of the axis m_houghU_tag.push_back(houghU_index); @@ -941,7 +949,7 @@ cout<<"Write tuples"<<endl; } } for(int i=0; i<m_halfclusterV.size(); i++){ // loop half cluster V - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("HoughAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("HoughAxis"); for(int ita=0; ita<m_mergedaxisV.size(); ita++){ // loop axis V // General information of the axis m_houghV_tag.push_back(houghV_index); @@ -982,7 +990,7 @@ cout<<"Write tuples"<<endl; int coneU_index=0; int coneV_index=0; for(int i=0; i<m_halfclusterU.size(); i++){ // loop half cluster U - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("ConeAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("ConeAxis"); for(int ita=0; ita<m_mergedaxisU.size(); ita++){ // loop axis U // General information of the axis m_coneU_tag.push_back(coneU_index); @@ -1016,7 +1024,7 @@ cout<<"Write tuples"<<endl; } } for(int i=0; i<m_halfclusterV.size(); i++){ // loop half cluster V - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("ConeAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("ConeAxis"); for(int ita=0; ita<m_mergedaxisV.size(); ita++){ // loop axis V // General information of the axis m_coneV_tag.push_back(coneV_index); @@ -1055,7 +1063,7 @@ cout<<"Write tuples"<<endl; int trackU_index=0; int trackV_index=0; for(int i=0; i<m_halfclusterU.size(); i++){ // loop half cluster U - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("TrackAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("TrackAxis"); for(int ita=0; ita<m_mergedaxisU.size(); ita++){ // loop axis U // General information of the axis m_trackU_tag.push_back(trackU_index); @@ -1089,7 +1097,7 @@ cout<<"Write tuples"<<endl; } } for(int i=0; i<m_halfclusterV.size(); i++){ // loop half cluster V - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("TrackAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("TrackAxis"); for(int ita=0; ita<m_mergedaxisV.size(); ita++){ // loop axis V // General information of the axis m_trackV_tag.push_back(trackV_index); @@ -1128,7 +1136,7 @@ cout<<"Write tuples"<<endl; int axisU_index=0; int axisV_index=0; for(int i=0; i<m_halfclusterU.size(); i++){ // loop half cluster U - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("MergedAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisU = m_halfclusterU[i]->getHalfClusterCol("MergedAxis"); for(int ita=0; ita<m_mergedaxisU.size(); ita++){ // loop axis U // General information of the axis m_axisU_tag.push_back(axisU_index); @@ -1161,7 +1169,7 @@ cout<<"Write tuples"<<endl; } } for(int i=0; i<m_halfclusterV.size(); i++){ // loop half cluster V - std::vector<const PandoraPlus::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("MergedAxis"); + std::vector<const Cyber::CaloHalfCluster*> m_mergedaxisV = m_halfclusterV[i]->getHalfClusterCol("MergedAxis"); for(int ita=0; ita<m_mergedaxisV.size(); ita++){ // loop axis V // General information of the axis m_axisV_tag.push_back(axisV_index); @@ -1300,7 +1308,7 @@ cout<<"Write tuples"<<endl; //Tower ClearTower(); - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_tower = m_DataCol.map_CaloCluster["ESTower"]; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_tower = m_DataCol.map_CaloCluster["ESTower"]; for(int it=0; it<m_tower.size(); it++){ ClearTower(); towerID[0] = m_tower[it]->getTowerID()[0][0]; @@ -1343,9 +1351,9 @@ cout<<"Write tuples"<<endl; cout<<" Write 3D cluster"<<endl; //3D cluster ClearCluster(); - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_EcalClusterCol = m_DataCol.map_CaloCluster["TrkMergedECAL"]; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_HcalClusterCol = m_DataCol.map_CaloCluster["HCALCluster"]; - std::vector<std::shared_ptr<PandoraPlus::Calo3DCluster>> m_SimpleHcalClusterCol = m_DataCol.map_CaloCluster["SimpleHCALCluster"]; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_EcalClusterCol = m_DataCol.map_CaloCluster["TrkMergedECAL"]; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_HcalClusterCol = m_DataCol.map_CaloCluster["HCALCluster"]; + std::vector<std::shared_ptr<Cyber::Calo3DCluster>> m_SimpleHcalClusterCol = m_DataCol.map_CaloCluster["SimpleHCALCluster"]; m_totE_Ecal = 0.; m_totE_Hcal = 0.; m_Nclus_Ecal = m_EcalClusterCol.size(); @@ -1495,7 +1503,7 @@ cout<<" Write 3D cluster"<<endl; // Save Track info ClearTrack(); - std::vector<PandoraPlus::Track*> m_trkCol; + std::vector<Cyber::Track*> m_trkCol; for(int it=0; it<m_DataCol.TrackCol.size(); it++) m_trkCol.push_back( m_DataCol.TrackCol[it].get() ); @@ -1515,41 +1523,29 @@ cout<<" Write 3D cluster"<<endl; m_trkstate_refz.push_back( AllTrackStates[istate].referencePoint.Z() ); m_trkstate_location.push_back( AllTrackStates[istate].location ); m_trkstate_tag.push_back(itrk); - }} + } + std::vector<TrackState> EcalTrackStates = m_trkCol[itrk]->getTrackStates("Ecal"); + for(int istate=0; istate<EcalTrackStates.size(); istate++){ + m_trkstate_x_ECAL.push_back(EcalTrackStates[istate].referencePoint.X()); + m_trkstate_y_ECAL.push_back(EcalTrackStates[istate].referencePoint.Y()); + m_trkstate_z_ECAL.push_back(EcalTrackStates[istate].referencePoint.Z()); + m_trkstate_tag_ECAL.push_back(itrk); + } + std::vector<TrackState> HcalTrackStates = m_trkCol[itrk]->getTrackStates("Hcal"); + for(int istate=0; istate<HcalTrackStates.size(); istate++){ + m_trkstate_x_ECAL.push_back(HcalTrackStates[istate].referencePoint.X()); + m_trkstate_y_ECAL.push_back(HcalTrackStates[istate].referencePoint.Y()); + m_trkstate_z_ECAL.push_back(HcalTrackStates[istate].referencePoint.Z()); + m_trkstate_tag_HCAL.push_back(itrk); + } + } t_Track->Fill(); // yyy: pfo ClearPFO(); - std::vector<PandoraPlus::PFObject*> m_pfobjects; m_pfobjects.clear(); - std::vector<PandoraPlus::PFObject*> m_chargedPFOs, m_neutralPFOs; - for(int ip=0; ip<m_DataCol.map_PFObjects["outputPFO"].size(); ip++){ + std::vector<Cyber::PFObject*> m_pfobjects; m_pfobjects.clear(); + for(int ip=0; ip<m_DataCol.map_PFObjects["outputPFO"].size(); ip++) m_pfobjects.push_back(m_DataCol.map_PFObjects["outputPFO"][ip].get()); - if(m_DataCol.map_PFObjects["outputPFO"][ip]->getTracks().size()!=0) m_chargedPFOs.push_back( m_DataCol.map_PFObjects["outputPFO"][ip].get() ); - else m_neutralPFOs.push_back( m_DataCol.map_PFObjects["outputPFO"][ip].get() ); - } - - double totE_Ecal = 0; - double totE_Hcal = 0; - cout<<"After merge all virtual to Ch: charged "<<m_chargedPFOs.size()<<", neutral "<<m_neutralPFOs.size()<<", total "<<m_pfobjects.size()<<endl; - for(int i=0; i<m_neutralPFOs.size(); i++){ - cout<<" PFO #"<<i<<": track size "<<m_neutralPFOs[i]->getTracks().size()<<", leading P "<<m_neutralPFOs[i]->getTrackMomentum(); - cout<<", ECAL cluster size "<<m_neutralPFOs[i]->getECALClusters().size()<<", totE "<<m_neutralPFOs[i]->getECALClusterEnergy(); - cout<<", HCAL cluster size "<<m_neutralPFOs[i]->getHCALClusters().size()<<", totE "<<m_neutralPFOs[i]->getHCALClusterEnergy()<<endl; - totE_Ecal += m_neutralPFOs[i]->getECALClusterEnergy(); - totE_Hcal += m_neutralPFOs[i]->getHCALClusterEnergy(); - } - cout<<"-----Neutral cluster Ecal total energy: "<<totE_Ecal<<", Hcal total energy: "<<totE_Hcal<<endl; - totE_Ecal = 0; - totE_Hcal = 0; - for(int i=0; i<m_chargedPFOs.size(); i++){ - cout<<" PFO #"<<i<<": track size "<<m_chargedPFOs[i]->getTracks().size()<<", leading P "<<m_chargedPFOs[i]->getTrackMomentum(); - cout<<", ECAL cluster size "<<m_chargedPFOs[i]->getECALClusters().size()<<", totE "<<m_chargedPFOs[i]->getECALClusterEnergy(); - cout<<", HCAL cluster size "<<m_chargedPFOs[i]->getHCALClusters().size()<<", totE "<<m_chargedPFOs[i]->getHCALClusterEnergy()<<endl; - totE_Ecal += m_chargedPFOs[i]->getECALClusterEnergy(); - totE_Hcal += m_chargedPFOs[i]->getHCALClusterEnergy(); - } - cout<<"-----Charged cluster Ecal total energy: "<<totE_Ecal<<", Hcal total energy: "<<totE_Hcal<<endl; - for(int ip=0; ip<m_pfobjects.size(); ip++){ @@ -1610,7 +1606,7 @@ cout<<" Write 3D cluster"<<endl; return StatusCode::SUCCESS; } -StatusCode PandoraPlusPFAlg::finalize() +StatusCode CyberPFAlg::finalize() { m_wfile->cd(); t_MCParticle->Write(); @@ -1652,7 +1648,7 @@ StatusCode PandoraPlusPFAlg::finalize() return GaudiAlgorithm::finalize(); } -void PandoraPlusPFAlg::ClearMCParticle(){ +void CyberPFAlg::ClearMCParticle(){ m_mcPdgid.clear(); m_mcStatus.clear(); m_mcPx.clear(); @@ -1668,7 +1664,7 @@ void PandoraPlusPFAlg::ClearMCParticle(){ m_depEn_hcal.clear(); } -void PandoraPlusPFAlg::ClearBar(){ +void CyberPFAlg::ClearBar(){ m_totE_EcalSim = -99; m_totE_HcalSim = -99; m_simBar_x.clear(); @@ -1711,7 +1707,7 @@ void PandoraPlusPFAlg::ClearBar(){ m_HcalHit_truthMC_weight.clear(); } -void PandoraPlusPFAlg::ClearLocalMax(){ +void CyberPFAlg::ClearLocalMax(){ m_NlmU=-99; m_NlmV=-99; m_localMaxU_tag.clear(); @@ -1738,7 +1734,7 @@ void PandoraPlusPFAlg::ClearLocalMax(){ m_localMaxV_mc_weight.clear(); } -void PandoraPlusPFAlg::ClearLayer(){ +void CyberPFAlg::ClearLayer(){ m_NshowerU=-99; m_NshowerV=-99; m_barShowerU_tag.clear(); @@ -1766,7 +1762,7 @@ void PandoraPlusPFAlg::ClearLayer(){ } -void PandoraPlusPFAlg::ClearHough(){ +void CyberPFAlg::ClearHough(){ m_houghU_tag.clear(); m_houghU_type.clear(); m_houghU_x.clear(); @@ -1806,7 +1802,7 @@ void PandoraPlusPFAlg::ClearHough(){ } -void PandoraPlusPFAlg::ClearCone(){ +void CyberPFAlg::ClearCone(){ m_coneU_tag.clear(); m_coneU_type.clear(); m_coneU_x.clear(); @@ -1844,7 +1840,7 @@ void PandoraPlusPFAlg::ClearCone(){ } -void PandoraPlusPFAlg::ClearTrackAxis(){ +void CyberPFAlg::ClearTrackAxis(){ m_trackU_tag.clear(); m_trackU_type.clear(); m_trackU_x.clear(); @@ -1882,7 +1878,7 @@ void PandoraPlusPFAlg::ClearTrackAxis(){ } -void PandoraPlusPFAlg::ClearAxis(){ +void CyberPFAlg::ClearAxis(){ m_axisU_tag.clear(); m_axisU_type.clear(); m_axisU_x.clear(); @@ -1930,7 +1926,7 @@ void PandoraPlusPFAlg::ClearAxis(){ m_emptyAxisV_E.clear(); } -void PandoraPlusPFAlg::ClearHalfCluster(){ +void CyberPFAlg::ClearHalfCluster(){ m_totE_HFClusU = -99.; m_totE_HFClusV = -99.; m_HalfClusterV_x.clear(); @@ -1971,7 +1967,7 @@ void PandoraPlusPFAlg::ClearHalfCluster(){ m_HalfClusterU_truthMC_weight.clear(); } -void PandoraPlusPFAlg::ClearTower(){ +void CyberPFAlg::ClearTower(){ towerID[0] = 0; towerID[1] = 0; towerID[2] = 0; @@ -1997,7 +1993,7 @@ void PandoraPlusPFAlg::ClearTower(){ } -void PandoraPlusPFAlg::ClearCluster(){ +void CyberPFAlg::ClearCluster(){ m_totE_Ecal = -99.; m_totE_Hcal = -99.; m_Nclus_Ecal = -99; @@ -2083,7 +2079,7 @@ void PandoraPlusPFAlg::ClearCluster(){ m_SimpleHcalClus_truthMC_weight.clear(); } -void PandoraPlusPFAlg::ClearTrack(){ +void CyberPFAlg::ClearTrack(){ m_type.clear(); m_trkstate_d0.clear(); m_trkstate_z0.clear(); @@ -2096,9 +2092,18 @@ void PandoraPlusPFAlg::ClearTrack(){ m_trkstate_refz.clear(); m_trkstate_location.clear(); m_trkstate_tag.clear(); + m_trkstate_x_ECAL.clear(); + m_trkstate_y_ECAL.clear(); + m_trkstate_z_ECAL.clear(); + m_trkstate_x_HCAL.clear(); + m_trkstate_y_HCAL.clear(); + m_trkstate_z_HCAL.clear(); + m_trkstate_tag_ECAL.clear(); + m_trkstate_tag_HCAL.clear(); + } -void PandoraPlusPFAlg::ClearPFO(){ +void CyberPFAlg::ClearPFO(){ pfo_tag.clear(); pfo_n_track.clear(); pfo_n_ecal_clus.clear(); @@ -2125,7 +2130,7 @@ void PandoraPlusPFAlg::ClearPFO(){ } -double PandoraPlusPFAlg::GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<PandoraPlus::CaloUnit>>& barcol){ +double CyberPFAlg::GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<Cyber::CaloUnit>>& barcol){ double EnDep = 0.; for(int i=0; i<barcol.size(); i++){ @@ -2140,7 +2145,7 @@ double PandoraPlusPFAlg::GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vec } -double PandoraPlusPFAlg::GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<PandoraPlus::CaloHit>>& hitcol){ +double CyberPFAlg::GetParticleDepEnergy(edm4hep::MCParticle& mcp, std::vector<std::shared_ptr<Cyber::CaloHit>>& hitcol){ double EnDep = 0.; for(int i=0; i<hitcol.size(); i++){ diff --git a/Reconstruction/CrystalCaloRec/src/Objects/Calo1DCluster.cc b/Reconstruction/PFA/CyberPFA/src/Objects/Calo1DCluster.cc similarity index 90% rename from Reconstruction/CrystalCaloRec/src/Objects/Calo1DCluster.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/Calo1DCluster.cc index 5ca151ca269d17125c04a44df20d84ebee423918..5e9a87288efa3fa6d24c65e6e38ae3e37f94f67f 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/Calo1DCluster.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/Calo1DCluster.cc @@ -4,7 +4,7 @@ #include "Objects/CaloUnit.h" #include "Objects/Calo1DCluster.h" using namespace std; -namespace PandoraPlus{ +namespace Cyber{ void Calo1DCluster::Clear(){ Bars.clear(); @@ -33,8 +33,8 @@ namespace PandoraPlus{ if(!Seeds[i]) { Seeds.erase(Seeds.begin()+i); i--; } } - std::shared_ptr<PandoraPlus::Calo1DCluster> Calo1DCluster::Clone() const{ - std::shared_ptr<PandoraPlus::Calo1DCluster> p_cluster = std::make_shared<PandoraPlus::Calo1DCluster>(); + std::shared_ptr<Cyber::Calo1DCluster> Calo1DCluster::Clone() const{ + std::shared_ptr<Cyber::Calo1DCluster> p_cluster = std::make_shared<Cyber::Calo1DCluster>(); p_cluster->setBars( Bars ); p_cluster->setSeeds( Seeds ); p_cluster->setIDInfo(); @@ -46,7 +46,7 @@ namespace PandoraPlus{ } - bool Calo1DCluster::isNeighbor(const PandoraPlus::CaloUnit* m_bar) const + bool Calo1DCluster::isNeighbor(const Cyber::CaloUnit* m_bar) const { for(int i1d = 0; i1d<Bars.size(); i1d++){ if(Bars[i1d]->isNeighbor(m_bar)){ /*cout<<" isNeighbor! "<<endl;*/ return true;} @@ -54,7 +54,7 @@ namespace PandoraPlus{ return false; } - bool Calo1DCluster::inCluster(const PandoraPlus::CaloUnit* iBar) const{ + bool Calo1DCluster::inCluster(const Cyber::CaloUnit* iBar) const{ return (find(Bars.begin(), Bars.end(), iBar)!=Bars.end() ); } @@ -152,7 +152,7 @@ namespace PandoraPlus{ std::sort(Bars.begin(), Bars.end()); if(Bars.size()==0) return -99; int edge = -99; - if( Bars[0]->getSlayer()==0 ) edge = Bars[0]->getBar() + Bars[0]->getStave()*PandoraPlus::CaloUnit::NbarZ; + if( Bars[0]->getSlayer()==0 ) edge = Bars[0]->getBar() + Bars[0]->getStave()*Cyber::CaloUnit::NbarZ; if( Bars[0]->getSlayer()==1 ){ if(Bars[0]->getModule()%2==0) edge = Bars[0]->getBar() + Bars[0]->getModule()*(CaloUnit::NbarPhi_even[Bars[0]->getDlayer()]); else edge = Bars[0]->getBar() + Bars[0]->getModule()*(CaloUnit::NbarPhi_odd[Bars[0]->getDlayer()]); @@ -172,7 +172,7 @@ namespace PandoraPlus{ return edge; } - void Calo1DCluster::addUnit(const PandoraPlus::CaloUnit* _bar ) + void Calo1DCluster::addUnit(const Cyber::CaloUnit* _bar ) { Bars.push_back(_bar); std::vector<int> id(2); @@ -181,7 +181,7 @@ namespace PandoraPlus{ if(find(towerID.begin(), towerID.end(), id)==towerID.end()) towerID.push_back(id); } - void Calo1DCluster::deleteCousinCluster( const PandoraPlus::Calo1DCluster* _cl ){ + void Calo1DCluster::deleteCousinCluster( const Cyber::Calo1DCluster* _cl ){ auto iter = find( CousinClusters.begin(), CousinClusters.end(), _cl ); if(iter!=CousinClusters.end()) CousinClusters.erase( iter ); } diff --git a/Reconstruction/CrystalCaloRec/src/Objects/Calo2DCluster.cc b/Reconstruction/PFA/CyberPFA/src/Objects/Calo2DCluster.cc similarity index 92% rename from Reconstruction/CrystalCaloRec/src/Objects/Calo2DCluster.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/Calo2DCluster.cc index adf232408b5644a665931e4076890b62dab9598b..69605fcc88115d31dc7b4a7b02445295f9d10ddc 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/Calo2DCluster.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/Calo2DCluster.cc @@ -4,7 +4,7 @@ #include "Objects/Calo2DCluster.h" #include <cmath> using namespace std; -namespace PandoraPlus{ +namespace Cyber{ void Calo2DCluster::Clear() { towerID.clear(); @@ -41,7 +41,7 @@ namespace PandoraPlus{ Clear(); } - bool Calo2DCluster::isNeighbor(const PandoraPlus::Calo1DCluster* m_1dcluster) const{ + bool Calo2DCluster::isNeighbor(const Cyber::Calo1DCluster* m_1dcluster) const{ assert(m_1dcluster->getBars().size() > 0 && getCluster().at(0)->getBars().size()>0 ); if(m_1dcluster->getDlayer() != getDlayer() ) return false; @@ -103,7 +103,7 @@ namespace PandoraPlus{ TVector3 m_pos(0, 0, 0); if(towerID.size()==0) return m_pos; - float rotAngle = -towerID[0][0]*TMath::TwoPi()/PandoraPlus::CaloUnit::Nmodule; + float rotAngle = -towerID[0][0]*TMath::TwoPi()/Cyber::CaloUnit::Nmodule; TVector3 m_vecX(0., 0., 0.); TVector3 m_vecY(0., 0., 0.); for(int m=0; m<barShowerUCol.size(); m++) m_vecX += barShowerUCol[m]->getPos(); diff --git a/Reconstruction/CrystalCaloRec/src/Objects/Calo3DCluster.cc b/Reconstruction/PFA/CyberPFA/src/Objects/Calo3DCluster.cc similarity index 88% rename from Reconstruction/CrystalCaloRec/src/Objects/Calo3DCluster.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/Calo3DCluster.cc index adc8dbc3c53473e50662f532c539c9e94611ec68..dbbf49fa2497fa67ab8a1537a13ce4e02eb2a385 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/Calo3DCluster.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/Calo3DCluster.cc @@ -4,7 +4,7 @@ #include "Objects/Calo3DCluster.h" #include <cmath> using namespace std; -namespace PandoraPlus{ +namespace Cyber{ void Calo3DCluster::Clear() { @@ -34,8 +34,8 @@ namespace PandoraPlus{ } - std::shared_ptr<PandoraPlus::Calo3DCluster> Calo3DCluster::Clone() const{ - std::shared_ptr<PandoraPlus::Calo3DCluster> m_clus = std::make_shared<PandoraPlus::Calo3DCluster>(); + std::shared_ptr<Cyber::Calo3DCluster> Calo3DCluster::Clone() const{ + std::shared_ptr<Cyber::Calo3DCluster> m_clus = std::make_shared<Cyber::Calo3DCluster>(); m_clus->setCaloHits(hits); m_clus->setClusters(m_2dclusters); m_clus->setTowers(m_towers); @@ -59,7 +59,7 @@ namespace PandoraPlus{ //TODO: This function is sooooooo time consumeing now!! -/* bool Calo3DCluster::isNeighbor(const PandoraPlus::Calo2DCluster* m_2dcluster) const +/* bool Calo3DCluster::isNeighbor(const Cyber::Calo2DCluster* m_2dcluster) const { //Inner module @@ -89,10 +89,10 @@ namespace PandoraPlus{ //If not the adjacent Dlayer: if(fabs(m_2dcluster->getDlayer()-m_2dclusters[i]->getDlayer())>1) continue; - std::vector<const PandoraPlus::CaloUnit*> m_EdgeBarU_clus1; m_EdgeBarU_clus1.clear(); //Income 2DCluster - std::vector<const PandoraPlus::CaloUnit*> m_EdgeBarV_clus1; m_EdgeBarV_clus1.clear(); - std::vector<const PandoraPlus::CaloUnit*> m_EdgeBarU_clus2; m_EdgeBarU_clus2.clear(); //2DCluster in present 3DCluster. - std::vector<const PandoraPlus::CaloUnit*> m_EdgeBarV_clus2; m_EdgeBarV_clus2.clear(); + std::vector<const Cyber::CaloUnit*> m_EdgeBarU_clus1; m_EdgeBarU_clus1.clear(); //Income 2DCluster + std::vector<const Cyber::CaloUnit*> m_EdgeBarV_clus1; m_EdgeBarV_clus1.clear(); + std::vector<const Cyber::CaloUnit*> m_EdgeBarU_clus2; m_EdgeBarU_clus2.clear(); //2DCluster in present 3DCluster. + std::vector<const Cyber::CaloUnit*> m_EdgeBarV_clus2; m_EdgeBarV_clus2.clear(); for(int ib=0; ib<m_2dcluster->getBarUCol().size(); ib++){ if(m_2dcluster->getBarUCol()[ib]->isAtLowerEdgeZ() || m_2dcluster->getBarUCol()[ib]->isAtUpperEdgeZ()) m_EdgeBarU_clus1.push_back(m_2dcluster->getBarUCol()[ib]); @@ -132,7 +132,7 @@ namespace PandoraPlus{ } //Over modules - std::vector<const PandoraPlus::CaloUnit*> bars_2d = m_2dcluster->getBars(); + std::vector<const Cyber::CaloUnit*> bars_2d = m_2dcluster->getBars(); for(int ib2d=0; ib2d<bars_2d.size(); ib2d++){ for(int ic=0; ic<m_2dclusters.size(); ic++){ for(int ib3d=0; ib3d<m_2dclusters[ic]->getBars().size(); ib3d++){ @@ -153,7 +153,7 @@ namespace PandoraPlus{ } - void Calo3DCluster::mergeCluster( const PandoraPlus::Calo3DCluster* _clus ){ + void Calo3DCluster::mergeCluster( const Cyber::Calo3DCluster* _clus ){ for(int i=0; i<_clus->getCluster().size(); i++) addUnit( _clus->getCluster()[i] ); @@ -202,8 +202,8 @@ namespace PandoraPlus{ } - std::vector<const PandoraPlus::CaloUnit*> Calo3DCluster::getBars() const{ - std::vector<const PandoraPlus::CaloUnit*> results; results.clear(); + std::vector<const Cyber::CaloUnit*> Calo3DCluster::getBars() const{ + std::vector<const Cyber::CaloUnit*> results; results.clear(); for(int i=0; i<m_2dclusters.size(); i++){ for(int j=0; j<m_2dclusters.at(i)->getBars().size(); j++){ results.push_back(m_2dclusters.at(i)->getBars().at(j)); @@ -280,29 +280,29 @@ namespace PandoraPlus{ double Calo3DCluster::getDepthToECALSurface() const{ TVector3 pos = getShowerCenter(); - return pos.Perp() - PandoraPlus::CaloUnit::ecal_innerR; + return pos.Perp() - Cyber::CaloUnit::ecal_innerR; } - std::vector<const PandoraPlus::CaloHalfCluster*> Calo3DCluster::getHalfClusterUCol(std::string name) const { + std::vector<const Cyber::CaloHalfCluster*> Calo3DCluster::getHalfClusterUCol(std::string name) const { std::vector<const CaloHalfCluster*> emptyCol; emptyCol.clear(); if(map_halfClusUCol.find(name)!=map_halfClusUCol.end()) emptyCol = map_halfClusUCol.at(name); return emptyCol; } - std::vector<const PandoraPlus::CaloHalfCluster*> Calo3DCluster::getHalfClusterVCol(std::string name) const { + std::vector<const Cyber::CaloHalfCluster*> Calo3DCluster::getHalfClusterVCol(std::string name) const { std::vector<const CaloHalfCluster*> emptyCol; emptyCol.clear(); if(map_halfClusVCol.find(name)!=map_halfClusVCol.end()) emptyCol = map_halfClusVCol.at(name); return emptyCol; } - std::vector<const PandoraPlus::Calo1DCluster*> Calo3DCluster::getLocalMaxUCol(std::string name) const{ + std::vector<const Cyber::Calo1DCluster*> Calo3DCluster::getLocalMaxUCol(std::string name) const{ std::vector<const Calo1DCluster*> emptyCol; emptyCol.clear(); if(map_localMaxU.find(name)!=map_localMaxU.end()) emptyCol = map_localMaxU.at(name); return emptyCol; } - std::vector<const PandoraPlus::Calo1DCluster*> Calo3DCluster::getLocalMaxVCol(std::string name) const{ + std::vector<const Cyber::Calo1DCluster*> Calo3DCluster::getLocalMaxVCol(std::string name) const{ std::vector<const Calo1DCluster*> emptyCol; emptyCol.clear(); if(map_localMaxV.find(name)!=map_localMaxV.end()) emptyCol = map_localMaxV.at(name); return emptyCol; @@ -414,7 +414,7 @@ namespace PandoraPlus{ //void Calo3DCluster::FitProfile(){ //} - bool Calo3DCluster::isHCALNeighbor(const PandoraPlus::CaloHit* m_hit) const + bool Calo3DCluster::isHCALNeighbor(const Cyber::CaloHit* m_hit) const { for(int i=0; i<hits.size(); i++) { diff --git a/Reconstruction/CrystalCaloRec/src/Objects/CaloHalfCluster.cc b/Reconstruction/PFA/CyberPFA/src/Objects/CaloHalfCluster.cc similarity index 85% rename from Reconstruction/CrystalCaloRec/src/Objects/CaloHalfCluster.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/CaloHalfCluster.cc index e5a463958f26d90e98ca0bff146e3b509f35f94b..70555e6e1b0cb18e024189a692e6f02325796aec 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/CaloHalfCluster.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/CaloHalfCluster.cc @@ -3,7 +3,7 @@ #include "Objects/CaloHalfCluster.h" -namespace PandoraPlus{ +namespace Cyber{ void CaloHalfCluster::Clear() { type = -1; @@ -32,8 +32,8 @@ namespace PandoraPlus{ Clear(); } - std::shared_ptr<PandoraPlus::CaloHalfCluster> CaloHalfCluster::Clone() const{ - std::shared_ptr<PandoraPlus::CaloHalfCluster> m_clus = std::make_shared<PandoraPlus::CaloHalfCluster>(); + std::shared_ptr<Cyber::CaloHalfCluster> CaloHalfCluster::Clone() const{ + std::shared_ptr<Cyber::CaloHalfCluster> m_clus = std::make_shared<Cyber::CaloHalfCluster>(); for(int i1d=0; i1d<m_1dclusters.size(); i1d++) m_clus->addUnit(m_1dclusters[i1d]); for(int itrk=0; itrk<m_TrackCol.size(); itrk++) m_clus->addAssociatedTrack(m_TrackCol[itrk]); for(auto iter:map_localMax) m_clus->setLocalMax( iter.first, iter.second ); @@ -46,7 +46,7 @@ namespace PandoraPlus{ return m_clus; } - bool CaloHalfCluster::isNeighbor(const PandoraPlus::Calo1DCluster* m_1dcluster) const{ + bool CaloHalfCluster::isNeighbor(const Cyber::Calo1DCluster* m_1dcluster) const{ assert(m_1dcluster->getBars().size() > 0 && getCluster().at(0)->getBars().size()>0 ); if(m_1dcluster->getSlayer() != getSlayer() ) return false; @@ -153,32 +153,32 @@ namespace PandoraPlus{ return tower; } - std::vector<const PandoraPlus::Calo1DCluster*> CaloHalfCluster::getLocalMaxCol(std::string name) const{ - std::vector<const PandoraPlus::Calo1DCluster*> emptyCol; emptyCol.clear(); + std::vector<const Cyber::Calo1DCluster*> CaloHalfCluster::getLocalMaxCol(std::string name) const{ + std::vector<const Cyber::Calo1DCluster*> emptyCol; emptyCol.clear(); if(map_localMax.find(name)!=map_localMax.end()) emptyCol = map_localMax.at(name); return emptyCol; } std::vector<const Calo1DCluster*> CaloHalfCluster::getAllLocalMaxCol() const{ - std::vector<const PandoraPlus::Calo1DCluster*> emptyCol; emptyCol.clear(); + std::vector<const Cyber::Calo1DCluster*> emptyCol; emptyCol.clear(); for(auto &iter: map_localMax) emptyCol.insert(emptyCol.end(), iter.second.begin(), iter.second.end()); return emptyCol; } - std::vector<const PandoraPlus::CaloHalfCluster*> CaloHalfCluster::getHalfClusterCol(std::string name) const{ - std::vector<const PandoraPlus::CaloHalfCluster*> emptyCol; emptyCol.clear(); + std::vector<const Cyber::CaloHalfCluster*> CaloHalfCluster::getHalfClusterCol(std::string name) const{ + std::vector<const Cyber::CaloHalfCluster*> emptyCol; emptyCol.clear(); if(map_halfClusCol.find(name)!=map_halfClusCol.end()) emptyCol = map_halfClusCol.at(name); return emptyCol; } - std::vector<const PandoraPlus::CaloHalfCluster*> CaloHalfCluster::getAllHalfClusterCol() const{ - std::vector<const PandoraPlus::CaloHalfCluster*> emptyCol; emptyCol.clear(); + std::vector<const Cyber::CaloHalfCluster*> CaloHalfCluster::getAllHalfClusterCol() const{ + std::vector<const Cyber::CaloHalfCluster*> emptyCol; emptyCol.clear(); for(auto &iter: map_halfClusCol) emptyCol.insert(emptyCol.end(), iter.second.begin(), iter.second.end()); return emptyCol; } - std::vector<const PandoraPlus::Calo1DCluster*> CaloHalfCluster::getClusterInLayer(int _layer) const{ - std::vector<const PandoraPlus::Calo1DCluster*> outShowers; outShowers.clear(); + std::vector<const Cyber::Calo1DCluster*> CaloHalfCluster::getClusterInLayer(int _layer) const{ + std::vector<const Cyber::Calo1DCluster*> outShowers; outShowers.clear(); for(int i=0; i<m_1dclusters.size(); i++) if(m_1dclusters[i]->getDlayer()==_layer) outShowers.push_back(m_1dclusters[i]); return outShowers; @@ -268,7 +268,7 @@ namespace PandoraPlus{ void CaloHalfCluster::fitAxis( std::string name ){ - std::vector<const PandoraPlus::Calo1DCluster*> barShowerCol; barShowerCol.clear(); + std::vector<const Cyber::Calo1DCluster*> barShowerCol; barShowerCol.clear(); if(!name.empty() && map_localMax.find(name)!=map_localMax.end() ) barShowerCol = map_localMax.at(name); else barShowerCol = m_1dclusters; @@ -286,8 +286,8 @@ namespace PandoraPlus{ } else{ track->clear(); - double barAngle = (barShowerCol[0]->getTowerID()[0][0]+PandoraPlus::CaloUnit::Nmodule/4.)*2*TMath::Pi()/PandoraPlus::CaloUnit::Nmodule; - double posErr = PandoraPlus::CaloUnit::barsize/sqrt(12); + double barAngle = (barShowerCol[0]->getTowerID()[0][0]+Cyber::CaloUnit::Nmodule/4.)*2*TMath::Pi()/Cyber::CaloUnit::Nmodule; + double posErr = Cyber::CaloUnit::barsize/sqrt(12); if(barAngle>=TMath::TwoPi()) barAngle = barAngle-TMath::TwoPi(); track->setBarAngle(barAngle); for(int is=0; is<barShowerCol.size(); is++){ @@ -367,11 +367,11 @@ namespace PandoraPlus{ if(tmp_shower.size()>1){ //Merge following showers into the first: - PandoraPlus::CaloUnit* p_seed = nullptr; + Cyber::CaloUnit* p_seed = nullptr; float maxEseed = -99; for(int is=0; is<tmp_shower[0]->getNseeds(); is++){ if(tmp_shower[0]->getSeeds()[is]->getEnergy()>maxEseed){ - p_seed = const_cast<PandoraPlus::CaloUnit*>(tmp_shower[0]->getSeeds()[is]); + p_seed = const_cast<Cyber::CaloUnit*>(tmp_shower[0]->getSeeds()[is]); maxEseed=tmp_shower[0]->getSeeds()[is]->getEnergy(); } } @@ -380,21 +380,21 @@ namespace PandoraPlus{ //Find maxE as seed for(int iseed=0; iseed<tmp_shower[is]->getNseeds(); iseed++){ if(tmp_shower[is]->getSeeds()[iseed]->getEnergy()>maxEseed){ - p_seed = const_cast<PandoraPlus::CaloUnit*>(tmp_shower[is]->getSeeds()[iseed]); + p_seed = const_cast<Cyber::CaloUnit*>(tmp_shower[is]->getSeeds()[iseed]); maxEseed=tmp_shower[is]->getSeeds()[iseed]->getEnergy(); } } //Bars for(int icl=0; icl<tmp_shower[is]->getBars().size(); icl++){ - const_cast<PandoraPlus::Calo1DCluster*>(tmp_shower[0])->addUnit(tmp_shower[is]->getBars()[icl]); + const_cast<Cyber::Calo1DCluster*>(tmp_shower[0])->addUnit(tmp_shower[is]->getBars()[icl]); } tmp_shower.erase(tmp_shower.begin()+is); is--; } if(p_seed){ - std::vector<const PandoraPlus::CaloUnit*> tmp_seed; tmp_seed.clear(); + std::vector<const Cyber::CaloUnit*> tmp_seed; tmp_seed.clear(); tmp_seed.push_back(p_seed); - const_cast<PandoraPlus::Calo1DCluster*>(tmp_shower[0])->setSeeds( tmp_seed ); + const_cast<Cyber::Calo1DCluster*>(tmp_shower[0])->setSeeds( tmp_seed ); } } @@ -404,7 +404,7 @@ namespace PandoraPlus{ } - void CaloHalfCluster::deleteCousinCluster( const PandoraPlus::CaloHalfCluster* _cl ){ + void CaloHalfCluster::deleteCousinCluster( const Cyber::CaloHalfCluster* _cl ){ auto iter = find( map_halfClusCol["CousinCluster"].begin(), map_halfClusCol["CousinCluster"].end(), _cl ); if(iter!=map_halfClusCol["CousinCluster"].end()) map_halfClusCol["CousinCluster"].erase( iter ); } diff --git a/Reconstruction/CrystalCaloRec/src/Objects/CaloHit.cc b/Reconstruction/PFA/CyberPFA/src/Objects/CaloHit.cc similarity index 97% rename from Reconstruction/CrystalCaloRec/src/Objects/CaloHit.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/CaloHit.cc index baac05bbe2f35acee53ba09e63ec1b130c2866f6..f37d448426d6c65cb32f858cc3c3cb21f4605af1 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/CaloHit.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/CaloHit.cc @@ -3,7 +3,7 @@ #include "Objects/CaloHit.h" -namespace PandoraPlus{ +namespace Cyber{ std::shared_ptr<CaloHit> CaloHit::Clone() const{ diff --git a/Reconstruction/CrystalCaloRec/src/Objects/CaloUnit.cc b/Reconstruction/PFA/CyberPFA/src/Objects/CaloUnit.cc similarity index 99% rename from Reconstruction/CrystalCaloRec/src/Objects/CaloUnit.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/CaloUnit.cc index 694ecc714dd01a9598f23ec74c31b848a134503d..b2a9b619f3df03da8f77c847b56d644751675011 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/CaloUnit.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/CaloUnit.cc @@ -4,7 +4,7 @@ #include "Objects/CaloUnit.h" #include <cmath> -namespace PandoraPlus{ +namespace Cyber{ bool CaloUnit::isNeighbor(const CaloUnit* x) const { if( cellID==x->getcellID() ) return false; diff --git a/Reconstruction/CrystalCaloRec/src/Objects/HoughObject.cc b/Reconstruction/PFA/CyberPFA/src/Objects/HoughObject.cc similarity index 90% rename from Reconstruction/CrystalCaloRec/src/Objects/HoughObject.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/HoughObject.cc index 4225bede9eb978d5a78c8b9c5e6356882be526a3..f4f77f7dfbf5d8263d529b1d14641f5c992110e8 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/HoughObject.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/HoughObject.cc @@ -3,9 +3,9 @@ #include "Objects/HoughObject.h" -namespace PandoraPlus{ +namespace Cyber{ - HoughObject::HoughObject( const PandoraPlus::Calo1DCluster* _localmax, double _cellSize, double _ecal_inner_radius, double _phi){ + HoughObject::HoughObject( const Cyber::Calo1DCluster* _localmax, double _cellSize, double _ecal_inner_radius, double _phi){ m_local_max = _localmax; setCellSize(_cellSize); diff --git a/Reconstruction/CrystalCaloRec/src/Objects/HoughSpace.cc b/Reconstruction/PFA/CyberPFA/src/Objects/HoughSpace.cc similarity index 97% rename from Reconstruction/CrystalCaloRec/src/Objects/HoughSpace.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/HoughSpace.cc index 996fa56a0dad94b0ab226d466a26f7a3e5624053..132e28b25670d28f9c67768698e94a48c4999a2c 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/HoughSpace.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/HoughSpace.cc @@ -3,7 +3,7 @@ #include "Objects/HoughSpace.h" #include <iostream> -namespace PandoraPlus{ +namespace Cyber{ int HoughSpace::getAlphaBin(double alpha) const{ if(alpha<alpha_low){ diff --git a/Reconstruction/CrystalCaloRec/src/Objects/PFObject.cc b/Reconstruction/PFA/CyberPFA/src/Objects/PFObject.cc similarity index 88% rename from Reconstruction/CrystalCaloRec/src/Objects/PFObject.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/PFObject.cc index 3205ff560fe060b0a27ff69688137678c405348f..c9038b120f9a80b4a21e22c6874c83b03635c32b 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/PFObject.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/PFObject.cc @@ -2,7 +2,7 @@ #define PFOBJECT_C #include "Objects/PFObject.h" -namespace PandoraPlus{ +namespace Cyber{ void PFObject::Clear() { @@ -12,8 +12,8 @@ namespace PandoraPlus{ m_hcal_clusters.clear(); } - std::shared_ptr<PandoraPlus::PFObject> PFObject::Clone() const{ - std::shared_ptr<PandoraPlus::PFObject> m_newpfo = std::make_shared<PandoraPlus::PFObject>(); + std::shared_ptr<Cyber::PFObject> PFObject::Clone() const{ + std::shared_ptr<Cyber::PFObject> m_newpfo = std::make_shared<Cyber::PFObject>(); m_newpfo->setTrack(m_tracks); m_newpfo->setECALCluster(m_ecal_clusters); m_newpfo->setHCALCluster(m_hcal_clusters); diff --git a/Reconstruction/CrystalCaloRec/src/Objects/Track.cc b/Reconstruction/PFA/CyberPFA/src/Objects/Track.cc similarity index 99% rename from Reconstruction/CrystalCaloRec/src/Objects/Track.cc rename to Reconstruction/PFA/CyberPFA/src/Objects/Track.cc index b74fbf402a971750337212c990f8ed51dbec2fb2..bb083dd024f9a9b54a9c463420a2e99c6ff0b9fd 100644 --- a/Reconstruction/CrystalCaloRec/src/Objects/Track.cc +++ b/Reconstruction/PFA/CyberPFA/src/Objects/Track.cc @@ -5,7 +5,7 @@ #include <cmath> #include "TGraph.h" -namespace PandoraPlus{ +namespace Cyber{ const double Track::B = 3.; diff --git a/Reconstruction/CrystalCaloRec/src/Tools/CaloHitsCreator.cpp b/Reconstruction/PFA/CyberPFA/src/Tools/CaloHitsCreator.cpp similarity index 84% rename from Reconstruction/CrystalCaloRec/src/Tools/CaloHitsCreator.cpp rename to Reconstruction/PFA/CyberPFA/src/Tools/CaloHitsCreator.cpp index 873d2f6a98d16eb49077a0e4fa5102891d88b810..2b19c09283676da026f4a5747ecd6da87ee7626a 100644 --- a/Reconstruction/CrystalCaloRec/src/Tools/CaloHitsCreator.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Tools/CaloHitsCreator.cpp @@ -3,12 +3,12 @@ #include "Tools/CaloHitsCreator.h" -namespace PandoraPlus{ +namespace Cyber{ CaloHitsCreator::CaloHitsCreator(const Settings& m_settings) : settings( m_settings ){ }; - StatusCode CaloHitsCreator::CreateCaloHits( PandoraPlusDataCol& m_DataCol, + StatusCode CaloHitsCreator::CreateCaloHits( CyberDataCol& m_DataCol, std::vector<DataHandle<edm4hep::CalorimeterHitCollection>*>& r_CaloHitCols, std::map<std::string, dd4hep::DDSegmentation::BitFieldCoder*>& map_decoder, std::map<std::string, DataHandle<edm4hep::MCRecoCaloParticleAssociationCollection>*>& map_CaloParticleAssoCol ) @@ -34,14 +34,14 @@ namespace PandoraPlus{ for(auto iter : m_DataCol.collectionMap_CaloHit){ if( settings.map_stringPars.at("EcalType")=="BarEcal" && iter.first == "ECALBarrel") continue; - std::vector<std::shared_ptr<PandoraPlus::CaloHit>> m_hitCol; m_hitCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloHit>> m_hitCol; m_hitCol.clear(); const edm4hep::MCRecoCaloParticleAssociationCollection* const_MCPCaloAssoCol; if( map_CaloParticleAssoCol.find(iter.first)!=map_CaloParticleAssoCol.end()) const_MCPCaloAssoCol = map_CaloParticleAssoCol[iter.first]->get(); for(int ihit=0; ihit<iter.second.size(); ihit++){ - //PandoraPlus::CaloHit* m_hit = new PandoraPlus::CaloHit(); - std::shared_ptr<PandoraPlus::CaloHit> m_hit = std::make_shared<PandoraPlus::CaloHit>(); + //Cyber::CaloHit* m_hit = new Cyber::CaloHit(); + std::shared_ptr<Cyber::CaloHit> m_hit = std::make_shared<Cyber::CaloHit>(); m_hit->setOriginHit( iter.second[ihit] ); m_hit->setcellID( iter.second[ihit].getCellID() ); @@ -63,13 +63,13 @@ namespace PandoraPlus{ //Convert to local objects: CalorimeterHit to CaloUnit (For ECALBarrel only) if(settings.map_stringPars.at("EcalType")=="BarEcal"){ - std::vector<std::shared_ptr<PandoraPlus::CaloUnit>> m_barCol; m_barCol.clear(); + std::vector<std::shared_ptr<Cyber::CaloUnit>> m_barCol; m_barCol.clear(); const edm4hep::MCRecoCaloParticleAssociationCollection* const_MCPCaloAssoCol = map_CaloParticleAssoCol["ECALBarrel"]->get(); auto CaloHits = m_DataCol.collectionMap_CaloHit["ECALBarrel"]; - std::map<std::uint64_t, std::vector<PandoraPlus::CaloUnit> > map_cellID_hits; map_cellID_hits.clear(); + std::map<std::uint64_t, std::vector<Cyber::CaloUnit> > map_cellID_hits; map_cellID_hits.clear(); for(auto& hit : CaloHits){ - PandoraPlus::CaloUnit m_bar; + Cyber::CaloUnit m_bar; m_bar.setcellID(hit.getCellID()); m_bar.setPosition( TVector3(hit.getPosition().x, hit.getPosition().y, hit.getPosition().z) ); m_bar.setQ(hit.getEnergy()/2., hit.getEnergy()/2.); @@ -84,8 +84,8 @@ namespace PandoraPlus{ for(auto& hit : map_cellID_hits){ if(hit.second.size()!=2){ std::cout<<"WARNING: didn't find correct hit pairs! "<<std::endl; continue; } - //PandoraPlus::CaloUnit* m_bar = new PandoraPlus::CaloUnit(); - std::shared_ptr<PandoraPlus::CaloUnit> m_bar = std::make_shared<PandoraPlus::CaloUnit>(); + //Cyber::CaloUnit* m_bar = new Cyber::CaloUnit(); + std::shared_ptr<Cyber::CaloUnit> m_bar = std::make_shared<Cyber::CaloUnit>(); unsigned long long id = hit.first; m_bar->setcellID( id ); @@ -102,10 +102,10 @@ namespace PandoraPlus{ //---oooOOO000OOOooo---set bar length---oooOOO000OOOooo--- //TODO: reading bar length from geosvc. double t_bar_length; - if(m_bar->getSlayer()==1) t_bar_length = 375.133; + if(m_bar->getSlayer()==1) t_bar_length = 374.667; else{ - if( m_bar->getModule()%2==0 ) t_bar_length = 295.905 + (m_bar->getDlayer()-1)* 6.13231; - else t_bar_length = 416.843 - (m_bar->getDlayer()+1)* 2.25221; + if( m_bar->getModule()%2==0 ) t_bar_length = 288 + (m_bar->getDlayer()-1)* 12.708; + else t_bar_length = 409 - (m_bar->getDlayer()-1)* 4.667; } m_bar->setBarLength(t_bar_length); //---oooOOO000OOOooo---set bar length---oooOOO000OOOooo--- diff --git a/Reconstruction/CrystalCaloRec/src/Tools/MCParticleCreator.cpp b/Reconstruction/PFA/CyberPFA/src/Tools/MCParticleCreator.cpp similarity index 82% rename from Reconstruction/CrystalCaloRec/src/Tools/MCParticleCreator.cpp rename to Reconstruction/PFA/CyberPFA/src/Tools/MCParticleCreator.cpp index 561dafc474b847979d20748bf719db220efe2f2c..be8cd697ac617d98b6d24e8e573d99e3b52f255f 100644 --- a/Reconstruction/CrystalCaloRec/src/Tools/MCParticleCreator.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Tools/MCParticleCreator.cpp @@ -3,13 +3,13 @@ #include "Tools/MCParticleCreator.h" -namespace PandoraPlus{ +namespace Cyber{ MCParticleCreator::MCParticleCreator( const Settings& m_settings ): settings(m_settings){ } - StatusCode MCParticleCreator::CreateMCParticle( PandoraPlusDataCol& m_DataCol, DataHandle<edm4hep::MCParticleCollection>& r_MCParticleCol ){ + StatusCode MCParticleCreator::CreateMCParticle( CyberDataCol& m_DataCol, DataHandle<edm4hep::MCParticleCollection>& r_MCParticleCol ){ if(settings.map_stringPars.at("MCParticleCollections").empty()) return StatusCode::SUCCESS; m_DataCol.collectionMap_MC.clear(); diff --git a/Reconstruction/CrystalCaloRec/src/Tools/OutputCreator.cpp b/Reconstruction/PFA/CyberPFA/src/Tools/OutputCreator.cpp similarity index 94% rename from Reconstruction/CrystalCaloRec/src/Tools/OutputCreator.cpp rename to Reconstruction/PFA/CyberPFA/src/Tools/OutputCreator.cpp index 8e95bb3f7d76defa57d2f85368076622d65fef56..b36d83257e7f3c1d7589c8afef0150fb18a9fdb0 100644 --- a/Reconstruction/CrystalCaloRec/src/Tools/OutputCreator.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Tools/OutputCreator.cpp @@ -3,14 +3,14 @@ #include "Tools/OutputCreator.h" -namespace PandoraPlus{ +namespace Cyber{ OutputCreator::OutputCreator( const Settings& m_settings ): settings(m_settings){ } - StatusCode OutputCreator::CreateOutputCollections( PandoraPlusDataCol& m_DataCol, + StatusCode OutputCreator::CreateOutputCollections( CyberDataCol& m_DataCol, DataHandle<edm4hep::CalorimeterHitCollection>& m_outRecHitsHandler, DataHandle<edm4hep::CalorimeterHitCollection>& m_outRecCoreHandler, DataHandle<edm4hep::CalorimeterHitCollection>& m_outRecHcalHitsHandler, @@ -32,7 +32,7 @@ namespace PandoraPlus{ //PFO - std::vector<std::shared_ptr<PandoraPlus::PFObject>> p_pfos = m_DataCol.map_PFObjects[settings.map_stringPars.at("OutputPFO")]; + std::vector<std::shared_ptr<Cyber::PFObject>> p_pfos = m_DataCol.map_PFObjects[settings.map_stringPars.at("OutputPFO")]; std::cout<<" Input PFO size: "<<p_pfos.size()<<std::endl; for(int ip=0; ip<p_pfos.size(); ip++){ auto m_pfo = m_pfocol->create(); @@ -50,7 +50,7 @@ std::cout<<" Input PFO size: "<<p_pfos.size()<<std::endl; //create high granularity ECAL hits for(int ih=0; ih<p_clus->getCaloHits().size(); ih++){ - const PandoraPlus::CaloHit* p_hit = p_clus->getCaloHits()[ih]; + const Cyber::CaloHit* p_hit = p_clus->getCaloHits()[ih]; edm4hep::Vector3f pos(p_hit->getPosition().x(), p_hit->getPosition().y(), p_hit->getPosition().z()); int _module = p_hit->getModule(); int _layer = p_hit->getLayer(); @@ -68,7 +68,7 @@ std::cout<<" Input PFO size: "<<p_pfos.size()<<std::endl; auto m_core = m_Ecalcore->create(); double totE = 0.; for(int ih=0; ih<p_clus->getCluster().size(); ih++){ - const PandoraPlus::Calo2DCluster* p_core = p_clus->getCluster()[ih]; + const Cyber::Calo2DCluster* p_core = p_clus->getCluster()[ih]; edm4hep::Vector3f pos(p_core->getPos().x(), p_core->getPos().y(), p_core->getPos().z()); int _module = p_core->getTowerID()[0][0]; int _layer = p_core->getDlayer(); @@ -111,7 +111,7 @@ std::cout<<" Input PFO size: "<<p_pfos.size()<<std::endl; auto m_clus = m_Hcalcluster->create(); for(int ih=0; ih<p_clus->getCaloHits().size(); ih++){ - const PandoraPlus::CaloHit* p_hit = p_clus->getCaloHits()[ih]; + const Cyber::CaloHit* p_hit = p_clus->getCaloHits()[ih]; //auto _hit = m_hcalhitCol->create(); auto _hit = p_hit->getOriginHit().clone(); m_hcalhitCol->push_back(_hit); @@ -206,7 +206,7 @@ std::cout<<" Created PFO size: "<<m_pfocol->size()<<std::endl; //TrkInit_Helix->Initialize_Canonical(m_trkst.phi, m_trkst.D0, m_trkst.Z0, m_trkst.omega, m_trkst.tanLambda, settings.map_floatPars["BField"]); //float intPoint[3]; //float refPoint[3] = {mcp_vertex.x, mcp_vertex.y, mcp_vertex.z}; - //TrkInit_Helix->getPointOnCircle(PandoraPlus::CaloUnit::ecal_innerR, refPoint, intPoint); + //TrkInit_Helix->getPointOnCircle(Cyber::CaloUnit::ecal_innerR, refPoint, intPoint); ////If track reach to the edge of barrel //if(fabs(intPoint[2])>ECALHalfZ ){ // TrkInit_Helix->getPointInZ(ECALHalfZ, refPoint, intPoint); diff --git a/Reconstruction/CrystalCaloRec/src/Tools/TrackCreator.cpp b/Reconstruction/PFA/CyberPFA/src/Tools/TrackCreator.cpp similarity index 87% rename from Reconstruction/CrystalCaloRec/src/Tools/TrackCreator.cpp rename to Reconstruction/PFA/CyberPFA/src/Tools/TrackCreator.cpp index 1beddc5bac76debe33f8cbf4016376a57571a7b7..aca3e85ca297d8cefee9d587bdbe3d986a00adef 100644 --- a/Reconstruction/CrystalCaloRec/src/Tools/TrackCreator.cpp +++ b/Reconstruction/PFA/CyberPFA/src/Tools/TrackCreator.cpp @@ -3,14 +3,14 @@ #include "Tools/TrackCreator.h" -namespace PandoraPlus{ +namespace Cyber{ TrackCreator::TrackCreator(const Settings& m_settings) : settings( m_settings ){ }; - StatusCode TrackCreator::CreateTracks( PandoraPlusDataCol& m_DataCol, + StatusCode TrackCreator::CreateTracks( CyberDataCol& m_DataCol, std::vector<DataHandle<edm4hep::TrackCollection>*>& r_TrackCols, DataHandle<edm4hep::MCRecoTrackParticleAssociationCollection>* r_MCParticleTrkCol ){ @@ -32,18 +32,18 @@ namespace PandoraPlus{ //Convert to local objects - std::vector<std::shared_ptr<PandoraPlus::Track>> m_trkCol; m_trkCol.clear(); + std::vector<std::shared_ptr<Cyber::Track>> m_trkCol; m_trkCol.clear(); const edm4hep::MCRecoTrackParticleAssociationCollection* const_MCPTrkAssoCol = r_MCParticleTrkCol->get(); for(auto iter : m_DataCol.collectionMap_Track){ auto const_TrkCol = iter.second; for(int itrk=0; itrk<const_TrkCol.size(); itrk++){ - //PandoraPlus::Track* m_trk = new PandoraPlus::Track(); - std::shared_ptr<PandoraPlus::Track> m_trk = std::make_shared<PandoraPlus::Track>(); - std::vector<PandoraPlus::TrackState> m_trkstates; + //Cyber::Track* m_trk = new Cyber::Track(); + std::shared_ptr<Cyber::Track> m_trk = std::make_shared<Cyber::Track>(); + std::vector<Cyber::TrackState> m_trkstates; for(int its=0; its<const_TrkCol[itrk].trackStates_size(); its++){ - PandoraPlus::TrackState m_trkst; + Cyber::TrackState m_trkst; m_trkst.D0 = const_TrkCol[itrk].getTrackStates(its).D0; m_trkst.Z0 = const_TrkCol[itrk].getTrackStates(its).Z0; m_trkst.phi0 = const_TrkCol[itrk].getTrackStates(its).phi; @@ -90,7 +90,7 @@ namespace PandoraPlus{ } - StatusCode TrackCreator::CreateTracksFromMCParticle(PandoraPlusDataCol& m_DataCol, + StatusCode TrackCreator::CreateTracksFromMCParticle(CyberDataCol& m_DataCol, DataHandle<edm4hep::MCParticleCollection>& r_MCParticleCol){ @@ -107,10 +107,10 @@ namespace PandoraPlus{ } // Convert to local Track objects - std::vector<std::shared_ptr<PandoraPlus::Track>> m_trkCol; m_trkCol.clear(); + std::vector<std::shared_ptr<Cyber::Track>> m_trkCol; m_trkCol.clear(); for(auto mcp : m_MCPvec){ - std::shared_ptr<PandoraPlus::Track> m_trk = std::make_shared<PandoraPlus::Track>(); - std::vector<PandoraPlus::TrackState> m_trkstates; + std::shared_ptr<Cyber::Track> m_trk = std::make_shared<Cyber::Track>(); + std::vector<Cyber::TrackState> m_trkstates; TVector3 mcp_vertex(mcp.getVertex().x, mcp.getVertex().y, mcp.getVertex().z); TVector3 mcp_p(mcp.getMomentum().x, mcp.getMomentum().y, mcp.getMomentum().z); @@ -118,7 +118,7 @@ namespace PandoraPlus{ double charge = mcp.getCharge(); // Evaluate track state at vertex - PandoraPlus::TrackState m_trkst; + Cyber::TrackState m_trkst; m_trkst.location = 1; // At IP m_trkst.D0 = 0; m_trkst.Z0 = 0; diff --git a/Reconstruction/CrystalCaloRec/src/Tools/TrackFitInEcal.cpp b/Reconstruction/PFA/CyberPFA/src/Tools/TrackFitInEcal.cpp similarity index 100% rename from Reconstruction/CrystalCaloRec/src/Tools/TrackFitInEcal.cpp rename to Reconstruction/PFA/CyberPFA/src/Tools/TrackFitInEcal.cpp diff --git a/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h b/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h index 4f2b6182c431cf3249591ae06f435bec7240b38d..b81bc14e7629be01653dca659257a1e0a253efea 100644 --- a/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h +++ b/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h @@ -23,7 +23,7 @@ public: virtual void Initialize(G4HCofThisEvent* HCE); virtual G4bool ProcessHits(G4Step* step,G4TouchableHistory* history); virtual void EndOfEvent(G4HCofThisEvent* HCE); - void ApplyBirksLaw(){m_applyBirksLaw = true;}; + void ApplyBirksLaw(double _birks){m_applyBirksLaw = true; m_BirksConst = _birks;}; protected: CalorimeterHit* find(const HitCollection*, const dd4hep::sim::HitCompare<CalorimeterHit>&); @@ -34,6 +34,7 @@ protected: std::map<unsigned long, CalorimeterHit*> m_hitMap; bool m_isMergeEnabled = false; bool m_applyBirksLaw = false; + double m_BirksConst = 0.; }; diff --git a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp index 950c4c45f91c1084f21fc95982fb533ae6b7a596..b023b3dcd673e1670cd8d74f6ec5f6be67ed2916 100644 --- a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp @@ -63,9 +63,17 @@ CaloSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) { m_hc->insert(hit); } hit->truth.push_back(contrib); - //hit->energyDeposit += contrib.deposit; - hit->energyDeposit += h.totalEnergy(); - //std::cout << "Apply Birk law: before = " << contrib.deposit << " after = " << h.totalEnergy() << std::endl; + double depEnergy = step->GetTotalEnergyDeposit(); + double stepl = step->GetStepLength(); + double charge = step->GetTrack()->GetDefinition()->GetPDGCharge(); + double visEnergy = depEnergy; + if( m_applyBirksLaw * m_BirksConst * depEnergy * stepl * charge !=0 ){ + visEnergy = depEnergy/(1 + m_BirksConst*depEnergy/stepl); + } + hit->energyDeposit += visEnergy; + + //std::cout << "Birk constant " << m_BirksConst << ", step length: "<< stepl << ", charge "<<charge; + //std::cout << ". before = " << depEnergy << " after = " << visEnergy << std::endl; return true; } diff --git a/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp b/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp index 12a5f3f9586884efa9f5f3ee95f5aa9a82281362..3884764225aa44a5b4bce1213bf2402e487d56ee 100644 --- a/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp +++ b/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp @@ -46,15 +46,20 @@ CalorimeterSensDetTool::createSD(const std::string& name) { CaloSensitiveDetector* sd = new CaloSensitiveDetector(name, *dd4hep_geo, is_merge_enabled); warning() << name << " set to merge true/false = " << is_merge_enabled << endmsg; - for(auto cal_name : m_listCalsApplyBirks){ - if(cal_name==name){ - info() << name << " will apply Birks law" << endmsg; - sd->ApplyBirksLaw(); - break; + + if(m_listCalsApplyBirks.size()!=m_listCalsBirksConst.size()){ + info() << name << " is set to apply Birks law, but Hit collection and Birks constant collection can not match! " << endmsg; + } + else{ + for(int i=0; i<m_listCalsApplyBirks.size(); i++){ + if(m_listCalsApplyBirks[i]==name){ + info() << name << " will apply Birks law" << endmsg; + sd->ApplyBirksLaw(m_listCalsBirksConst[i]); + break; + } } } - return sd; } diff --git a/Simulation/DetSimSD/src/CalorimeterSensDetTool.h b/Simulation/DetSimSD/src/CalorimeterSensDetTool.h index 69bab1d4e5a5bde38b087ce14d54c8db1969dd96..95cc732f20b7abdec58abfbdd2323df16037551d 100644 --- a/Simulation/DetSimSD/src/CalorimeterSensDetTool.h +++ b/Simulation/DetSimSD/src/CalorimeterSensDetTool.h @@ -31,6 +31,7 @@ private: Gaudi::Property<std::vector<std::string> > m_listCalsMergeDisable{this, "CalNamesMergeDisable", {}}; Gaudi::Property<std::vector<std::string> > m_listCalsApplyBirks{this, "CalNamesApplyBirks", {}}; + Gaudi::Property<std::vector<double> > m_listCalsBirksConst{this, "CalNamesBirksConstants", {}}; }; #endif