CMS 3D CMS Logo

ParametersDefinerForTP.cc
Go to the documentation of this file.
13 
14 
16  : beamSpotInputTag_ ( iConfig.getUntrackedParameter<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot")) )
17 {
18 }
19 
20 
23  const Charge charge, const Point & vtx, const LorentzVector& lv) const {
24  // to add a new implementation for cosmic. For the moment, it is just as for the base class:
25 
26  using namespace edm;
27 
29  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
30 
32  iEvent.getByLabel(beamSpotInputTag_,bs);
33 
35 
36  FreeTrajectoryState ftsAtProduction(GlobalPoint(vtx.x(),vtx.y(),vtx.z()),
37  GlobalVector(lv.x(),lv.y(),lv.z()),
38  TrackCharge(charge),
39  theMF.product());
40 
41  TSCBLBuilderNoMaterial tscblBuilder;
42  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
43  if(tsAtClosestApproach.isValid()){
44  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
45  momentum = TrackingParticle::Vector(p.x(), p.y(), p.z());
46  }
47  return momentum;
48 }
49 
51  const Charge charge, const Point & vtx, const LorentzVector& lv) const {
52  // to add a new implementation for cosmic. For the moment, it is just as for the base class:
53  using namespace edm;
54 
56  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
57 
59  iEvent.getByLabel(beamSpotInputTag_,bs);
60 
62 
63  FreeTrajectoryState ftsAtProduction(GlobalPoint(vtx.x(),vtx.y(),vtx.z()),
64  GlobalVector(lv.x(),lv.y(),lv.z()),
65  TrackCharge(charge),
66  theMF.product());
67 
68  TSCBLBuilderNoMaterial tscblBuilder;
69  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
70  if(tsAtClosestApproach.isValid()){
71  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
72  vertex = TrackingParticle::Point(v.x(),v.y(),v.z());
73  }
74  else {
75  // to preserve old behaviour
76  // would be better to flag this somehow to allow ignoring in downstream
77  vertex = TrackingParticle::Point(bs->x0(), bs->y0(), bs->z0());
78  }
79  return vertex;
80 }
81 
82 
double z0() const
z coordinate
Definition: BeamSpot.h:68
math::XYZTLorentzVectorD LorentzVector
Lorentz vector.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
math::XYZPointD Point
point in the space
int TrackCharge
Definition: TrackCharge.h:4
int iEvent
Definition: GenABIO.cc:230
T z() const
Definition: PV3DBase.h:64
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
math::XYZPointD Point
point in the space
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
GlobalVector momentum() const
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:96
GlobalPoint position() const
int Charge
electric charge type
const T & get() const
Definition: EventSetup.h:56
HLT enums.
double y0() const
y coordinate
Definition: BeamSpot.h:66
math::XYZVectorD Vector
point in the space
T x() const
Definition: PV3DBase.h:62
T const * product() const
Definition: ESHandle.h:86
Global3DVector GlobalVector
Definition: GlobalVector.h:10
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
double x0() const
x coordinate
Definition: BeamSpot.h:64