35 LogInfo(
"PFTrackTransformer")<<
"PFTrackTransformer built";
49 bool msgwarning)
const {
51 LogDebug(
"PFTrackTransformer")<<
"Trajectory propagation started";
57 float pfenergy=
sqrt((pfmass*pfmass)+(track.
p()*track.
p()));
89 track.
pz(), track.
p());
93 posClosest,momClosest));
115 vector<TrajectoryMeasurement> measurements =traj.
measurements();
116 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
117 int increment = (direction) ? +1 : -1;
118 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
121 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
122 GlobalPoint v=measurements[iTraj].updatedState().globalPosition();
123 GlobalVector p=measurements[iTraj].updatedState().globalMomentum();
124 unsigned int iid=measurements[iTraj].recHit()->det()->geographicalId().rawId();
131 bool isBelowPS=
false;
132 theOutParticle.propagateToPreshowerLayer1(
false);
133 if(theOutParticle.getSuccess()!=0)
143 theOutParticle.propagateToPreshowerLayer2(
false);
144 if(theOutParticle.getSuccess()!=0){
154 theOutParticle.propagateToEcalEntrance(
false);
156 if(theOutParticle.getSuccess()!=0){
160 double ecalShowerDepth
161 = PFCluster::getDepthCorrection(theOutParticle.particle().momentum().E(),
172 if (PT>5. && msgwarning)
173 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
181 theOutParticle.propagateToHcalEntrance(
false);
182 if(theOutParticle.getSuccess()!=0)
187 if (PT>5.&& msgwarning)
188 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
190 pftrack.
addPoint(dummyHCALentrance);
195 theOutParticle.propagateToHcalExit(
false);
196 if(theOutParticle.getSuccess()!=0)
201 if (PT>5.&& msgwarning)
202 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
211 theOutParticle.setMagneticField(0);
213 theOutParticle.propagateToHOLayer(
false);
214 if(theOutParticle.getSuccess()!=0) {
219 if (PT>5. &&
abs(theOutParticle.particle().Z()) < 700.25 && msgwarning)
220 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
232 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;
244 unsigned int iTrajPos = 0;
245 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
247 GlobalPoint v=measurements[iTraj].updatedState().globalPosition();
250 bool ComputeMODE = GetMode;
254 unsigned int iid=measurements[iTraj].recHit()->det()->geographicalId().rawId();
261 float ptot =
sqrt((p.
x()*p.
x())+(p.
y()*p.
y())+(p.
z()*p.
z()));
262 float pfenergy= ptot;
264 if (iTraj == iTrajFirst) {
271 posClosest,momClosest));
306 if (iTraj != iTrajFirst && iTraj != (
abs(iTrajLast)-1)) {
313 if (iTraj == (
abs(iTrajLast)-1)) {
335 bool isBelowPS=
false;
364 double ecalShowerDepth
377 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
394 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
396 pftrack.
addPoint(dummyHCALentrance);
406 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
420 if (PT>5. &&
abs(theOutParticle.
particle().
Z()) < 700.25 )
421 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
434 if ((v.
perp()>110) ||(fabs(v.
z())>280))
continue;
435 unsigned int iTrajPoint = iTrajPos + 2;
436 if(iid%2 == 1) iTrajPoint = 99;
438 PFBrem brem(DP,SigmaDP,iTrajPoint);
442 float e_gamma = fabs(DP);
470 bool isBelowPS=
false;
500 double ecalShowerDepth
512 if ((DP>5.) && ((DP/SigmaDP)>3))
513 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
529 if ((DP>5.) && ((DP/SigmaDP)>3))
530 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
542 if ((DP>5.) && ((DP/SigmaDP)>3))
543 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
557 if ((DP>5.) && ((DP/SigmaDP)>3) &&
abs(theBremParticle.
particle().
Z()) < 700.25 )
558 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
578 unsigned int iTrajPos = 0;
579 unsigned int iid = 0;
588 LogWarning(
"PFTrackTransformer")<<
" INNER TSOS NOT VALID ";
590 LogWarning(
"PFTrackTransformer")<<
" OUTER TSOS NOT VALID ";
606 float ptot =
sqrt((InMom.
x()*InMom.
x())+(InMom.
y()*InMom.
y())+(InMom.
z()*InMom.
z()));
607 float pfenergy= ptot;
614 posClosest,momClosest));
650 unsigned int iTrajPoint = iTrajPos + 2;
651 double dp_tang = ptot;
653 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
678 bool isBelowPS=
false;
710 double EDepthCorr = 0.01;
711 double ecalShowerDepth
712 = PFCluster::getDepthCorrection(EDepthCorr,
723 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
724 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
740 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
741 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
753 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
754 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
768 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
particle().
Z()) < 700.25 )
769 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
786 if(track.
gsfExtra()->tangentsSize() == 0)
788 <<
"BE CAREFUL: Gsf Tangents not stored in the event. You need to re-reco the particle-flow with RecoToDisplay_cfg.py and not RecoToDisplay_NoTracking_cfg.py ";
791 vector<GsfTangent> gsftang = track.
gsfExtra()->tangents();
792 for(
unsigned int iTang = 0; iTang < track.
gsfExtra()->tangentsSize(); iTang++) {
794 dp_tang = gsftang[iTang].deltaP().value();
795 sdp_tang = gsftang[iTang].deltaP().error();
800 ||(fabs(gsftang[iTang].
position().
z())>280))
continue;
802 iTrajPoint = iTrajPos + 2;
803 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
808 gsftang[iTang].momentum().
y(),
809 gsftang[iTang].momentum().
z());
824 double e_gamma = fabs(dp_tang);
831 gsftang[iTang].position().y(),
832 gsftang[iTang].position().z(),
878 double ecalShowerDepth
890 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
891 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
907 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
908 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
920 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
921 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
935 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
particle().
Z()) < 700.25 )
936 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
970 float ptot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y())+(OutMom.
z()*OutMom.
z()));
971 float pTtot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y()));
972 float pfenergy_out = ptot_out;
1013 double EDepthCorr = 0.01;
1014 double ecalShowerDepth
1015 = PFCluster::getDepthCorrection(EDepthCorr,
1027 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
1044 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1046 pftrack.
addPoint(dummyHCALentrance);
1056 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1070 if ( pTtot_out > 5. &&
abs(theOutParticle.
particle().
Z()) < 700.25 )
1071 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
1078 dp_tang = OutMom.
mag();
1081 iTrajPoint = iTrajPos + 2;
1082 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
1136 double ecalShowerDepth
1148 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1149 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
1165 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1166 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1177 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1178 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1192 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
particle().
Z()) < 700.25 )
1193 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 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 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