CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
PFTrackTransformer Class Reference

#include <PFTrackTransformer.h>

Public Member Functions

bool addPoints (reco::PFRecTrack &pftrack, const reco::Track &track, const Trajectory &traj, bool msgwarning=true) const
 Add points to a PFTrack. return false if a TSOS is invalid. More...
 
bool addPointsAndBrems (reco::GsfPFRecTrack &pftrack, const reco::Track &track, const Trajectory &traj, const bool &GetMode) const
 
bool addPointsAndBrems (reco::GsfPFRecTrack &pftrack, const reco::GsfTrack &track, const MultiTrajectoryStateTransform &mtjstate) const
 
void OnlyProp ()
 
 PFTrackTransformer (const math::XYZVector &)
 
 ~PFTrackTransformer ()
 

Public Attributes

bool onlyprop_
 

Private Attributes

math::XYZVector B_
 B field. More...
 
PFGeometry pfGeometry_
 

Detailed Description

Definition at line 37 of file PFTrackTransformer.h.

Constructor & Destructor Documentation

PFTrackTransformer::PFTrackTransformer ( const math::XYZVector B)

Definition at line 34 of file PFTrackTransformer.cc.

References onlyprop_.

34  :B_(B){
35  LogInfo("PFTrackTransformer")<<"PFTrackTransformer built";
36 
37  onlyprop_=false;
38 }
math::XYZVector B_
B field.
static const std::string B
PFTrackTransformer::~PFTrackTransformer ( )

Definition at line 40 of file PFTrackTransformer.cc.

40  {
41 
42 }

Member Function Documentation

bool PFTrackTransformer::addPoints ( reco::PFRecTrack pftrack,
const reco::Track track,
const Trajectory traj,
bool  msgwarning = true 
) const

Add points to a PFTrack. return false if a TSOS is invalid.

Definition at line 46 of file PFTrackTransformer.cc.

References funct::abs(), reco::PFTrack::addPoint(), reco::PFRecTrack::algoType(), alongMomentum, B_, PFGeometry::BeamPipe, reco::TrackBase::charge(), Trajectory::direction(), BaseParticlePropagator::getSuccess(), reco::PFRecTrack::KF_ELCAND, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), Trajectory::measurements(), RawParticle::momentum(), onlyprop_, reco::Track::outerMomentum(), reco::Track::outerPosition(), PFGeometry::outerRadius(), PFGeometry::outerZ(), AlCaHLTBitMon_ParallelJobs::p, reco::TrackBase::p(), BaseParticlePropagator::particle(), pfGeometry_, BaseParticlePropagator::propagate(), PT, reco::TrackBase::pt(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), BaseParticlePropagator::setPropagationConditions(), mathSSE::sqrt(), findQualityFiles::v, RawParticle::vertex(), reco::TrackBase::vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by PFDisplacedTrackerVertexProducer::produce(), PFNuclearProducer::produce(), LightPFTrackProducer::produce(), PFConversionProducer::produce(), and PFV0Producer::produce().

