CMS 3D CMS Logo

CaloPropagateTrack.h
Go to the documentation of this file.
1 #ifndef CalibrationIsolatedParticlesCaloPropagateTrack_h
2 #define CalibrationIsolatedParticlesCaloPropagateTrack_h
3 
4 #include <cmath>
5 #include <vector>
6 #include <string>
7 
16 
17 //sim track
24 
28 
30 
31 namespace spr {
32 
33  struct propagatedTrack {
34  propagatedTrack() { ok = false; }
35  bool ok;
38  };
39 
42  ok = false;
43  okECAL = false;
44  okHCAL = false;
45  }
46  bool ok, okECAL, okHCAL;
48  double etaECAL, etaHCAL;
49  double phiECAL, phiHCAL;
50  reco::TrackCollection::const_iterator trkItr;
51  };
52 
55  ok = false;
56  okECAL = false;
57  okHCAL = false;
58  }
59  bool ok, okECAL, okHCAL;
63  reco::TrackCollection::const_iterator trkItr;
64  };
65 
68  ok = okECAL = okHCAL = false;
69  charge = pdgId = 0;
70  }
71  bool ok, okECAL, okHCAL;
75  int charge, pdgId;
76  HepMC::GenEvent::particle_const_iterator trkItr;
77  };
78 
81  ok = okECAL = okHCAL = false;
82  charge = pdgId = 0;
83  }
84  bool ok, okECAL, okHCAL;
88  int charge, pdgId;
89  reco::GenParticleCollection::const_iterator trkItr;
90  };
91 
92  struct trackAtOrigin {
93  trackAtOrigin() { ok = false; }
94  bool ok;
95  int charge;
98  };
99 
100  // Returns a vector of DetID's of closest cell on the ECAL/HCAL surface of
101  // all the tracks in the collection. Also saves a boolean if extrapolation
102  // is satisfactory
103  std::vector<spr::propagatedTrackID> propagateCosmicCALO(edm::Handle<reco::TrackCollection>& trkCollection,
104  const CaloGeometry* geo,
105  const MagneticField* bField,
106  const std::string& theTrackQuality,
107  bool debug = false);
108  std::vector<spr::propagatedTrackID> propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection,
109  const CaloGeometry* geo,
110  const MagneticField* bField,
111  const std::string& theTrackQuality,
112  bool debug = false);
114  const CaloGeometry* geo,
115  const MagneticField* bField,
116  const std::string& theTrackQuality,
117  std::vector<spr::propagatedTrackID>& vdets,
118  bool debug = false);
120  const CaloGeometry* geo,
121  const MagneticField* bField,
122  const std::string& theTrackQuality,
123  std::vector<spr::propagatedTrackDirection>& trkDir,
124  bool debug = false);
126  const CaloGeometry* geo,
127  const MagneticField* bField,
128  bool debug = false);
129  std::vector<spr::propagatedGenTrackID> propagateCALO(const HepMC::GenEvent* genEvent,
131  const CaloGeometry* geo,
132  const MagneticField* bField,
133  double etaMax = 3.0,
134  bool debug = false);
135  std::vector<spr::propagatedGenParticleID> propagateCALO(edm::Handle<reco::GenParticleCollection>& genParticles,
137  const CaloGeometry* geo,
138  const MagneticField* bField,
139  double etaMax = 3.0,
140  bool debug = false);
141  spr::propagatedTrackDirection propagateCALO(unsigned int thisTrk,
144  const CaloGeometry* geo,
145  const MagneticField* bField,
146  bool debug = false);
150  const CaloGeometry* geo,
151  const MagneticField* bField,
152  bool debug = false);
153  std::pair<bool, HcalDetId> propagateHCALBack(const reco::Track*,
154  const CaloGeometry* geo,
155  const MagneticField* bField,
156  bool debug = false);
157 
158  // Propagate tracks to the ECAL surface and optionally returns the
159  // extrapolated point (and the track direction at point of extrapolation)
161  spr::propagatedTrack propagateTrackToECAL(unsigned int thisTrk,
164  const MagneticField*,
165  bool debug = false);
166  std::pair<math::XYZPoint, bool> propagateECAL(const reco::Track*, const MagneticField*, bool debug = false);
167  std::pair<DetId, bool> propagateIdECAL(const HcalDetId& id,
168  const CaloGeometry* geo,
169  const MagneticField*,
170  bool debug = false);
171  std::pair<math::XYZPoint, bool> propagateECAL(
172  const GlobalPoint& vertex, const GlobalVector& momentum, int charge, const MagneticField*, bool debug = false);
173 
174  // Propagate tracks to the HCAL surface and optionally returns the
175  // extrapolated point (and the track direction at point of extrapolation)
177  spr::propagatedTrack propagateTrackToHCAL(unsigned int thisTrk,
180  const MagneticField*,
181  bool debug = false);
182  std::pair<math::XYZPoint, bool> propagateHCAL(const reco::Track*, const MagneticField*, bool debug = false);
183  std::pair<math::XYZPoint, bool> propagateHCAL(
184  const GlobalPoint& vertex, const GlobalVector& momentum, int charge, const MagneticField*, bool debug = false);
185 
186  // Propagate the track to the end of the tracker and returns the extrapolated
187  // point and optionally the length of the track upto the end
188  std::pair<math::XYZPoint, bool> propagateTracker(const reco::Track*, const MagneticField*, bool debug = false);
189  std::pair<math::XYZPoint, double> propagateTrackerEnd(const reco::Track*, const MagneticField*, bool debug = false);
190 
192  const GlobalVector& momentum,
193  int charge,
194  const MagneticField*,
195  float zdist,
196  float radius,
197  float corner,
198  bool debug = false);
199 
200  // Gives the vertex and momentum of a SimTrack
201  spr::trackAtOrigin simTrackAtOrigin(unsigned int thisTrk,
204  bool debug = false);
205 
206  //Get HcalDetID's for two values of r/z
207  bool propagateHCAL(const reco::Track* track,
208  const CaloGeometry* geo,
209  const MagneticField* bField,
210  bool typeRZ,
211  const std::pair<double, double> rz,
212  bool debug);
213  bool propagateHCAL(unsigned int thisTrk,
216  const CaloGeometry* geo,
217  const MagneticField* bField,
218  bool typeRZ,
219  const std::pair<double, double> rz,
220  bool debug);
221  std::pair<HcalDetId, HcalDetId> propagateHCAL(const CaloGeometry* geo,
222  const MagneticField* bField,
223  const GlobalPoint& vertex,
224  const GlobalVector& momentum,
225  int charge,
226  bool typeRZ,
227  const std::pair<double, double> rz,
228  bool debug);
229 
230 } // namespace spr
231 #endif
Vector3DBase
Definition: Vector3DBase.h:8
spr::propagatedTrackID::phiECAL
double phiECAL
Definition: CaloPropagateTrack.h:49
spr::propagatedGenParticleID::pdgId
int pdgId
Definition: CaloPropagateTrack.h:88
Handle.h
spr::propagatedTrackID::propagatedTrackID
propagatedTrackID()
Definition: CaloPropagateTrack.h:41
spr::propagatedGenTrackID::charge
int charge
Definition: CaloPropagateTrack.h:75
spr
Definition: CaloConstants.h:6
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
spr::propagatedTrack::direction
GlobalVector direction
Definition: CaloPropagateTrack.h:37
spr::propagatedTrack
Definition: CaloPropagateTrack.h:33
spr::propagatedTrackID::detIdEHCAL
DetId detIdEHCAL
Definition: CaloPropagateTrack.h:47
ESHandle.h
spr::propagateIdECAL
std::pair< DetId, bool > propagateIdECAL(const HcalDetId &id, const CaloGeometry *geo, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:706
spr::propagatedGenTrackID::directionHCAL
GlobalVector directionHCAL
Definition: CaloPropagateTrack.h:74
spr::propagateCosmicCALO
std::vector< spr::propagatedTrackID > propagateCosmicCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
Definition: CaloPropagateTrack.cc:20
distTCMET_cfi.corner
corner
Definition: distTCMET_cfi.py:38
spr::propagatedGenParticleID::pointECAL
GlobalPoint pointECAL
Definition: CaloPropagateTrack.h:86
spr::propagateTracker
std::pair< math::XYZPoint, bool > propagateTracker(const reco::Track *, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:773
spr::propagatedGenTrackID::propagatedGenTrackID
propagatedGenTrackID()
Definition: CaloPropagateTrack.h:67
spr::propagateTrackToECAL
spr::propagatedTrack propagateTrackToECAL(const reco::Track *, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:679
spr::propagatedGenTrackID::pdgId
int pdgId
Definition: CaloPropagateTrack.h:75
spr::propagatedGenParticleID::trkItr
reco::GenParticleCollection::const_iterator trkItr
Definition: CaloPropagateTrack.h:89
edm::Handle< reco::TrackCollection >
distTCMET_cfi.zdist
zdist
Definition: distTCMET_cfi.py:37
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
GenParticle.h
spr::propagateCalo
spr::propagatedTrack propagateCalo(const GlobalPoint &vertex, const GlobalVector &momentum, int charge, const MagneticField *, float zdist, float radius, float corner, bool debug=false)
Definition: CaloPropagateTrack.cc:844
DetId
Definition: DetId.h:17
spr::propagatedTrackID::ok
bool ok
Definition: CaloPropagateTrack.h:46
CaloGeometry
Definition: CaloGeometry.h:21
debug
#define debug
Definition: HDRShower.cc:19
spr::propagatedGenTrackID::detIdEHCAL
DetId detIdEHCAL
Definition: CaloPropagateTrack.h:72
Track.h
TrackFwd.h
spr::propagatedGenParticleID::directionECAL
GlobalVector directionECAL
Definition: CaloPropagateTrack.h:87
spr::propagatedGenParticleID::okECAL
bool okECAL
Definition: CaloPropagateTrack.h:84
spr::propagatedTrackDirection::okECAL
bool okECAL
Definition: CaloPropagateTrack.h:59
spr::propagatedTrackID::okECAL
bool okECAL
Definition: CaloPropagateTrack.h:46
spr::propagatedGenTrackID
Definition: CaloPropagateTrack.h:66
SimVertex.h
GenParticleFwd.h
reco::Track
Definition: Track.h:27
edm::ESHandle< ParticleDataTable >
spr::trackAtOrigin::trackAtOrigin
trackAtOrigin()
Definition: CaloPropagateTrack.h:93
spr::trackAtOrigin
Definition: CaloPropagateTrack.h:92
spr::propagatedGenParticleID::directionHCAL
GlobalVector directionHCAL
Definition: CaloPropagateTrack.h:87
spr::propagatedTrackID::etaECAL
double etaECAL
Definition: CaloPropagateTrack.h:48
Point3DBase< float, GlobalTag >
spr::propagatedTrackDirection::propagatedTrackDirection
propagatedTrackDirection()
Definition: CaloPropagateTrack.h:54
spr::propagateECAL
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:699
spr::propagatedGenParticleID::charge
int charge
Definition: CaloPropagateTrack.h:88
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
spr::propagatedTrack::point
math::XYZPoint point
Definition: CaloPropagateTrack.h:36
spr::propagatedTrack::ok
bool ok
Definition: CaloPropagateTrack.h:35
CaloSubdetectorGeometry.h
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
spr::propagatedTrackID::detIdHCAL
DetId detIdHCAL
Definition: CaloPropagateTrack.h:47
spr::propagatedTrackDirection::pointHCAL
GlobalPoint pointHCAL
Definition: CaloPropagateTrack.h:61
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
spr::propagatedTrackID::detIdECAL
DetId detIdECAL
Definition: CaloPropagateTrack.h:47
ParticleDataTable.h
spr::propagatedTrackDirection::detIdHCAL
DetId detIdHCAL
Definition: CaloPropagateTrack.h:60
spr::trackAtOrigin::ok
bool ok
Definition: CaloPropagateTrack.h:94
spr::propagatedGenParticleID::detIdHCAL
DetId detIdHCAL
Definition: CaloPropagateTrack.h:85
HcalDetId.h
spr::propagatedTrackID::etaHCAL
double etaHCAL
Definition: CaloPropagateTrack.h:48
spr::propagatedTrackID::trkItr
reco::TrackCollection::const_iterator trkItr
Definition: CaloPropagateTrack.h:50
HcalDetId
Definition: HcalDetId.h:12
MagneticField.h
spr::propagatedGenParticleID::ok
bool ok
Definition: CaloPropagateTrack.h:84
spr::simTrackAtOrigin
spr::trackAtOrigin simTrackAtOrigin(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, bool debug=false)
Definition: CaloPropagateTrack.cc:922
nano_cff.genEvent
genEvent
Definition: nano_cff.py:97
spr::propagatedTrackDirection::directionECAL
GlobalVector directionECAL
Definition: CaloPropagateTrack.h:62
spr::propagatedTrackID::okHCAL
bool okHCAL
Definition: CaloPropagateTrack.h:46
spr::propagatedGenTrackID::okECAL
bool okECAL
Definition: CaloPropagateTrack.h:71
spr::propagatedTrackDirection::directionHCAL
GlobalVector directionHCAL
Definition: CaloPropagateTrack.h:62
spr::propagatedGenParticleID::okHCAL
bool okHCAL
Definition: CaloPropagateTrack.h:84
spr::propagatedGenTrackID::detIdECAL
DetId detIdECAL
Definition: CaloPropagateTrack.h:72
spr::propagateCALO
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
Definition: CaloPropagateTrack.cc:141
spr::propagatedTrackDirection::ok
bool ok
Definition: CaloPropagateTrack.h:59
spr::trackAtOrigin::position
GlobalPoint position
Definition: CaloPropagateTrack.h:96
spr::propagatedGenTrackID::okHCAL
bool okHCAL
Definition: CaloPropagateTrack.h:71
spr::propagatedGenParticleID
Definition: CaloPropagateTrack.h:79
spr::propagatedTrackDirection::pointECAL
GlobalPoint pointECAL
Definition: CaloPropagateTrack.h:61
spr::propagateHCALBack
spr::propagatedTrackDirection propagateHCALBack(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const CaloGeometry *geo, const MagneticField *bField, bool debug=false)
Definition: CaloPropagateTrack.cc:619
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
spr::propagateTrackerEnd
std::pair< math::XYZPoint, double > propagateTrackerEnd(const reco::Track *, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:782
DetId.h
spr::trackAtOrigin::charge
int charge
Definition: CaloPropagateTrack.h:95
CaloGeometry.h
spr::trackAtOrigin::momentum
GlobalVector momentum
Definition: CaloPropagateTrack.h:97
spr::propagatedTrackID
Definition: CaloPropagateTrack.h:40
spr::propagatedTrackDirection::detIdECAL
DetId detIdECAL
Definition: CaloPropagateTrack.h:60
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
spr::propagatedTrackDirection::detIdEHCAL
DetId detIdEHCAL
Definition: CaloPropagateTrack.h:60
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
spr::propagateHCAL
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:759
spr::propagatedGenTrackID::pointHCAL
GlobalPoint pointHCAL
Definition: CaloPropagateTrack.h:73
spr::propagatedTrackID::phiHCAL
double phiHCAL
Definition: CaloPropagateTrack.h:49
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
SimTrack.h
spr::propagatedTrack::propagatedTrack
propagatedTrack()
Definition: CaloPropagateTrack.h:34
spr::propagatedGenParticleID::detIdEHCAL
DetId detIdEHCAL
Definition: CaloPropagateTrack.h:85
HepMCProduct.h
spr::propagatedGenTrackID::trkItr
HepMC::GenEvent::particle_const_iterator trkItr
Definition: CaloPropagateTrack.h:76
MagneticField
Definition: MagneticField.h:19
spr::propagatedGenParticleID::propagatedGenParticleID
propagatedGenParticleID()
Definition: CaloPropagateTrack.h:80
spr::propagatedGenParticleID::pointHCAL
GlobalPoint pointHCAL
Definition: CaloPropagateTrack.h:86
GlobalPoint.h
spr::propagatedTrackDirection::okHCAL
bool okHCAL
Definition: CaloPropagateTrack.h:59
SimTrackContainer.h
spr::propagatedGenTrackID::detIdHCAL
DetId detIdHCAL
Definition: CaloPropagateTrack.h:72
spr::propagatedTrackDirection
Definition: CaloPropagateTrack.h:53
spr::propagatedGenTrackID::pointECAL
GlobalPoint pointECAL
Definition: CaloPropagateTrack.h:73
SimVertexContainer.h
spr::propagatedTrackDirection::trkItr
reco::TrackCollection::const_iterator trkItr
Definition: CaloPropagateTrack.h:63
spr::propagatedGenTrackID::ok
bool ok
Definition: CaloPropagateTrack.h:71
spr::propagatedGenTrackID::directionECAL
GlobalVector directionECAL
Definition: CaloPropagateTrack.h:74
spr::propagateTrackToHCAL
spr::propagatedTrack propagateTrackToHCAL(const reco::Track *, const MagneticField *, bool debug=false)
Definition: CaloPropagateTrack.cc:739
spr::propagatedGenParticleID::detIdECAL
DetId detIdECAL
Definition: CaloPropagateTrack.h:85