CMS 3D CMS Logo

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

#include <CosmicParametersDefinerForTP.h>

Inheritance diagram for CosmicParametersDefinerForTP:
ParametersDefinerForTP

Public Member Functions

std::unique_ptr
< ParametersDefinerForTP
clone () const override
 
 CosmicParametersDefinerForTP ()
 
void initEvent (edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssocToSet) override
 
virtual TrackingParticle::Vector momentum (const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const override
 
virtual TrackingParticle::Vector momentum (const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vertex, const LorentzVector &lv) const override
 
virtual TrackingParticle::Point vertex (const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const override
 
virtual TrackingParticle::Point vertex (const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vertex, const LorentzVector &lv) const override
 
virtual ~CosmicParametersDefinerForTP ()
 
- Public Member Functions inherited from ParametersDefinerForTP
virtual TrackingParticle::Vector momentum (const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Candidate &tp) const
 
 ParametersDefinerForTP ()
 
 ParametersDefinerForTP (const edm::ParameterSet &iConfig)
 
virtual TrackingParticle::Point vertex (const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Candidate &tp) const
 
virtual ~ParametersDefinerForTP ()
 

Private Attributes

edm::Handle
< SimHitTPAssociationProducer::SimHitTPAssociationList
simHitsTPAssoc
 

Additional Inherited Members

- Public Types inherited from ParametersDefinerForTP
typedef int Charge
 electric charge type More...
 
typedef math::XYZTLorentzVectorD LorentzVector
 Lorentz vector. More...
 
typedef math::XYZPointD Point
 point in the space More...
 
- Public Attributes inherited from ParametersDefinerForTP
edm::InputTag beamSpotInputTag_
 

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.

Referenced by clone().

16 {};
virtual CosmicParametersDefinerForTP::~CosmicParametersDefinerForTP ( )
inlinevirtual

Definition at line 17 of file CosmicParametersDefinerForTP.h.

17 {};

Member Function Documentation

std::unique_ptr<ParametersDefinerForTP> CosmicParametersDefinerForTP::clone ( void  ) const
inlineoverridevirtual

Reimplemented from ParametersDefinerForTP.

Definition at line 36 of file CosmicParametersDefinerForTP.h.

References CosmicParametersDefinerForTP().

36 { return std::unique_ptr<CosmicParametersDefinerForTP>( new CosmicParametersDefinerForTP(*this)); }
void CosmicParametersDefinerForTP::initEvent ( edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList simHitsTPAssocToSet)
inlineoverridevirtual

Reimplemented from ParametersDefinerForTP.

Definition at line 32 of file CosmicParametersDefinerForTP.h.

References simHitsTPAssoc.

32  {
33  simHitsTPAssoc = simHitsTPAssocToSet;
34  }
edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssoc
TrackingParticle::Vector CosmicParametersDefinerForTP::momentum ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const TrackingParticleRef tpr 
) const
overridevirtual

Reimplemented from ParametersDefinerForTP.

Definition at line 25 of file CosmicParametersDefinerForTP.cc.

References newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), HLT_25ns10e33_v2_cff::InputTag, TrajectoryStateClosestToBeamLine::isValid(), edm::HandleBase::isValid(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::perp(), CosmicsPD_Skims::radius, dt_dqm_sourceclient_common_cff::reco, simHitsTPAssoc, SimHitTPAssociationProducer::simHitTPAssociationListGreater(), mathSSE::sqrt(), GeomDet::surface(), Surface::toGlobal(), patCandidatesForDimuonsSequences_cff::tracker, TrajectoryStateClosestToBeamLine::trackStateAtPCA(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

25  {
26  // to add a new implementation for cosmic. For the moment, it is just as for the base class:
27  using namespace edm;
28  using namespace std;
29  using namespace reco;
30 
32  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
34  iSetup.get<GlobalTrackingGeometryRecord>().get(theGeometry);
35 
37  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
38 
40  iEvent.getByLabel(InputTag("offlineBeamSpot"),bs);
41 
42  GlobalVector finalGV(0,0,0);
43  GlobalPoint finalGP(0,0,0);
44  double radius(9999);
45  bool found(0);
47 
48  edm::LogVerbatim("CosmicParametersDefinerForTP")<<"\t in CosmicParametersDefinerForTP::momentum";
49  edm::LogVerbatim("CosmicParametersDefinerForTP")
50  <<"\t \t Original TP state: pt = "<<tpr->pt()<<", pz = "<<tpr->pz();
51 
52  if (simHitsTPAssoc.isValid()==0) {
53  LogError("TrackAssociation") << "Invalid handle!";
54  return momentum;
55  }
56  std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(tpr,TrackPSimHitRef());//SimHit is dummy: for simHitTPAssociationListGreater
57  // sorting only the cluster is needed
58  auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
60  for(auto ip = range.first; ip != range.second; ++ip) {
61  TrackPSimHitRef it = ip->second;
62  const GeomDet* tmpDet = theGeometry->idToDet( DetId(it->detUnitId()) ) ;
63  if (!tmpDet) {
64  edm::LogVerbatim("CosmicParametersDefinerForTP")
65  <<"***WARNING in CosmicParametersDefinerForTP::momentum: no GeomDet for: "<<it->detUnitId()<<". Skipping it."<<"\n";
66  continue;
67  }
68 
69  LocalVector lv = it->momentumAtEntry();
70  Local3DPoint lp = it->localPosition ();
71  GlobalVector gv = tmpDet->surface().toGlobal( lv );
72  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
73 
74  // discard hits related to low energy debris from the primary particle
75  if (it->processType()!=0) continue;
76 
77  if(gp.perp()<radius){
78  found=true;
79  radius = gp.perp();
80  finalGV = gv;
81  finalGP = gp;
82  }
83  }
84 
85  edm::LogVerbatim("CosmicParametersDefinerForTP")
86  // <<"\t FINAL State at InnerMost Hit: Radius = "<< finalGP.perp() << ", z = "<< finalGP.z()
87  // <<", pt = "<< finalGV.perp() << ", pz = "<< finalGV.z();
88  <<"\t \t FINAL State at InnerMost Hit: pt = "<< finalGV.perp() << ", pz = "<< finalGV.z();
89 
90  if(found)
91  {
92  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tpr->charge()),theMF.product());
93  TSCBLBuilderNoMaterial tscblBuilder;
94  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
95 
96  if(tsAtClosestApproach.isValid()){
97  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
98  momentum = TrackingParticle::Vector(p.x(), p.y(), p.z());
99  }
100  else {
101  edm::LogVerbatim("CosmicParametersDefinerForTP")
102  <<"*** WARNING in CosmicParametersDefinerForTP::momentum: tsAtClosestApproach is not valid." <<"\n";
103  }
104 
105  edm::LogVerbatim("CosmicParametersDefinerForTP")
106  <<"\t \t FINAL State extrap. at PCA: pt = "<< sqrt(momentum.x()*momentum.x()+momentum.y()*momentum.y()) << ", pz = "<< momentum.z() <<"\n";
107 
108  return momentum;
109  }
110 
111  edm::LogVerbatim("CosmicParametersDefinerForTP")
112  <<"*** WARNING in CosmicParametersDefinerForTP::momentum: NOT found the innermost TP point" <<"\n";
113  edm::LogVerbatim("CosmicParametersDefinerForTP")
114  <<"*** FINAL Reference MOMENTUM TP (px,py,pz) = "<<momentum.x()<<momentum.y()<<momentum.z()<<"\n";
115  return momentum;
116 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T perp() const
Definition: PV3DBase.h:72
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const override
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
GlobalVector momentum() const
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
math::XYZVectorD Vector
point in the space
T x() const
Definition: PV3DBase.h:62
edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssoc
virtual TrackingParticle::Vector CosmicParametersDefinerForTP::momentum ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const Charge  ch,
const Point vertex,
const LorentzVector lv 
) const
inlineoverridevirtual

