CMS 3D CMS Logo

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

#include <CosmicParametersDefinerForTP.h>

Inheritance diagram for CosmicParametersDefinerForTP:
ParametersDefinerForTP

Public Member Functions

 CosmicParametersDefinerForTP ()
 
virtual ParticleBase::Vector momentum (const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
 
virtual ParticleBase::Point vertex (const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
 
- Public Member Functions inherited from ParametersDefinerForTP
 ParametersDefinerForTP ()
 

Detailed Description

Author
Boris Mangano (UCSD) 5/7/2009

Definition at line 13 of file CosmicParametersDefinerForTP.h.

Constructor & Destructor Documentation

CosmicParametersDefinerForTP::CosmicParametersDefinerForTP ( )
inline

Definition at line 16 of file CosmicParametersDefinerForTP.h.

16 {};

Member Function Documentation

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

Reimplemented from ParametersDefinerForTP.

Definition at line 22 of file CosmicParametersDefinerForTP.cc.

References ParticleBase::charge(), newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), TrajectoryStateClosestToBeamLine::isValid(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::perp(), CosmicsPD_Skims::radius, dt_dqm_sourceclient_common_cff::reco, trackerHits::simHits, GeomDet::surface(), Surface::toGlobal(), DetId::Tracker, patCandidatesForDimuonsSequences_cff::tracker, TrackingParticle::trackPSimHit(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

22  {
23  // to add a new implementation for cosmic. For the moment, it is just as for the base class:
24  using namespace edm;
25  using namespace std;
26  using namespace reco;
27 
29  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
30 
32  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
33 
35  iEvent.getByLabel(InputTag("offlineBeamSpot"),bs);
36 
37  // cout<<"TrackingParticle pdgId = "<<tp.pdgId()<<endl;
38  // cout<<"with tp.vertex(): ("<<tp.vertex().x()<<", "<<tp.vertex().y()<<", "<<tp.vertex().z()<<")"<<endl;
39  // cout<<"with tp.momentum(): ("<<tp.momentum().x()<<", "<<tp.momentum().y()<<", "<<tp.momentum().z()<<")"<<endl;
40 
41  GlobalVector finalGV;
42  GlobalPoint finalGP;
43  double radius(9999);
44  bool found(0);
46 
47  const vector<PSimHit> & simHits = tp.trackPSimHit(DetId::Tracker);
48  for(vector<PSimHit>::const_iterator it=simHits.begin(); it!=simHits.end(); ++it){
49  const GeomDet* tmpDet = tracker->idToDet( DetId(it->detUnitId()) ) ;
50  LocalVector lv = it->momentumAtEntry();
51  Local3DPoint lp = it->localPosition ();
52  GlobalVector gv = tmpDet->surface().toGlobal( lv );
53  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
54  if(gp.perp()<radius){
55  found=true;
56  radius = gp.perp();
57  finalGV = gv;
58  finalGP = gp;
59  }
60  }
61 
62  //cout<<"found = "<<found<<endl;
63  // cout<<"Closest Hit Position: ("<<finalGP.x()<<", "<<finalGP.y()<<", "<<finalGP.z()<<")"<<endl;
64  //cout<<"Momentum at Closest Hit to BL: ("<<finalGV.x()<<", "<<finalGV.y()<<", "<<finalGV.z()<<")"<<endl;
65 
66  if(found)
67  {
68  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tp.charge()),theMF.product());
69  TSCBLBuilderNoMaterial tscblBuilder;
70  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
71  if(tsAtClosestApproach.isValid()){
72  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
73  momentum = ParticleBase::Vector(p.x(), p.y(), p.z());
74  }
75  return momentum;
76  }
77  return momentum;
78 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T perp() const
Definition: PV3DBase.h:71
int charge() const
electric charge
Definition: ParticleBase.h:54
const std::vector< PSimHit > & trackPSimHit() const
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
GlobalVector momentum() const
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
tuple simHits
Definition: trackerHits.py:16
virtual ParticleBase::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
T x() const
Definition: PV3DBase.h:61
ParticleBase::Point CosmicParametersDefinerForTP::vertex ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const TrackingParticle tp 
) const
virtual

Reimplemented from ParametersDefinerForTP.

Definition at line 80 of file CosmicParametersDefinerForTP.cc.

References ParticleBase::charge(), newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), TrajectoryStateClosestToBeamLine::isValid(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), CosmicsPD_Skims::radius, dt_dqm_sourceclient_common_cff::reco, trackerHits::simHits, GeomDet::surface(), Surface::toGlobal(), DetId::Tracker, patCandidatesForDimuonsSequences_cff::tracker, TrackingParticle::trackPSimHit(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

80  {
81 
82  using namespace edm;
83  using namespace std;
84  using namespace reco;
85 
87  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
88 
90  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
91 
93  iEvent.getByLabel(InputTag("offlineBeamSpot"),bs);
94 
95  GlobalVector finalGV;
96  GlobalPoint finalGP;
97  double radius(9999);
98  bool found(0);
100 
101  const vector<PSimHit> & simHits = tp.trackPSimHit(DetId::Tracker);
102  for(vector<PSimHit>::const_iterator it=simHits.begin(); it!=simHits.end(); ++it){
103  const GeomDet* tmpDet = tracker->idToDet( DetId(it->detUnitId()) ) ;
104  LocalVector lv = it->momentumAtEntry();
105  Local3DPoint lp = it->localPosition ();
106  GlobalVector gv = tmpDet->surface().toGlobal( lv );
107  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
108  if(gp.perp()<radius){
109  found=true;
110  radius = gp.perp();
111  finalGV = gv;
112  finalGP = gp;
113  }
114  }
115  if(found)
116  {
117  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tp.charge()),theMF.product());
118  TSCBLBuilderNoMaterial tscblBuilder;
119  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
120  if(tsAtClosestApproach.isValid()){
121  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
122  vertex = ParticleBase::Point(v.x()-bs->x0(),v.y()-bs->y0(),v.z()-bs->z0());
123  }
124  return vertex;
125  }
126  return vertex;
127 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T perp() const
Definition: PV3DBase.h:71
int charge() const
electric charge
Definition: ParticleBase.h:54
const std::vector< PSimHit > & trackPSimHit() const
T y() const
Definition: PV3DBase.h:62
virtual ParticleBase::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticle &tp) const
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
Definition: DetId.h:20
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:55
tuple simHits
Definition: trackerHits.py:16
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
T x() const
Definition: PV3DBase.h:61
mathSSE::Vec4< T > v