CMS 3D CMS Logo

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