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