49  {
50 
51  LogDebug("PFTrackTransformer")<<"Trajectory propagation started";
52  using namespace reco;
53  using namespace std;
54 
55  float PT= track.pt();
56  float pfmass= (pftrack.algoType()==reco::PFRecTrack::KF_ELCAND) ? 0.0005 : 0.139;
57  float pfenergy=sqrt((pfmass*pfmass)+(track.p()*track.p()));
58  // closest approach
59  BaseParticlePropagator theParticle =
62  track.py(),
63  track.pz(),
64  pfenergy),
65  XYZTLorentzVector(track.vertex().x(),
66  track.vertex().y(),
67  track.vertex().z(),
68  0.),
69  track.charge()),
70  0.,0.,B_.z());
71 
72  float pfoutenergy=sqrt((pfmass*pfmass)+track.outerMomentum().Mag2());
73  BaseParticlePropagator theOutParticle =
76  track.outerMomentum().y(),
77  track.outerMomentum().z(),
78  pfoutenergy),
79  XYZTLorentzVector(track.outerPosition().x(),
80  track.outerPosition().y(),
81  track.outerPosition().z(),
82  0.),
83  track.charge()),
84  0.,0.,B_.z());
85 
86 
87  math::XYZTLorentzVector momClosest
88  = math::XYZTLorentzVector(track.px(), track.py(),
89  track.pz(), track.p());
90  const math::XYZPoint& posClosest = track.vertex();
91 
92  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ClosestApproach,
93  posClosest,momClosest));
94 
95 
96  //BEAMPIPE
99  theParticle.propagate();
100  if(theParticle.getSuccess()!=0)
101  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::BeamPipeOrEndVertex,
102  math::XYZPoint(theParticle.particle().vertex()),
103  math::XYZTLorentzVector(theParticle.particle().momentum())));
104  else {
105  PFTrajectoryPoint dummyMaxSh;
106  pftrack.addPoint(dummyMaxSh);
107  }
108 
109 
110 
111  //trajectory points
112 
113  if (!onlyprop_){
114  bool direction =(traj.direction() == alongMomentum);
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;
119 
120 
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();
125  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
126  math::XYZPoint(v.x(), v.y(), v.z()),
127  math::XYZTLorentzVector(p.x(),p.y(),p.z(),p.mag())));
128  }
129  }
130 
131  bool isBelowPS=false;
132  theOutParticle.propagateToPreshowerLayer1(false);
133  if(theOutParticle.getSuccess()!=0)
134  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
135  math::XYZPoint(theOutParticle.particle().vertex()),
136  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
137  else {
138  PFTrajectoryPoint dummyPS1;
139  pftrack.addPoint(dummyPS1);
140  }
141 
142 
143  theOutParticle.propagateToPreshowerLayer2(false);
144  if(theOutParticle.getSuccess()!=0){
145  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
146  math::XYZPoint(theOutParticle.particle().vertex()),
147  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
148  isBelowPS=true;
149  } else {
150  PFTrajectoryPoint dummyPS2;
151  pftrack.addPoint(dummyPS2);
152  }
153 
154  theOutParticle.propagateToEcalEntrance(false);
155 
156  if(theOutParticle.getSuccess()!=0){
157  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
158  math::XYZPoint(theOutParticle.particle().vertex()),
159  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
160  double ecalShowerDepth
161  = PFCluster::getDepthCorrection(theOutParticle.particle().momentum().E(),
162  isBelowPS,
163  false);
164 
165  math::XYZPoint meanShower=math::XYZPoint(theOutParticle.particle().vertex())+
166  math::XYZTLorentzVector(theOutParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
167 
168  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
169  meanShower,
170  math::XYZTLorentzVector(theOutParticle.particle().momentum())));}
171  else {
172  if (PT>5. && msgwarning)
173  LogWarning("PFTrackTransformer")<<"KF TRACK "<<pftrack<< " PROPAGATION TO THE ECAL HAS FAILED";
174  PFTrajectoryPoint dummyECAL;
175  pftrack.addPoint(dummyECAL);
176  PFTrajectoryPoint dummyMaxSh;
177  pftrack.addPoint(dummyMaxSh);
178  }
179 
180  //HCAL entrance
181  theOutParticle.propagateToHcalEntrance(false);
182  if(theOutParticle.getSuccess()!=0)
183  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
184  math::XYZPoint(theOutParticle.particle().vertex()),
185  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
186  else{
187  if (PT>5.&& msgwarning)
188  LogWarning("PFTrackTransformer")<<"KF TRACK "<<pftrack<< " PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
189  PFTrajectoryPoint dummyHCALentrance;
190  pftrack.addPoint(dummyHCALentrance);
191  }
192 
193  //HCAL exit
194  // theOutParticle.setMagneticField(0); //Show we propagate as straight line inside HCAL ?
195  theOutParticle.propagateToHcalExit(false);
196  if(theOutParticle.getSuccess()!=0)
197  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
198  math::XYZPoint(theOutParticle.particle().vertex()),
199  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
200  else{
201  if (PT>5.&& msgwarning)
202  LogWarning("PFTrackTransformer")<<"KF TRACK "<<pftrack<< " PROPAGATION TO THE HCAL EXIT HAS FAILED";
203  PFTrajectoryPoint dummyHCALexit;
204  pftrack.addPoint(dummyHCALexit);
205  }
206 
207 
208  //HO layer0
209  // if (abs(theOutParticle.particle().vertex().z())<550) {
210  if ( PT>3.0) { //Same value is used in PFBlockAlgo::link( case PFBlockLink::TRACKandHO:
211  theOutParticle.setMagneticField(0);
212  //theOutParticle.setCharge(0); //Since the B field is 0, there should be no need to change charge
213  theOutParticle.propagateToHOLayer(false);
214  if(theOutParticle.getSuccess()!=0) {
215  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
216  math::XYZPoint(theOutParticle.particle().vertex()),
217  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
218  } else {
219  if (PT>5. && abs(theOutParticle.particle().Z()) < 700.25 && msgwarning)
220  LogWarning("PFTrackTransformer")<<"KF TRACK "<<pftrack<< " PROPAGATION TO THE HO HAS FAILED";
221  PFTrajectoryPoint dummyHOLayer;
222  pftrack.addPoint(dummyHOLayer);
223  }
224  }
225 
226  return true;
227 }
#define LogDebug(id)
double p() const
momentum vector magnitude
Definition: TrackBase.h:654
#define PT
math::XYZVector B_
B field.
T y() const
Definition: PV3DBase.h:63
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
Definition: PFGeometry.h:68
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:666
RawParticle const & particle() const
The particle being propagated.
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:140
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
DataContainer const & measurements() const
Definition: Trajectory.h:196
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:738
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:340
T mag() const
Definition: PV3DBase.h:67
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:660
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float outerRadius(PFGeometry::Layers_t layer) const
return outer radius of a given layer
Definition: PFGeometry.h:60
void addPoint(const reco::PFTrajectoryPoint &trajPt)
Definition: PFTrack.cc:42
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:678
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:339
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:72
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
fixed size matrix
unsigned int algoType() const
Definition: PFRecTrack.h:47
int charge() const
track electric charge
Definition: TrackBase.h:606
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
T x() const
Definition: PV3DBase.h:62
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:672
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27
bool PFTrackTransformer::addPointsAndBrems ( reco::GsfPFRecTrack pftrack,
const reco::Track track,
const Trajectory traj,
const bool &  GetMode 
) const

Definition at line 229 of file PFTrackTransformer.cc.

References funct::abs(), reco::GsfPFRecTrack::addBrem(), reco::PFTrack::addPoint(), alongMomentum, B_, PFGeometry::BeamPipe, reco::PFTrack::calculatePositionREP(), reco::TrackBase::charge(), PFGsfHelper::computeP(), constexpr, Trajectory::direction(), PFGsfHelper::fittedDP(), BaseParticlePropagator::getSuccess(), PV3DBase< T, PVType, FrameType >::mag(), Trajectory::measurements(), RawParticle::momentum(), PFGeometry::outerRadius(), PFGeometry::outerZ(), AlCaHLTBitMon_ParallelJobs::p, BaseParticlePropagator::particle(), PV3DBase< T, PVType, FrameType >::perp(), pfGeometry_, BaseParticlePropagator::propagate(), BaseParticlePropagator::propagateToEcalEntrance(), BaseParticlePropagator::propagateToHcalEntrance(), BaseParticlePropagator::propagateToHcalExit(), BaseParticlePropagator::propagateToHOLayer(), BaseParticlePropagator::propagateToPreshowerLayer1(), BaseParticlePropagator::propagateToPreshowerLayer2(), PT, reco::TrackBase::pt(), BaseParticlePropagator::setMagneticField(), BaseParticlePropagator::setPropagationConditions(), PFGsfHelper::sigmafittedDP(), mathSSE::sqrt(), findQualityFiles::v, RawParticle::vertex(), reco::TrackBase::vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and RawParticle::Z().

