CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParametersDefinerForTP.cc
Go to the documentation of this file.
13 
16  // to add a new implementation for cosmic. For the moment, it is just as for the base class:
17 
18  using namespace edm;
19 
21  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
22 
24  iEvent.getByLabel(InputTag("offlineBeamSpot"),bs);
25 
27 
28  FreeTrajectoryState ftsAtProduction(GlobalPoint(tp.vertex().x(),tp.vertex().y(),tp.vertex().z()),
29  GlobalVector(tp.momentum().x(),tp.momentum().y(),tp.momentum().z()),
30  TrackCharge(tp.charge()),
31  theMF.product());
32 
33  TSCBLBuilderNoMaterial tscblBuilder;
34  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
35  if(tsAtClosestApproach.isValid()){
36  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
37  momentum = ParticleBase::Vector(p.x(), p.y(), p.z());
38  }
39  return momentum;
40 }
41 
43  // to add a new implementation for cosmic. For the moment, it is just as for the base class:
44  using namespace edm;
45 
47  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
48 
50  iEvent.getByLabel(InputTag("offlineBeamSpot"),bs);
51 
52  ParticleBase::Point vertex(0, 0, 0);
53 
54  FreeTrajectoryState ftsAtProduction(GlobalPoint(tp.vertex().x(),tp.vertex().y(),tp.vertex().z()),
55  GlobalVector(tp.momentum().x(),tp.momentum().y(),tp.momentum().z()),
56  TrackCharge(tp.charge()),
57  theMF.product());
58 
59  TSCBLBuilderNoMaterial tscblBuilder;
60  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
61  if(tsAtClosestApproach.isValid()){
62  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
63  vertex = ParticleBase::Point(v.x()-bs->x0(),v.y()-bs->y0(),v.z()-bs->z0());
64  }
65  return vertex;
66 }
67 
68 
int charge() const
electric charge
Definition: ParticleBase.h:55
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:57
math::XYZVectorD Vector
point in the space
Definition: ParticleBase.h:31
int TrackCharge
Definition: TrackCharge.h:4
math::XYZPointD Point
point in the space
Definition: ParticleBase.h:29
int iEvent
Definition: GenABIO.cc:243
T z() const
Definition: PV3DBase.h:58
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:97
const T & get() const
Definition: EventSetup.h:55
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:87
virtual ParticleBase::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
const Point & vertex() const
vertex position
Definition: ParticleBase.h:229
T x() const
Definition: PV3DBase.h:56
mathSSE::Vec4< T > v
Global3DVector GlobalVector
Definition: GlobalVector.h:10
virtual ParticleBase::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const