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