232  {
233 
234  float PT= track.pt();
235  // Trajectory for each trajectory point
236 
237  bool direction =(traj.direction() == alongMomentum);
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;
242 
243 
244  unsigned int iTrajPos = 0;
245  for (int iTraj = iTrajFirst; iTraj != iTrajLast; iTraj += increment) {
246 
247  GlobalPoint v=measurements[iTraj].updatedState().globalPosition();
248  PFGsfHelper* PFGsf = new PFGsfHelper(measurements[iTraj]);
249  //if (PFGsf->isValid()){
250  bool ComputeMODE = GetMode;
251  GlobalVector p = PFGsf->computeP(ComputeMODE);
252  double DP = PFGsf->fittedDP();
253  double SigmaDP = PFGsf->sigmafittedDP();
254  unsigned int iid=measurements[iTraj].recHit()->det()->geographicalId().rawId();
255  delete PFGsf;
256 
257  // -------------------------- Fill GSF Track -------------------------------------
258 
259 
260  // float pfmass= (pftrack.algoType()==reco::PFRecTrack::KF_ELCAND) ? 0.0005 : 0.139;
261  float ptot = sqrt((p.x()*p.x())+(p.y()*p.y())+(p.z()*p.z()));
262  float pfenergy= ptot;
263 
264  if (iTraj == iTrajFirst) {
265 
266  math::XYZTLorentzVector momClosest
267  = math::XYZTLorentzVector(p.x(), p.y(),
268  p.z(), ptot);
269  const math::XYZPoint& posClosest = track.vertex();
270  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ClosestApproach,
271  posClosest,momClosest));
272 
273  BaseParticlePropagator theInnerParticle =
276  p.y(),
277  p.z(),
278  pfenergy),
279  XYZTLorentzVector(track.vertex().x(),
280  track.vertex().y(),
281  track.vertex().z(),
282  0.),
283  track.charge()), //DANIELE Same thing v.x(),v.y(),v.()?
284  0.,0.,B_.z());
285 
286  //BEAMPIPE
289  theInnerParticle.propagate();
290  if(theInnerParticle.getSuccess()!=0)
291  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::BeamPipeOrEndVertex,
292  math::XYZPoint(theInnerParticle.particle().vertex()),
293  math::XYZTLorentzVector(theInnerParticle.particle().momentum())));
294  else {
295  PFTrajectoryPoint dummyMaxSh;
296  pftrack.addPoint(dummyMaxSh);
297  }
298 
299  // First Point for the trajectory == Vertex ??
300  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
301  math::XYZPoint(v.x(), v.y(), v.z()),
302  math::XYZTLorentzVector(p.x(),p.y(),p.z(),p.mag())));
303 
304 
305  }
306  if (iTraj != iTrajFirst && iTraj != (abs(iTrajLast)-1)) {
307  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
308  math::XYZPoint(v.x(), v.y(), v.z()),
309  math::XYZTLorentzVector(p.x(),p.y(),p.z(),p.mag())));
310 
311 
312  }
313  if (iTraj == (abs(iTrajLast)-1)) {
314 
315  // Last Trajectory Meas
316  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
317  math::XYZPoint(v.x(), v.y(), v.z()),
318  math::XYZTLorentzVector(p.x(),p.y(),p.z(),p.mag())));
319 
320 
321 
322 
323  BaseParticlePropagator theOutParticle =
326  p.y(),
327  p.z(),
328  pfenergy),
329  XYZTLorentzVector(v.x(),
330  v.y(),
331  v.z(),
332  0.),
333  track.charge()),
334  0.,0.,B_.z());
335  bool isBelowPS=false;
336  theOutParticle.propagateToPreshowerLayer1(false);
337  if(theOutParticle.getSuccess()!=0)
338  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
339  math::XYZPoint(theOutParticle.particle().vertex()),
340  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
341  else {
342  PFTrajectoryPoint dummyPS1;
343  pftrack.addPoint(dummyPS1);
344  }
345 
346 
347  theOutParticle.propagateToPreshowerLayer2(false);
348  if(theOutParticle.getSuccess()!=0){
349  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
350  math::XYZPoint(theOutParticle.particle().vertex()),
351  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
352  isBelowPS=true;
353  } else {
354  PFTrajectoryPoint dummyPS2;
355  pftrack.addPoint(dummyPS2);
356  }
357 
358  theOutParticle.propagateToEcalEntrance(false);
359 
360  if(theOutParticle.getSuccess()!=0){
361  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
362  math::XYZPoint(theOutParticle.particle().vertex()),
363  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
364  double ecalShowerDepth
365  = PFCluster::getDepthCorrection(theOutParticle.particle().momentum().E(),
366  isBelowPS,
367  false);
368 
369  math::XYZPoint meanShower=math::XYZPoint(theOutParticle.particle().vertex())+
370  math::XYZTLorentzVector(theOutParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
371 
372  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
373  meanShower,
374  math::XYZTLorentzVector(theOutParticle.particle().momentum())));}
375  else {
376  if (PT>5.)
377  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE ECAL HAS FAILED";
378  PFTrajectoryPoint dummyECAL;
379  pftrack.addPoint(dummyECAL);
380  PFTrajectoryPoint dummyMaxSh;
381  pftrack.addPoint(dummyMaxSh);
382  }
383 
384 
385 
386  //HCAL entrance
387  theOutParticle.propagateToHcalEntrance(false);
388  if(theOutParticle.getSuccess()!=0)
389  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
390  math::XYZPoint(theOutParticle.particle().vertex()),
391  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
392  else{
393  if (PT>5.)
394  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
395  PFTrajectoryPoint dummyHCALentrance;
396  pftrack.addPoint(dummyHCALentrance);
397  }
398  //HCAL exit
399  theOutParticle.propagateToHcalExit(false);
400  if(theOutParticle.getSuccess()!=0)
401  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
402  math::XYZPoint(theOutParticle.particle().vertex()),
403  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
404  else{
405  if (PT>5.)
406  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE HCAL EXIT HAS FAILED";
407  PFTrajectoryPoint dummyHCALexit;
408  pftrack.addPoint(dummyHCALexit);
409  }
410 
411  //HO Layer0
412  if ( abs(theOutParticle.particle().vertex().z())<550) {
413  theOutParticle.setMagneticField(0);
414  theOutParticle.propagateToHOLayer(false);
415  if(theOutParticle.getSuccess()!=0)
416  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
417  math::XYZPoint(theOutParticle.particle().vertex()),
418  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
419  else{
420  if (PT>5. && abs(theOutParticle.particle().Z()) < 700.25 )
421  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE HO HAS FAILED";
422  PFTrajectoryPoint dummyHOLayer;
423  pftrack.addPoint(dummyHOLayer);
424  }
425  }
426  }
427 
428  // -------------------------- END GSF Track -------------------------------------
429 
430  // -------------------------- Fill Brem "Track" ---------------------------------
431  // Fill the brem for each traj point
432 
433  //check that the vertex of the brem is in the tracker volume
434  if ((v.perp()>110) ||(fabs(v.z())>280)) continue;
435  unsigned int iTrajPoint = iTrajPos + 2;
436  if(iid%2 == 1) iTrajPoint = 99;
437 
438  PFBrem brem(DP,SigmaDP,iTrajPoint);
439 
440 
441  GlobalVector p_gamma= p*(fabs(DP)/p.mag()); // Direction from the electron (tangent), DP without any sign!;
442  float e_gamma = fabs(DP); // DP = pout-pin so could be negative
443  constexpr int gamma_charge = 0;
444  BaseParticlePropagator theBremParticle =
446  RawParticle(XYZTLorentzVector(p_gamma.x(),
447  p_gamma.y(),
448  p_gamma.z(),
449  e_gamma),
450  XYZTLorentzVector(v.x(),
451  v.y(),
452  v.z(),
453  0.),
454  gamma_charge),
455  0.,0.,B_.z());
456 
457 
458  // add TrajectoryPoint for Brem, PS, ECAL, ECALShowMax, HCAL
459  // Brem Entrance PS Layer1
460 
461  PFTrajectoryPoint dummyClosest; // Added just to have the right number order in PFTrack.cc
462  brem.addPoint(dummyClosest);
463 
464 
465  PFTrajectoryPoint dummyBeamPipe; // Added just to have the right number order in PFTrack.cc
466  brem.addPoint(dummyBeamPipe);
467 
468 
469 
470  bool isBelowPS=false;
471  theBremParticle.propagateToPreshowerLayer1(false);
472  if(theBremParticle.getSuccess()!=0)
473  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
474  math::XYZPoint(theBremParticle.particle().vertex()),
475  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
476  else {
477  PFTrajectoryPoint dummyPS1;
478  brem.addPoint(dummyPS1);
479  }
480 
481  // Brem Entrance PS Layer 2
482 
483  theBremParticle.propagateToPreshowerLayer2(false);
484  if(theBremParticle.getSuccess()!=0){
485  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
486  math::XYZPoint(theBremParticle.particle().vertex()),
487  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
488  isBelowPS=true;
489  } else {
490  PFTrajectoryPoint dummyPS2;
491  brem.addPoint(dummyPS2);
492  }
493 
494  theBremParticle.propagateToEcalEntrance(false);
495 
496  if(theBremParticle.getSuccess()!=0){
497  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
498  math::XYZPoint(theBremParticle.particle().vertex()),
499  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
500  double ecalShowerDepth
501  = PFCluster::getDepthCorrection(theBremParticle.particle().momentum().E(),
502  isBelowPS,
503  false);
504 
505  math::XYZPoint meanShower=math::XYZPoint(theBremParticle.particle().vertex())+
506  math::XYZTLorentzVector(theBremParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
507 
508  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
509  meanShower,
510  math::XYZTLorentzVector(theBremParticle.particle().momentum())));}
511  else {
512  if ((DP>5.) && ((DP/SigmaDP)>3))
513  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE ECAL HAS FAILED";
514  PFTrajectoryPoint dummyECAL;
515  brem.addPoint(dummyECAL);
516  PFTrajectoryPoint dummyMaxSh;
517  brem.addPoint(dummyMaxSh);
518  }
519 
520 
521 
522  //HCAL entrance
523  theBremParticle.propagateToHcalEntrance(false);
524  if(theBremParticle.getSuccess()!=0)
525  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
526  math::XYZPoint(theBremParticle.particle().vertex()),
527  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
528  else{
529  if ((DP>5.) && ((DP/SigmaDP)>3))
530  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
531  PFTrajectoryPoint dummyHCALentrance;
532  brem.addPoint(dummyHCALentrance);
533  }
534 
535  //HCAL exit
536  theBremParticle.propagateToHcalExit(false);
537  if(theBremParticle.getSuccess()!=0)
538  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
539  math::XYZPoint(theBremParticle.particle().vertex()),
540  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
541  else{
542  if ((DP>5.) && ((DP/SigmaDP)>3))
543  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL EXIT HAS FAILED";
544  PFTrajectoryPoint dummyHCALexit;
545  brem.addPoint(dummyHCALexit);
546  }
547 
548  //HO Layer0
549  if ( abs(theBremParticle.particle().vertex().z())<550.0) {
550  theBremParticle.setMagneticField(0);
551  theBremParticle.propagateToHOLayer(false);
552  if(theBremParticle.getSuccess()!=0)
553  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
554  math::XYZPoint(theBremParticle.particle().vertex()),
555  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
556  else {
557  if ((DP>5.) && ((DP/SigmaDP)>3) && abs(theBremParticle.particle().Z()) < 700.25 )
558  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE H0 HAS FAILED";
559  PFTrajectoryPoint dummyHOLayer;
560  brem.addPoint(dummyHOLayer);
561  }
562  }
563  brem.calculatePositionREP();
564  pftrack.addBrem(brem);
565  iTrajPos++;
566  }
567  return true;
568 }
bool propagateToPreshowerLayer1(bool first=true)
T perp() const
Definition: PV3DBase.h:72
#define PT
math::XYZVector B_
B field.
T y() const
Definition: PV3DBase.h:63
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
Definition: PFGeometry.h:68
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.
RawParticle const & particle() const
The particle being propagated.
double sigmafittedDP() const
Definition: PFGsfHelper.cc:142
PropagationDirection const & direction() const
Definition: Trajectory.cc:140
void addBrem(const reco::PFBrem &brem)
add a Bremsstrahlung photon
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
DataContainer const & measurements() const
Definition: Trajectory.h:196
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:738
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:340
T mag() const
Definition: PV3DBase.h:67
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:660
bool propagateToHcalExit(bool first=true)
T z() const
Definition: PV3DBase.h:64
void calculatePositionREP()
calculate posrep_ once and for all
double Z() const
z of vertex
Definition: RawParticle.h:307
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float outerRadius(PFGeometry::Layers_t layer) const
return outer radius of a given layer
Definition: PFGeometry.h:60
void addPoint(const reco::PFTrajectoryPoint &trajPt)
Definition: PFTrack.cc:42
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:339
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double fittedDP() const
Definition: PFGsfHelper.cc:138
bool propagateToHcalEntrance(bool first=true)
int charge() const
track electric charge
Definition: TrackBase.h:606
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
GlobalVector computeP(bool ComputeMode) const
Definition: PFGsfHelper.cc:132
bool propagateToHOLayer(bool first=true)
T x() const
Definition: PV3DBase.h:62
bool propagateToPreshowerLayer2(bool first=true)
#define constexpr
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27
bool PFTrackTransformer::addPointsAndBrems ( reco::GsfPFRecTrack pftrack,
const reco::GsfTrack track,
const MultiTrajectoryStateTransform mtjstate 
) const

