35 LogInfo(
"PFTrackTransformer")<<
"PFTrackTransformer built";
50 bool msgwarning)
const {
52 LogDebug(
"PFTrackTransformer")<<
"Trajectory propagation started";
58 float pfenergy=
sqrt((pfmass*pfmass)+(track.
p()*track.
p()));
90 track.
pz(), track.
p());
94 posClosest,momClosest));
100 theParticle.propagate();
101 if(theParticle.getSuccess()!=0)
116 vector<TrajectoryMeasurement> measurements =traj.
measurements();
117 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
118 int increment = (direction) ? +1 : -1;
119 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
122 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
123 GlobalPoint v=measurements[iTraj].updatedState().globalPosition();
124 GlobalVector p=measurements[iTraj].updatedState().globalMomentum();
125 unsigned int iid=measurements[iTraj].recHit()->det()->geographicalId().rawId();
132 bool isBelowPS=
false;
133 theOutParticle.propagateToPreshowerLayer1(
false);
134 if(theOutParticle.getSuccess()!=0)
144 theOutParticle.propagateToPreshowerLayer2(
false);
145 if(theOutParticle.getSuccess()!=0){
155 theOutParticle.propagateToEcalEntrance(
false);
157 if(theOutParticle.getSuccess()!=0){
161 double ecalShowerDepth
162 = PFCluster::getDepthCorrection(theOutParticle.momentum().E(),
173 if (
PT>5. && msgwarning)
174 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
184 theOutParticle.propagateToHcalEntrance(
false);
185 if(theOutParticle.getSuccess()!=0)
190 if (
PT>5.&& msgwarning)
191 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
193 pftrack.
addPoint(dummyHCALentrance);
198 theOutParticle.propagateToHcalExit(
false);
199 if(theOutParticle.getSuccess()!=0)
204 if (
PT>5.&& msgwarning)
205 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
214 theOutParticle.setMagneticField(0);
215 theOutParticle.setCharge(0);
216 theOutParticle.propagateToHOLayer(
false);
217 if(theOutParticle.getSuccess()!=0) {
222 if (
PT>5. &&
abs(theOutParticle.Z()) < 700.25 && msgwarning)
223 LogWarning(
"PFTrackTransformer")<<
"KF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
235 const bool& GetMode)
const {
237 float PT= track.
pt();
241 vector<TrajectoryMeasurement> measurements =traj.
measurements();
242 int iTrajFirst = (direction) ? 0 : measurements.size() - 1;
243 int increment = (direction) ? +1 : -1;
244 int iTrajLast = (direction) ?
int(measurements.size()) : -1;
247 unsigned int iTrajPos = 0;
248 for (
int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
250 GlobalPoint v=measurements[iTraj].updatedState().globalPosition();
253 bool ComputeMODE = GetMode;
257 unsigned int iid=measurements[iTraj].recHit()->det()->geographicalId().rawId();
264 float ptot =
sqrt((p.
x()*p.
x())+(p.
y()*p.
y())+(p.
z()*p.
z()));
265 float pfenergy= ptot;
267 if (iTraj == iTrajFirst) {
274 posClosest,momClosest));
309 if (iTraj != iTrajFirst && iTraj != (
abs(iTrajLast)-1)) {
316 if (iTraj == (
abs(iTrajLast)-1)) {
338 bool isBelowPS=
false;
367 double ecalShowerDepth
368 = PFCluster::getDepthCorrection(theOutParticle.
momentum().E(),
380 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
397 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
399 pftrack.
addPoint(dummyHCALentrance);
409 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
415 if (
abs(theOutParticle.
vertex().z())<550) {
423 if (PT>5. &&
abs(theOutParticle.
Z()) < 700.25 )
424 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
437 if ((v.
perp()>110) ||(fabs(v.
z())>280))
continue;
438 unsigned int iTrajPoint = iTrajPos + 2;
439 if(iid%2 == 1) iTrajPoint = 99;
441 PFBrem brem(DP,SigmaDP,iTrajPoint);
445 float e_gamma = fabs(DP);
457 int gamma_charge = 0;
473 bool isBelowPS=
false;
503 double ecalShowerDepth
504 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
515 if ((DP>5.) && ((DP/SigmaDP)>3))
516 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
532 if ((DP>5.) && ((DP/SigmaDP)>3))
533 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
545 if ((DP>5.) && ((DP/SigmaDP)>3))
546 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
552 if (
abs(theBremParticle.
vertex().z())<550.0) {
560 if ((DP>5.) && ((DP/SigmaDP)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
561 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
581 unsigned int iTrajPos = 0;
582 unsigned int iid = 0;
591 LogWarning(
"PFTrackTransformer")<<
" INNER TSOS NOT VALID ";
593 LogWarning(
"PFTrackTransformer")<<
" OUTER TSOS NOT VALID ";
609 float ptot =
sqrt((InMom.
x()*InMom.
x())+(InMom.
y()*InMom.
y())+(InMom.
z()*InMom.
z()));
610 float pfenergy= ptot;
617 posClosest,momClosest));
653 unsigned int iTrajPoint = iTrajPos + 2;
654 double dp_tang = ptot;
656 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
668 int gamma_charge = 0;
681 bool isBelowPS=
false;
713 double EDepthCorr = 0.01;
714 double ecalShowerDepth
715 = PFCluster::getDepthCorrection(EDepthCorr,
726 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
727 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
743 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
744 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
756 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
757 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
763 if (
abs(theBremParticle.
vertex().z())<550) {
771 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
772 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
789 if(track.
gsfExtra()->tangentsSize() == 0)
791 <<
"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 ";
794 vector<GsfTangent> gsftang = track.
gsfExtra()->tangents();
795 for(
unsigned int iTang = 0; iTang < track.
gsfExtra()->tangentsSize(); iTang++) {
797 dp_tang = gsftang[iTang].deltaP().value();
798 sdp_tang = gsftang[iTang].deltaP().error();
803 ||(fabs(gsftang[iTang].
position().
z())>280))
continue;
805 iTrajPoint = iTrajPos + 2;
806 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
811 gsftang[iTang].momentum().
y(),
812 gsftang[iTang].momentum().
z());
827 double e_gamma = fabs(dp_tang);
834 gsftang[iTang].position().y(),
835 gsftang[iTang].position().z(),
882 double ecalShowerDepth
883 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
894 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
895 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
911 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
912 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
924 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
925 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
931 if (
abs(theBremParticle.
vertex().z())<550) {
939 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
940 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE H0 HAS FAILED";
974 float ptot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y())+(OutMom.
z()*OutMom.
z()));
975 float pTtot_out =
sqrt((OutMom.
x()*OutMom.
x())+(OutMom.
y()*OutMom.
y()));
976 float pfenergy_out = ptot_out;
1017 double EDepthCorr = 0.01;
1018 double ecalShowerDepth
1019 = PFCluster::getDepthCorrection(EDepthCorr,
1031 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE ECAL HAS FAILED";
1048 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1050 pftrack.
addPoint(dummyHCALentrance);
1060 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1066 if (
abs(theOutParticle.
vertex().z())<550) {
1074 if ( pTtot_out > 5. &&
abs(theOutParticle.
Z()) < 700.25 )
1075 LogWarning(
"PFTrackTransformer")<<
"GSF TRACK "<<pftrack<<
" PROPAGATION TO THE HO HAS FAILED";
1082 dp_tang = OutMom.
mag();
1085 iTrajPoint = iTrajPos + 2;
1086 PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
1098 theBremParticle.
setCharge(gamma_charge);
1140 double ecalShowerDepth
1141 = PFCluster::getDepthCorrection(theBremParticle.
momentum().E(),
1152 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1153 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE ECAL HAS FAILED";
1169 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1170 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1181 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1182 LogWarning(
"PFTrackTransformer")<<
"BREM "<<brem<<
" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1188 if (
abs(theBremParticle.
vertex().z())<550) {
1196 if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3) &&
abs(theBremParticle.
Z()) < 700.25 )
1197 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 ?
General CMS geometry parameters used during Particle Flow reconstruction or drawing. All methods and members are static.
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.
static const float outerZ(PFGeometry::Layers_t layer)
return outer position along z axis of a given layer
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
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
static const float outerRadius(PFGeometry::Layers_t layer)
return outer radius of a given layer
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