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.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);
212 theOutParticle.setCharge(0);
213 theOutParticle.propagateToHOLayer(
false);
214 if(theOutParticle.getSuccess()!=0) {
219 if (PT>5. &&
abs(theOutParticle.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
365 = PFCluster::getDepthCorrection(theOutParticle.
momentum().E(),
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";
412 if (
abs(theOutParticle.
vertex().z())<550) {
420 if (PT>5. &&
abs(theOutParticle.
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);
454 int gamma_charge = 0;
470 bool isBelowPS=
false;
500 double ecalShowerDepth
501 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
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";
549 if (
abs(theBremParticle.
vertex().z())<550.0) {
557 if ((DP>5.) && ((DP/SigmaDP)>3) &&
abs(theBremParticle.
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);
665 int gamma_charge = 0;
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";
760 if (
abs(theBremParticle.
vertex().z())<550) {
768 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
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(),
879 double ecalShowerDepth
880 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
891 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
892 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
908 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
909 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
921 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
922 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
928 if (
abs(theBremParticle.
vertex().z())<550) {
936 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
937 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
971 float ptot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y())+(OutMom.
z()*OutMom.
z()));
972 float pTtot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y()));
973 float pfenergy_out = ptot_out;
1014 double EDepthCorr = 0.01;
1015 double ecalShowerDepth
1016 = PFCluster::getDepthCorrection(EDepthCorr,
1028 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
1045 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1047 pftrack.
addPoint(dummyHCALentrance);
1057 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1063 if (
abs(theOutParticle.
vertex().z())<550) {
1071 if ( pTtot_out > 5. &&
abs(theOutParticle.
Z()) < 700.25 )
1072 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
1079 dp_tang = OutMom.
mag();
1082 iTrajPoint = iTrajPos + 2;
1083 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
1095 theBremParticle.
setCharge(gamma_charge);
1137 double ecalShowerDepth
1138 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
1149 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1150 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
1166 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1167 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1178 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1179 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1185 if (
abs(theBremParticle.
vertex().z())<550) {
1193 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
1194 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
double p() const
momentum vector magnitude
void setCharge(float q)
set the MEASURED charge
reconstructed track used as an input to particle flow
double pyMode() const
y coordinate of momentum vector from mode
bool positionFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalPoint &position) const
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
bool momentumFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalVector &momentum) const
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
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
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...
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