CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
ParametersDefinerForTP Class Reference

#include <ParametersDefinerForTP.h>

Inheritance diagram for ParametersDefinerForTP:
CosmicParametersDefinerForTP

Public Member Functions

virtual ParticleBase::Vector momentum (const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
 
 ParametersDefinerForTP ()
 
virtual ParticleBase::Point vertex (const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
 

Detailed Description

Author
Boris Mangano (UCSD) 5/7/2009

Definition at line 15 of file ParametersDefinerForTP.h.

Constructor & Destructor Documentation

ParametersDefinerForTP::ParametersDefinerForTP ( )
inline

Definition at line 18 of file ParametersDefinerForTP.h.

18 {};

Member Function Documentation

ParticleBase::Vector ParametersDefinerForTP::momentum ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const TrackingParticle tp 
) const
virtual

Reimplemented in CosmicParametersDefinerForTP.

Definition at line 15 of file ParametersDefinerForTP.cc.

References ParticleBase::charge(), edm::EventSetup::get(), edm::Event::getByLabel(), ParticleBase::momentum(), AlCaHLTBitMon_ParallelJobs::p, ParticleBase::vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

15  {
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 }
int charge() const
electric charge
Definition: ParticleBase.h:54
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
math::XYZVectorD Vector
point in the space
Definition: ParticleBase.h:30
int TrackCharge
Definition: TrackCharge.h:4
T z() const
Definition: PV3DBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:86
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:228
T x() const
Definition: PV3DBase.h:61
Global3DVector GlobalVector
Definition: GlobalVector.h:10
ParticleBase::Point ParametersDefinerForTP::vertex ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const TrackingParticle tp 
) const
virtual

Reimplemented in CosmicParametersDefinerForTP.

Definition at line 42 of file ParametersDefinerForTP.cc.

References ParticleBase::charge(), edm::EventSetup::get(), edm::Event::getByLabel(), ParticleBase::momentum(), v, ParticleBase::vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

42  {
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 }
int charge() const
electric charge
Definition: ParticleBase.h:54
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
int TrackCharge
Definition: TrackCharge.h:4
math::XYZPointD Point
point in the space
Definition: ParticleBase.h:28
T z() const
Definition: PV3DBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:86
const Point & vertex() const
vertex position
Definition: ParticleBase.h:228
T x() const
Definition: PV3DBase.h:61
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