33 LogInfo(
"PFTrackTransformer") <<
"PFTrackTransformer built";
43 bool msgwarning)
const {
44 LogDebug(
"PFTrackTransformer") <<
"Trajectory propagation started";
48 float PT = track.
pt();
50 float pfenergy =
sqrt((pfmass * pfmass) + (track.
p() * track.
p()));
73 theOutParticle = theParticle;
81 theParticle.setPropagationConditions(
83 theParticle.propagate();
84 if (theParticle.getSuccess() != 0)
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 {
238 float PT = track.
pt();
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,
405 if (PT > 5. &&
abs(theOutParticle.
particle().
Z()) < 700.25)
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;
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";
double p() const
momentum vector magnitude
reconstructed track used as an input to particle flow
double pyMode() const
y coordinate of momentum vector from mode
bool propagateToPreshowerLayer1(bool first=true)
double pt() const
transverse momentum
double pMode() const
momentum vector magnitude from mode
Global3DPoint GlobalPoint
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
float outerZ(PFGeometry::Layers_t layer) const
return outer position along z axis of a given layer
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.
double px() const
x coordinate of momentum vector
Log< level::Error, false > LogError
RawParticle const & particle() const
The particle being propagated.
const math::XYZPoint & outerPosition() const
position of the outermost hit
double sigmafittedDP() const
double ptModeError() const
error on Pt (set to 1000 TeV if charge==0 for safety) from mode
PropagationDirection const & direction() const
void addBrem(const reco::PFBrem &brem)
add a Bremsstrahlung photon
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
DataContainer const & measurements() const
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
const XYZTLorentzVector & momentum() const
the momentum fourvector
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
double pt() const
track transverse momentum
bool propagateToHcalExit(bool first=true)
double cos2ThetaV() const
double Z() const
z of vertex
double pzMode() const
z coordinate of momentum vector from mode
Abs< T >::type abs(const T &t)
float outerRadius(PFGeometry::Layers_t layer) const
return outer radius of a given layer
static const std::string B
void addPoint(const reco::PFTrajectoryPoint &trajPt)
bool propagateToEcalEntrance(bool first=true)
double pz() const
z coordinate of momentum vector
const XYZTLorentzVector & vertex() const
the vertex fourvector
Log< level::Info, false > LogInfo
const GsfTrackExtraRef & gsfExtra() const
reference to "extra" object
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
double pxMode() const
x coordinate of momentum vector from mode
bool propagateToHcalEntrance(bool first=true)
unsigned int algoType() const
static int position[264][3]
int charge() const
track electric charge
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)
GlobalVector computeP(bool ComputeMode) const
bool propagateToHOLayer(bool first=true)
double ptMode() const
track transverse momentum from mode
bool propagateToPreshowerLayer2(bool first=true)
double py() const
y coordinate of momentum vector
Global3DVector GlobalVector
math::XYZTLorentzVector XYZTLorentzVector