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));
99 theParticle.propagate();
100 if(theParticle.getSuccess()!=0)
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";
183 theOutParticle.propagateToHcalEntrance(
false);
184 if(theOutParticle.getSuccess()!=0)
189 if (
PT>5.&& msgwarning)
190 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
192 pftrack.
addPoint(dummyHCALentrance);
197 theOutParticle.propagateToHcalExit(
false);
198 if(theOutParticle.getSuccess()!=0)
203 if (
PT>5.&& msgwarning)
204 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
213 theOutParticle.setMagneticField(0);
214 theOutParticle.setCharge(0);
215 theOutParticle.propagateToHOLayer(
false);
216 if(theOutParticle.getSuccess()!=0) {
221 if (
PT>5. &&
abs(theOutParticle.Z()) < 700.25 && msgwarning)
222 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
234 const bool& GetMode)
const {
236 float PT= track.
pt();
240 vector<TrajectoryMeasurement> measurements =traj.
measurements();
241 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
242 int increment = (direction) ? +1 : -1;
243 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
246 unsigned int iTrajPos = 0;
247 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();
263 float ptot =
sqrt((p.
x()*p.
x())+(p.
y()*p.
y())+(p.
z()*p.
z()));
264 float pfenergy= ptot;
266 if (iTraj == iTrajFirst) {
273 posClosest,momClosest));
308 if (iTraj != iTrajFirst && iTraj != (
abs(iTrajLast)-1)) {
315 if (iTraj == (
abs(iTrajLast)-1)) {
337 bool isBelowPS=
false;
366 double ecalShowerDepth
367 = PFCluster::getDepthCorrection(theOutParticle.
momentum().E(),
379 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
396 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
398 pftrack.
addPoint(dummyHCALentrance);
408 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
414 if (
abs(theOutParticle.
vertex().z())<550) {
422 if (PT>5. &&
abs(theOutParticle.
Z()) < 700.25 )
423 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
436 if ((v.
perp()>110) ||(fabs(v.
z())>280))
continue;
437 unsigned int iTrajPoint = iTrajPos + 2;
438 if(iid%2 == 1) iTrajPoint = 99;
440 PFBrem brem(DP,SigmaDP,iTrajPoint);
444 float e_gamma = fabs(DP);
456 int gamma_charge = 0;
472 bool isBelowPS=
false;
502 double ecalShowerDepth
503 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
514 if ((DP>5.) && ((DP/SigmaDP)>3))
515 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
531 if ((DP>5.) && ((DP/SigmaDP)>3))
532 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
544 if ((DP>5.) && ((DP/SigmaDP)>3))
545 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
551 if (
abs(theBremParticle.
vertex().z())<550.0) {
559 if ((DP>5.) && ((DP/SigmaDP)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
560 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
580 unsigned int iTrajPos = 0;
581 unsigned int iid = 0;
590 LogWarning(
"PFTrackTransformer")<<
" INNER TSOS NOT VALID ";
592 LogWarning(
"PFTrackTransformer")<<
" OUTER TSOS NOT VALID ";
608 float ptot =
sqrt((InMom.
x()*InMom.
x())+(InMom.
y()*InMom.
y())+(InMom.
z()*InMom.
z()));
609 float pfenergy= ptot;
616 posClosest,momClosest));
652 unsigned int iTrajPoint = iTrajPos + 2;
653 double dp_tang = ptot;
655 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
667 int gamma_charge = 0;
680 bool isBelowPS=
false;
712 double EDepthCorr = 0.01;
713 double ecalShowerDepth
714 = PFCluster::getDepthCorrection(EDepthCorr,
725 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
726 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
742 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
743 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
755 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
756 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
762 if (
abs(theBremParticle.
vertex().z())<550) {
770 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
771 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
788 if(track.
gsfExtra()->tangentsSize() == 0)
790 <<
"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 ";
793 vector<GsfTangent> gsftang = track.
gsfExtra()->tangents();
794 for(
unsigned int iTang = 0; iTang < track.
gsfExtra()->tangentsSize(); iTang++) {
796 dp_tang = gsftang[iTang].deltaP().value();
797 sdp_tang = gsftang[iTang].deltaP().error();
802 ||(fabs(gsftang[iTang].
position().
z())>280))
continue;
804 iTrajPoint = iTrajPos + 2;
805 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
810 gsftang[iTang].momentum().
y(),
811 gsftang[iTang].momentum().
z());
826 double e_gamma = fabs(dp_tang);
833 gsftang[iTang].position().y(),
834 gsftang[iTang].position().z(),
881 double ecalShowerDepth
882 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
893 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
894 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
910 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
911 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
923 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
924 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
930 if (
abs(theBremParticle.
vertex().z())<550) {
938 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
939 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
973 float ptot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y())+(OutMom.
z()*OutMom.
z()));
974 float pTtot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y()));
975 float pfenergy_out = ptot_out;
1016 double EDepthCorr = 0.01;
1017 double ecalShowerDepth
1018 = PFCluster::getDepthCorrection(EDepthCorr,
1030 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
1047 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1049 pftrack.
addPoint(dummyHCALentrance);
1059 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1065 if (
abs(theOutParticle.
vertex().z())<550) {
1073 if ( pTtot_out > 5. &&
abs(theOutParticle.
Z()) < 700.25 )
1074 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
1081 dp_tang = OutMom.
mag();
1084 iTrajPoint = iTrajPos + 2;
1085 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
1097 theBremParticle.
setCharge(gamma_charge);
1139 double ecalShowerDepth
1140 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
1151 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1152 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
1168 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1169 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1180 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1181 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1187 if (
abs(theBremParticle.
vertex().z())<550) {
1195 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
1196 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 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 Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
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