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()));
82 PFTrajectoryPoint::BeamPipeOrEndVertex,
94 vector<TrajectoryMeasurement> measurements = traj.
measurements();
95 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
96 int increment = (direction) ? +1 : -1;
97 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
99 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
100 GlobalPoint v = measurements[iTraj].updatedState().globalPosition();
101 GlobalVector p = measurements[iTraj].updatedState().globalMomentum();
102 unsigned int iid = measurements[iTraj].recHit()->det()->geographicalId().rawId();
109 bool isBelowPS =
false;
110 theOutParticle.propagateToPreshowerLayer1(
false);
111 if (theOutParticle.getSuccess() != 0)
113 PFTrajectoryPoint::PS1,
122 theOutParticle.propagateToPreshowerLayer2(
false);
123 if (theOutParticle.getSuccess() != 0) {
125 PFTrajectoryPoint::PS2,
135 theOutParticle.propagateToEcalEntrance(
false);
136 if (theOutParticle.getSuccess() != 0) {
138 PFTrajectoryPoint::ECALEntrance,
141 double ecalShowerDepth = PFCluster::getDepthCorrection(theOutParticle.particle().momentum().E(), isBelowPS,
false);
148 PFTrajectoryPoint::ECALShowerMax,
156 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 157 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.particle().pt() <<
" " 158 << theOutParticle.particle().eta();
166 theOutParticle.propagateToHcalEntrance(
false);
167 if (theOutParticle.getSuccess() != 0)
169 PFTrajectoryPoint::HCALEntrance,
174 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
176 pftrack.
addPoint(dummyHCALentrance);
181 theOutParticle.propagateToHcalExit(
false);
182 if (theOutParticle.getSuccess() != 0)
184 PFTrajectoryPoint::HCALExit,
189 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
197 theOutParticle.setMagneticField(0);
198 theOutParticle.propagateToHOLayer(
false);
199 if (theOutParticle.getSuccess() != 0) {
201 PFTrajectoryPoint::HOLayer,
205 if (PT > 5. &&
abs(theOutParticle.particle().Z()) < 700.25 && msgwarning)
206 LogWarning(
"PFTrackTransformer") <<
"KF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
216 theOutParticle.setMagneticField(0);
217 theOutParticle.propagateToVFcalEntrance(
false);
218 if (theOutParticle.getSuccess() != 0) {
220 PFTrajectoryPoint::VFcalEntrance,
225 pftrack.
addPoint(dummyVFcalentrance);
233 const bool& GetMode)
const {
234 float PT = track.
pt();
238 vector<TrajectoryMeasurement> measurements = traj.
measurements();
239 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
240 int increment = (direction) ? +1 : -1;
241 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
243 unsigned int iTrajPos = 0;
244 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
245 GlobalPoint v = measurements[iTraj].updatedState().globalPosition();
248 bool ComputeMODE = GetMode;
252 unsigned int iid = measurements[iTraj].recHit()->det()->geographicalId().rawId();
258 float ptot =
sqrt((p.
x() * p.
x()) + (p.
y() * p.
y()) + (p.
z() * p.
z()));
259 float pfenergy = ptot;
261 if (iTraj == iTrajFirst) {
280 PFTrajectoryPoint::BeamPipeOrEndVertex,
292 if (iTraj != iTrajFirst && iTraj != (
abs(iTrajLast) - 1)) {
296 if (iTraj == (
abs(iTrajLast) - 1)) {
310 bool isBelowPS =
false;
314 PFTrajectoryPoint::PS1,
326 PFTrajectoryPoint::PS2,
339 PFTrajectoryPoint::ECALEntrance,
342 double ecalShowerDepth =
343 PFCluster::getDepthCorrection(theOutParticle.
particle().
momentum().E(), isBelowPS,
false);
350 PFTrajectoryPoint::ECALShowerMax,
355 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 356 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.
particle().
pt()
368 PFTrajectoryPoint::HCALEntrance,
373 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
375 pftrack.
addPoint(dummyHCALentrance);
381 PFTrajectoryPoint::HCALExit,
386 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
397 PFTrajectoryPoint::HOLayer,
401 if (PT > 5. &&
abs(theOutParticle.
particle().
Z()) < 700.25)
402 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
415 if ((v.
perp() > 110) || (fabs(v.
z()) > 280))
417 unsigned int iTrajPoint = iTrajPos + 2;
421 PFBrem brem(DP, SigmaDP, iTrajPoint);
424 float e_gamma = fabs(DP);
444 bool isBelowPS =
false;
448 PFTrajectoryPoint::PS1,
461 PFTrajectoryPoint::PS2,
474 PFTrajectoryPoint::ECALEntrance,
477 double ecalShowerDepth =
478 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
485 PFTrajectoryPoint::ECALShowerMax,
490 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 491 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 504 PFTrajectoryPoint::HCALEntrance,
509 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
518 PFTrajectoryPoint::HCALExit,
523 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
534 PFTrajectoryPoint::HOLayer,
538 if ((DP > 5.) && ((DP / SigmaDP) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
539 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
555 unsigned int iTrajPos = 0;
556 unsigned int iid = 0;
564 LogWarning(
"PFTrackTransformer") <<
" INNER TSOS NOT VALID ";
566 LogWarning(
"PFTrackTransformer") <<
" OUTER TSOS NOT VALID ";
581 float ptot =
sqrt((InMom.
x() * InMom.
x()) + (InMom.
y() * InMom.
y()) + (InMom.
z() * InMom.
z()));
582 float pfenergy = ptot;
601 PFTrajectoryPoint::BeamPipeOrEndVertex,
617 unsigned int iTrajPoint = iTrajPos + 2;
618 double dp_tang = ptot;
620 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
637 bool isBelowPS =
false;
641 PFTrajectoryPoint::PS1,
654 PFTrajectoryPoint::PS2,
667 PFTrajectoryPoint::ECALEntrance,
672 double EDepthCorr = 0.01;
673 double ecalShowerDepth = PFCluster::getDepthCorrection(EDepthCorr, isBelowPS,
false);
680 PFTrajectoryPoint::ECALShowerMax,
684 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
686 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 687 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 700 PFTrajectoryPoint::HCALEntrance,
704 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
706 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
715 PFTrajectoryPoint::HCALExit,
719 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
721 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
732 PFTrajectoryPoint::HOLayer,
736 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
737 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
751 if (track.
gsfExtra()->tangentsSize() == 0)
753 <<
"BE CAREFUL: Gsf Tangents not stored in the event. You need to re-reco the particle-flow with " 754 "RecoToDisplay_cfg.py and not RecoToDisplay_NoTracking_cfg.py ";
756 vector<GsfTangent> gsftang = track.
gsfExtra()->tangents();
757 for (
unsigned int iTang = 0; iTang < track.
gsfExtra()->tangentsSize(); iTang++) {
758 dp_tang = gsftang[iTang].deltaP().value();
759 sdp_tang = gsftang[iTang].deltaP().error();
764 (fabs(gsftang[iTang].
position().
z()) > 280))
767 iTrajPoint = iTrajPos + 2;
768 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
771 GlobalVector(gsftang[iTang].momentum().
x(), gsftang[iTang].momentum().
y(), gsftang[iTang].momentum().
z());
785 double e_gamma = fabs(dp_tang);
790 gsftang[iTang].
position().x(), gsftang[iTang].position().y(), gsftang[iTang].position().z(), 0.),
806 PFTrajectoryPoint::PS1,
819 PFTrajectoryPoint::PS2,
832 PFTrajectoryPoint::ECALEntrance,
836 double ecalShowerDepth =
837 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
844 PFTrajectoryPoint::ECALShowerMax,
848 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
850 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 851 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 864 PFTrajectoryPoint::HCALEntrance,
868 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
870 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
879 PFTrajectoryPoint::HCALExit,
883 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
885 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
896 PFTrajectoryPoint::HOLayer,
900 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
901 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE H0 HAS FAILED";
930 float ptot_out =
sqrt((OutMom.
x() * OutMom.
x()) + (OutMom.
y() * OutMom.
y()) + (OutMom.
z() * OutMom.
z()));
931 float pTtot_out =
sqrt((OutMom.
x() * OutMom.
x()) + (OutMom.
y() * OutMom.
y()));
932 float pfenergy_out = ptot_out;
944 PFTrajectoryPoint::PS1,
955 PFTrajectoryPoint::PS2,
968 PFTrajectoryPoint::ECALEntrance,
971 double EDepthCorr = 0.01;
972 double ecalShowerDepth = PFCluster::getDepthCorrection(EDepthCorr, isBelowPS,
false);
979 PFTrajectoryPoint::ECALShowerMax,
984 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 985 <<
"theOutParticle.particle() pt,eta: " << theOutParticle.
particle().
pt()
998 PFTrajectoryPoint::HCALEntrance,
1003 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1005 pftrack.
addPoint(dummyHCALentrance);
1011 PFTrajectoryPoint::HCALExit,
1016 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1027 PFTrajectoryPoint::HOLayer,
1031 if (pTtot_out > 5. &&
abs(theOutParticle.
particle().
Z()) < 700.25)
1032 LogWarning(
"PFTrackTransformer") <<
"GSF TRACK " << pftrack <<
" PROPAGATION TO THE HO HAS FAILED";
1039 dp_tang = OutMom.
mag();
1042 iTrajPoint = iTrajPos + 2;
1043 PFBrem brem(dp_tang, sdp_tang, iTrajPoint);
1062 PFTrajectoryPoint::PS1,
1075 PFTrajectoryPoint::PS2,
1088 PFTrajectoryPoint::ECALEntrance,
1091 double ecalShowerDepth =
1092 PFCluster::getDepthCorrection(theBremParticle.
particle().
momentum().E(), isBelowPS,
false);
1099 PFTrajectoryPoint::ECALShowerMax,
1103 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1105 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE ECAL HAS FAILED\n" 1106 <<
"theBremParticle.particle() pt,eta,cos2ThetaV: " 1119 PFTrajectoryPoint::HCALEntrance,
1123 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1125 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1133 PFTrajectoryPoint::HCALExit,
1137 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
1139 LogWarning(
"PFTrackTransformer") <<
"BREM " << brem <<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1150 PFTrajectoryPoint::HOLayer,
1154 if ((dp_tang > 5.) && ((dp_tang / sdp_tang) > 3) &&
abs(theBremParticle.
particle().
Z()) < 700.25)
1155 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
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
const GsfTrackExtraRef & gsfExtra() const
reference to "extra" object
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
void calculatePositionREP()
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...
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