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*
64  TEveTrackPropagator* propagator,
65  const std::vector<TEveVector>& extraRefPoints )
66 {
67  // To make use of all available information, we have to order states
68  // properly first. Propagator should take care of y=0 transition.
69 
70  std::vector<State> refStates;
71  TEveVector trackMomentum(track.px(), track.py(), track.pz());
72  refStates.push_back(State(TEveVector(track.vx(), track.vy(), track.vz()),
73  trackMomentum));
74  if( track.extra().isAvailable() ) {
75  if (track.innerOk()) {
76  const reco::TrackBase::Point &v = track.innerPosition();
77  const reco::TrackBase::Vector &p = track.innerMomentum();
78  refStates.push_back(State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
79  }
80  if (track.outerOk()) {
81  const reco::TrackBase::Point &v = track.outerPosition();
82  const reco::TrackBase::Vector &p = track.outerMomentum();
83  refStates.push_back(State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
84  }
85  }
86  for( std::vector<TEveVector>::const_iterator point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
87  point != pointEnd; ++point )
88  refStates.push_back(State(*point));
89  if( track.pt()>1 )
90  std::sort( refStates.begin(), refStates.end(), StateOrdering(trackMomentum) );
91 
92  // * if the first state has non-zero momentum use it as a starting point
93  // and all other points as PathMarks to follow
94  // * if the first state has only position, try the last state. If it has
95  // momentum we propagate backword, if not, we look for the first one
96  // on left that has momentum and ignore all earlier.
97  //
98 
99  TEveRecTrack t;
100  t.fBeta = 1.;
101  t.fSign = track.charge();
102 
103  if( refStates.front().valid ) {
104  t.fV = refStates.front().position;
105  t.fP = refStates.front().momentum;
106  TEveTrack* trk = new TEveTrack( &t, propagator );
107  for( unsigned int i(1); i<refStates.size()-1; ++i) {
108  if( refStates[i].valid )
109  trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[i].position, refStates[i].momentum ) );
110  else
111  trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[i].position ) );
112  }
113  if( refStates.size()>1 ) {
114  trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
115  }
116  return trk;
117  }
118 
119  if( refStates.back().valid ) {
120  t.fSign = (-1)*track.charge();
121  t.fV = refStates.back().position;
122  t.fP = refStates.back().momentum * (-1.0f);
123  TEveTrack* trk = new TEveTrack( &t, propagator );
124  unsigned int i( refStates.size()-1 );
125  for(; i>0; --i) {
126  if ( refStates[i].valid )
127  trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[i].position, refStates[i].momentum*(-1.0f) ) );
128  else
129  trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[i].position ) );
130  }
131  if ( refStates.size()>1 ) {
132  trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.front().position ) );
133  }
134  return trk;
135  }
136 
137  unsigned int i(0);
138  while( i<refStates.size() && !refStates[i].valid ) ++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
160 pixelLocalX( const double mpx, const float* par )
161 {
162  float xoffset = 0;
163  float xpitch = 0;
164  // std::cerr << "version pr0d " << fireworks::Context::getInstance()->getGeom()->getProducerVersion() << "\n";
165  if (fireworks::Context::getInstance() && fireworks::Context::getInstance()->getGeom()->getProducerVersion() < 1)
166  {
167 
168  static const int ROWS_PER_ROC = 80; // Num of cols per ROC
169  static const int BIG_PIX_PER_ROC_X = 1; // in x direction, rows
170  static const double PITCHX = 100*MICRON;
171  // Calculate the edge of the active sensor with respect to the center,
172  // that is simply the half-size.
173  // Take into account large pixels
174  xpitch = PITCHX;
175  xoffset = -( par[0] + BIG_PIX_PER_ROC_X * par[0] / ROWS_PER_ROC ) / 2. * PITCHX;
176  }
177  else {
178  xpitch = par[0];
179  xoffset = par[2];
180  }
181 
182  bool bigPixelsLayout = par[4];
183 
184  int binoffx = int(mpx); // truncate to int
185  double fractionX = mpx - binoffx; // find the fraction
186  double local_xpitch = xpitch; // defaultpitch
187 
188  if (bigPixelsLayout == 0) {
189  // Measurement to local transformation for X coordinate
190  // X coordinate is in the ROC row number direction
191  // Copy from RectangularPixelTopology::localX implementation
192  if( binoffx > 80 ) { // ROC 1 - handles x on edge cluster
193  binoffx = binoffx + 2;
194  } else if( binoffx == 80 ) { // ROC 1
195  binoffx = binoffx+1;
196  local_xpitch = 2 * xpitch;
197  } else if( binoffx == 79 ) { // ROC 0
198  binoffx = binoffx + 0;
199  local_xpitch = 2 * xpitch;
200  } else if( binoffx >= 0 ) { // ROC 0
201  binoffx = binoffx + 0;
202  }
203  }
204 
205  // The final position in local coordinates
206  double lpX = double( binoffx * xpitch ) + fractionX * local_xpitch + xoffset;
207 
208  return lpX;
209 }
210 
211 //==============================================================================
212 
213 
214 // Transform measurement to local coordinates in Y dimension
215 float
216 pixelLocalY( const double mpy, const float* par )
217 {
218  float ypitch = 0;
219  float yoffset = 0;
220  if (fireworks::Context::getInstance() && fireworks::Context::getInstance()->getGeom()->getProducerVersion() < 1)
221  {
222  static const double PITCHY = 150*MICRON;
223  static const int BIG_PIX_PER_ROC_Y = 2; // in y direction, cols
224  static const int COLS_PER_ROC = 52; // Num of Rows per ROC
225 
226  // Calculate the edge of the active sensor with respect to the center,
227  // that is simply the half-size.
228  // Take into account large pixels
229  yoffset = -( par[1] + BIG_PIX_PER_ROC_Y * par[1] / COLS_PER_ROC ) / 2. * PITCHY;
230  ypitch = PITCHY;
231  }
232  else
233  {
234  ypitch = par[1];
235  yoffset = par[3];
236  }
237  // Measurement to local transformation for Y coordinate
238  // Y is in the ROC column number direction
239  // Copy from RectangularPixelTopology::localY implementation
240  int binoffy = int( mpy ); // truncate to int
241  double fractionY = mpy - binoffy; // find the fraction
242  double local_pitchy = ypitch; // defaultpitch
243 
244 
245  bool bigPixelsLayout = par[4];
246  if (bigPixelsLayout == 0) {
247  constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
248  auto const j = std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),binoffy);
249  if (*j==binoffy) local_pitchy *= 2 ;
250  binoffy += (j-bigYIndeces);
251  }
252 
253  // The final position in local coordinates
254  double lpY = double( binoffy * ypitch ) + fractionY * local_pitchy + yoffset;
255 
256  return lpY;
257 }
258 
259 //
260 // Returns strip geometry in local coordinates of a detunit.
261 // The strip is a line from a localTop to a localBottom point.
262 void localSiStrip( short strip, float* localTop, float* localBottom, const float* pars, unsigned int id )
263 {
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  }
281  else if( topology == 2 ) // RectangularStripTopology
282  {
283  // offset = -numberOfStrips/2. * pitch
284  // localY = strip * pitch + offset
285  Float_t offset = -pars[1] * 0.5 * pars[3];
286  localCenter[0] = strip * pars[3] + offset;
287  localTop[0] = localCenter[0];
288  localBottom[0] = localCenter[0];
289  }
290  else if( topology == 3 ) // TrapezoidalStripTopology
291  {
293  << "did not expect TrapezoidalStripTopology of "
294  << id << std::endl;
295  }
296  else if( pars[0] == 0 ) // StripTopology
297  {
299  << "did not find StripTopology of "
300  << id << std::endl;
301  }
302 }
303 
304 //______________________________________________________________________________
305 
306 void
307 setupAddElement(TEveElement* el, TEveElement* parent, const FWEventItem* item, bool master, bool color)
308 {
309  if (master)
310  {
311  el->CSCTakeAnyParentAsMaster();
312  el->SetPickable(true);
313  }
314 
315  if (color)
316  {
317  el->CSCApplyMainColorToMatchingChildren();
318  el->CSCApplyMainTransparencyToMatchingChildren();
319  el->SetMainColor(item->defaultDisplayProperties().color());
320  assert((item->defaultDisplayProperties().transparency() >= 0)
321  && (item->defaultDisplayProperties().transparency() <= 100));
322  el->SetMainTransparency(item->defaultDisplayProperties().transparency());
323  }
324  parent->AddElement(el);
325 }
326 
327 //______________________________________________________________________________
328 
330 {
331  const SiStripCluster* cluster = nullptr;
332 
333  if( const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
334  {
335  fwLog( fwlog::kDebug ) << "hit 2D ";
336 
337  cluster = hit2D->cluster().get();
338  }
339  if( cluster == nullptr )
340  {
341  if( const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
342  {
343  fwLog( fwlog::kDebug ) << "hit 1D ";
344 
345  cluster = hit1D->cluster().get();
346  }
347  }
348  return cluster;
349 }
350 
351 void
352 addSiStripClusters( const FWEventItem* iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master )
353 {
354  // master is true if the product is for proxy builder
355  const FWGeometry *geom = iItem->getGeom();
356 
357  const edmNew::DetSetVector<SiStripCluster> * allClusters = nullptr;
358  if( addNearbyClusters )
359  {
360  for( trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it )
361  {
362  const auto & rhs = *(*(it));
363  if( typeid( rhs ) == typeid( SiStripRecHit2D ))
364  {
365  const SiStripRecHit2D &hit = static_cast<const SiStripRecHit2D &>( **it );
366  if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
367  {
369  iItem->getEvent()->get(hit.cluster().id(), allClustersHandle);
370  allClusters = allClustersHandle.product();
371  break;
372  }
373  }
374  else if( typeid( rhs ) == typeid( SiStripRecHit1D ))
375  {
376  const SiStripRecHit1D &hit = static_cast<const SiStripRecHit1D &>( **it );
377  if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
378  {
380  iItem->getEvent()->get(hit.cluster().id(), allClustersHandle);
381  allClusters = allClustersHandle.product();
382  break;
383  }
384  }
385  }
386  }
387 
388  for( trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it )
389  {
390  unsigned int rawid = (*it)->geographicalId();
391  if( ! geom->contains( rawid ))
392  {
394  << "failed to get geometry of SiStripCluster with detid: "
395  << rawid << std::endl;
396 
397  continue;
398  }
399 
400  const float* pars = geom->getParameters( rawid );
401 
402  // -- get phi from SiStripHit
403  auto rechitRef = *it;
404  const TrackingRecHit *rechit = &( *rechitRef );
405  const SiStripCluster *cluster = extractClusterFromTrackingRecHit( rechit );
406 
407  if( cluster )
408  {
409  if( allClusters != nullptr )
410  {
411  const edmNew::DetSet<SiStripCluster> & clustersOnThisDet = (*allClusters)[rechit->geographicalId().rawId()];
412 
413  for( edmNew::DetSet<SiStripCluster>::const_iterator itc = clustersOnThisDet.begin(), edc = clustersOnThisDet.end(); itc != edc; ++itc )
414  {
415 
416  TEveStraightLineSet *scposition = new TEveStraightLineSet;
417  scposition->SetDepthTest( false );
418  scposition->SetPickable( kTRUE );
419 
420  short firststrip = itc->firstStrip();
421 
422  if( &*itc == cluster )
423  {
424  scposition->SetTitle( Form( "Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
425  scposition->SetLineColor( kGreen );
426  }
427  else
428  {
429  scposition->SetTitle( Form( "SiStripCluster, first strip %d", firststrip ));
430  scposition->SetLineColor( kRed );
431  }
432 
433  float localTop[3] = { 0.0, 0.0, 0.0 };
434  float localBottom[3] = { 0.0, 0.0, 0.0 };
435 
436  fireworks::localSiStrip( firststrip, localTop, localBottom, pars, rawid );
437 
438  float globalTop[3];
439  float globalBottom[3];
440  geom->localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
441 
442  scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
443  globalBottom[0], globalBottom[1], globalBottom[2] );
444 
445  setupAddElement( scposition, tList, iItem, master, false );
446  }
447  }
448  else
449  {
450  short firststrip = cluster->firstStrip();
451  TEveStraightLineSet *scposition = new TEveStraightLineSet;
452  scposition->SetDepthTest( false );
453  scposition->SetPickable( kTRUE );
454  scposition->SetTitle( Form( "SiStripCluster, first strip %d", firststrip ));
455 
456  float localTop[3] = { 0.0, 0.0, 0.0 };
457  float localBottom[3] = { 0.0, 0.0, 0.0 };
458 
459  fireworks::localSiStrip( firststrip, localTop, localBottom, pars, rawid );
460 
461  float globalTop[3];
462  float globalBottom[3];
463  geom->localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
464 
465  scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
466  globalBottom[0], globalBottom[1], globalBottom[2] );
467 
468  setupAddElement( scposition, tList, iItem, master, true );
469  }
470  }
471  else if( !rechit->isValid() && ( rawid != 0 )) // lost hit
472  {
473  if( allClusters != nullptr )
474  {
475  edmNew::DetSetVector<SiStripCluster>::const_iterator itds = allClusters->find( rawid );
476  if( itds != allClusters->end())
477  {
478  const edmNew::DetSet<SiStripCluster> & clustersOnThisDet = *itds;
479  for( edmNew::DetSet<SiStripCluster>::const_iterator itc = clustersOnThisDet.begin(), edc = clustersOnThisDet.end(); itc != edc; ++itc )
480  {
481  short firststrip = itc->firstStrip();
482 
483  TEveStraightLineSet *scposition = new TEveStraightLineSet;
484  scposition->SetDepthTest( false );
485  scposition->SetPickable( kTRUE );
486  scposition->SetTitle( Form( "Lost SiStripCluster, first strip %d", firststrip ));
487 
488  float localTop[3] = { 0.0, 0.0, 0.0 };
489  float localBottom[3] = { 0.0, 0.0, 0.0 };
490 
491  fireworks::localSiStrip( firststrip, localTop, localBottom, pars, rawid );
492 
493  float globalTop[3];
494  float globalBottom[3];
495  geom->localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
496 
497  scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
498  globalBottom[0], globalBottom[1], globalBottom[2] );
499 
500 
501  setupAddElement( scposition, tList, iItem, master, false );
502  scposition->SetLineColor( kRed );
503  }
504  }
505  }
506  }
507  else
508  {
510  << "*ANOTHER* option possible: valid=" << rechit->isValid()
511  << ", rawid=" << rawid << std::endl;
512  }
513  }
514 }
515 
516 //______________________________________________________________________________
517 
518 void
519 pushNearbyPixelHits( std::vector<TVector3> &pixelPoints, const FWEventItem &iItem, const reco::Track &t )
520 {
521  const edmNew::DetSetVector<SiPixelCluster> * allClusters = nullptr;
522  for( trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it)
523  {
524  const auto & rhs = *(*(it));
525  if( typeid( rhs ) == typeid( SiPixelRecHit ))
526  {
527  const SiPixelRecHit &hit = static_cast<const SiPixelRecHit &>(**it);
528  if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
529  {
531  iItem.getEvent()->get(hit.cluster().id(), allClustersHandle);
532  allClusters = allClustersHandle.product();
533  break;
534  }
535  }
536  }
537  if( allClusters == nullptr ) return;
538 
539  const FWGeometry *geom = iItem.getGeom();
540 
541  for( trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it )
542  {
543  const TrackingRecHit* rh = &(**it);
544 
545  DetId id = (*it)->geographicalId();
546  if( ! geom->contains( id ))
547  {
549  << "failed to get geometry of Tracker Det with raw id: "
550  << id.rawId() << std::endl;
551 
552  continue;
553  }
554 
555  // -- in which detector are we?
556  unsigned int subdet = (unsigned int)id.subdetId();
557  if(( subdet != PixelSubdetector::PixelBarrel ) && ( subdet != PixelSubdetector::PixelEndcap )) continue;
558 
559  const SiPixelCluster* hitCluster = nullptr;
560  if( const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
561  hitCluster = pixel->cluster().get();
562  edmNew::DetSetVector<SiPixelCluster>::const_iterator itds = allClusters->find(id.rawId());
563  if( itds != allClusters->end())
564  {
565  const edmNew::DetSet<SiPixelCluster> & clustersOnThisDet = *itds;
566  for( edmNew::DetSet<SiPixelCluster>::const_iterator itc = clustersOnThisDet.begin(), edc = clustersOnThisDet.end(); itc != edc; ++itc )
567  {
568  if( &*itc != hitCluster )
569  pushPixelCluster( pixelPoints, *geom, id, *itc, geom->getParameters( id ));
570  }
571  }
572  }
573 }
574 
575 //______________________________________________________________________________
576 
577 void
578 pushPixelHits( std::vector<TVector3> &pixelPoints, const FWEventItem &iItem, const reco::Track &t )
579 {
580  /*
581  * -- return for each Pixel Hit a 3D point
582  */
583  const FWGeometry *geom = iItem.getGeom();
584 
585  double dz = t.dz();
586  double vz = t.vz();
587  double etaT = t.eta();
588 
589  fwLog( fwlog::kDebug ) << "Track eta: " << etaT << ", vz: " << vz << ", dz: " << dz
590  << std::endl;
591 
592  int cnt = 0;
593  for( trackingRecHit_iterator it = t.recHitsBegin(), itEnd = t.recHitsEnd(); it != itEnd; ++it )
594  {
595  const TrackingRecHit* rh = &(**it);
596  // -- get position of center of wafer, assuming (0,0,0) is the center
597  DetId id = (*it)->geographicalId();
598  if( ! geom->contains( id ))
599  {
601  << "failed to get geometry of Tracker Det with raw id: "
602  << id.rawId() << std::endl;
603 
604  continue;
605  }
606 
607  // -- in which detector are we?
608  unsigned int subdet = (unsigned int)id.subdetId();
609 
610  if(( subdet == PixelSubdetector::PixelBarrel ) || ( subdet == PixelSubdetector::PixelEndcap ))
611  {
612  fwLog( fwlog::kDebug ) << cnt++ << " -- "
613  << subdets[subdet];
614 
615  if( const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
616  {
617  const SiPixelCluster& c = *( pixel->cluster());
618  pushPixelCluster( pixelPoints, *geom, id, c, geom->getParameters( id ));
619  }
620  }
621  }
622 }
623 
624 void
625 pushPixelCluster( std::vector<TVector3> &pixelPoints, const FWGeometry &geom, DetId id, const SiPixelCluster &c, const float* pars )
626 {
627  double row = c.minPixelRow();
628  double col = c.minPixelCol();
629  float lx = 0.;
630  float ly = 0.;
631 
632  // int nrows = (int)pars[0];
633  // int ncols = (int)pars[1];
634  lx = pixelLocalX( row, pars );
635  ly = pixelLocalY( col, pars );
636 
638  << ", row: " << row << ", col: " << col
639  << ", lx: " << lx << ", ly: " << ly ;
640 
641  float local[3] = { lx, ly, 0. };
642  float global[3];
643  geom.localToGlobal( id, local, global );
644  TVector3 pb( global[0], global[1], global[2] );
645  pixelPoints.push_back( pb );
646 
648  << " x: " << pb.X()
649  << ", y: " << pb.Y()
650  << " z: " << pb.Z()
651  << " eta: " << pb.Eta()
652  << ", phi: " << pb.Phi()
653  << " rho: " << pb.Pt() << std::endl;
654 }
655 
656 //______________________________________________________________________________
657 
659 info(const DetId& id) {
660  std::ostringstream oss;
661 
662  oss << "DetId: " << id.rawId() << "\n";
663 
664  switch ( id.det() ) {
665 
666  case DetId::Tracker:
668  break;
669 
670  case DetId::Muon:
671  switch ( id.subdetId() ) {
672  case MuonSubdetId::DT:
673  {
674  DTChamberId detId(id.rawId());
675  oss << "DT chamber (wheel, station, sector): "
676  << detId.wheel() << ", "
677  << detId.station() << ", "
678  << detId.sector();
679  }
680  break;
681  case MuonSubdetId::CSC:
682  {
683  CSCDetId detId(id.rawId());
684  oss << "CSC chamber (endcap, station, ring, chamber, layer): "
685  << detId.endcap() << ", "
686  << detId.station() << ", "
687  << detId.ring() << ", "
688  << detId.chamber() << ", "
689  << detId.layer();
690  }
691  break;
692  case MuonSubdetId::RPC:
693  {
694  RPCDetId detId(id.rawId());
695  oss << "RPC chamber ";
696  switch ( detId.region() ) {
697  case 0:
698  oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): "
699  << detId.ring() << ", "
700  << detId.station() << ", "
701  << detId.sector() << ", "
702  << detId.layer() << ", "
703  << detId.subsector() << ", "
704  << detId.roll();
705  break;
706  case 1:
707  oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
708  << detId.ring() << ", "
709  << detId.station() << ", "
710  << detId.sector() << ", "
711  << detId.layer() << ", "
712  << detId.subsector() << ", "
713  << detId.roll();
714  break;
715  case -1:
716  oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
717  << detId.ring() << ", "
718  << detId.station() << ", "
719  << detId.sector() << ", "
720  << detId.layer() << ", "
721  << detId.subsector() << ", "
722  << detId.roll();
723  break;
724  }
725  }
726  break;
727  case MuonSubdetId::GEM:
728  {
729  GEMDetId detId(id.rawId());
730  oss << "GEM chamber (region, station, ring, chamber, layer): "
731  << detId.region() << ", "
732  << detId.station() << ", "
733  << detId.ring() << ", "
734  << detId.chamber() << ", "
735  << detId.layer();
736  }
737  break;
738  case MuonSubdetId::ME0:
739  {
740  ME0DetId detId(id.rawId());
741  oss << "ME0 chamber (region, chamber, layer): "
742  << detId.region() << ", "
743  << detId.chamber() << ", "
744  << detId.layer();
745  }
746  break;
747  }
748  break;
749 
750  case DetId::Calo:
751  {
752  CaloTowerDetId detId( id.rawId() );
753  oss << "CaloTower (ieta, iphi): "
754  << detId.ieta() << ", "
755  << detId.iphi();
756  }
757  break;
758 
759  case DetId::Ecal:
760  switch ( id.subdetId() ) {
761  case EcalBarrel:
762  {
763  EBDetId detId(id);
764  oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
765  << detId.ieta() << ", "
766  << detId.iphi() << ", "
767  << detId.tower_ieta() << ", "
768  << detId.tower_iphi();
769  }
770  break;
771  case EcalEndcap:
772  {
773  EEDetId detId(id);
774  oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
775  << detId.ix() << ", "
776  << detId.iy() << ", "
777  << detId.isc() << ", "
778  << detId.ic() << ", "
779  << detId.iquadrant();
780  }
781  break;
782  case EcalPreshower:
783  oss << "EcalPreshower";
784  break;
785  case EcalTriggerTower:
786  oss << "EcalTriggerTower";
787  break;
788  case EcalLaserPnDiode:
789  oss << "EcalLaserPnDiode";
790  break;
791  }
792  break;
793 
794  case DetId::Hcal:
795  {
796  HcalDetId detId(id);
797  switch ( detId.subdet() ) {
798  case HcalEmpty:
799  oss << "HcalEmpty ";
800  break;
801  case HcalBarrel:
802  oss << "HcalBarrel ";
803  break;
804  case HcalEndcap:
805  oss << "HcalEndcap ";
806  break;
807  case HcalOuter:
808  oss << "HcalOuter ";
809  break;
810  case HcalForward:
811  oss << "HcalForward ";
812  break;
813  case HcalTriggerTower:
814  oss << "HcalTriggerTower ";
815  break;
816  case HcalOther:
817  oss << "HcalOther ";
818  break;
819  }
820  oss << "(ieta, iphi, depth):"
821  << detId.ieta() << ", "
822  << detId.iphi() << ", "
823  << detId.depth();
824  }
825  break;
826  default :;
827  }
828  return oss.str();
829 }
830 
832 info(const std::set<DetId>& idSet) {
834  for(std::set<DetId>::const_iterator id = idSet.begin(), idEnd = idSet.end(); id != idEnd; ++id)
835  {
836  text += info(*id);
837  text += "\n";
838  }
839  return text;
840 }
841 
843 info(const std::vector<DetId>& idSet) {
845  for(std::vector<DetId>::const_iterator id = idSet.begin(), idEnd = idSet.end(); id != idEnd; ++id)
846  {
847  text += info(*id);
848  text += "\n";
849  }
850  return text;
851 }
852 }
ClusterRef cluster() const
dbl * delta
Definition: mlp_gen.cc:36
bool isAvailable() const
Definition: Ref.h:577
int chamber() const
Definition: CSCDetId.h:68
Master< F > master(const F &f)
Definition: FunctClone.h:68
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:453
int minPixelCol() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
int ix() const
Definition: EEDetId.h:76
int ic() const
Definition: EEDetId.cc:324
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:142
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:189
CaloTopology const * topology(0)
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:63
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
Definition: EBDetId.h:55
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:313
bool get(ProductID const &, Handle< T > &) const
Definition: EventBase.h:106
const FWGeometry * getGeom() const
Definition: Context.h:83
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.cc:114
int isc() const
Definition: EEDetId.cc:285
static const int GEM
Definition: MuonSubdetId.h:15
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
int ring() const
Definition: GEMDetId.h:59
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:50
int iquadrant() const
Definition: EEDetId.cc:264
uint16_t firstStrip() const
data_type const * const_iterator
Definition: DetSetNew.h:30
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
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
std::string print(DetId detid) const
int layer() const
Definition: CSCDetId.h:61
#define constexpr
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
Color_t color() const
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
Definition: TrackUtils.cc:262
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
int endcap() const
Definition: CSCDetId.h:93
static const int ME0
Definition: MuonSubdetId.h:16
int depth() const
get the tower depth
Definition: HcalDetId.h:162
Char_t transparency() const
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:51
static const int CSC
Definition: MuonSubdetId.h:13
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
int roll() const
Definition: RPCDetId.h:120
int minPixelRow() const
int ring() const
Definition: RPCDetId.h:72
double pt() const
track transverse momentum
Definition: TrackBase.h:621
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
Definition: TrackUtils.cc:329
static const double MICRON
Definition: TrackUtils.cc:57
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Definition: GEMDetId.h:69
int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:345
int iphi() const
get the tower iphi
int station() const
Station id : the station is the pair of chambers at same disk.
Definition: GEMDetId.h:64
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double f[11][100]
ClusterRef cluster() const
int iy() const
Definition: EEDetId.h:82
bool contains(unsigned int id) const
Definition: FWGeometry.h:113
#define end
Definition: vmac.h:39
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
Definition: TrackUtils.cc:578
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: GEMDetId.h:53
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:160
static Context * getInstance()
Definition: Context.cc:243
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
Definition: TrackUtils.cc:352
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:639
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:609
int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:216
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:669
int ring() const
Definition: CSCDetId.h:75
const edm::EventBase * getEvent() const
Definition: FWEventItem.h:148
int layer() const
Definition: RPCDetId.h:108
Definition: DetId.h:18
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
T const * product() const
Definition: Handle.h:81
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:45
#define fwLog(_level_)
Definition: fwLog.h:50
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:46
bool isValid() const
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
const_iterator find(id_type i, bool update=false) const
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:114
Pixel cluster – collection of neighboring pixels above threshold.
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:663
#define begin
Definition: vmac.h:32
iterator end()
Definition: DetSetNew.h:70
static const int RPC
Definition: MuonSubdetId.h:14
int sector() const
Definition: DTChamberId.h:61
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::string info(const DetId &)
Definition: TrackUtils.cc:659
col
Definition: cuy.py:1010
int station() const
Definition: CSCDetId.h:86
int charge() const
track electric charge
Definition: TrackBase.h:567
static const int DT
Definition: MuonSubdetId.h:12
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
Definition: ME0DetId.h:56
const TrackerTopology * getTrackerTopology() const
Definition: FWGeometry.h:129
DetId geographicalId() const
int ieta() const
get the tower ieta
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
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:519
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:80
void pushPixelCluster(std::vector< TVector3 > &pixelPoints, const FWGeometry &geom, DetId id, const SiPixelCluster &c, const float *pars)
Definition: TrackUtils.cc:625
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
Definition: TrackUtils.cc:307
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683
*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
Our base class.
Definition: SiPixelRecHit.h:23
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
iterator begin()
Definition: DetSetNew.h:67