Definition at line 573 of file PFTrackTransformer.cc.

References funct::abs(), reco::GsfPFRecTrack::addBrem(), reco::PFTrack::addPoint(), B_, PFGeometry::BeamPipe, reco::PFTrack::calculatePositionREP(), reco::TrackBase::charge(), constexpr, BaseParticlePropagator::getSuccess(), reco::GsfTrack::gsfExtra(), MultiTrajectoryStateTransform::innerStateOnSurface(), TrajectoryStateOnSurface::isValid(), PV3DBase< T, PVType, FrameType >::mag(), RawParticle::momentum(), multiTrajectoryStateMode::momentumFromModeCartesian(), PFGeometry::outerRadius(), MultiTrajectoryStateTransform::outerStateOnSurface(), PFGeometry::outerZ(), BaseParticlePropagator::particle(), pfGeometry_, reco::GsfTrack::pMode(), position, multiTrajectoryStateMode::positionFromModeCartesian(), BaseParticlePropagator::propagate(), BaseParticlePropagator::propagateToEcalEntrance(), BaseParticlePropagator::propagateToHcalEntrance(), BaseParticlePropagator::propagateToHcalExit(), BaseParticlePropagator::propagateToHOLayer(), BaseParticlePropagator::propagateToPreshowerLayer1(), BaseParticlePropagator::propagateToPreshowerLayer2(), reco::GsfTrack::ptMode(), reco::GsfTrack::ptModeError(), reco::GsfTrack::pxMode(), reco::GsfTrack::pyMode(), reco::GsfTrack::pzMode(), BaseParticlePropagator::setMagneticField(), BaseParticlePropagator::setPropagationConditions(), mathSSE::sqrt(), RawParticle::vertex(), reco::TrackBase::vertex(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, PV3DBase< T, PVType, FrameType >::z(), and RawParticle::Z().

575  {
576 
577  // float PT= track.pt();
578  unsigned int iTrajPos = 0;
579  unsigned int iid = 0; // not anymore saved
580 
581 
582  // ***************************** INNER State *************************************
583  TrajectoryStateOnSurface inTSOS = mtjstate.innerStateOnSurface((track));
584  TrajectoryStateOnSurface outTSOS = mtjstate.outerStateOnSurface((track));
585 
586  if(!inTSOS.isValid() || !outTSOS.isValid()) {
587  if(!inTSOS.isValid())
588  LogWarning("PFTrackTransformer")<<" INNER TSOS NOT VALID ";
589  if(!outTSOS.isValid())
590  LogWarning("PFTrackTransformer")<<" OUTER TSOS NOT VALID ";
591  return false;
592  }
593 
594  GlobalVector InMom;
595  GlobalPoint InPos;
596  if(inTSOS.isValid()) {
599  }
600  else {
601  InMom = GlobalVector(track.pxMode(),track.pyMode(),track.pzMode());
602  InPos = GlobalPoint(0.,0.,0.);
603  }
604 
605  // float pfmass= (pftrack.algoType()==reco::PFRecTrack::KF_ELCAND) ? 0.0005 : 0.139;
606  float ptot = sqrt((InMom.x()*InMom.x())+(InMom.y()*InMom.y())+(InMom.z()*InMom.z()));
607  float pfenergy= ptot;
608 
609  math::XYZTLorentzVector momClosest
610  = math::XYZTLorentzVector(InMom.x(), InMom.y(),
611  InMom.z(), ptot);
612  const math::XYZPoint& posClosest = track.vertex();
613  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ClosestApproach,
614  posClosest,momClosest));
615 
616  BaseParticlePropagator theInnerParticle =
618  InMom.y(),
619  InMom.z(),
620  pfenergy),
621  XYZTLorentzVector(track.vertex().x(),
622  track.vertex().y(),
623  track.vertex().z(),
624  0.),
625  track.charge()), //DANIELE Same thing v.x(),v.y(),v.()?
626  0.,0.,B_.z());
627  //BEAMPIPE
630  theInnerParticle.propagate();
631  if(theInnerParticle.getSuccess()!=0)
632  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::BeamPipeOrEndVertex,
633  math::XYZPoint(theInnerParticle.particle().vertex()),
634  math::XYZTLorentzVector(theInnerParticle.particle().momentum())));
635  else {
636  PFTrajectoryPoint dummyBeam;
637  pftrack.addPoint(dummyBeam);
638  }
639 
640 
641  // first tjpoint
642  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
643  math::XYZPoint(InPos.x(),InPos.y(), InPos.z()),
644  math::XYZTLorentzVector(InMom.x(),InMom.y(),InMom.z(),InMom.mag())));
645 
646 
647  //######### Photon at INNER State ##########
648 
649 
650  unsigned int iTrajPoint = iTrajPos + 2;
651  double dp_tang = ptot;
652  double sdp_tang = track.ptModeError()*(track.pMode()/track.ptMode());
653  PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
654  constexpr int gamma_charge = 0;
655  BaseParticlePropagator theBremParticle =
658  InMom.y(),
659  InMom.z(),
660  dp_tang),
661  XYZTLorentzVector(InPos.x(),
662  InPos.y(),
663  InPos.z(),
664  0.),
665  gamma_charge),
666  0.,0.,B_.z());
667  // add TrajectoryPoint for Brem, PS, ECAL, ECALShowMax, HCAL
668  // Brem Entrance PS Layer1
669  PFTrajectoryPoint dummyClosest; // Added just to have the right number order in PFTrack.cc
670  brem.addPoint(dummyClosest);
671 
672 
673  PFTrajectoryPoint dummyBeamPipe; // Added just to have the right number order in PFTrack.cc
674  brem.addPoint(dummyBeamPipe);
675 
676 
677 
678  bool isBelowPS=false;
679  theBremParticle.propagateToPreshowerLayer1(false);
680  if(theBremParticle.getSuccess()!=0)
681  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
682  math::XYZPoint(theBremParticle.particle().vertex()),
683  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
684  else {
685  PFTrajectoryPoint dummyPS1;
686  brem.addPoint(dummyPS1);
687  }
688 
689  // Brem Entrance PS Layer 2
690 
691  theBremParticle.propagateToPreshowerLayer2(false);
692  if(theBremParticle.getSuccess()!=0){
693  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
694  math::XYZPoint(theBremParticle.particle().vertex()),
695  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
696  isBelowPS=true;
697  } else {
698  PFTrajectoryPoint dummyPS2;
699  brem.addPoint(dummyPS2);
700  }
701 
702  theBremParticle.propagateToEcalEntrance(false);
703 
704  if(theBremParticle.getSuccess()!=0){
705  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
706  math::XYZPoint(theBremParticle.particle().vertex()),
707  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
708 
709  // for the first brem give a low default DP of 100 MeV.
710  double EDepthCorr = 0.01;
711  double ecalShowerDepth
712  = PFCluster::getDepthCorrection(EDepthCorr,
713  isBelowPS,
714  false);
715 
716  math::XYZPoint meanShower=math::XYZPoint(theBremParticle.particle().vertex())+
717  math::XYZTLorentzVector(theBremParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
718 
719  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
720  meanShower,
721  math::XYZTLorentzVector(theBremParticle.particle().momentum())));}
722  else {
723  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
724  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE ECAL HAS FAILED";
725  PFTrajectoryPoint dummyECAL;
726  brem.addPoint(dummyECAL);
727  PFTrajectoryPoint dummyMaxSh;
728  brem.addPoint(dummyMaxSh);
729  }
730 
731 
732 
733  //HCAL entrance
734  theBremParticle.propagateToHcalEntrance(false);
735  if(theBremParticle.getSuccess()!=0)
736  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
737  math::XYZPoint(theBremParticle.particle().vertex()),
738  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
739  else{
740  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
741  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
742  PFTrajectoryPoint dummyHCALentrance;
743  brem.addPoint(dummyHCALentrance);
744  }
745 
746  //HCAL exit
747  theBremParticle.propagateToHcalExit(false);
748  if(theBremParticle.getSuccess()!=0)
749  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
750  math::XYZPoint(theBremParticle.particle().vertex()),
751  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
752  else{
753  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
754  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL EXIT HAS FAILED";
755  PFTrajectoryPoint dummyHCALexit;
756  brem.addPoint(dummyHCALexit);
757  }
758 
759  //HO Layer0
760  if ( abs(theBremParticle.particle().vertex().z())<550) {
761  theBremParticle.setMagneticField(0);
762  theBremParticle.propagateToHOLayer(false);
763  if(theBremParticle.getSuccess()!=0)
764  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
765  math::XYZPoint(theBremParticle.particle().vertex()),
766  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
767  else{
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";
770  PFTrajectoryPoint dummyHOLayer;
771  brem.addPoint(dummyHOLayer);
772  }
773  }
774 
775  brem.calculatePositionREP();
776  pftrack.addBrem(brem);
777  iTrajPos++;
778 
779 
780 
781 
782  // ***************************** INTERMIDIATE State *************************************
783  //From the new Wolfgang code
784 
785  // To think if the cout should be removed.
786  if(track.gsfExtra()->tangentsSize() == 0)
787  LogError("PFTrackTransformer")
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 ";
789 
790 
791  vector<GsfTangent> gsftang = track.gsfExtra()->tangents();
792  for(unsigned int iTang = 0; iTang < track.gsfExtra()->tangentsSize(); iTang++) {
793 
794  dp_tang = gsftang[iTang].deltaP().value();
795  sdp_tang = gsftang[iTang].deltaP().error();
796 
797  //check that the vertex of the brem is in the tracker volume
798  if ((sqrt(gsftang[iTang].position().x()*gsftang[iTang].position().x()
799  + gsftang[iTang].position().y()*gsftang[iTang].position().y())>110)
800  ||(fabs(gsftang[iTang].position().z())>280)) continue;
801 
802  iTrajPoint = iTrajPos + 2;
803  PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
804 
805 
806 
807  GlobalVector p_tang= GlobalVector(gsftang[iTang].momentum().x(),
808  gsftang[iTang].momentum().y(),
809  gsftang[iTang].momentum().z());
810 
811 
812  // ###### track tj points
813  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
814  math::XYZPoint(gsftang[iTang].position().x(),gsftang[iTang].position().y(),gsftang[iTang].position().z()),
815  math::XYZTLorentzVector(p_tang.x(),p_tang.y(),p_tang.z(),p_tang.mag())));
816 
817 
818  //rescale
819  GlobalVector p_gamma = p_tang *(fabs(dp_tang)/p_tang.mag());
820 
821  // GlobalVector
822 
823 
824  double e_gamma = fabs(dp_tang); // DP = pout-pin so could be negative
825  theBremParticle = BaseParticlePropagator(
826  RawParticle(XYZTLorentzVector(p_gamma.x(),
827  p_gamma.y(),
828  p_gamma.z(),
829  e_gamma),
830  XYZTLorentzVector(gsftang[iTang].position().x(),
831  gsftang[iTang].position().y(),
832  gsftang[iTang].position().z(),
833  0.),
834  gamma_charge),
835  0.,0.,B_.z());
836 
837 
838  PFTrajectoryPoint dummyClosest; // Added just to have the right number order in PFTrack.cc
839  brem.addPoint(dummyClosest);
840 
841 
842  PFTrajectoryPoint dummyBeamPipe; // Added just to have the right number order in PFTrack.cc
843  brem.addPoint(dummyBeamPipe);
844 
845 
846 
847  isBelowPS=false;
848  theBremParticle.propagateToPreshowerLayer1(false);
849  if(theBremParticle.getSuccess()!=0)
850  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
851  math::XYZPoint(theBremParticle.particle().vertex()),
852  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
853  else {
854  PFTrajectoryPoint dummyPS1;
855  brem.addPoint(dummyPS1);
856  }
857 
858  // Brem Entrance PS Layer 2
859 
860  theBremParticle.propagateToPreshowerLayer2(false);
861  if(theBremParticle.getSuccess()!=0){
862  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
863  math::XYZPoint(theBremParticle.particle().vertex()),
864  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
865  isBelowPS=true;
866  } else {
867  PFTrajectoryPoint dummyPS2;
868  brem.addPoint(dummyPS2);
869  }
870 
871  theBremParticle.propagateToEcalEntrance(false);
872 
873  if(theBremParticle.getSuccess()!=0){
874  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
875  math::XYZPoint(theBremParticle.particle().vertex()),
876  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
877 
878  double ecalShowerDepth
879  = PFCluster::getDepthCorrection(theBremParticle.particle().momentum().E(),
880  isBelowPS,
881  false);
882 
883  math::XYZPoint meanShower=math::XYZPoint(theBremParticle.particle().vertex())+
884  math::XYZTLorentzVector(theBremParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
885 
886  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
887  meanShower,
888  math::XYZTLorentzVector(theBremParticle.particle().momentum())));}
889  else {
890  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
891  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE ECAL HAS FAILED";
892  PFTrajectoryPoint dummyECAL;
893  brem.addPoint(dummyECAL);
894  PFTrajectoryPoint dummyMaxSh;
895  brem.addPoint(dummyMaxSh);
896  }
897 
898 
899 
900  //HCAL entrance
901  theBremParticle.propagateToHcalEntrance(false);
902  if(theBremParticle.getSuccess()!=0)
903  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
904  math::XYZPoint(theBremParticle.particle().vertex()),
905  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
906  else{
907  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
908  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
909  PFTrajectoryPoint dummyHCALentrance;
910  brem.addPoint(dummyHCALentrance);
911  }
912 
913  //HCAL exit
914  theBremParticle.propagateToHcalExit(false);
915  if(theBremParticle.getSuccess()!=0)
916  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
917  math::XYZPoint(theBremParticle.particle().vertex()),
918  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
919  else{
920  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
921  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL EXIT HAS FAILED";
922  PFTrajectoryPoint dummyHCALexit;
923  brem.addPoint(dummyHCALexit);
924  }
925 
926  //HO Layer0
927  if ( abs(theBremParticle.particle().vertex().z())<550) {
928  theBremParticle.setMagneticField(0);
929  theBremParticle.propagateToHOLayer(false);
930  if(theBremParticle.getSuccess()!=0)
931  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
932  math::XYZPoint(theBremParticle.particle().vertex()),
933  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
934  else{
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";
937  PFTrajectoryPoint dummyHOLayer;
938  brem.addPoint(dummyHOLayer);
939  }
940  }
941 
942  brem.calculatePositionREP();
943  pftrack.addBrem(brem);
944  iTrajPos++;
945  }
946 
947 
948 
949 
950  // ***************************** OUTER State *************************************
951 
952  if(outTSOS.isValid()) {
953  GlobalVector OutMom;
954  GlobalPoint OutPos;
955 
956  // DANIELE ????? if the out is not valid maybe take the last tangent?
957  // From Wolfgang. It should be always valid
958 
961 
962 
963 
964  // last tjpoint
965  pftrack.addPoint(PFTrajectoryPoint(iid,-1,
966  math::XYZPoint(OutPos.x(),OutPos.y(), OutPos.z()),
967  math::XYZTLorentzVector(OutMom.x(),OutMom.y(),OutMom.z(),OutMom.mag())));
968 
969 
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;
973  BaseParticlePropagator theOutParticle =
975  OutMom.y(),
976  OutMom.z(),
977  pfenergy_out),
978  XYZTLorentzVector(OutPos.x(),
979  OutPos.y(),
980  OutPos.z(),
981  0.),
982  track.charge()),
983  0.,0.,B_.z());
984  isBelowPS=false;
985  theOutParticle.propagateToPreshowerLayer1(false);
986  if(theOutParticle.getSuccess()!=0)
987  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
988  math::XYZPoint(theOutParticle.particle().vertex()),
989  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
990  else {
991  PFTrajectoryPoint dummyPS1;
992  pftrack.addPoint(dummyPS1);
993  }
994 
995 
996  theOutParticle.propagateToPreshowerLayer2(false);
997  if(theOutParticle.getSuccess()!=0){
998  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
999  math::XYZPoint(theOutParticle.particle().vertex()),
1000  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
1001  isBelowPS=true;
1002  } else {
1003  PFTrajectoryPoint dummyPS2;
1004  pftrack.addPoint(dummyPS2);
1005  }
1006 
1007  theOutParticle.propagateToEcalEntrance(false);
1008 
1009  if(theOutParticle.getSuccess()!=0){
1010  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
1011  math::XYZPoint(theOutParticle.particle().vertex()),
1012  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
1013  double EDepthCorr = 0.01;
1014  double ecalShowerDepth
1015  = PFCluster::getDepthCorrection(EDepthCorr,
1016  isBelowPS,
1017  false);
1018 
1019  math::XYZPoint meanShower=math::XYZPoint(theOutParticle.particle().vertex())+
1020  math::XYZTLorentzVector(theOutParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
1021 
1022  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
1023  meanShower,
1024  math::XYZTLorentzVector(theOutParticle.particle().momentum())));}
1025  else {
1026  if (pTtot_out>5.)
1027  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE ECAL HAS FAILED";
1028  PFTrajectoryPoint dummyECAL;
1029  pftrack.addPoint(dummyECAL);
1030  PFTrajectoryPoint dummyMaxSh;
1031  pftrack.addPoint(dummyMaxSh);
1032  }
1033 
1034 
1035 
1036  //HCAL entrance
1037  theOutParticle.propagateToHcalEntrance(false);
1038  if(theOutParticle.getSuccess()!=0)
1039  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
1040  math::XYZPoint(theOutParticle.particle().vertex()),
1041  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
1042  else{
1043  if (pTtot_out>5.)
1044  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1045  PFTrajectoryPoint dummyHCALentrance;
1046  pftrack.addPoint(dummyHCALentrance);
1047  }
1048  //HCAL exit
1049  theOutParticle.propagateToHcalExit(false);
1050  if(theOutParticle.getSuccess()!=0)
1051  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
1052  math::XYZPoint(theOutParticle.particle().vertex()),
1053  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
1054  else{
1055  if (pTtot_out>5.)
1056  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<< " PROPAGATION TO THE HCAL EXIT HAS FAILED";
1057  PFTrajectoryPoint dummyHCALexit;
1058  pftrack.addPoint(dummyHCALexit);
1059  }
1060 
1061  //HO Layer0
1062  if ( abs(theOutParticle.particle().vertex().z())<550) {
1063  theOutParticle.setMagneticField(0);
1064  theOutParticle.propagateToHOLayer(false);
1065  if(theOutParticle.getSuccess()!=0)
1066  pftrack.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
1067  math::XYZPoint(theOutParticle.particle().vertex()),
1068  math::XYZTLorentzVector(theOutParticle.particle().momentum())));
1069  else{
1070  if ( pTtot_out > 5. && abs(theOutParticle.particle().Z()) < 700.25 )
1071  LogWarning("PFTrackTransformer")<<"GSF TRACK "<<pftrack<<" PROPAGATION TO THE HO HAS FAILED";
1072  PFTrajectoryPoint dummyHOLayer;
1073  pftrack.addPoint(dummyHOLayer);
1074  }
1075  }
1076  //######## Photon at the OUTER State ##########
1077 
1078  dp_tang = OutMom.mag();
1079  // for the moment same inner error just for semplicity
1080  sdp_tang = track.ptModeError()*(track.pMode()/track.ptMode());
1081  iTrajPoint = iTrajPos + 2;
1082  PFBrem brem(dp_tang,sdp_tang,iTrajPoint);
1083 
1084  theBremParticle =
1086  OutMom.y(),
1087  OutMom.z(),
1088  dp_tang),
1089  XYZTLorentzVector(OutPos.x(),
1090  OutPos.y(),
1091  OutPos.z(),
1092  0.),
1093  gamma_charge),
1094  0.,0.,B_.z());
1095 
1096 
1097  PFTrajectoryPoint dummyClosest; // Added just to have the right number order in PFTrack.cc
1098  brem.addPoint(dummyClosest);
1099 
1100 
1101  PFTrajectoryPoint dummyBeamPipe; // Added just to have the right number order in PFTrack.cc
1102  brem.addPoint(dummyBeamPipe);
1103 
1104 
1105 
1106  isBelowPS=false;
1107  theBremParticle.propagateToPreshowerLayer1(false);
1108  if(theBremParticle.getSuccess()!=0)
1109  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS1,
1110  math::XYZPoint(theBremParticle.particle().vertex()),
1111  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
1112  else {
1113  PFTrajectoryPoint dummyPS1;
1114  brem.addPoint(dummyPS1);
1115  }
1116 
1117  // Brem Entrance PS Layer 2
1118 
1119  theBremParticle.propagateToPreshowerLayer2(false);
1120  if(theBremParticle.getSuccess()!=0){
1121  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::PS2,
1122  math::XYZPoint(theBremParticle.particle().vertex()),
1123  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
1124  isBelowPS=true;
1125  } else {
1126  PFTrajectoryPoint dummyPS2;
1127  brem.addPoint(dummyPS2);
1128  }
1129 
1130  theBremParticle.propagateToEcalEntrance(false);
1131 
1132  if(theBremParticle.getSuccess()!=0){
1133  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALEntrance,
1134  math::XYZPoint(theBremParticle.particle().vertex()),
1135  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
1136  double ecalShowerDepth
1137  = PFCluster::getDepthCorrection(theBremParticle.particle().momentum().E(),
1138  isBelowPS,
1139  false);
1140 
1141  math::XYZPoint meanShower=math::XYZPoint(theBremParticle.particle().vertex())+
1142  math::XYZTLorentzVector(theBremParticle.particle().momentum()).Vect().Unit()*ecalShowerDepth;
1143 
1144  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::ECALShowerMax,
1145  meanShower,
1146  math::XYZTLorentzVector(theBremParticle.particle().momentum())));}
1147  else {
1148  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1149  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE ECAL HAS FAILED";
1150  PFTrajectoryPoint dummyECAL;
1151  brem.addPoint(dummyECAL);
1152  PFTrajectoryPoint dummyMaxSh;
1153  brem.addPoint(dummyMaxSh);
1154  }
1155 
1156 
1157 
1158  //HCAL entrance
1159  theBremParticle.propagateToHcalEntrance(false);
1160  if(theBremParticle.getSuccess()!=0)
1161  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALEntrance,
1162  math::XYZPoint(theBremParticle.particle().vertex()),
1163  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
1164  else{
1165  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1166  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL ENTRANCE HAS FAILED";
1167  PFTrajectoryPoint dummyHCALentrance;
1168  brem.addPoint(dummyHCALentrance);
1169  }
1170  //HCAL exit
1171  theBremParticle.propagateToHcalExit(false);
1172  if(theBremParticle.getSuccess()!=0)
1173  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HCALExit,
1174  math::XYZPoint(theBremParticle.particle().vertex()),
1175  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
1176  else{
1177  if ((dp_tang>5.) && ((dp_tang/sdp_tang)>3))
1178  LogWarning("PFTrackTransformer")<<"BREM "<<brem<<" PROPAGATION TO THE HCAL EXIT HAS FAILED";
1179  PFTrajectoryPoint dummyHCALexit;
1180  brem.addPoint(dummyHCALexit);
1181  }
1182 
1183  //HO Layer0
1184  if ( abs(theBremParticle.particle().vertex().z())<550) {
1185  theBremParticle.setMagneticField(0);
1186  theBremParticle.propagateToHOLayer(false);
1187  if(theBremParticle.getSuccess()!=0)
1188  brem.addPoint(PFTrajectoryPoint(-1,PFTrajectoryPoint::HOLayer,
1189  math::XYZPoint(theBremParticle.particle().vertex()),
1190  math::XYZTLorentzVector(theBremParticle.particle().momentum())));
1191  else{
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";
1194  PFTrajectoryPoint dummyHOLayer;
1195  brem.addPoint(dummyHOLayer);
1196  }
1197  }
1198  brem.calculatePositionREP();
1199  pftrack.addBrem(brem);
1200  iTrajPos++;
1201  }
1202 
1203  return true;
1204 }
double pyMode() const
y coordinate of momentum vector from mode
Definition: GsfTrack.h:53
bool propagateToPreshowerLayer1(bool first=true)
double pMode() const
momentum vector magnitude from mode
Definition: GsfTrack.h:47
math::XYZVector B_
B field.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
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
Definition: PFGeometry.h:68
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.
RawParticle const & particle() const
The particle being propagated.
TrajectoryStateOnSurface outerStateOnSurface(const reco::GsfTrack &tk) const
double ptModeError() const
error on Pt (set to 1000 TeV if charge==0 for safety) from mode
Definition: GsfTrack.h:81
void addBrem(const reco::PFBrem &brem)
add a Bremsstrahlung photon
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:738
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:340
T mag() const
Definition: PV3DBase.h:67
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
T sqrt(T t)
Definition: SSEVec.h:18
bool propagateToHcalExit(bool first=true)
T z() const
Definition: PV3DBase.h:64
void calculatePositionREP()
calculate posrep_ once and for all
double Z() const
z of vertex
Definition: RawParticle.h:307
double pzMode() const
z coordinate of momentum vector from mode
Definition: GsfTrack.h:55
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float outerRadius(PFGeometry::Layers_t layer) const
return outer radius of a given layer
Definition: PFGeometry.h:60
void addPoint(const reco::PFTrajectoryPoint &trajPt)
Definition: PFTrack.cc:42
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:339
const GsfTrackExtraRef & gsfExtra() const
reference to "extra" object
Definition: GsfTrack.h:32
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double pxMode() const
x coordinate of momentum vector from mode
Definition: GsfTrack.h:51
TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack &tk) const
bool propagateToHcalEntrance(bool first=true)
static int position[264][3]
Definition: ReadPGInfo.cc:509
int charge() const
track electric charge
Definition: TrackBase.h:606
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
bool momentumFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalVector &momentum)
bool propagateToHOLayer(bool first=true)
T x() const
Definition: PV3DBase.h:62
double ptMode() const
track transverse momentum from mode
Definition: GsfTrack.h:49
bool propagateToPreshowerLayer2(bool first=true)
#define constexpr
Global3DVector GlobalVector
Definition: GlobalVector.h:10
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27
void PFTrackTransformer::OnlyProp ( )
inline

Member Data Documentation

math::XYZVector PFTrackTransformer::B_
private

B field.

Definition at line 68 of file PFTrackTransformer.h.

Referenced by addPoints(), and addPointsAndBrems().

bool PFTrackTransformer::onlyprop_

Definition at line 64 of file PFTrackTransformer.h.

Referenced by addPoints(), OnlyProp(), and PFTrackTransformer().

PFGeometry PFTrackTransformer::pfGeometry_
private

Definition at line 69 of file PFTrackTransformer.h.

Referenced by addPoints(), and addPointsAndBrems().