CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MeasurementTracker.cc
Go to the documentation of this file.
2 
5 
11 
13 
15 
20 
22 
27 
33 
36 
39 
40 #include <iostream>
41 #include <typeinfo>
42 #include <map>
43 #include <algorithm>
44 
45 
46 // here just while testing
47 
48 #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ > 4)
49 #include <x86intrin.h>
50 
51 #else
52 
53 #ifdef __SSE2__
54 #include <mmintrin.h>
55 #include <emmintrin.h>
56 #endif
57 #ifdef __SSE3__
58 #include <pmmintrin.h>
59 #endif
60 #ifdef __SSE4_1__
61 #include <smmintrin.h>
62 #endif
63 
64 #endif
65 
66 
67 //
68 
69 using namespace std;
70 
71 namespace {
72 
73  struct CmpTKD {
74  bool operator()(MeasurementDet* rh, MeasurementDet* lh) {
75  return rh->geomDet().geographicalId().rawId() < lh->geomDet().geographicalId().rawId();
76  }
77  };
78 
79  template<typename TKD>
80  void sortTKD( std::vector<TKD*> & det) {
81  std::sort(det.begin(),det.end(),CmpTKD());
82  }
83 }
84 
85 
87  const PixelClusterParameterEstimator* pixelCPE,
88  const StripClusterParameterEstimator* stripCPE,
89  const SiStripRecHitMatcher* hitMatcher,
90  const TrackerGeometry* trackerGeom,
91  const GeometricSearchTracker* geometricSearchTracker,
92  const SiStripQuality *stripQuality,
93  int stripQualityFlags,
94  int stripQualityDebugFlags,
95  const SiPixelQuality *pixelQuality,
96  const SiPixelFedCabling *pixelCabling,
97  int pixelQualityFlags,
98  int pixelQualityDebugFlags,
99  bool isRegional) :
100  pset_(conf),
101  name_(conf.getParameter<std::string>("ComponentName")),
102  thePixelCPE(pixelCPE),theStripCPE(stripCPE),theHitMatcher(hitMatcher),
103  theTrackerGeom(trackerGeom),theGeometricSearchTracker(geometricSearchTracker),
104  theInactivePixelDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels")),
105  theInactiveStripDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels")),
106  isRegional_(isRegional)
107 {
108  this->initialize();
109  this->initializeStripStatus(stripQuality, stripQualityFlags, stripQualityDebugFlags);
110  this->initializePixelStatus(pixelQuality, pixelCabling, pixelQualityFlags, pixelQualityDebugFlags);
111  //the measurement tracking is set to skip clusters, the other option is set from outside
112  selfUpdateSkipClusters_=conf.exists("skipClusters");
114  {
115  edm::InputTag skip=conf.getParameter<edm::InputTag>("skipClusters");
116  if (skip==edm::InputTag("")) selfUpdateSkipClusters_=false;
117  }
118 
119  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
120 }
121 
123 {
124  for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
125  delete *it;
126  }
127 
128  for(vector<TkStripMeasurementDet*>::const_iterator it=theStripDets.begin(); it!=theStripDets.end(); ++it){
129  delete *it;
130  }
131 
132  for(vector<TkGluedMeasurementDet*>::const_iterator it=theGluedDets.begin(); it!=theGluedDets.end(); ++it){
133  delete *it;
134  }
135 }
136 
137 
139 {
140  addPixelDets( theTrackerGeom->detsPXB());
141  addPixelDets( theTrackerGeom->detsPXF());
142  addStripDets( theTrackerGeom->detsTIB());
143  addStripDets( theTrackerGeom->detsTID());
144  addStripDets( theTrackerGeom->detsTOB());
145  addStripDets( theTrackerGeom->detsTEC());
146 
147  sortTKD(theStripDets);
148  sortTKD(thePixelDets);
149  sortTKD(theGluedDets);
150 
151 }
152 
153 
155 {
156  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
157  gd != dets.end(); gd++) {
158  addPixelDet(*gd, thePixelCPE);
159  }
160 }
161 
163 {
164  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
165  gd != dets.end(); gd++) {
166 
167  const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(*gd);
168 
169  // StripSubdetector stripId( (**gd).geographicalId());
170  // bool isDetUnit( gdu != 0);
171  // cout << "StripSubdetector glued? " << stripId.glued()
172  // << " is DetUnit? " << isDetUnit << endl;
173 
174  if (gdu != 0) {
175  addStripDet(*gd, theStripCPE);
176  }
177  else {
178  const GluedGeomDet* gluedDet = dynamic_cast<const GluedGeomDet*>(*gd);
179  if (gluedDet == 0) {
180  throw MeasurementDetException("MeasurementTracker ERROR: GeomDet neither DetUnit nor GluedDet");
181  }
182  addGluedDet(gluedDet, theHitMatcher);
183  }
184  }
185 }
186 
188  const StripClusterParameterEstimator* cpe) const
189 {
190  try {
191  TkStripMeasurementDet* det = new TkStripMeasurementDet( gd, cpe,isRegional_);
192  theStripDets.push_back(det);
193  theDetMap[gd->geographicalId()] = det;
194  }
195  catch(MeasurementDetException& err){
196  edm::LogError("MeasurementDet") << "Oops, got a MeasurementDetException: " << err.what() ;
197  }
198 }
199 
201  const PixelClusterParameterEstimator* cpe) const
202 {
203  TkPixelMeasurementDet* det = new TkPixelMeasurementDet( gd, cpe);
204  thePixelDets.push_back(det);
205  theDetMap[gd->geographicalId()] = det;
206 }
207 
209  const SiStripRecHitMatcher* matcher) const
210 {
211  const MeasurementDet* monoDet = idToDet( gd->monoDet()->geographicalId());
212  if (monoDet == 0) {
213  addStripDet(gd->monoDet(), theStripCPE); // in case glued det comes before components
214  monoDet = idToDet( gd->monoDet()->geographicalId());
215  }
216 
217  const MeasurementDet* stereoDet = idToDet( gd->stereoDet()->geographicalId());
218  if (stereoDet == 0) {
219  addStripDet(gd->stereoDet(), theStripCPE); // in case glued det comes before components
220  stereoDet = idToDet( gd->stereoDet()->geographicalId());
221  }
222 
223  if (monoDet == 0 || stereoDet == 0) {
224  edm::LogError("MeasurementDet") << "MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
225  throw MeasurementDetException("MeasurementTracker ERROR: GluedDet components not found as MeasurementDets");
226  }
227 
228  TkGluedMeasurementDet* det = new TkGluedMeasurementDet( gd, theHitMatcher,
229  monoDet, stereoDet);
230  theGluedDets.push_back( det);
231  theDetMap[gd->geographicalId()] = det;
232 }
233 
235 {
236  updatePixels(event);
237  updateStrips(event);
238 
239  /*
240  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
241  i!=theStripDets.end(); i++) {
242  if( (*i)->isEmpty()){
243  std::cout << "stripDet id, #hits: "
244  << (*i)->geomDet().geographicalId().rawId() << " , "
245  << 0 << std::endl;
246  }else{
247  std::cout << "stripDet id, #hits: "
248  << (*i)->geomDet().geographicalId().rawId() << " , "
249  << (*i)->size() << std::endl;
250  }
251  }
252  */
253 }
255 {
256  LogDebug("MeasurementTracker")<<"setClusterToSkip";
257  if (selfUpdateSkipClusters_)
258  edm::LogError("MeasurementTracker")<<"this mode of operation is not supported, either the measurement tracker is set to skip clusters, or is being told to skip clusters. not both";
259 
261  event.getByLabel(cluster,pixelClusterRefs);
262  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
263  i!=thePixelDets.end(); i++) {
264  edmNew::DetSetVector<SiPixelClusterRefNew>::const_iterator f=pixelClusterRefs->find((**i).geomDet().geographicalId().rawId());
265  if (f!=pixelClusterRefs->end())
266  (**i).setClusterToSkip(f->begin(),f->end());
267  else
268  (**i).unset();
269  }
270 
272  event.getByLabel(cluster,stripClusterRefs);
273  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
274  i!=theStripDets.end(); i++){
275  edmNew::DetSetVector<TkStripMeasurementDet::SiStripClusterRef>::const_iterator f=stripClusterRefs->find((**i).geomDet().geographicalId().rawId());
276  if (f!=stripClusterRefs->end())
277  (**i).setClusterToSkip(f->begin(),f->end());
278  else
279  (**i).unset();
280  }
281 }
282 
284  LogDebug("MeasurementTracker")<<"unsetClusterToSkip";
285  if (selfUpdateSkipClusters_)
286  edm::LogError("MeasurementTracker")<<"this mode of operation is not supported, either the measurement tracker is set to skip clusters, or is being told to skip clusters. not both";
287 
288  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
289  i!=thePixelDets.end(); i++) {
290  (**i).unset();
291  }
292  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
293  i!=theStripDets.end(); i++){
294  (**i).unset();
295  }
296 }
297 
299 {
300  // avoid to update twice from the same event
301  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTracker::updatePixels::"+name_)) return;
302 
303  typedef edmNew::DetSet<SiPixelCluster> PixelDetSet;
304 
305  bool switchOffPixelsIfEmpty = (!pset_.existsAs<bool>("switchOffPixelsIfEmpty")) ||
306  (pset_.getParameter<bool>("switchOffPixelsIfEmpty"));
307 
308  std::vector<uint32_t> rawInactiveDetIds;
309  if (!theInactivePixelDetectorLabels.empty()) {
311  for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end();
312  itt != edt; ++itt) {
313  event.getByLabel(*itt, detIds);
314  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
315  }
316  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
317  }
318  // Pixel Clusters
319  std::string pixelClusterProducer = pset_.getParameter<std::string>("pixelClusterProducer");
320  if( pixelClusterProducer.empty() ) { //clusters have not been produced
321  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
322  i!=thePixelDets.end(); i++) {
323  if (switchOffPixelsIfEmpty) {
324  (**i).setActiveThisEvent(false);
325  }else{
326  (**i).setEmpty();
327  }
328  }
329  }else{
330 
332  if (selfUpdateSkipClusters_){
333  //and get the collection of pixel ref to skip
334  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),pixelClusterRefs);
335  LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
336  if (pixelClusterRefs.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters to skip";
337  }
338 
340  event.getByLabel(pixelClusterProducer, pixelClusters);
341  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
342 
343  if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
344  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
345  i!=thePixelDets.end(); i++) {
346  (**i).setActiveThisEvent(false);
347  }
348  } else {
349 
350  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
351  i!=thePixelDets.end(); i++) {
352 
353  // foreach det get cluster range
354  unsigned int id = (**i).geomDet().geographicalId().rawId();
355  if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
356  (**i).setActiveThisEvent(false); continue;
357  }
358  //FIXME
359  //fill the set with what needs to be skipped
361  if ( it != pixelCollection->end() ){
362  // push cluster range in det
363  (**i).update( *it, pixelClusters, id );
364  if (selfUpdateSkipClusters_){
366  if (f!=pixelClusterRefs->end())
367  (**i).setClusterToSkip(f->begin(),f->end());
368  }
369  }else{
370  (**i).setEmpty();
371  }
372  }
373  }
374  }
375 
376 
377 
378 }
379 
381  std::vector<uint32_t> & rawInactiveDetIds) const {
382  if (!theInactiveStripDetectorLabels.empty()) {
384  for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end();
385  itt != edt; ++itt) {
386  event.getByLabel(*itt, detIds);
387  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
388  }
389  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
390  }
391 }
392 
394 {
395  // avoid to update twice from the same event
396  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTracker::updateStrips::"+name_)) return;
397 
398  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
399 
400  std::vector<uint32_t> rawInactiveDetIds;
401  getInactiveStrips(event,rawInactiveDetIds);
402 
403  // Strip Clusters
404  std::string stripClusterProducer = pset_.getParameter<std::string>("stripClusterProducer");
405  //first clear all of them
406 
407  {
408  std::vector<TkStripMeasurementDet*>::const_iterator end = theStripDets.end()-200;
409  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
410  i!=end; i++) {
411  (**i).setEmpty();
412 #ifdef __SSE2__
413  _mm_prefetch(((char *)(*(i+200))),_MM_HINT_T0);
414 #endif
415  }
416  for (std::vector<TkStripMeasurementDet*>::const_iterator i=end;
417  i!=theStripDets.end(); i++)
418  (**i).setEmpty();
419  }
420  if( !stripClusterProducer.compare("") ) { //clusters have not been produced
421  }else{
422  //========= actually load cluster =============
423  if(!isRegional_){
425  if (selfUpdateSkipClusters_){
426  //and get the collection of pixel ref to skip
427  LogDebug("MeasurementTracker")<<"getting strp refs to skip";
428  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterRefs);
429  if (stripClusterRefs.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
430  }
431 
433  event.getByLabel(stripClusterProducer, clusterHandle);
434  const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
435 
436  std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
437  std::vector<TkStripMeasurementDet*>::const_iterator endDet=theStripDets.end();
438  edmNew::DetSetVector<SiStripCluster>::const_iterator it = (*clusterCollection).begin();
439  edmNew::DetSetVector<SiStripCluster>::const_iterator endColl = (*clusterCollection).end();
440  // cluster and det and in order (both) and unique so let's use set intersection
441  for (;it!=endColl; ++it) {
442  StripDetSet detSet = *it;
443  unsigned int id = detSet.id();
444  while ( id != (**i).rawId()) { // eventually change to lower_range
445  ++i;
446  if (i==endDet) throw "we have a problem!!!!";
447  }
448 
449  if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
450  (**i).setActiveThisEvent(false); continue;
451  }
452  // push cluster range in det
453 
454  (**i).update( detSet, clusterHandle, id );
455  if (selfUpdateSkipClusters_){
457  if (f!=stripClusterRefs->end())
458  (**i).setClusterToSkip(f->begin(),f->end());
459  }
460  }
461  }else{
462 
464  if(selfUpdateSkipClusters_){
465  LogDebug("MeasurementTracker")<<"getting reg strp refs to skip";
466  event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterRefs);
467  if (stripClusterRefs.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
468  }
469 
470  //then set the not-empty ones only
472  event.getByLabel(stripClusterProducer, refClusterHandle);
473 
474  std::string lazyGetter = pset_.getParameter<std::string>("stripLazyGetterProducer");
476  event.getByLabel(lazyGetter,lazyClusterHandle);
477 
478  uint32_t tmpId=0;
479  vector<SiStripCluster>::const_iterator beginIterator;
480  edm::RefGetter<SiStripCluster>::const_iterator iregion = refClusterHandle->begin();
481  for(;iregion!=refClusterHandle->end();++iregion) {
482  const edm::RegionIndex<SiStripCluster>& region = *iregion;
483  vector<SiStripCluster>::const_iterator icluster = region.begin();
484  const vector<SiStripCluster>::const_iterator endIterator = region.end();
485  tmpId = icluster->geographicalId();
486  beginIterator = icluster;
487 
488  //std::cout << "== tmpId ad inizio loop dentro region: " << tmpId << std::endl;
489 
490  for (;icluster!=endIterator;icluster++) {
491  //std::cout << "===== cluster id,pos "
492  // << icluster->geographicalId() << " , " << icluster->barycenter()
493  // << std::endl;
494  //std::cout << "=====making ref in recHits() " << std::endl;
495  if( icluster->geographicalId() != tmpId){
496  //std::cout << "geo!=tmpId" << std::endl;
497  //we should find a way to avoid this casting. it is slow
498  //create also another map for TkStripMeasurementDet ??
499 
500  // the following castings are really ugly. To be corrected ASAP
501  const TkStripMeasurementDet* theConcreteDet =
502  dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
503 
504  if(theConcreteDet == 0)
505  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
506  TkStripMeasurementDet* theConcreteDetUpdatable =
507  const_cast<TkStripMeasurementDet*>(theConcreteDet);
508  theConcreteDetUpdatable->update(beginIterator,icluster,lazyClusterHandle,tmpId);
509  if (selfUpdateSkipClusters_){
511  if (f!=stripClusterRefs->end())
512  theConcreteDetUpdatable->setRegionalClustersToSkip(f->begin(),f->end());
513  }
514  //cannot we avoid to update the det with detId of itself??
515 
516  tmpId = icluster->geographicalId();
517  beginIterator = icluster;
518  if( icluster == (endIterator-1)){
519  const TkStripMeasurementDet* theConcreteDet =
520  dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
521 
522  if(theConcreteDet == 0)
523  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
524  TkStripMeasurementDet* theConcreteDetUpdatable =
525  const_cast<TkStripMeasurementDet*>(theConcreteDet);
526  theConcreteDetUpdatable->update(icluster,endIterator,lazyClusterHandle,tmpId);
527  if (selfUpdateSkipClusters_){
529  if (f!=stripClusterRefs->end())
530  theConcreteDetUpdatable->setRegionalClustersToSkip(f->begin(),f->end());
531  }
532  }
533  }else if( icluster == (endIterator-1)){
534  const TkStripMeasurementDet* theConcreteDet =
535  dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
536 
537  if(theConcreteDet == 0)
538  throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
539  TkStripMeasurementDet* theConcreteDetUpdatable =
540  const_cast<TkStripMeasurementDet*>(theConcreteDet);
541  //std::cout << "=== option3. fill det with id,#clust: " << tmpId << " , "
542  // << iregion->end() - beginIterator << std::endl;
543  theConcreteDetUpdatable->update(beginIterator,endIterator,lazyClusterHandle,tmpId);
544  if (selfUpdateSkipClusters_){
546  if (f!=stripClusterRefs->end())
547  theConcreteDetUpdatable->setRegionalClustersToSkip(f->begin(),f->end());
548  }
549  }
550  }//end loop cluster in one ragion
551  }
552  }//end of block for updating with regional clusters
553  }
554 }
555 
556 
557 
558 const MeasurementDet*
560 {
561  std::map<DetId,MeasurementDet*>::const_iterator it = theDetMap.find(id);
562  if(it !=theDetMap.end()) {
563  return it->second;
564  }else{
565  //throw exception;
566  }
567 
568  return 0; //to avoid compile warning
569 }
570 
571 void MeasurementTracker::initializeStripStatus(const SiStripQuality *quality, int qualityFlags, int qualityDebugFlags) const {
572  TkStripMeasurementDet::BadStripCuts badStripCuts[4];
573  if (qualityFlags & BadStrips) {
574  edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
579  }
580 
581  if ((quality != 0) && (qualityFlags != 0)) {
582  edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
583  unsigned int on = 0, tot = 0;
584  unsigned int foff = 0, ftot = 0, aoff = 0, atot = 0;
585  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
586  i!=theStripDets.end(); i++) {
587  uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
588  if (qualityFlags & BadModules) {
589  bool isOn = quality->IsModuleUsable(detid);
590  (*i)->setActive(isOn);
591  tot++; on += (unsigned int) isOn;
592  if (qualityDebugFlags & BadModules) {
593  edm::LogInfo("MeasurementTracker")<< "MeasurementTracker::initializeStripStatus : detid " << detid << " is " << (isOn ? "on" : "off");
594  }
595  } else {
596  (*i)->setActive(true);
597  }
598  // first turn all APVs and fibers ON
599  (*i)->set128StripStatus(true);
600  if (qualityFlags & BadAPVFibers) {
601  short badApvs = quality->getBadApvs(detid);
602  short badFibers = quality->getBadFibers(detid);
603  for (int j = 0; j < 6; j++) {
604  atot++;
605  if (badApvs & (1 << j)) {
606  (*i)->set128StripStatus(false, j);
607  aoff++;
608  }
609  }
610  for (int j = 0; j < 3; j++) {
611  ftot++;
612  if (badFibers & (1 << j)) {
613  (*i)->set128StripStatus(false, 2*j);
614  (*i)->set128StripStatus(false, 2*j+1);
615  foff++;
616  }
617  }
618  (*i)->setMaskBad128StripBlocks((qualityFlags & MaskBad128StripBlocks) != 0);
619  }
620  std::vector<TkStripMeasurementDet::BadStripBlock> &badStrips = (*i)->getBadStripBlocks();
621  badStrips.clear();
622  if (qualityFlags & BadStrips) {
623  SiStripBadStrip::Range range = quality->getRange(detid);
624  for (SiStripBadStrip::ContainerIterator bit = range.first; bit != range.second; ++bit) {
625  badStrips.push_back(quality->decode(*bit));
626  }
627  (*i)->setBadStripCuts(badStripCuts[SiStripDetId(detid).subdetId()-3]);
628  }
629  }
630  if (qualityDebugFlags & BadModules) {
631  edm::LogInfo("MeasurementTracker StripModuleStatus") <<
632  " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
633  }
634  if (qualityDebugFlags & BadAPVFibers) {
635  edm::LogInfo("MeasurementTracker StripAPVStatus") <<
636  " Total APVs: " << atot << ", active " << (atot-aoff) <<", inactive " << (aoff);
637  edm::LogInfo("MeasurementTracker StripFiberStatus") <<
638  " Total Fibers: " << ftot << ", active " << (ftot-foff) <<", inactive " << (foff);
639  }
640  } else {
641  for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
642  i!=theStripDets.end(); i++) {
643  (*i)->setActive(true); // module ON
644  (*i)->set128StripStatus(true); // all APVs and fibers ON
645  }
646  }
647 }
648 
649 void MeasurementTracker::initializePixelStatus(const SiPixelQuality *quality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags) const {
650  if ((quality != 0) && (qualityFlags != 0)) {
651  edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
652  unsigned int on = 0, tot = 0, badrocs = 0;
653  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
654  i!=thePixelDets.end(); i++) {
655  uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
656  if (qualityFlags & BadModules) {
657  bool isOn = quality->IsModuleUsable(detid);
658  (*i)->setActive(isOn);
659  tot++; on += (unsigned int) isOn;
660  if (qualityDebugFlags & BadModules) {
661  edm::LogInfo("MeasurementTracker")<< "MeasurementTracker::initializePixelStatus : detid " << detid << " is " << (isOn ? "on" : "off");
662  }
663  } else {
664  (*i)->setActive(true);
665  }
666  if ((qualityFlags & BadROCs) && (quality->getBadRocs(detid) != 0)) {
667  std::vector<LocalPoint> badROCs = quality->getBadRocPositions(detid, *theTrackerGeom, pixelCabling);
668  badrocs += badROCs.size();
669  (*i)->setBadRocPositions(badROCs);
670  } else {
671  (*i)->clearBadRocPositions();
672  }
673  }
674  if (qualityDebugFlags & BadModules) {
675  edm::LogInfo("MeasurementTracker PixelModuleStatus") <<
676  " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
677  }
678  if (qualityDebugFlags & BadROCs) {
679  edm::LogInfo("MeasurementTracker PixelROCStatus") << " Total of bad ROCs: " << badrocs ;
680  }
681  } else {
682  for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
683  i!=thePixelDets.end(); i++) {
684  (*i)->setActive(true); // module ON
685  }
686  }
687 }
688 
#define LogDebug(id)
virtual char const * what() const
Definition: Exception.cc:97
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
short getBadFibers(const uint32_t &detid) const
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
void setRegionalClustersToSkip(IT begin, IT end)
void updateStrips(const edm::Event &) const
virtual void update(const edm::Event &) const
std::vector< unsigned int >::const_iterator ContainerIterator
virtual const GeomDet & geomDet() const
const_iterator end() const
Get off the end iterator.
Definition: LazyGetter.h:189
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool int lh
Definition: SSEVec.h:37
std::vector< GeomDet * > DetContainer
const_iterator find(id_type i) const
id_type id(size_t cell) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void updatePixels(const edm::Event &) const
short getBadApvs(const uint32_t &detid) const
bool IsModuleUsable(const uint32_t &detid) const
const std::vector< LocalPoint > getBadRocPositions(const uint32_t &detid, const TrackerGeometry &theTracker, const SiPixelFedCabling *map) const
int j
Definition: DBlmapReader.cc:9
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
double f[11][100]
#define end
Definition: vmac.h:38
const_iterator end() const
bool IsModuleUsable(const uint32_t &detid) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const_iterator begin() const
Get begin iterator.
Definition: LazyGetter.h:180
tuple conf
Definition: dbtoconf.py:185
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
void update(const detset &detSet, const edm::Handle< edmNew::DetSetVector< SiStripCluster > > h, unsigned int id)
bool failedToGet() const
Definition: HandleBase.h:80
void addGluedDet(const GluedGeomDet *gd, const SiStripRecHitMatcher *matcher) const
Definition: DetId.h:20
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
Definition: RefGetter.h:25
MeasurementTracker(const edm::ParameterSet &conf, const PixelClusterParameterEstimator *pixelCPE, const StripClusterParameterEstimator *stripCPE, const SiStripRecHitMatcher *hitMatcher, const TrackerGeometry *trackerGeom, const GeometricSearchTracker *geometricSearchTracker, const SiStripQuality *stripQuality, int stripQualityFlags, int stripQualityDebugFlags, const SiPixelQuality *pixelQuality, const SiPixelFedCabling *pixelCabling, int pixelQualityFlags, int pixelQualityDebugFlags, bool isRegional=false)
virtual const MeasurementDet * idToDet(const DetId &id) const
MeasurementDetSystem interface.
const Range getRange(const uint32_t &detID) const
T const * product() const
Definition: Handle.h:74
short getBadRocs(const uint32_t &detid) const
std::pair< ContainerIterator, ContainerIterator > Range
void initializeStripStatus(const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags) const
void setClusterToSkip(const edm::InputTag &cluster, const edm::Event &event) const
void addPixelDet(const GeomDet *gd, const PixelClusterParameterEstimator *cpe) const
void addStripDet(const GeomDet *gd, const StripClusterParameterEstimator *cpe) const
void addStripDets(const TrackingGeometry::DetContainer &dets) const
void addPixelDets(const TrackingGeometry::DetContainer &dets) const
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
data decode(const unsigned int &value) const
void initializePixelStatus(const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags) const
void unsetClusterToSkip() const