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";
558 unsigned int iTrajPos = 0;
559 unsigned int iid = 0;
567 LogWarning(
"PFTrackTransformer") <<
" INNER TSOS NOT VALID ";
569 LogWarning(
"PFTrackTransformer") <<
" OUTER TSOS NOT VALID ";
584 float ptot =
sqrt((InMom.
x() * InMom.
x()) + (InMom.
y() * InMom.
y()) + (InMom.
z() * InMom.
z()));
585 float pfenergy = ptot;
604 PFTrajectoryPoint::BeamPipeOrEndVertex,
620 unsigned int iTrajPoint = iTrajPos + 2;
621 double dp_tang = ptot;
622 double sdp_tang =
track.ptModeError() * (
track.pMode() /
track.ptMode());
623 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
624 constexpr
int gamma_charge = 0;
640 bool isBelowPS =
false;
644 PFTrajectoryPoint::PS1,
657 PFTrajectoryPoint::PS2,
670 PFTrajectoryPoint::ECALEntrance,
675 double EDepthCorr = 0.01;
676 double ecalShowerDepth = PFCluster::getDepthCorrection(EDepthCorr, isBelowPS,
false);
683 PFTrajectoryPoint::ECALShowerMax,
687 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
689 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 690 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 703 PFTrajectoryPoint::HCALEntrance,
707 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
709 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
718 PFTrajectoryPoint::HCALExit,
722 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
724 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
735 PFTrajectoryPoint::HOLayer,
739 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
740 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
753 if (
track.gsfExtra()->tangentsSize() == 0)
755 <<
"BE CAREFUL: Gsf Tangents not stored in the event. You need to re-reco the particle-flow with " 756 "RecoToDisplay_cfg.py and not RecoToDisplay_NoTracking_cfg.py ";
758 vector<GsfTangent> gsftang =
track.gsfExtra()->tangents();
759 for (
unsigned int iTang = 0; iTang <
track.gsfExtra()->tangentsSize(); iTang++) {
760 dp_tang = gsftang[iTang].deltaP().value();
761 sdp_tang = gsftang[iTang].deltaP().error();
766 (fabs(gsftang[iTang].
position().
z()) > 280))
769 iTrajPoint = iTrajPos + 2;
770 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
773 GlobalVector(gsftang[iTang].momentum().
x(), gsftang[iTang].momentum().
y(), gsftang[iTang].momentum().
z());
787 double e_gamma = fabs(dp_tang);
792 gsftang[iTang].
position().x(), gsftang[iTang].position().y(), gsftang[iTang].position().z(), 0.),
808 PFTrajectoryPoint::PS1,
821 PFTrajectoryPoint::PS2,
834 PFTrajectoryPoint::ECALEntrance,
838 double ecalShowerDepth =
839 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
846 PFTrajectoryPoint::ECALShowerMax,
850 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
852 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 853 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 866 PFTrajectoryPoint::HCALEntrance,
870 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
872 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
881 PFTrajectoryPoint::HCALExit,
885 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
887 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
898 PFTrajectoryPoint::HOLayer,
902 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
903 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
931 float ptot_out =
sqrt((OutMom.
x() * OutMom.
x()) + (OutMom.
y() * OutMom.
y()) + (OutMom.
z() * OutMom.
z()));
932 float pTtot_out =
sqrt((OutMom.
x() * OutMom.
x()) + (OutMom.
y() * OutMom.
y()));
933 float pfenergy_out = ptot_out;
945 PFTrajectoryPoint::PS1,
956 PFTrajectoryPoint::PS2,
969 PFTrajectoryPoint::ECALEntrance,
972 double EDepthCorr = 0.01;
973 double ecalShowerDepth = PFCluster::getDepthCorrection(EDepthCorr, isBelowPS,
false);
980 PFTrajectoryPoint::ECALShowerMax,
985 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 986 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.
particle().
pt()
999 PFTrajectoryPoint::HCALEntrance,
1004 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1006 pftrack.
addPoint(dummyHCALentrance);
1012 PFTrajectoryPoint::HCALExit,
1017 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1028 PFTrajectoryPoint::HOLayer,
1032 if (pTtot_out > 5. &&
abs(theOutParticle.
particle().
Z()) < 700.25)
1033 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
1040 dp_tang = OutMom.
mag();
1043 iTrajPoint = iTrajPos + 2;
1044 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
1063 PFTrajectoryPoint::PS1,
1076 PFTrajectoryPoint::PS2,
1089 PFTrajectoryPoint::ECALEntrance,
1092 double ecalShowerDepth =
1093 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
1100 PFTrajectoryPoint::ECALShowerMax,
1104 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1106 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 1107 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 1120 PFTrajectoryPoint::HCALEntrance,
1124 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1126 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1134 PFTrajectoryPoint::HCALExit,
1138 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1140 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1151 PFTrajectoryPoint::HOLayer,
1155 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
1156 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
reconstructed track used as an input to particle flow
unsigned int algoType() const
bool propagateToPreshowerLayer1(bool first=true)
double Z() const
z of vertex
Global3DPoint GlobalPoint
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
void setMagneticField(double b)
Set the magnetic field.
const XYZTLorentzVector & momentum() const
the momentum fourvector
Log< level::Error, false > LogError
DataContainer const & measurements() const
double pt() const
transverse momentum
void addBrem(const reco::PFBrem &brem)
add a Bremsstrahlung photon
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double cos2ThetaV() const
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
double sigmafittedDP() const
PropagationDirection const & direction() const
bool propagateToHcalExit(bool first=true)
Abs< T >::type abs(const T &t)
RawParticle const & particle() const
The particle being propagated.
void addPoint(const reco::PFTrajectoryPoint &trajPt)
bool propagateToEcalEntrance(bool first=true)
Log< level::Info, false > LogInfo
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
bool propagateToHcalEntrance(bool first=true)
float outerZ(PFGeometry::Layers_t layer) const
return outer position along z axis of a given layer
static int position[264][3]
GlobalVector computeP(bool ComputeMode) const
float outerRadius(PFGeometry::Layers_t layer) const
return outer radius of a given layer
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
Log< level::Warning, false > LogWarning
bool momentumFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalVector &momentum)
bool propagateToHOLayer(bool first=true)
bool propagateToPreshowerLayer2(bool first=true)
Global3DVector GlobalVector
math::XYZTLorentzVector XYZTLorentzVector
const XYZTLorentzVector & vertex() const
the vertex fourvector