CMS 3D CMS Logo

TrackUtils.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Tracks
4 // Class : TrackUtils
5 //
6 
7 // system include files
8 #include "TEveTrack.h"
9 #include "TEveTrackPropagator.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveVSDStructs.h"
12 #include "TEveGeoNode.h"
13 
14 // user include files
20 
22 
24 
26 
36 
43 
47 
49 
52 
54 
55 namespace fireworks {
56 
57  static const double MICRON = 1. / 1000. / 1000.;
58 
59  // -- Si module names for printout
60  static const std::string subdets[7] = {"UNKNOWN", "PXB", "PXF", "TIB", "TID", "TOB", "TEC"};
61 
62  TEveTrack* prepareTrack(const reco::Track& track,
63  TEveTrackPropagator* propagator,
64  const std::vector<TEveVector>& extraRefPoints) {
65  // To make use of all available information, we have to order states
66  // properly first. Propagator should take care of y=0 transition.
67 
68  std::vector<State> refStates;
69  TEveVector trackMomentum(track.px(), track.py(), track.pz());
70  refStates.push_back(State(TEveVector(track.vx(), track.vy(), track.vz()), trackMomentum));
71  if (track.extra().isAvailable()) {
72  if (track.innerOk()) {
73  const reco::TrackBase::Point& v = track.innerPosition();
74  const reco::TrackBase::Vector& p = track.innerMomentum();
75  refStates.push_back(State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
76  }
77  if (track.outerOk()) {
78  const reco::TrackBase::Point& v = track.outerPosition();
79  const reco::TrackBase::Vector& p = track.outerMomentum();
80  refStates.push_back(State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
81  }
82  }
83  for (std::vector<TEveVector>::const_iterator point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
84  point != pointEnd;
85  ++point)
86  refStates.push_back(State(*point));
87  if (track.pt() > 1)
88  std::sort(refStates.begin(), refStates.end(), StateOrdering(trackMomentum));
89 
90  // * if the first state has non-zero momentum use it as a starting point
91  // and all other points as PathMarks to follow
92  // * if the first state has only position, try the last state. If it has
93  // momentum we propagate backword, if not, we look for the first one
94  // on left that has momentum and ignore all earlier.
95  //
96 
97  TEveRecTrack t;
98  t.fBeta = 1.;
99  t.fSign = track.charge();
100 
101  if (refStates.front().valid) {
102  t.fV = refStates.front().position;
103  t.fP = refStates.front().momentum;
104  TEveTrack* trk = new TEveTrack(&t, propagator);
105  for (unsigned int i(1); i < refStates.size() - 1; ++i) {
106  if (refStates[i].valid)
107  trk->AddPathMark(TEvePathMark(TEvePathMark::kReference, refStates[i].position, refStates[i].momentum));
108  else
109  trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, refStates[i].position));
110  }
111  if (refStates.size() > 1) {
112  trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, refStates.back().position));
113  }
114  return trk;
115  }
116 
117  if (refStates.back().valid) {
118  t.fSign = (-1) * track.charge();
119  t.fV = refStates.back().position;
120  t.fP = refStates.back().momentum * (-1.0f);
121  TEveTrack* trk = new TEveTrack(&t, propagator);
122  unsigned int i(refStates.size() - 1);
123  for (; i > 0; --i) {
124  if (refStates[i].valid)
125  trk->AddPathMark(
126  TEvePathMark(TEvePathMark::kReference, refStates[i].position, refStates[i].momentum * (-1.0f)));
127  else
128  trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, refStates[i].position));
129  }
130  if (refStates.size() > 1) {
131  trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, refStates.front().position));
132  }
133  return trk;
134  }
135 
136  unsigned int i(0);
137  while (i < refStates.size() && !refStates[i].valid)
138  ++i;
139  assert(i < refStates.size());
140 
141  t.fV = refStates[i].position;
142  t.fP = refStates[i].momentum;
143  TEveTrack* trk = new TEveTrack(&t, propagator);
144  for (unsigned int j(i + 1); j < refStates.size() - 1; ++j) {
145  if (refStates[i].valid)
146  trk->AddPathMark(TEvePathMark(TEvePathMark::kReference, refStates[i].position, refStates[i].momentum));
147  else
148  trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, refStates[i].position));
149  }
150  if (i < refStates.size()) {
151  trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, refStates.back().position));
152  }
153  return trk;
154  }
155 
156  //==============================================================================
157 
158  // Transform measurement to local coordinates in X dimension
159  float pixelLocalX(const double mpx, const float* par) {
160  float xoffset = 0;
161  float xpitch = 0;
162  // std::cerr << "version pr0d " << fireworks::Context::getInstance()->getGeom()->getProducerVersion() << "\n";
163  if (fireworks::Context::getInstance() && fireworks::Context::getInstance()->getGeom()->getProducerVersion() < 1) {
164  static const int ROWS_PER_ROC = 80; // Num of cols per ROC
165  static const int BIG_PIX_PER_ROC_X = 1; // in x direction, rows
166  static const double PITCHX = 100 * MICRON;
167  // Calculate the edge of the active sensor with respect to the center,
168  // that is simply the half-size.
169  // Take into account large pixels
170  xpitch = PITCHX;
171  xoffset = -(par[0] + BIG_PIX_PER_ROC_X * par[0] / ROWS_PER_ROC) / 2. * PITCHX;
172  } else {
173  xpitch = par[0];
174  xoffset = par[2];
175  }
176 
177  bool bigPixelsLayout = par[4];
178 
179  int binoffx = int(mpx); // truncate to int
180  double fractionX = mpx - binoffx; // find the fraction
181  double local_xpitch = xpitch; // defaultpitch
182 
183  if (bigPixelsLayout == 0) {
184  // Measurement to local transformation for X coordinate
185  // X coordinate is in the ROC row number direction
186  // Copy from RectangularPixelTopology::localX implementation
187  if (binoffx > 80) { // ROC 1 - handles x on edge cluster
188  binoffx = binoffx + 2;
189  } else if (binoffx == 80) { // ROC 1
190  binoffx = binoffx + 1;
191  local_xpitch = 2 * xpitch;
192  } else if (binoffx == 79) { // ROC 0
193  binoffx = binoffx + 0;
194  local_xpitch = 2 * xpitch;
195  } else if (binoffx >= 0) { // ROC 0
196  binoffx = binoffx + 0;
197  }
198  }
199 
200  // The final position in local coordinates
201  double lpX = double(binoffx * xpitch) + fractionX * local_xpitch + xoffset;
202 
203  return lpX;
204  }
205 
206  //==============================================================================
207 
208  // Transform measurement to local coordinates in Y dimension
209  float pixelLocalY(const double mpy, const float* par) {
210  float ypitch = 0;
211  float yoffset = 0;
212  if (fireworks::Context::getInstance() && fireworks::Context::getInstance()->getGeom()->getProducerVersion() < 1) {
213  static const double PITCHY = 150 * MICRON;
214  static const int BIG_PIX_PER_ROC_Y = 2; // in y direction, cols
215  static const int COLS_PER_ROC = 52; // Num of Rows per ROC
216 
217  // Calculate the edge of the active sensor with respect to the center,
218  // that is simply the half-size.
219  // Take into account large pixels
220  yoffset = -(par[1] + BIG_PIX_PER_ROC_Y * par[1] / COLS_PER_ROC) / 2. * PITCHY;
221  ypitch = PITCHY;
222  } else {
223  ypitch = par[1];
224  yoffset = par[3];
225  }
226  // Measurement to local transformation for Y coordinate
227  // Y is in the ROC column number direction
228  // Copy from RectangularPixelTopology::localY implementation
229  int binoffy = int(mpy); // truncate to int
230  double fractionY = mpy - binoffy; // find the fraction
231  double local_pitchy = ypitch; // defaultpitch
232 
233  bool bigPixelsLayout = par[4];
234  if (bigPixelsLayout == 0) {
235  constexpr int bigYIndeces[]{0, 51, 52, 103, 104, 155, 156, 207, 208, 259, 260, 311, 312, 363, 364, 415, 416, 511};
236  auto const j = std::lower_bound(std::begin(bigYIndeces), std::end(bigYIndeces), binoffy);
237  if (*j == binoffy)
238  local_pitchy *= 2;
239  binoffy += (j - bigYIndeces);
240  }
241 
242  // The final position in local coordinates
243  double lpY = double(binoffy * ypitch) + fractionY * local_pitchy + yoffset;
244 
245  return lpY;
246  }
247 
248  // Transform measurement to local coordinates in X dimension
249  float phase2PixelLocalX(const double mpx, const float* par, const float* shape) {
250  // The final position in local coordinates
251  return (-shape[1] + mpx * par[0]);
252  }
253 
254  // Transform measurement to local coordinates in Y dimension
255  float phase2PixelLocalY(const double mpy, const float* par, const float* shape) {
256  // The final position in local coordinates
257  return (-shape[2] + mpy * par[1]);
258  }
259 
260  //
261  // Returns strip geometry in local coordinates of a detunit.
262  // The strip is a line from a localTop to a localBottom point.
263  void localSiStrip(short strip, float* localTop, float* localBottom, const float* pars, unsigned int id) {
264  Float_t topology = pars[0];
265  Float_t halfStripLength = pars[2] * 0.5;
266 
267  Double_t localCenter[3] = {0.0, 0.0, 0.0};
268  localTop[1] = halfStripLength;
269  localBottom[1] = -halfStripLength;
270 
271  if (topology == 1) // RadialStripTopology
272  {
273  // stripAngle = phiOfOneEdge + strip * angularWidth
274  // localY = originToIntersection * tan( stripAngle )
275  Float_t stripAngle = tan(pars[5] + strip * pars[6]);
276  Float_t delta = halfStripLength * stripAngle;
277  localCenter[0] = pars[4] * stripAngle;
278  localTop[0] = localCenter[0] + delta;
279  localBottom[0] = localCenter[0] - delta;
280  } else if (topology == 2) // RectangularStripTopology
281  {
282  // offset = -numberOfStrips/2. * pitch
283  // localY = strip * pitch + offset
284  Float_t offset = -pars[1] * 0.5 * pars[3];
285  localCenter[0] = strip * pars[3] + offset;
286  localTop[0] = localCenter[0];
287  localBottom[0] = localCenter[0];
288  } else if (topology == 3) // TrapezoidalStripTopology
289  {
290  fwLog(fwlog::kError) << "did not expect TrapezoidalStripTopology of " << id << std::endl;
291  } else if (pars[0] == 0) // StripTopology
292  {
293  fwLog(fwlog::kError) << "did not find StripTopology of " << id << std::endl;
294  }
295  }
296 
297  //______________________________________________________________________________
298 
299  void setupAddElement(TEveElement* el, TEveElement* parent, const FWEventItem* item, bool master, bool color) {
300  if (master) {
301  el->CSCTakeAnyParentAsMaster();
302  el->SetPickable(true);
303  }
304 
305  if (color) {
306  el->CSCApplyMainColorToMatchingChildren();
307  el->CSCApplyMainTransparencyToMatchingChildren();
308  el->SetMainColor(item->defaultDisplayProperties().color());
309  assert((item->defaultDisplayProperties().transparency() >= 0) &&
310  (item->defaultDisplayProperties().transparency() <= 100));
311  el->SetMainTransparency(item->defaultDisplayProperties().transparency());
312  }
313  parent->AddElement(el);
314  }
315 
316  //______________________________________________________________________________
317 
319  const SiStripCluster* cluster = nullptr;
320 
321  if (const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>(rechit)) {
322  fwLog(fwlog::kDebug) << "hit 2D ";
323 
324  cluster = hit2D->cluster().get();
325  }
326  if (cluster == nullptr) {
327  if (const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>(rechit)) {
328  fwLog(fwlog::kDebug) << "hit 1D ";
329 
330  cluster = hit1D->cluster().get();
331  }
332  }
333  return cluster;
334  }
335 
337  const FWEventItem* iItem, const reco::Track& t, class TEveElement* tList, bool addNearbyClusters, bool master) {
338  // master is true if the product is for proxy builder
339  const FWGeometry* geom = iItem->getGeom();
340 
341  const edmNew::DetSetVector<SiStripCluster>* allClusters = nullptr;
342  if (addNearbyClusters) {
343  for (trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it) {
344  const auto& rhs = *(*(it));
345  if (typeid(rhs) == typeid(SiStripRecHit2D)) {
346  const SiStripRecHit2D& hit = static_cast<const SiStripRecHit2D&>(**it);
347  if (hit.cluster().isNonnull() && hit.cluster().isAvailable()) {
349  iItem->getEvent()->get(hit.cluster().id(), allClustersHandle);
350  allClusters = allClustersHandle.product();
351  break;
352  }
353  } else if (typeid(rhs) == typeid(SiStripRecHit1D)) {
354  const SiStripRecHit1D& hit = static_cast<const SiStripRecHit1D&>(**it);
355  if (hit.cluster().isNonnull() && hit.cluster().isAvailable()) {
357  iItem->getEvent()->get(hit.cluster().id(), allClustersHandle);
358  allClusters = allClustersHandle.product();
359  break;
360  }
361  }
362  }
363  }
364 
365  for (trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it) {
366  unsigned int rawid = (*it)->geographicalId();
367  if (!geom->contains(rawid)) {
368  fwLog(fwlog::kError) << "failed to get geometry of SiStripCluster with detid: " << rawid << std::endl;
369 
370  continue;
371  }
372 
373  const float* pars = geom->getParameters(rawid);
374 
375  // -- get phi from SiStripHit
376  auto rechitRef = *it;
377  const TrackingRecHit* rechit = &(*rechitRef);
378  const SiStripCluster* cluster = extractClusterFromTrackingRecHit(rechit);
379 
380  if (cluster) {
381  if (allClusters != nullptr) {
382  const edmNew::DetSet<SiStripCluster>& clustersOnThisDet = (*allClusters)[rechit->geographicalId().rawId()];
383 
384  for (edmNew::DetSet<SiStripCluster>::const_iterator itc = clustersOnThisDet.begin(),
385  edc = clustersOnThisDet.end();
386  itc != edc;
387  ++itc) {
388  TEveStraightLineSet* scposition = new TEveStraightLineSet;
389  scposition->SetDepthTest(false);
390  scposition->SetPickable(kTRUE);
391 
392  short firststrip = itc->firstStrip();
393 
394  if (&*itc == cluster) {
395  scposition->SetTitle(Form("Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip));
396  scposition->SetLineColor(kGreen);
397  } else {
398  scposition->SetTitle(Form("SiStripCluster, first strip %d", firststrip));
399  scposition->SetLineColor(kRed);
400  }
401 
402  float localTop[3] = {0.0, 0.0, 0.0};
403  float localBottom[3] = {0.0, 0.0, 0.0};
404 
405  fireworks::localSiStrip(firststrip, localTop, localBottom, pars, rawid);
406 
407  float globalTop[3];
408  float globalBottom[3];
409  geom->localToGlobal(rawid, localTop, globalTop, localBottom, globalBottom);
410 
411  scposition->AddLine(
412  globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
413 
414  setupAddElement(scposition, tList, iItem, master, false);
415  }
416  } else {
417  short firststrip = cluster->firstStrip();
418  TEveStraightLineSet* scposition = new TEveStraightLineSet;
419  scposition->SetDepthTest(false);
420  scposition->SetPickable(kTRUE);
421  scposition->SetTitle(Form("SiStripCluster, first strip %d", firststrip));
422 
423  float localTop[3] = {0.0, 0.0, 0.0};
424  float localBottom[3] = {0.0, 0.0, 0.0};
425 
426  fireworks::localSiStrip(firststrip, localTop, localBottom, pars, rawid);
427 
428  float globalTop[3];
429  float globalBottom[3];
430  geom->localToGlobal(rawid, localTop, globalTop, localBottom, globalBottom);
431 
432  scposition->AddLine(
433  globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
434 
435  setupAddElement(scposition, tList, iItem, master, true);
436  }
437  } else if (!rechit->isValid() && (rawid != 0)) // lost hit
438  {
439  if (allClusters != nullptr) {
441  if (itds != allClusters->end()) {
442  const edmNew::DetSet<SiStripCluster>& clustersOnThisDet = *itds;
443  for (edmNew::DetSet<SiStripCluster>::const_iterator itc = clustersOnThisDet.begin(),
444  edc = clustersOnThisDet.end();
445  itc != edc;
446  ++itc) {
447  short firststrip = itc->firstStrip();
448 
449  TEveStraightLineSet* scposition = new TEveStraightLineSet;
450  scposition->SetDepthTest(false);
451  scposition->SetPickable(kTRUE);
452  scposition->SetTitle(Form("Lost SiStripCluster, first strip %d", firststrip));
453 
454  float localTop[3] = {0.0, 0.0, 0.0};
455  float localBottom[3] = {0.0, 0.0, 0.0};
456 
457  fireworks::localSiStrip(firststrip, localTop, localBottom, pars, rawid);
458 
459  float globalTop[3];
460  float globalBottom[3];
461  geom->localToGlobal(rawid, localTop, globalTop, localBottom, globalBottom);
462 
463  scposition->AddLine(
464  globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
465 
466  setupAddElement(scposition, tList, iItem, master, false);
467  scposition->SetLineColor(kRed);
468  }
469  }
470  }
471  } else {
472  fwLog(fwlog::kDebug) << "*ANOTHER* option possible: valid=" << rechit->isValid() << ", rawid=" << rawid
473  << std::endl;
474  }
475  }
476  }
477 
478  //______________________________________________________________________________
479 
480  void pushNearbyPixelHits(std::vector<TVector3>& pixelPoints, const FWEventItem& iItem, const reco::Track& t) {
481  const edmNew::DetSetVector<SiPixelCluster>* allClusters = nullptr;
482  for (trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it) {
483  const auto& rhs = *(*(it));
484  if (typeid(rhs) == typeid(SiPixelRecHit)) {
485  const SiPixelRecHit& hit = static_cast<const SiPixelRecHit&>(**it);
486  if (hit.cluster().isNonnull() && hit.cluster().isAvailable()) {
488  iItem.getEvent()->get(hit.cluster().id(), allClustersHandle);
489  allClusters = allClustersHandle.product();
490  break;
491  }
492  }
493  }
494  if (allClusters == nullptr)
495  return;
496 
497  const FWGeometry* geom = iItem.getGeom();
498 
499  for (trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it) {
500  const TrackingRecHit* rh = &(**it);
501 
502  DetId id = (*it)->geographicalId();
503  if (!geom->contains(id)) {
504  fwLog(fwlog::kError) << "failed to get geometry of Tracker Det with raw id: " << id.rawId() << std::endl;
505 
506  continue;
507  }
508 
509  // -- in which detector are we?
510  unsigned int subdet = (unsigned int)id.subdetId();
511  if ((subdet != PixelSubdetector::PixelBarrel) && (subdet != PixelSubdetector::PixelEndcap))
512  continue;
513 
514  const SiPixelCluster* hitCluster = nullptr;
515  if (const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>(rh))
516  hitCluster = pixel->cluster().get();
518  if (itds != allClusters->end()) {
519  const edmNew::DetSet<SiPixelCluster>& clustersOnThisDet = *itds;
520  for (edmNew::DetSet<SiPixelCluster>::const_iterator itc = clustersOnThisDet.begin(),
521  edc = clustersOnThisDet.end();
522  itc != edc;
523  ++itc) {
524  if (&*itc != hitCluster)
525  pushPixelCluster(pixelPoints, *geom, id, *itc, geom->getParameters(id));
526  }
527  }
528  }
529  }
530 
531  //______________________________________________________________________________
532 
533  void pushPixelHits(std::vector<TVector3>& pixelPoints, const FWEventItem& iItem, const reco::Track& t) {
534  /*
535  * -- return for each Pixel Hit a 3D point
536  */
537  const FWGeometry* geom = iItem.getGeom();
538 
539  double dz = t.dz();
540  double vz = t.vz();
541  double etaT = t.eta();
542 
543  fwLog(fwlog::kDebug) << "Track eta: " << etaT << ", vz: " << vz << ", dz: " << dz << std::endl;
544 
545  int cnt = 0;
546  for (trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it) {
547  const TrackingRecHit* rh = &(**it);
548  // -- get position of center of wafer, assuming (0,0,0) is the center
549  DetId id = (*it)->geographicalId();
550  if (!geom->contains(id)) {
551  fwLog(fwlog::kError) << "failed to get geometry of Tracker Det with raw id: " << id.rawId() << std::endl;
552 
553  continue;
554  }
555 
556  // -- in which detector are we?
557  unsigned int subdet = (unsigned int)id.subdetId();
558 
559  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
560  fwLog(fwlog::kDebug) << cnt++ << " -- " << subdets[subdet];
561 
562  if (const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>(rh)) {
563  const SiPixelCluster& c = *(pixel->cluster());
564  pushPixelCluster(pixelPoints, *geom, id, c, geom->getParameters(id));
565  }
566  }
567  }
568  }
569 
570  void pushPixelCluster(std::vector<TVector3>& pixelPoints,
571  const FWGeometry& geom,
572  DetId id,
573  const SiPixelCluster& c,
574  const float* pars) {
575  double row = c.minPixelRow();
576  double col = c.minPixelCol();
577  float lx = 0.;
578  float ly = 0.;
579 
580  // int nrows = (int)pars[0];
581  // int ncols = (int)pars[1];
582  lx = pixelLocalX(row, pars);
583  ly = pixelLocalY(col, pars);
584 
585  fwLog(fwlog::kDebug) << ", row: " << row << ", col: " << col << ", lx: " << lx << ", ly: " << ly;
586 
587  float local[3] = {lx, ly, 0.};
588  float global[3];
589  geom.localToGlobal(id, local, global);
590  TVector3 pb(global[0], global[1], global[2]);
591  pixelPoints.push_back(pb);
592 
593  fwLog(fwlog::kDebug) << " x: " << pb.X() << ", y: " << pb.Y() << " z: " << pb.Z() << " eta: " << pb.Eta()
594  << ", phi: " << pb.Phi() << " rho: " << pb.Pt() << std::endl;
595  }
596 
597  //______________________________________________________________________________
598 
599  std::string info(const DetId& id) {
600  std::ostringstream oss;
601 
602  oss << "DetId: " << id.rawId() << "\n";
603 
604  switch (id.det()) {
605  case DetId::Tracker:
607  break;
608 
609  case DetId::Muon:
610  switch (id.subdetId()) {
611  case MuonSubdetId::DT: {
612  DTChamberId detId(id.rawId());
613  oss << "DT chamber (wheel, station, sector): " << detId.wheel() << ", " << detId.station() << ", "
614  << detId.sector();
615  } break;
616  case MuonSubdetId::CSC: {
617  CSCDetId detId(id.rawId());
618  oss << "CSC chamber (endcap, station, ring, chamber, layer): " << detId.endcap() << ", " << detId.station()
619  << ", " << detId.ring() << ", " << detId.chamber() << ", " << detId.layer();
620  } break;
621  case MuonSubdetId::RPC: {
622  RPCDetId detId(id.rawId());
623  oss << "RPC chamber ";
624  switch (detId.region()) {
625  case 0:
626  oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
627  << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
628  << ", " << detId.roll();
629  break;
630  case 1:
631  oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
632  << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
633  << ", " << detId.roll();
634  break;
635  case -1:
636  oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
637  << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
638  << ", " << detId.roll();
639  break;
640  }
641  } break;
642  case MuonSubdetId::GEM: {
643  GEMDetId detId(id.rawId());
644  oss << "GEM chamber (region, station, ring, chamber, layer): " << detId.region() << ", " << detId.station()
645  << ", " << detId.ring() << ", " << detId.chamber() << ", " << detId.layer();
646  } break;
647  case MuonSubdetId::ME0: {
648  ME0DetId detId(id.rawId());
649  oss << "ME0 chamber (region, chamber, layer): " << detId.region() << ", " << detId.chamber() << ", "
650  << detId.layer();
651  } break;
652  }
653  break;
654 
655  case DetId::Calo: {
656  CaloTowerDetId detId(id.rawId());
657  oss << "CaloTower (ieta, iphi): " << detId.ieta() << ", " << detId.iphi();
658  } break;
659 
660  case DetId::Ecal:
661  switch (id.subdetId()) {
662  case EcalBarrel: {
663  EBDetId detId(id);
664  oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " << detId.ieta() << ", " << detId.iphi() << ", "
665  << detId.tower_ieta() << ", " << detId.tower_iphi();
666  } break;
667  case EcalEndcap: {
668  EEDetId detId(id);
669  oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " << detId.ix() << ", " << detId.iy() << ", "
670  << detId.isc() << ", " << detId.ic() << ", " << detId.iquadrant();
671  } break;
672  case EcalPreshower:
673  oss << "EcalPreshower";
674  break;
675  case EcalTriggerTower:
676  oss << "EcalTriggerTower";
677  break;
678  case EcalLaserPnDiode:
679  oss << "EcalLaserPnDiode";
680  break;
681  }
682  break;
683 
684  case DetId::Hcal: {
685  HcalDetId detId(id);
686  switch (detId.subdet()) {
687  case HcalEmpty:
688  oss << "HcalEmpty ";
689  break;
690  case HcalBarrel:
691  oss << "HcalBarrel ";
692  break;
693  case HcalEndcap:
694  oss << "HcalEndcap ";
695  break;
696  case HcalOuter:
697  oss << "HcalOuter ";
698  break;
699  case HcalForward:
700  oss << "HcalForward ";
701  break;
702  case HcalTriggerTower:
703  oss << "HcalTriggerTower ";
704  break;
705  case HcalOther:
706  oss << "HcalOther ";
707  break;
708  }
709  oss << "(ieta, iphi, depth):" << detId.ieta() << ", " << detId.iphi() << ", " << detId.depth();
710  } break;
711  default:;
712  }
713  return oss.str();
714  }
715 
716  std::string info(const std::set<DetId>& idSet) {
718  for (std::set<DetId>::const_iterator id = idSet.begin(), idEnd = idSet.end(); id != idEnd; ++id) {
719  text += info(*id);
720  text += "\n";
721  }
722  return text;
723  }
724 
725  std::string info(const std::vector<DetId>& idSet) {
727  for (std::vector<DetId>::const_iterator id = idSet.begin(), idEnd = idSet.end(); id != idEnd; ++id) {
728  text += info(*id);
729  text += "\n";
730  }
731  return text;
732  }
733 } // namespace fireworks
uint16_t firstStrip() const
static constexpr int GEM
Definition: MuonSubdetId.h:14
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
std::string print(DetId detid) const
T const * product() const
Definition: Handle.h:70
float phase2PixelLocalY(const double mpy, const float *, const float *)
Definition: TrackUtils.cc:255
Trktree trk
Definition: Trktree.cc:2
data_type const * const_iterator
Definition: DetSetNew.h:31
assert(be >=bs)
const_iterator end(bool update=false) const
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
Definition: TrackUtils.cc:263
float phase2PixelLocalX(const double mpx, const float *, const float *)
Definition: TrackUtils.cc:249
const TrackerTopology * getTrackerTopology() const
Definition: FWGeometry.h:157
FWGeometry * getGeom() const
Definition: Context.h:72
bool isValid() const
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
Definition: TrackUtils.cc:318
static const double MICRON
Definition: TrackUtils.cc:57
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double f[11][100]
static constexpr int ME0
Definition: MuonSubdetId.h:15
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
Definition: TrackUtils.cc:533
const edm::EventBase * getEvent() const
Definition: FWEventItem.h:131
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:159
static Context * getInstance()
Definition: Context.cc:209
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
Definition: TrackUtils.cc:336
unsigned int id
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:209
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
DetId geographicalId() const
#define fwLog(_level_)
Definition: fwLog.h:45
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static constexpr int RPC
Definition: MuonSubdetId.h:13
bool get(ProductID const &, Handle< T > &) const
Definition: EventBase.h:119
Pixel cluster – collection of neighboring pixels above threshold.
iterator end()
Definition: DetSetNew.h:53
const_iterator find(id_type i, bool update=false) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::string info(const DetId &)
Definition: TrackUtils.cc:599
col
Definition: cuy.py:1009
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12
static const std::string subdets[7]
Definition: TrackUtils.cc:60
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
Definition: TrackUtils.cc:480
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77
void pushPixelCluster(std::vector< TVector3 > &pixelPoints, const FWGeometry &geom, DetId id, const SiPixelCluster &c, const float *pars)
Definition: TrackUtils.cc:570
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
Definition: TrackUtils.cc:299
*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
Our base class.
Definition: SiPixelRecHit.h:23
iterator begin()
Definition: DetSetNew.h:51