Reimplemented from ParametersDefinerForTP.

Definition at line 22 of file CosmicParametersDefinerForTP.h.

23  {
24  return TrackingParticle::Vector();
25  }
math::XYZVectorD Vector
point in the space
TrackingParticle::Point CosmicParametersDefinerForTP::vertex ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const TrackingParticleRef tpr 
) const
overridevirtual

Reimplemented from ParametersDefinerForTP.

Definition at line 118 of file CosmicParametersDefinerForTP.cc.

References newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), HLT_25ns10e33_v2_cff::InputTag, TrajectoryStateClosestToBeamLine::isValid(), edm::HandleBase::isValid(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), CosmicsPD_Skims::radius, dt_dqm_sourceclient_common_cff::reco, simHitsTPAssoc, SimHitTPAssociationProducer::simHitTPAssociationListGreater(), mathSSE::sqrt(), GeomDet::surface(), Surface::toGlobal(), patCandidatesForDimuonsSequences_cff::tracker, TrajectoryStateClosestToBeamLine::trackStateAtPCA(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by Tau.Tau::dxy().

118  {
119 
120  using namespace edm;
121  using namespace std;
122  using namespace reco;
123 
125  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
127  iSetup.get<GlobalTrackingGeometryRecord>().get(theGeometry);
128 
130  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
131 
133  iEvent.getByLabel(InputTag("offlineBeamSpot"),bs);
134 
135  GlobalVector finalGV(0,0,0);
136  GlobalPoint finalGP(0,0,0);
137  double radius(9999);
138  bool found(0);
140 
141  edm::LogVerbatim("CosmicParametersDefinerForTP")<<"\t in CosmicParametersDefinerForTP::vertex";
142  edm::LogVerbatim("CosmicParametersDefinerForTP")
143  <<"\t \t Original TP state: radius = "<<sqrt(tpr->vertex().x()*tpr->vertex().x()+tpr->vertex().y()*tpr->vertex().y())<<", z = "<<tpr->vertex().z();
144 
145  if (simHitsTPAssoc.isValid()==0) {
146  LogError("TrackAssociation") << "Invalid handle!";
147  return vertex;
148  }
149  std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(tpr,TrackPSimHitRef());//SimHit is dummy: for simHitTPAssociationListGreater
150  // sorting only the cluster is needed
151  auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
153  for(auto ip = range.first; ip != range.second; ++ip) {
154  TrackPSimHitRef it = ip->second;
155  const GeomDet* tmpDet = theGeometry->idToDet( DetId(it->detUnitId()) ) ;
156  if (!tmpDet) {
157  edm::LogVerbatim("CosmicParametersDefinerForTP")
158  <<"***WARNING in CosmicParametersDefinerForTP::vertex: no GeomDet for: "<<it->detUnitId()<<". Skipping it."<<"\n";
159  continue;
160  }
161 
162  LocalVector lv = it->momentumAtEntry();
163  Local3DPoint lp = it->localPosition ();
164  GlobalVector gv = tmpDet->surface().toGlobal( lv );
165  GlobalPoint gp = tmpDet->surface().toGlobal( lp );
166 
167  // discard hits related to low energy debris from the primary particle
168  if (it->processType()!=0) continue;
169 
170  if(gp.perp()<radius){
171  found=true;
172  radius = gp.perp();
173  finalGV = gv;
174  finalGP = gp;
175  }
176  }
177  edm::LogVerbatim("CosmicParametersDefinerForTP")
178  <<"\t \t FINAL State at InnerMost Hit: radius = "<< finalGP.perp() << ", z = "<< finalGP.z();
179 
180  if(found)
181  {
182  FreeTrajectoryState ftsAtProduction(finalGP,finalGV,TrackCharge(tpr->charge()),theMF.product());
183  TSCBLBuilderNoMaterial tscblBuilder;
184  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,*bs);//as in TrackProducerAlgorithm
185 
186  if(tsAtClosestApproach.isValid()){
187  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
188  vertex = TrackingParticle::Point(v.x()-bs->x0(),v.y()-bs->y0(),v.z()-bs->z0());
189  }
190  else {
191  edm::LogVerbatim("CosmicParametersDefinerForTP")
192  <<"*** WARNING in CosmicParametersDefinerForTP::vertex: tsAtClosestApproach is not valid." <<"\n";
193  }
194  edm::LogVerbatim("CosmicParametersDefinerForTP")
195  <<"\t \t FINAL State extrap. at PCA: radius = "
196  <<sqrt(vertex.x()*vertex.x()+vertex.y()*vertex.y())<<", z = "<<vertex.z()<<"\n";
197 
198  return vertex;
199  }
200 
201  edm::LogVerbatim("CosmicParametersDefinerForTP")
202  <<"*** WARNING in CosmicParametersDefinerForTP::vertex: NOT found the innermost TP point" <<"\n";
203  edm::LogVerbatim("CosmicParametersDefinerForTP")
204  <<"*** FINAL Reference VERTEX TP V(x,y,z) = "<<vertex.x()<<vertex.y()<<vertex.z()<<"\n";
205 
206  return vertex;
207 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T perp() const
Definition: PV3DBase.h:72
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
math::XYZPointD Point
point in the space
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
Definition: DetId.h:18
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:56
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const override
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
T x() const
Definition: PV3DBase.h:62
edm::Handle< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitsTPAssoc
virtual TrackingParticle::Point CosmicParametersDefinerForTP::vertex ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const Charge  ch,
const Point vertex,
const LorentzVector lv 
) const
inlineoverridevirtual

Reimplemented from ParametersDefinerForTP.

Definition at line 27 of file CosmicParametersDefinerForTP.h.

Referenced by Tau.Tau::dxy().

28  {
29  return TrackingParticle::Point();
30  }
math::XYZPointD Point
point in the space

Member Data Documentation

edm::Handle<SimHitTPAssociationProducer::SimHitTPAssociationList> CosmicParametersDefinerForTP::simHitsTPAssoc
private

Definition at line 38 of file CosmicParametersDefinerForTP.h.

Referenced by initEvent(), momentum(), and vertex().