33 LogInfo(
"PFTrackTransformer") <<
"PFTrackTransformer built";
43 bool msgwarning)
const {
44 LogDebug(
"PFTrackTransformer") <<
"Trajectory propagation started";
50 float pfenergy =
sqrt((pfmass * pfmass) + (
track.p() *
track.p()));
60 float pfoutenergy =
sqrt((pfmass * pfmass) +
track.outerMomentum().Mag2());
66 track.outerMomentum().x(),
track.outerMomentum().y(),
track.outerMomentum().z(), pfoutenergy),
73 theOutParticle = theParticle;
86 PFTrajectoryPoint::BeamPipeOrEndVertex,
98 vector<TrajectoryMeasurement> measurements = traj.
measurements();
99 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
100 int increment = (direction) ? +1 : -1;
101 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
103 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
104 GlobalPoint v = measurements[iTraj].updatedState().globalPosition();
105 GlobalVector p = measurements[iTraj].updatedState().globalMomentum();
106 unsigned int iid = measurements[iTraj].recHit()->det()->geographicalId().rawId();
113 bool isBelowPS =
false;
114 theOutParticle.propagateToPreshowerLayer1(
false);
115 if (theOutParticle.getSuccess() != 0)
117 PFTrajectoryPoint::PS1,
126 theOutParticle.propagateToPreshowerLayer2(
false);
127 if (theOutParticle.getSuccess() != 0) {
129 PFTrajectoryPoint::PS2,
139 theOutParticle.propagateToEcalEntrance(
false);
140 if (theOutParticle.getSuccess() != 0) {
142 PFTrajectoryPoint::ECALEntrance,
145 double ecalShowerDepth = PFCluster::getDepthCorrection(theOutParticle.particle().momentum().E(), isBelowPS,
false);
152 PFTrajectoryPoint::ECALShowerMax,
160 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
161 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.particle().pt() <<
" "
162 << theOutParticle.particle().eta();
170 theOutParticle.propagateToHcalEntrance(
false);
171 if (theOutParticle.getSuccess() != 0)
173 PFTrajectoryPoint::HCALEntrance,
178 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
180 pftrack.
addPoint(dummyHCALentrance);
185 theOutParticle.propagateToHcalExit(
false);
186 if (theOutParticle.getSuccess() != 0)
188 PFTrajectoryPoint::HCALExit,
193 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
201 theOutParticle.setMagneticField(0);
202 theOutParticle.propagateToHOLayer(
false);
203 if (theOutParticle.getSuccess() != 0) {
205 PFTrajectoryPoint::HOLayer,
209 if (
PT > 5. &&
abs(theOutParticle.particle().Z()) < 700.25 && msgwarning)
210 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
220 theOutParticle.setMagneticField(0);
221 theOutParticle.propagateToVFcalEntrance(
false);
222 if (theOutParticle.getSuccess() != 0) {
224 PFTrajectoryPoint::VFcalEntrance,
229 pftrack.
addPoint(dummyVFcalentrance);
237 const bool& GetMode)
const {
242 vector<TrajectoryMeasurement> measurements = traj.
measurements();
243 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
244 int increment = (direction) ? +1 : -1;
245 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
247 unsigned int iTrajPos = 0;
248 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
249 GlobalPoint v = measurements[iTraj].updatedState().globalPosition();
252 bool ComputeMODE = GetMode;
256 unsigned int iid = measurements[iTraj].recHit()->det()->geographicalId().rawId();
262 float ptot =
sqrt((
p.x() *
p.x()) + (
p.y() *
p.y()) + (
p.z() *
p.z()));
263 float pfenergy = ptot;
265 if (iTraj == iTrajFirst) {
284 PFTrajectoryPoint::BeamPipeOrEndVertex,
296 if (iTraj != iTrajFirst && iTraj != (
abs(iTrajLast) - 1)) {
300 if (iTraj == (
abs(iTrajLast) - 1)) {
314 bool isBelowPS =
false;
318 PFTrajectoryPoint::PS1,
330 PFTrajectoryPoint::PS2,
343 PFTrajectoryPoint::ECALEntrance,
346 double ecalShowerDepth =
347 PFCluster::getDepthCorrection(theOutParticle.
particle().
momentum().E(), isBelowPS,
false);
354 PFTrajectoryPoint::ECALShowerMax,
359 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
360 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.
particle().
pt()
372 PFTrajectoryPoint::HCALEntrance,
377 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
379 pftrack.
addPoint(dummyHCALentrance);
385 PFTrajectoryPoint::HCALExit,
390 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
401 PFTrajectoryPoint::HOLayer,
406 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
419 if ((
v.perp() > 110) || (fabs(
v.z()) > 280))
421 unsigned int iTrajPoint = iTrajPos + 2;
425 PFBrem brem(DP, SigmaDP, iTrajPoint);
428 float e_gamma = fabs(DP);
429 constexpr
int gamma_charge = 0;
448 bool isBelowPS =
false;
452 PFTrajectoryPoint::PS1,
465 PFTrajectoryPoint::PS2,
478 PFTrajectoryPoint::ECALEntrance,
481 double ecalShowerDepth =
482 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
489 PFTrajectoryPoint::ECALShowerMax,
494 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
495 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: "
508 PFTrajectoryPoint::HCALEntrance,
513 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
522 PFTrajectoryPoint::HCALExit,
527 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
538 PFTrajectoryPoint::HOLayer,
542 if ((DP > 5.) && ((DP / SigmaDP) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
543 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
559 unsigned int iTrajPos = 0;
560 unsigned int iid = 0;
568 LogWarning(
"PFTrackTransformer") <<
" INNER TSOS NOT VALID ";
570 LogWarning(
"PFTrackTransformer") <<
" OUTER TSOS NOT VALID ";
585 float ptot =
sqrt((InMom.
x() * InMom.
x()) + (InMom.
y() * InMom.
y()) + (InMom.
z() * InMom.
z()));
586 float pfenergy = ptot;
605 PFTrajectoryPoint::BeamPipeOrEndVertex,
621 unsigned int iTrajPoint = iTrajPos + 2;
622 double dp_tang = ptot;
623 double sdp_tang =
track.ptModeError() * (
track.pMode() /
track.ptMode());
624 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
625 constexpr
int gamma_charge = 0;
641 bool isBelowPS =
false;
645 PFTrajectoryPoint::PS1,
658 PFTrajectoryPoint::PS2,
671 PFTrajectoryPoint::ECALEntrance,
676 double EDepthCorr = 0.01;
677 double ecalShowerDepth = PFCluster::getDepthCorrection(EDepthCorr, isBelowPS,
false);
684 PFTrajectoryPoint::ECALShowerMax,
688 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
690 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
691 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: "
704 PFTrajectoryPoint::HCALEntrance,
708 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
710 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
719 PFTrajectoryPoint::HCALExit,
723 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
725 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
736 PFTrajectoryPoint::HOLayer,
740 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
741 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
755 if (
track.gsfExtra()->tangentsSize() == 0)
757 <<
"BE CAREFUL: Gsf Tangents not stored in the event. You need to re-reco the particle-flow with "
758 "RecoToDisplay_cfg.py and not RecoToDisplay_NoTracking_cfg.py ";
760 vector<GsfTangent> gsftang =
track.gsfExtra()->tangents();
761 for (
unsigned int iTang = 0; iTang <
track.gsfExtra()->tangentsSize(); iTang++) {
762 dp_tang = gsftang[iTang].deltaP().value();
763 sdp_tang = gsftang[iTang].deltaP().error();
768 (fabs(gsftang[iTang].
position().
z()) > 280))
771 iTrajPoint = iTrajPos + 2;
772 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
775 GlobalVector(gsftang[iTang].momentum().
x(), gsftang[iTang].momentum().
y(), gsftang[iTang].momentum().
z());
789 double e_gamma = fabs(dp_tang);
794 gsftang[iTang].
position().x(), gsftang[iTang].position().y(), gsftang[iTang].position().z(), 0.),
810 PFTrajectoryPoint::PS1,
823 PFTrajectoryPoint::PS2,
836 PFTrajectoryPoint::ECALEntrance,
840 double ecalShowerDepth =
841 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
848 PFTrajectoryPoint::ECALShowerMax,
852 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
854 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
855 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: "
868 PFTrajectoryPoint::HCALEntrance,
872 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
874 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
883 PFTrajectoryPoint::HCALExit,
887 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
889 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
900 PFTrajectoryPoint::HOLayer,
904 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
905 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
934 float ptot_out =
sqrt((OutMom.
x() * OutMom.
x()) + (OutMom.
y() * OutMom.
y()) + (OutMom.
z() * OutMom.
z()));
935 float pTtot_out =
sqrt((OutMom.
x() * OutMom.
x()) + (OutMom.
y() * OutMom.
y()));
936 float pfenergy_out = ptot_out;
948 PFTrajectoryPoint::PS1,
959 PFTrajectoryPoint::PS2,
972 PFTrajectoryPoint::ECALEntrance,
975 double EDepthCorr = 0.01;
976 double ecalShowerDepth = PFCluster::getDepthCorrection(EDepthCorr, isBelowPS,
false);
983 PFTrajectoryPoint::ECALShowerMax,
988 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
989 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.
particle().
pt()
1002 PFTrajectoryPoint::HCALEntrance,
1007 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1009 pftrack.
addPoint(dummyHCALentrance);
1015 PFTrajectoryPoint::HCALExit,
1020 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1031 PFTrajectoryPoint::HOLayer,
1035 if (pTtot_out > 5. &&
abs(theOutParticle.
particle().
Z()) < 700.25)
1036 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
1043 dp_tang = OutMom.
mag();
1046 iTrajPoint = iTrajPos + 2;
1047 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
1066 PFTrajectoryPoint::PS1,
1079 PFTrajectoryPoint::PS2,
1092 PFTrajectoryPoint::ECALEntrance,
1095 double ecalShowerDepth =
1096 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
1103 PFTrajectoryPoint::ECALShowerMax,
1107 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1109 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n"
1110 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: "
1123 PFTrajectoryPoint::HCALEntrance,
1127 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1129 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1137 PFTrajectoryPoint::HCALExit,
1141 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1143 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1154 PFTrajectoryPoint::HOLayer,
1158 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
1159 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";