CMS 3D CMS Logo

CaloPropagateTrack.cc
Go to the documentation of this file.
8 
10 
13 
14 #include <iostream>
15 
16 //#define EDM_ML_DEBUG
17 
18 namespace spr{
19 
20  std::vector<spr::propagatedTrackID> propagateCosmicCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, bool debug) {
21 
26  std::vector<spr::propagatedTrackID> vdets;
27 
28  unsigned int indx;
29  reco::TrackCollection::const_iterator trkItr;
30  for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
31  const reco::Track* pTrack = &(*trkItr);
33  vdet.trkItr = trkItr;
34  vdet.ok = (pTrack->quality(trackQuality_));
35  vdet.detIdECAL = DetId(0);
36  vdet.detIdHCAL = DetId(0);
37  vdet.detIdEHCAL= DetId(0);
38 #ifdef EDM_ML_DEBUG
39  if (debug) std::cout << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() << " phi " << trkItr->phi() << " Flag " << vdet.ok << std::endl;
40 #endif
41  GlobalPoint vertex;
42  GlobalVector momentum;
43  int charge (pTrack->charge());
44  if (((pTrack->innerPosition()).Perp2()) <
45  ((pTrack->outerPosition()).Perp2())) {
46  vertex = GlobalPoint(((pTrack->innerPosition()).X()),
47  ((pTrack->innerPosition()).Y()),
48  ((pTrack->innerPosition()).Z()));
49  momentum = GlobalVector(((pTrack->innerMomentum()).X()),
50  ((pTrack->innerMomentum()).Y()),
51  ((pTrack->innerMomentum()).Z()));
52  } else {
53  vertex = GlobalPoint(((pTrack->outerPosition()).X()),
54  ((pTrack->outerPosition()).Y()),
55  ((pTrack->outerPosition()).Z()));
56  momentum = GlobalVector(((pTrack->outerMomentum()).X()),
57  ((pTrack->outerMomentum()).Y()),
58  ((pTrack->outerMomentum()).Z()));
59  }
60 #ifdef EDM_ML_DEBUG
61  if (debug) std::cout << "Track charge " << charge << " p " << momentum << " position " << vertex << std::endl;
62 #endif
63  std::pair<math::XYZPoint,bool> info =
64  spr::propagateECAL (vertex, momentum, charge, bField, debug);
65 #ifdef EDM_ML_DEBUG
66  if (debug) std::cout << "Propagate to ECAL " << info.second << " at (" << info.first.x() << ", "<< info.first.y() << ", " << info.first.z() << ")\n";
67 #endif
68 
69  vdet.okECAL = info.second;
70  if (vdet.okECAL) {
71  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
72  vdet.etaECAL = point.eta();
73  vdet.phiECAL = point.phi();
74  if (std::abs(point.eta())<spr::etaBEEcal) {
75  vdet.detIdECAL = barrelGeom->getClosestCell(point);
76  } else {
77  if (endcapGeom)
78  vdet.detIdECAL = endcapGeom->getClosestCell(point);
79  else
80  vdet.okECAL = false;
81  }
82  vdet.detIdEHCAL = gHB->getClosestCell(point);
83 #ifdef EDM_ML_DEBUG
84  if (debug) {
85  std::cout << "Point at ECAL (" << vdet.etaECAL << ", " << vdet.phiECAL << " ";
86  if (std::abs(point.eta())<spr::etaBEEcal)
87  std::cout << EBDetId(vdet.detIdECAL);
88  else
89  std::cout << EEDetId(vdet.detIdECAL);
90  std::cout << " " << HcalDetId(vdet.detIdEHCAL) << std::endl;
91  }
92 #endif
93  }
94  info = spr::propagateHCAL (vertex, momentum, charge, bField, debug);
95 #ifdef EDM_ML_DEBUG
96  if (debug) std::cout << "Propagate to HCAL " << info.second << " at (" << info.first.x() << ", "<< info.first.y() << ", " << info.first.z() << ")\n";
97 #endif
98  vdet.okHCAL = info.second;
99  if (vdet.okHCAL) {
100  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
101  vdet.etaHCAL = point.eta();
102  vdet.phiHCAL = point.phi();
103  vdet.detIdHCAL = gHB->getClosestCell(point);
104  }
105 #ifdef EDM_ML_DEBUG
106  if (debug) {
107  std::cout << "Track [" << indx << "] Flag: " << vdet.ok << " ECAL ("
108  << vdet.okECAL << ") ";
109  if (vdet.detIdECAL.subdetId() == EcalBarrel)
110  std::cout << (EBDetId)(vdet.detIdECAL);
111  else
112  std::cout << (EEDetId)(vdet.detIdECAL);
113  std::cout << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " << (HcalDetId)(vdet.detIdEHCAL) << std::endl;
114  }
115 #endif
116  vdets.push_back(vdet);
117  }
118 
119 #ifdef EDM_ML_DEBUG
120  if (debug) {
121  std::cout << "propagateCALO:: for " << vdets.size() << " tracks" << std::endl;
122  for (unsigned int i=0; i<vdets.size(); ++i) {
123  std::cout << "Track [" << i << "] Flag: " << vdets[i].ok << " ECAL (" << vdets[i].okECAL << ") ";
124  if (vdets[i].detIdECAL.subdetId() == EcalBarrel) {
125  std::cout << (EBDetId)(vdets[i].detIdECAL);
126  } else {
127  std::cout << (EEDetId)(vdets[i].detIdECAL);
128  }
129  std::cout << " HCAL (" << vdets[i].okHCAL << ") " << (HcalDetId)(vdets[i].detIdHCAL) << " Or " << (HcalDetId)(vdets[i].detIdEHCAL) << std::endl;
130  }
131  }
132 #endif
133  return vdets;
134  }
135 
136  std::vector<spr::propagatedTrackID> propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, bool debug) {
137 
138  std::vector<spr::propagatedTrackID> vdets;
139  spr::propagateCALO(trkCollection,geo,bField,theTrackQuality, vdets, debug);
140  return vdets;
141  }
142 
143  void propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, std::vector<spr::propagatedTrackID>& vdets, bool debug) {
144 
148  reco::TrackBase::TrackQuality trackQuality_=reco::TrackBase::qualityByName(theTrackQuality);
149 
150  unsigned int indx;
151  reco::TrackCollection::const_iterator trkItr;
152  for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
153  const reco::Track* pTrack = &(*trkItr);
155  vdet.trkItr = trkItr;
156  vdet.ok = (pTrack->quality(trackQuality_));
157  vdet.detIdECAL = DetId(0);
158  vdet.detIdHCAL = DetId(0);
159  vdet.detIdEHCAL= DetId(0);
160 #ifdef EDM_ML_DEBUG
161  if (debug) std::cout << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() << " phi " << trkItr->phi() << " Flag " << vdet.ok << std::endl;
162 #endif
163  std::pair<math::XYZPoint,bool> info = spr::propagateECAL (pTrack, bField, debug);
164  vdet.okECAL = info.second;
165  if (vdet.okECAL) {
166  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
167  vdet.etaECAL = point.eta();
168  vdet.phiECAL = point.phi();
169  if (std::abs(point.eta())<spr::etaBEEcal) {
170  vdet.detIdECAL = barrelGeom->getClosestCell(point);
171  } else {
172  if (endcapGeom)
173  vdet.detIdECAL = endcapGeom->getClosestCell(point);
174  else
175  vdet.okECAL = false;
176  }
177  vdet.detIdEHCAL = gHB->getClosestCell(point);
178  }
179  info = spr::propagateHCAL (pTrack, bField, debug);
180  vdet.okHCAL = info.second;
181  if (vdet.okHCAL) {
182  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
183  vdet.etaHCAL = point.eta();
184  vdet.phiHCAL = point.phi();
185  vdet.detIdHCAL = gHB->getClosestCell(point);
186  }
187 #ifdef EDM_ML_DEBUG
188  if (debug) {
189  std::cout << "Track [" << indx << "] Flag: " << vdet.ok << " ECAL ("
190  << vdet.okECAL << ") ";
191  if (vdet.detIdECAL.subdetId() == EcalBarrel)
192  std::cout << (EBDetId)(vdet.detIdECAL);
193  else
194  std::cout << (EEDetId)(vdet.detIdECAL);
195  std::cout << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " << (HcalDetId)(vdet.detIdEHCAL) << std::endl;
196  }
197 #endif
198  vdets.push_back(vdet);
199  }
200 #ifdef EDM_ML_DEBUG
201  if (debug) {
202  std::cout << "propagateCALO:: for " << vdets.size() << " tracks" << std::endl;
203  for (unsigned int i=0; i<vdets.size(); ++i) {
204  std::cout << "Track [" << i << "] Flag: " << vdets[i].ok << " ECAL (" << vdets[i].okECAL << ") ";
205  if (vdets[i].detIdECAL.subdetId() == EcalBarrel) {
206  std::cout << (EBDetId)(vdets[i].detIdECAL);
207  } else {
208  std::cout << (EEDetId)(vdets[i].detIdECAL);
209  }
210  std::cout << " HCAL (" << vdets[i].okHCAL << ") " << (HcalDetId)(vdets[i].detIdHCAL) << " Or " << (HcalDetId)(vdets[i].detIdEHCAL) << std::endl;
211  }
212  }
213 #endif
214  }
215 
216  void propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, std::vector<spr::propagatedTrackDirection>& trkDir, bool debug) {
217 
221  reco::TrackBase::TrackQuality trackQuality_=reco::TrackBase::qualityByName(theTrackQuality);
222 
223  unsigned int indx;
224  reco::TrackCollection::const_iterator trkItr;
225  for (trkItr = trkCollection->begin(),indx=0; trkItr != trkCollection->end(); ++trkItr,indx++) {
226  const reco::Track* pTrack = &(*trkItr);
228  trkD.trkItr = trkItr;
229  trkD.ok = (pTrack->quality(trackQuality_));
230  trkD.detIdECAL = DetId(0);
231  trkD.detIdHCAL = DetId(0);
232  trkD.detIdEHCAL= DetId(0);
233 #ifdef EDM_ML_DEBUG
234  if (debug) std::cout << "Propagate track " << indx << " p " << trkItr->p() << " eta " << trkItr->eta() << " phi " << trkItr->phi() << " Flag " << trkD.ok << std::endl;
235 #endif
236  spr::propagatedTrack info = spr::propagateTrackToECAL (pTrack, bField, debug);
237  GlobalPoint point(info.point.x(),info.point.y(),info.point.z());
238  trkD.okECAL = info.ok;
239  trkD.pointECAL = point;
240  trkD.directionECAL = info.direction;
241  if (trkD.okECAL) {
242  if (std::abs(info.point.eta())<spr::etaBEEcal) {
243  trkD.detIdECAL = barrelGeom->getClosestCell(point);
244  } else {
245  if (endcapGeom)
246  trkD.detIdECAL = endcapGeom->getClosestCell(point);
247  else
248  trkD.okECAL = false;
249  }
250  trkD.detIdEHCAL = gHB->getClosestCell(point);
251  }
252  info = spr::propagateTrackToHCAL (pTrack, bField, debug);
253  point = GlobalPoint(info.point.x(),info.point.y(),info.point.z());
254  trkD.okHCAL = info.ok;
255  trkD.pointHCAL = point;
256  trkD.directionHCAL = info.direction;
257  if (trkD.okHCAL) {
258  trkD.detIdHCAL = gHB->getClosestCell(point);
259  }
260  trkDir.push_back(trkD);
261  }
262 #ifdef EDM_ML_DEBUG
263  if (debug) {
264  std::cout << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl;
265  for (unsigned int i=0; i<trkDir.size(); ++i) {
266  std::cout << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL << ")";
267  if (trkDir[i].okECAL) {
268  std::cout << " point " << trkDir[i].pointECAL << " direction "
269  << trkDir[i].directionECAL << " ";
270  if (trkDir[i].detIdECAL.subdetId() == EcalBarrel) {
271  std::cout << (EBDetId)(trkDir[i].detIdECAL);
272  } else {
273  std::cout << (EEDetId)(trkDir[i].detIdECAL);
274  }
275  }
276  std::cout << " HCAL (" << trkDir[i].okHCAL << ")";
277  if (trkDir[i].okHCAL) {
278  std::cout << " point " << trkDir[i].pointHCAL << " direction "
279  << trkDir[i].directionHCAL << " "
280  << (HcalDetId)(trkDir[i].detIdHCAL);
281  }
282  std::cout << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL) << std::endl;
283  }
284  }
285 #endif
286  }
287 
289 
293 
295  vdet.ok = true;
296  vdet.detIdECAL = DetId(0);
297  vdet.detIdHCAL = DetId(0);
298  vdet.detIdEHCAL= DetId(0);
299 #ifdef EDM_ML_DEBUG
300  if (debug) std::cout << "Propagate track: p " << pTrack->p() << " eta " << pTrack->eta() << " phi " << pTrack->phi() << " Flag " << vdet.ok << std::endl;
301 #endif
302  std::pair<math::XYZPoint,bool> info = spr::propagateECAL (pTrack, bField, debug);
303  vdet.okECAL = info.second;
304  if (vdet.okECAL) {
305  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
306  vdet.etaECAL = point.eta();
307  vdet.phiECAL = point.phi();
308  if (std::abs(point.eta())<spr::etaBEEcal) {
309  vdet.detIdECAL = barrelGeom->getClosestCell(point);
310  } else {
311  if (endcapGeom)
312  vdet.detIdECAL = endcapGeom->getClosestCell(point);
313  else
314  vdet.okECAL = false;
315  }
316  vdet.detIdEHCAL = gHB->getClosestCell(point);
317  }
318  info = spr::propagateHCAL (pTrack, bField, debug);
319  vdet.okHCAL = info.second;
320  if (vdet.okHCAL) {
321  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
322  vdet.etaHCAL = point.eta();
323  vdet.phiHCAL = point.phi();
324  vdet.detIdHCAL = gHB->getClosestCell(point);
325  }
326 #ifdef EDM_ML_DEBUG
327  if (debug) {
328  std::cout << "propagateCALO:: for 1 track" << std::endl;
329  std::cout << "Track [0] Flag: " << vdet.ok << " ECAL (" << vdet.okECAL << ") ";
330  if (vdet.detIdECAL.subdetId() == EcalBarrel) {
331  std::cout << (EBDetId)(vdet.detIdECAL);
332  } else {
333  std::cout << (EEDetId)(vdet.detIdECAL);
334  }
335  std::cout << " HCAL (" << vdet.okHCAL << ") " << (HcalDetId)(vdet.detIdHCAL) << " Or " << (HcalDetId)(vdet.detIdEHCAL) << std::endl;
336  }
337 #endif
338  return vdet;
339  }
340 
341  std::vector<spr::propagatedGenTrackID> propagateCALO(const HepMC::GenEvent * genEvent, edm::ESHandle<ParticleDataTable>& pdt, const CaloGeometry* geo, const MagneticField* bField, double etaMax, bool debug) {
342 
346 
347  std::vector<spr::propagatedGenTrackID> trkDir;
348  unsigned int indx;
349  HepMC::GenEvent::particle_const_iterator p;
350  for (p=genEvent->particles_begin(),indx=0; p != genEvent->particles_end(); ++p,++indx) {
352  trkD.trkItr = p;
353  trkD.detIdECAL = DetId(0);
354  trkD.detIdHCAL = DetId(0);
355  trkD.detIdEHCAL= DetId(0);
356  trkD.pdgId = ((*p)->pdg_id());
357  trkD.charge = ((pdt->particle(trkD.pdgId))->ID().threeCharge())/3;
358  const GlobalVector momentum = GlobalVector((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz());
359 #ifdef EDM_ML_DEBUG
360  if (debug) std::cout << "Propagate track " << indx << " pdg " << trkD.pdgId << " charge " << trkD.charge << " p " << momentum << std::endl;
361 #endif
362  // consider stable particles
363  if ( (*p)->status()==1 && std::abs((*p)->momentum().eta()) < etaMax ) {
364  const GlobalPoint vertex = GlobalPoint(0.1*(*p)->production_vertex()->position().x(),
365  0.1*(*p)->production_vertex()->position().y(),
366  0.1*(*p)->production_vertex()->position().z());
367  trkD.ok = true;
368  spr::propagatedTrack info = spr::propagateCalo (vertex, momentum, trkD.charge, bField, spr::zFrontEE, spr::rFrontEB, spr::etaBEEcal, debug);
369  GlobalPoint point(info.point.x(),info.point.y(),info.point.z());
370  trkD.okECAL = info.ok;
371  trkD.pointECAL = point;
372  trkD.directionECAL = info.direction;
373  if (trkD.okECAL) {
374  if (std::abs(info.point.eta())<spr::etaBEEcal) {
375  trkD.detIdECAL = barrelGeom->getClosestCell(point);
376  } else {
377  if (endcapGeom)
378  trkD.detIdECAL = endcapGeom->getClosestCell(point);
379  else
380  trkD.okECAL = false;
381  }
382  trkD.detIdEHCAL = gHB->getClosestCell(point);
383  }
384 
385  info = spr::propagateCalo (vertex, momentum, trkD.charge, bField, spr::zFrontHE, spr::rFrontHB, spr::etaBEHcal, debug);
386  point = GlobalPoint(info.point.x(),info.point.y(),info.point.z());
387  trkD.okHCAL = info.ok;
388  trkD.pointHCAL = point;
389  trkD.directionHCAL = info.direction;
390  if (trkD.okHCAL) {
391  trkD.detIdHCAL = gHB->getClosestCell(point);
392  }
393  }
394  trkDir.push_back(trkD);
395  }
396 #ifdef EDM_ML_DEBUG
397  if (debug) {
398  std::cout << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl;
399  for (unsigned int i=0; i<trkDir.size(); ++i) {
400  if (trkDir[i].okECAL) std::cout << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL << ")";
401  if (trkDir[i].okECAL) {
402  std::cout << " point " << trkDir[i].pointECAL << " direction "
403  << trkDir[i].directionECAL << " ";
404  if (trkDir[i].detIdECAL.subdetId() == EcalBarrel) {
405  std::cout << (EBDetId)(trkDir[i].detIdECAL);
406  } else {
407  std::cout << (EEDetId)(trkDir[i].detIdECAL);
408  }
409  }
410  if (trkDir[i].okECAL) std::cout << " HCAL (" << trkDir[i].okHCAL << ")";
411  if (trkDir[i].okHCAL) {
412  std::cout << " point " << trkDir[i].pointHCAL << " direction "
413  << trkDir[i].directionHCAL << " "
414  << (HcalDetId)(trkDir[i].detIdHCAL);
415  }
416  if (trkDir[i].okECAL) std::cout << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL) << std::endl;
417  }
418  }
419 #endif
420  return trkDir;
421  }
422 
423  std::vector<spr::propagatedGenParticleID> propagateCALO(edm::Handle<reco::GenParticleCollection>& genParticles, edm::ESHandle<ParticleDataTable>& pdt, const CaloGeometry* geo, const MagneticField* bField, double etaMax, bool debug) {
424 
428 
429  std::vector<spr::propagatedGenParticleID> trkDir;
430  unsigned int indx;
431  reco::GenParticleCollection::const_iterator p;
432  for (p=genParticles->begin(),indx=0; p != genParticles->end(); ++p,++indx) {
434  trkD.trkItr = p;
435  trkD.detIdECAL = DetId(0);
436  trkD.detIdHCAL = DetId(0);
437  trkD.detIdEHCAL= DetId(0);
438  trkD.pdgId = (p->pdgId());
439  trkD.charge = p->charge();
440  const GlobalVector momentum = GlobalVector(p->momentum().x(), p->momentum().y(), p->momentum().z());
441 #ifdef EDM_ML_DEBUG
442  if (debug) std::cout << "Propagate track " << indx << " pdg " << trkD.pdgId << " charge " << trkD.charge << " p " << momentum << std::endl;
443 #endif
444  // consider stable particles
445  if ( p->status()==1 && std::abs(momentum.eta()) < etaMax ) {
446  const GlobalPoint vertex = GlobalPoint(p->vertex().x(), p->vertex().y(), p->vertex().z());
447  trkD.ok = true;
448  spr::propagatedTrack info = spr::propagateCalo (vertex, momentum, trkD.charge, bField, spr::zFrontEE, spr::rFrontEB, spr::etaBEEcal, debug);
449  GlobalPoint point(info.point.x(),info.point.y(),info.point.z());
450  trkD.okECAL = info.ok;
451  trkD.pointECAL = point;
452  trkD.directionECAL = info.direction;
453  if (trkD.okECAL) {
454  if (std::abs(info.point.eta())<spr::etaBEEcal) {
455  trkD.detIdECAL = barrelGeom->getClosestCell(point);
456  } else {
457  if (endcapGeom)
458  trkD.detIdECAL = endcapGeom->getClosestCell(point);
459  else
460  trkD.okECAL = false;
461  }
462  trkD.detIdEHCAL = gHB->getClosestCell(point);
463  }
464 
465  info = spr::propagateCalo (vertex, momentum, trkD.charge, bField, spr::zFrontHE, spr::rFrontHB, spr::etaBEHcal, debug);
466  point = GlobalPoint(info.point.x(),info.point.y(),info.point.z());
467  trkD.okHCAL = info.ok;
468  trkD.pointHCAL = point;
469  trkD.directionHCAL = info.direction;
470  if (trkD.okHCAL) {
471  trkD.detIdHCAL = gHB->getClosestCell(point);
472  }
473  }
474  trkDir.push_back(trkD);
475  }
476 #ifdef EDM_ML_DEBUG
477  if (debug) {
478  std::cout << "propagateCALO:: for " << trkDir.size() << " tracks" << std::endl;
479  for (unsigned int i=0; i<trkDir.size(); ++i) {
480  if (trkDir[i].okECAL) std::cout << "Track [" << i << "] Flag: " << trkDir[i].ok << " ECAL (" << trkDir[i].okECAL << ")";
481  if (trkDir[i].okECAL) {
482  std::cout << " point " << trkDir[i].pointECAL << " direction "
483  << trkDir[i].directionECAL << " ";
484  if (trkDir[i].detIdECAL.subdetId() == EcalBarrel) {
485  std::cout << (EBDetId)(trkDir[i].detIdECAL);
486  } else {
487  std::cout << (EEDetId)(trkDir[i].detIdECAL);
488  }
489  }
490  if (trkDir[i].okECAL) std::cout << " HCAL (" << trkDir[i].okHCAL << ")";
491  if (trkDir[i].okHCAL) {
492  std::cout << " point " << trkDir[i].pointHCAL << " direction "
493  << trkDir[i].directionHCAL << " "
494  << (HcalDetId)(trkDir[i].detIdHCAL);
495  }
496  if (trkDir[i].okECAL) std::cout << " Or " << (HcalDetId)(trkDir[i].detIdEHCAL) << std::endl;
497  }
498  }
499 #endif
500  return trkDir;
501  }
502 
504 
508 
509  spr::trackAtOrigin trk = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug);
511  trkD.ok = trk.ok;
512  trkD.detIdECAL = DetId(0);
513  trkD.detIdHCAL = DetId(0);
514  trkD.detIdEHCAL= DetId(0);
515 #ifdef EDM_ML_DEBUG
516  if (debug) std::cout << "Propagate track " << thisTrk << " charge " << trk.charge << " position " << trk.position << " p " << trk.momentum << " Flag " << trkD.ok << std::endl;
517 #endif
518  if (trkD.ok) {
520  GlobalPoint point(info.point.x(),info.point.y(),info.point.z());
521  trkD.okECAL = info.ok;
522  trkD.pointECAL = point;
523  trkD.directionECAL = info.direction;
524  if (trkD.okECAL) {
525  if (std::abs(info.point.eta())<spr::etaBEEcal) {
526  trkD.detIdECAL = barrelGeom->getClosestCell(point);
527  } else {
528  if (endcapGeom)
529  trkD.detIdECAL = endcapGeom->getClosestCell(point);
530  else
531  trkD.okECAL = false;
532  }
533  trkD.detIdEHCAL = gHB->getClosestCell(point);
534  }
535 
536  info = spr::propagateCalo (trk.position, trk.momentum, trk.charge, bField, spr::zFrontHE, spr::rFrontHB, spr::etaBEHcal, debug);
537  point = GlobalPoint(info.point.x(),info.point.y(),info.point.z());
538  trkD.okHCAL = info.ok;
539  trkD.pointHCAL = point;
540  trkD.directionHCAL = info.direction;
541  if (trkD.okHCAL) {
542  trkD.detIdHCAL = gHB->getClosestCell(point);
543  }
544  }
545 #ifdef EDM_ML_DEBUG
546  if (debug) {
547  std::cout << "propagateCALO:: for track [" << thisTrk << "] Flag: " << trkD.ok << " ECAL (" << trkD.okECAL << ") HCAL (" << trkD.okHCAL << ")" << std::endl;
548  if (trkD.okECAL) {
549  std::cout << "ECAL point " << trkD.pointECAL << " direction "
550  << trkD.directionECAL << " ";
551  if (trkD.detIdECAL.subdetId() == EcalBarrel) {
552  std::cout << (EBDetId)(trkD.detIdECAL);
553  } else {
554  std::cout << (EEDetId)(trkD.detIdECAL);
555  }
556  }
557  if (trkD.okHCAL) {
558  std::cout << " HCAL point " << trkD.pointHCAL << " direction "
559  << trkD.directionHCAL << " " << (HcalDetId)(trkD.detIdHCAL);
560  }
561  if (trkD.okECAL) std::cout << " Or " << (HcalDetId)(trkD.detIdEHCAL);
562  std::cout << std::endl;
563  }
564 #endif
565  return trkD;
566  }
567 
569 
571  spr::trackAtOrigin trk = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug);
573  trkD.ok = trk.ok;
574  trkD.detIdECAL = DetId(0);
575  trkD.detIdHCAL = DetId(0);
576  trkD.detIdEHCAL= DetId(0);
577 #ifdef EDM_ML_DEBUG
578  if (debug) std::cout << "Propagate track " << thisTrk << " charge " << trk.charge << " position " << trk.position << " p " << trk.momentum << " Flag " << trkD.ok << std::endl;
579 #endif
580  if (trkD.ok) {
582  const GlobalPoint point = GlobalPoint(info.point.x(),info.point.y(),info.point.z());
583  trkD.okHCAL = info.ok;
584  trkD.pointHCAL = point;
585  trkD.directionHCAL = info.direction;
586  if (trkD.okHCAL) {
587  trkD.detIdHCAL = gHB->getClosestCell(point);
588  }
589  }
590 #ifdef EDM_ML_DEBUG
591  if (debug) {
592  std::cout << "propagateCALO:: for track [" << thisTrk << "] Flag: " << trkD.ok << " ECAL (" << trkD.okECAL << ") HCAL (" << trkD.okHCAL << ")" << std::endl;
593  if (trkD.okHCAL) {
594  std::cout << " HCAL point " << trkD.pointHCAL << " direction "
595  << trkD.directionHCAL << " " << (HcalDetId)(trkD.detIdHCAL);
596  }
597  }
598 #endif
599  return trkD;
600  }
601 
602 
603  std::pair<bool,HcalDetId> propagateHCALBack(const reco::Track* track, const CaloGeometry* geo, const MagneticField* bField, bool debug) {
605  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
606  const GlobalVector momentum (track->px(), track->py(), track->pz());
607  int charge (track->charge());
609  if (info.ok) {
610  const GlobalPoint point = GlobalPoint(info.point.x(),info.point.y(),info.point.z());
611  return std::pair<bool,HcalDetId>(true,HcalDetId(gHB->getClosestCell(point)));
612  } else {
613  return std::pair<bool,HcalDetId>(false,HcalDetId());
614  }
615  }
616 
618  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
619  const GlobalVector momentum (track->px(), track->py(), track->pz());
620  int charge (track->charge());
621  return spr::propagateCalo (vertex, momentum, charge, bfield, spr::zFrontEE, spr::rFrontEB, spr::etaBEEcal, debug);
622  }
623 
625 
626  spr::trackAtOrigin trk = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug);
628  if (trk.ok)
629  ptrk = spr::propagateCalo (trk.position, trk.momentum, trk.charge, bfield, spr::zFrontEE, spr::rFrontEB, spr::etaBEEcal, debug);
630  return ptrk;
631  }
632 
633  std::pair<math::XYZPoint,bool> propagateECAL(const reco::Track *track, const MagneticField* bfield, bool debug) {
634  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
635  const GlobalVector momentum (track->px(), track->py(), track->pz());
636  int charge (track->charge());
637  return spr::propagateECAL (vertex, momentum, charge, bfield, debug);
638  }
639 
640  std::pair<DetId,bool> propagateIdECAL(const HcalDetId& id, const CaloGeometry* geo, const MagneticField* bField, bool debug) {
641 
642  const HcalGeometry* gHB = static_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,HcalBarrel));
643  const GlobalPoint vertex(0,0,0);
644  const GlobalPoint hit(gHB->getPosition(id));
645  const GlobalVector momentum = GlobalVector(hit.x(),hit.y(),hit.z());
646  std::pair<math::XYZPoint,bool> info = propagateECAL(vertex,momentum,0,bField,debug);
647  DetId eId(0);
648  if (info.second) {
649  const GlobalPoint point(info.first.x(),info.first.y(),info.first.z());
650  if (std::abs(point.eta())<spr::etaBEEcal) {
652  eId = barrelGeom->getClosestCell(point);
653  } else {
655  if (endcapGeom)
656  eId = endcapGeom->getClosestCell(point);
657  else
658  info.second = false;
659  }
660  }
661  return std::pair<DetId,bool>(eId,info.second);
662  }
663 
664  std::pair<math::XYZPoint,bool> propagateECAL(const GlobalPoint& vertex, const GlobalVector& momentum, int charge, const MagneticField* bfield, bool debug) {
665  spr::propagatedTrack track = spr::propagateCalo (vertex, momentum, charge, bfield, spr::zFrontEE, spr::rFrontEB, spr::etaBEEcal, debug);
666  return std::pair<math::XYZPoint,bool>(track.point,track.ok);
667  }
668 
670  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
671  const GlobalVector momentum (track->px(), track->py(), track->pz());
672  int charge (track->charge());
673  return spr::propagateCalo (vertex, momentum, charge, bfield, spr::zFrontHE, spr::rFrontHB, spr::etaBEHcal, debug);
674  }
675 
677  spr::trackAtOrigin trk = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug);
679  if (trk.ok)
680  ptrk = spr::propagateCalo (trk.position, trk.momentum, trk.charge, bfield, spr::zFrontHE, spr::rFrontHB, spr::etaBEHcal, debug);
681  return ptrk;
682  }
683 
684  std::pair<math::XYZPoint,bool> propagateHCAL(const reco::Track *track, const MagneticField* bfield, bool debug) {
685  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
686  const GlobalVector momentum (track->px(), track->py(), track->pz());
687  int charge (track->charge());
688  return spr::propagateHCAL (vertex, momentum, charge, bfield, debug);
689  }
690 
691  std::pair<math::XYZPoint,bool> propagateHCAL(const GlobalPoint& vertex, const GlobalVector& momentum, int charge, const MagneticField* bfield, bool debug) {
692  spr::propagatedTrack track = spr::propagateCalo (vertex, momentum, charge, bfield, spr::zFrontHE, spr::rFrontHB, spr::etaBEHcal, debug);
693  return std::pair<math::XYZPoint,bool>(track.point,track.ok);
694  }
695 
696  std::pair<math::XYZPoint,bool> propagateTracker(const reco::Track *track, const MagneticField* bfield, bool debug) {
697  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
698  const GlobalVector momentum (track->px(), track->py(), track->pz());
699  int charge (track->charge());
700  spr::propagatedTrack track1 = spr::propagateCalo (vertex, momentum, charge, bfield, spr::zBackTE, spr::rBackTB, spr::etaBETrak, debug);
701  return std::pair<math::XYZPoint,bool>(track1.point,track1.ok);
702  }
703 
704  std::pair<math::XYZPoint,double> propagateTrackerEnd(const reco::Track *track,
705  const MagneticField* bField, bool
706 #ifdef EDM_ML_DEBUG
707  debug
708 #endif
709  ) {
710 
711  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
712  const GlobalVector momentum (track->px(), track->py(), track->pz());
713  int charge (track->charge());
714  float radius = track->outerPosition().Rho();
715  float zdist = track->outerPosition().Z();
716 #ifdef EDM_ML_DEBUG
717  if (debug) std::cout << "propagateTrackerEnd:: Vertex " << vertex << " Momentum " << momentum << " Charge " << charge << " Radius " << radius << " Z " << zdist << std::endl;
718 #endif
719  FreeTrajectoryState fts (vertex, momentum, charge, bField);
722 
723  AnalyticalPropagator myAP (bField, alongMomentum, 2*M_PI);
724 
725  TrajectoryStateOnSurface tsose = myAP.propagate(fts, *endcap);
726  TrajectoryStateOnSurface tsosb = myAP.propagate(fts, *barrel);
727 
728  math::XYZPoint point(-999.,-999.,-999.);
729  bool ok=false;
730  GlobalVector direction(0,0,1);
731  if (tsosb.isValid() && std::abs(zdist) < spr::zFrontTE) {
732  point.SetXYZ(tsosb.globalPosition().x(), tsosb.globalPosition().y(), tsosb.globalPosition().z());
733  direction = tsosb.globalDirection();
734  ok = true;
735  } else if (tsose.isValid()) {
736  point.SetXYZ(tsose.globalPosition().x(), tsose.globalPosition().y(), tsose.globalPosition().z());
737  direction = tsose.globalDirection();
738  ok = true;
739  }
740 
741  double length = -1;
742  if (ok) {
743  math::XYZPoint vDiff(point.x()-vertex.x(), point.y()-vertex.y(), point.z()-vertex.z());
744  double dphi = direction.phi()-momentum.phi();
745  double rdist = std::sqrt(vDiff.x()*vDiff.x()+vDiff.y()*vDiff.y());
746  double rat = 0.5*dphi/std::sin(0.5*dphi);
747  double dZ = vDiff.z();
748  double dS = rdist*rat; //dZ*momentum.z()/momentum.perp();
749  length = std::sqrt(dS*dS+dZ*dZ);
750 #ifdef EDM_ML_DEBUG
751  if (debug)
752  std::cout << "propagateTracker:: Barrel " << tsosb.isValid() << " Endcap " << tsose.isValid() << " OverAll " << ok << " Point " << point << " RDist " << rdist << " dS " << dS << " dS/pt " << rdist*rat/momentum.perp() << " zdist " << dZ << " dz/pz " << dZ/momentum.z() << " Length " << length << std::endl;
753 #endif
754  }
755 
756  return std::pair<math::XYZPoint,double>(point,length);
757  }
758 
760  const GlobalVector& tpMomentum,
761  int tpCharge, const MagneticField* bField,
762  float zdist, float radius, float corner, bool
763 #ifdef EDM_ML_DEBUG
764  debug
765 #endif
766  ) {
767 
769 #ifdef EDM_ML_DEBUG
770  if (debug) std::cout << "propagateCalo:: Vertex " << tpVertex << " Momentum " << tpMomentum << " Charge " << tpCharge << " Radius " << radius << " Z " << zdist << " Corner " << corner << std::endl;
771 #endif
772  FreeTrajectoryState fts (tpVertex, tpMomentum, tpCharge, bField);
773 
776 
778 
779  AnalyticalPropagator myAP (bField, alongMomentum, 2*M_PI);
780 
782  if (tpMomentum.eta() < 0) {
783  tsose = myAP.propagate(fts, *lendcap);
784  } else {
785  tsose = myAP.propagate(fts, *rendcap);
786  }
787 
788  TrajectoryStateOnSurface tsosb = myAP.propagate(fts, *barrel);
789 
790  track.ok=true;
791  if (tsose.isValid() && tsosb.isValid()) {
792  float absEta = std::abs(tsosb.globalPosition().eta());
793  if (absEta < corner) {
794  track.point.SetXYZ(tsosb.globalPosition().x(), tsosb.globalPosition().y(), tsosb.globalPosition().z());
795  track.direction = tsosb.globalDirection();
796  } else {
797  track.point.SetXYZ(tsose.globalPosition().x(), tsose.globalPosition().y(), tsose.globalPosition().z());
798  track.direction = tsose.globalDirection();
799  }
800  } else if (tsose.isValid()) {
801  track.point.SetXYZ(tsose.globalPosition().x(), tsose.globalPosition().y(), tsose.globalPosition().z());
802  track.direction = tsose.globalDirection();
803  } else if (tsosb.isValid()) {
804  track.point.SetXYZ(tsosb.globalPosition().x(), tsosb.globalPosition().y(), tsosb.globalPosition().z());
805  track.direction = tsosb.globalDirection();
806  } else {
807  track.point.SetXYZ(-999., -999., -999.);
808  track.direction = GlobalVector(0,0,1);
809  track.ok = false;
810  }
811 #ifdef EDM_ML_DEBUG
812  if (debug) {
813  std::cout << "propagateCalo:: Barrel " << tsosb.isValid() << " Endcap " << tsose.isValid() << " OverAll " << track.ok << " Point " << track.point << " Direction " << track.direction << std::endl;
814  if (track.ok) {
815  math::XYZPoint vDiff(track.point.x()-tpVertex.x(), track.point.y()-tpVertex.y(), track.point.z()-tpVertex.z());
816  double dphi = track.direction.phi()-tpMomentum.phi();
817  double rdist = std::sqrt(vDiff.x()*vDiff.x()+vDiff.y()*vDiff.y());
818  double pt = tpMomentum.perp();
819  double rat = 0.5*dphi/std::sin(0.5*dphi);
820  std::cout << "RDist " << rdist << " pt " << pt << " r/pt " << rdist*rat/pt << " zdist " << vDiff.z() << " pz " << tpMomentum.z() << " z/pz " << vDiff.z()/tpMomentum.z() << std::endl;
821  }
822  }
823 #endif
824  return track;
825  }
826 
827  spr::trackAtOrigin simTrackAtOrigin(unsigned int thisTrk,
830 #ifdef EDM_ML_DEBUG
831  debug
832 #endif
833  ) {
834 
835  spr::trackAtOrigin trk;
836 
837  edm::SimTrackContainer::const_iterator itr = SimTk->end();
838  for (edm::SimTrackContainer::const_iterator simTrkItr = SimTk->begin(); simTrkItr!= SimTk->end(); simTrkItr++) {
839  if ( simTrkItr->trackId() == thisTrk ) {
840 #ifdef EDM_ML_DEBUG
841  if (debug) std::cout << "matched trackId (maximum occurance) " << thisTrk << " type " << simTrkItr->type() << std::endl;
842 #endif
843  itr = simTrkItr;
844  break;
845  }
846  }
847 
848  if (itr != SimTk->end()) {
849  int vertIndex = itr->vertIndex();
850  if (vertIndex != -1 && vertIndex < (int)SimVtx->size()) {
851  edm::SimVertexContainer::const_iterator simVtxItr= SimVtx->begin();
852  for (int iv=0; iv<vertIndex; iv++) simVtxItr++;
853  const math::XYZTLorentzVectorD pos = simVtxItr->position();
854  const math::XYZTLorentzVectorD mom = itr->momentum();
855  trk.ok = true;
856  trk.charge = (int)(itr->charge());
857  trk.position = GlobalPoint(pos.x(), pos.y(), pos.z());
858  trk.momentum = GlobalVector(mom.x(), mom.y(), mom.z());
859  }
860  }
861 #ifdef EDM_ML_DEBUG
862  if (debug) std::cout << "Track flag " << trk.ok << " Position " << trk.position << " Momentum " << trk.momentum << std::endl;
863 #endif
864  return trk;
865  }
866 
867  bool propagateHCAL(const reco::Track *track, const CaloGeometry* geo, const MagneticField* bField, bool typeRZ, const std::pair<double,double> rz, bool debug) {
868  const GlobalPoint vertex (track->vx(), track->vy(), track->vz());
869  const GlobalVector momentum (track->px(), track->py(), track->pz());
870  int charge (track->charge());
871 #ifdef EDM_ML_DEBUG
872  if (debug) std::cout << "Propagate track with charge " << charge << " position " << vertex << " p " << momentum << std::endl;
873 #endif
874  std::pair<HcalDetId,HcalDetId> ids = propagateHCAL(geo, bField, vertex, momentum, charge, typeRZ, rz, debug);
875  bool ok = ((ids.first != HcalDetId()) &&
876  (ids.first.ieta() == ids.second.ieta()) &&
877  (ids.first.iphi() == ids.second.iphi()));
878  return ok;
879  }
880 
881  bool propagateHCAL(unsigned int thisTrk, edm::Handle<edm::SimTrackContainer>& SimTk, edm::Handle<edm::SimVertexContainer>& SimVtx, const CaloGeometry* geo, const MagneticField* bField, bool typeRZ, const std::pair<double,double> rz, bool debug) {
882 
883  spr::trackAtOrigin trk = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug);
884 #ifdef EDM_ML_DEBUG
885  if (debug) std::cout << "Propagate track " << thisTrk << " charge " << trk.charge << " position " << trk.position << " p " << trk.momentum << std::endl;
886 #endif
887  std::pair<HcalDetId,HcalDetId> ids = propagateHCAL(geo, bField, trk.position, trk.momentum, trk.charge, typeRZ, rz, debug);
888  bool ok = ((ids.first != HcalDetId()) &&
889  (ids.first.ieta() == ids.second.ieta()) &&
890  (ids.first.iphi() == ids.second.iphi()));
891  return ok;
892  }
893 
894  std::pair<HcalDetId,HcalDetId> propagateHCAL(const CaloGeometry* geo,
895  const MagneticField* bField,
896  const GlobalPoint& vertex,
897  const GlobalVector& momentum,
898  int charge, bool typeRZ,
899  const std::pair<double,double> rz, bool
900 #ifdef EDM_ML_DEBUG
901  debug
902 #endif
903  ) {
904 
905 #ifdef EDM_ML_DEBUG
906  if (debug) std::cout << "propagateCalo:: Vertex " << vertex << " Momentum " << momentum << " Charge " << charge << " R/Z " << rz.first << " : " << rz.second << " Type " << typeRZ << std::endl;
907 #endif
909  FreeTrajectoryState fts (vertex, momentum, charge, bField);
910  AnalyticalPropagator myAP (bField, alongMomentum, 2*M_PI);
911 
912  HcalDetId id1, id2;
913  for (int k=0; k<2; ++k) {
915  double rzv = (k == 0) ? rz.first : rz.second;
916  if (typeRZ) {
918  tsos = myAP.propagate(fts, *barrel);
919  } else {
921  tsos = myAP.propagate(fts, *endcap);
922  }
923 
924  if (tsos.isValid()) {
926  if (k == 0) id1 = gHB->getClosestCell(point);
927  else id2 = gHB->getClosestCell(point);
928 #ifdef EDM_ML_DEBUG
929  if (debug) {
930  std::cout << "Iteration " << k << " Point " << point << " ID ";
931  if (k == 0) std::cout << id1;
932  else std::cout << id2;
933  std::cout << std::endl;
934  }
935 #endif
936  }
937  }
938 #ifdef EDM_ML_DEBUG
939  if (debug) std::cout << "propagateCalo:: Front " << id1 << " Back " << id2 << std::endl;
940 #endif
941  return std::pair<HcalDetId,HcalDetId>(id1,id2);
942  }
943 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:615
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
static const double etaBEEcal
Definition: CaloConstants.h:12
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
T perp() const
Definition: PV3DBase.h:72
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
static const double zBackTE
Definition: CaloConstants.h:21
static const double etaBEHcal
Definition: CaloConstants.h:15
std::pair< DetId, bool > propagateIdECAL(const HcalDetId &id, const CaloGeometry *geo, const MagneticField *, bool debug=false)
reco::GenParticleCollection::const_iterator trkItr
TrackQuality
track quality
Definition: TrackBase.h:151
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
static const double zFrontHE
Definition: CaloConstants.h:13
uint32_t ID
Definition: Definitions.h:26
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
#define X(str)
Definition: MuonsGrabber.cc:48
GlobalPoint globalPosition() const
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:645
spr::trackAtOrigin simTrackAtOrigin(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, bool debug=false)
static const double zBackHE
Definition: CaloConstants.h:16
spr::propagatedTrack propagateCalo(const GlobalPoint &vertex, const GlobalVector &momentum, int charge, const MagneticField *, float zdist, float radius, float corner, bool debug=false)
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:627
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
static const double rFrontHB
Definition: CaloConstants.h:14
HepMC::GenEvent::particle_const_iterator trkItr
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
static const double rBackHB
Definition: CaloConstants.h:17
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
reco::TrackCollection::const_iterator trkItr
static const double zFrontEE
Definition: CaloConstants.h:9
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
static const double rBackTB
Definition: CaloConstants.h:22
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)
T sqrt(T t)
Definition: SSEVec.h:18
T phi() const
Definition: Phi.h:41
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
T z() const
Definition: PV3DBase.h:64
static const double rFrontEB
Definition: CaloConstants.h:10
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< math::XYZPoint, bool > propagateTracker(const reco::Track *, const MagneticField *, bool debug=false)
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
spr::propagatedTrack propagateTrackToECAL(const reco::Track *, const MagneticField *, bool debug=false)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
GlobalPoint getPosition(const DetId &id) const
#define M_PI
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:639
int k[5][pyjets_maxn]
virtual DetId getClosestCell(const GlobalPoint &r) const
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:669
Definition: DetId.h:18
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
#define debug
Definition: HDRShower.cc:19
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
static const double zFrontTE
Definition: CaloConstants.h:20
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:510
T eta() const
Definition: PV3DBase.h:76
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:663
if(dp >Float(M_PI)) dp-
std::pair< math::XYZPoint, double > propagateTrackerEnd(const reco::Track *, const MagneticField *, bool debug=false)
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
#define EDM_ML_DEBUG
std::vector< spr::propagatedTrackID > propagateCosmicCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
reco::TrackCollection::const_iterator trkItr
int charge() const
track electric charge
Definition: TrackBase.h:567
T x() const
Definition: PV3DBase.h:62
spr::propagatedTrack propagateTrackToHCAL(const reco::Track *, const MagneticField *, bool debug=false)
static const double etaBETrak
Definition: CaloConstants.h:23
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:633
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:657
Global3DVector GlobalVector
Definition: GlobalVector.h:10
GlobalVector globalDirection() const