00001 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
00002
00003 #include "FWCore/Framework/interface/ESHandle.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005
00006 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00007 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00008 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00009 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00010 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00011
00012 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00013
00014 #include "DataFormats/DetId/interface/DetIdCollection.h"
00015
00016 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00017 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00018 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00019 #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
00020
00021 #include "TrackingTools/MeasurementDet/interface/MeasurementDetException.h"
00022
00023 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
00024 #include "RecoLocalTracker/Records/interface/TrackerCPERecord.h"
00025 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h"
00026 #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h"
00027
00028 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00029 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
00030 #include "RecoTracker/MeasurementDet/interface/TkStripMeasurementDet.h"
00031 #include "RecoTracker/MeasurementDet/interface/TkPixelMeasurementDet.h"
00032 #include "RecoTracker/MeasurementDet/interface/TkGluedMeasurementDet.h"
00033
00034 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00035 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00036
00037 #include "FWCore/ServiceRegistry/interface/Service.h"
00038 #include "FWCore/Services/interface/UpdaterService.h"
00039
00040 #include <iostream>
00041 #include <typeinfo>
00042 #include <map>
00043 #include <algorithm>
00044
00045
00046
00047
00048 #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ > 4)
00049 #include <x86intrin.h>
00050
00051 #else
00052
00053 #ifdef __SSE2__
00054 #include <mmintrin.h>
00055 #include <emmintrin.h>
00056 #endif
00057 #ifdef __SSE3__
00058 #include <pmmintrin.h>
00059 #endif
00060 #ifdef __SSE4_1__
00061 #include <smmintrin.h>
00062 #endif
00063
00064 #endif
00065
00066
00067
00068
00069 using namespace std;
00070
00071 namespace {
00072
00073 struct CmpTKD {
00074 bool operator()(MeasurementDet* rh, MeasurementDet* lh) {
00075 return rh->geomDet().geographicalId().rawId() < lh->geomDet().geographicalId().rawId();
00076 }
00077 };
00078
00079 template<typename TKD>
00080 void sortTKD( std::vector<TKD*> & det) {
00081 std::sort(det.begin(),det.end(),CmpTKD());
00082 }
00083 }
00084
00085
00086 MeasurementTracker::MeasurementTracker(const edm::ParameterSet& conf,
00087 const PixelClusterParameterEstimator* pixelCPE,
00088 const StripClusterParameterEstimator* stripCPE,
00089 const SiStripRecHitMatcher* hitMatcher,
00090 const TrackerGeometry* trackerGeom,
00091 const GeometricSearchTracker* geometricSearchTracker,
00092 const SiStripQuality *stripQuality,
00093 int stripQualityFlags,
00094 int stripQualityDebugFlags,
00095 const SiPixelQuality *pixelQuality,
00096 const SiPixelFedCabling *pixelCabling,
00097 int pixelQualityFlags,
00098 int pixelQualityDebugFlags,
00099 bool isRegional) :
00100 pset_(conf),
00101 name_(conf.getParameter<std::string>("ComponentName")),
00102 thePixelCPE(pixelCPE),theStripCPE(stripCPE),theHitMatcher(hitMatcher),
00103 theTrackerGeom(trackerGeom),theGeometricSearchTracker(geometricSearchTracker),
00104 theInactivePixelDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels")),
00105 theInactiveStripDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels")),
00106 isRegional_(isRegional)
00107 {
00108 this->initialize();
00109 this->initializeStripStatus(stripQuality, stripQualityFlags, stripQualityDebugFlags);
00110 this->initializePixelStatus(pixelQuality, pixelCabling, pixelQualityFlags, pixelQualityDebugFlags);
00111 }
00112
00113 MeasurementTracker::~MeasurementTracker()
00114 {
00115 for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
00116 delete *it;
00117 }
00118
00119 for(vector<TkStripMeasurementDet*>::const_iterator it=theStripDets.begin(); it!=theStripDets.end(); ++it){
00120 delete *it;
00121 }
00122
00123 for(vector<TkGluedMeasurementDet*>::const_iterator it=theGluedDets.begin(); it!=theGluedDets.end(); ++it){
00124 delete *it;
00125 }
00126 }
00127
00128
00129 void MeasurementTracker::initialize() const
00130 {
00131 addPixelDets( theTrackerGeom->detsPXB());
00132 addPixelDets( theTrackerGeom->detsPXF());
00133 addStripDets( theTrackerGeom->detsTIB());
00134 addStripDets( theTrackerGeom->detsTID());
00135 addStripDets( theTrackerGeom->detsTOB());
00136 addStripDets( theTrackerGeom->detsTEC());
00137
00138 sortTKD(theStripDets);
00139 sortTKD(thePixelDets);
00140 sortTKD(theGluedDets);
00141
00142 }
00143
00144
00145 void MeasurementTracker::addPixelDets( const TrackingGeometry::DetContainer& dets) const
00146 {
00147 for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
00148 gd != dets.end(); gd++) {
00149 addPixelDet(*gd, thePixelCPE);
00150 }
00151 }
00152
00153 void MeasurementTracker::addStripDets( const TrackingGeometry::DetContainer& dets) const
00154 {
00155 for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
00156 gd != dets.end(); gd++) {
00157
00158 const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(*gd);
00159
00160
00161
00162
00163
00164
00165 if (gdu != 0) {
00166 addStripDet(*gd, theStripCPE);
00167 }
00168 else {
00169 const GluedGeomDet* gluedDet = dynamic_cast<const GluedGeomDet*>(*gd);
00170 if (gluedDet == 0) {
00171 throw MeasurementDetException("MeasurementTracker ERROR: GeomDet neither DetUnit nor GluedDet");
00172 }
00173 addGluedDet(gluedDet, theHitMatcher);
00174 }
00175 }
00176 }
00177
00178 void MeasurementTracker::addStripDet( const GeomDet* gd,
00179 const StripClusterParameterEstimator* cpe) const
00180 {
00181 try {
00182 TkStripMeasurementDet* det = new TkStripMeasurementDet( gd, cpe,isRegional_);
00183 theStripDets.push_back(det);
00184 theDetMap[gd->geographicalId()] = det;
00185 }
00186 catch(MeasurementDetException& err){
00187 edm::LogError("MeasurementDet") << "Oops, got a MeasurementDetException: " << err.what() ;
00188 }
00189 }
00190
00191 void MeasurementTracker::addPixelDet( const GeomDet* gd,
00192 const PixelClusterParameterEstimator* cpe) const
00193 {
00194 TkPixelMeasurementDet* det = new TkPixelMeasurementDet( gd, cpe);
00195 thePixelDets.push_back(det);
00196 theDetMap[gd->geographicalId()] = det;
00197 }
00198
00199 void MeasurementTracker::addGluedDet( const GluedGeomDet* gd,
00200 const SiStripRecHitMatcher* matcher) const
00201 {
00202 const MeasurementDet* monoDet = idToDet( gd->monoDet()->geographicalId());
00203 if (monoDet == 0) {
00204 addStripDet(gd->monoDet(), theStripCPE);
00205 monoDet = idToDet( gd->monoDet()->geographicalId());
00206 }
00207
00208 const MeasurementDet* stereoDet = idToDet( gd->stereoDet()->geographicalId());
00209 if (stereoDet == 0) {
00210 addStripDet(gd->stereoDet(), theStripCPE);
00211 stereoDet = idToDet( gd->stereoDet()->geographicalId());
00212 }
00213
00214 if (monoDet == 0 || stereoDet == 0) {
00215 edm::LogError("MeasurementDet") << "MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
00216 throw MeasurementDetException("MeasurementTracker ERROR: GluedDet components not found as MeasurementDets");
00217 }
00218
00219 TkGluedMeasurementDet* det = new TkGluedMeasurementDet( gd, theHitMatcher,
00220 monoDet, stereoDet);
00221 theGluedDets.push_back( det);
00222 theDetMap[gd->geographicalId()] = det;
00223 }
00224
00225 void MeasurementTracker::update( const edm::Event& event) const
00226 {
00227 updatePixels(event);
00228 updateStrips(event);
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244 }
00245
00246
00247 void MeasurementTracker::updatePixels( const edm::Event& event) const
00248 {
00249
00250 if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTracker::updatePixels::"+name_)) return;
00251
00252 typedef edmNew::DetSet<SiPixelCluster> PixelDetSet;
00253
00254 bool switchOffPixelsIfEmpty = (!pset_.existsAs<bool>("switchOffPixelsIfEmpty")) ||
00255 (pset_.getParameter<bool>("switchOffPixelsIfEmpty"));
00256
00257 std::vector<uint32_t> rawInactiveDetIds;
00258 if (!theInactivePixelDetectorLabels.empty()) {
00259 edm::Handle<DetIdCollection> detIds;
00260 for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end();
00261 itt != edt; ++itt) {
00262 event.getByLabel(*itt, detIds);
00263 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
00264 }
00265 if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
00266 }
00267
00268 std::string pixelClusterProducer = pset_.getParameter<std::string>("pixelClusterProducer");
00269 if( pixelClusterProducer.empty() ) {
00270 for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
00271 i!=thePixelDets.end(); i++) {
00272 if (switchOffPixelsIfEmpty) {
00273 (**i).setActiveThisEvent(false);
00274 }else{
00275 (**i).setEmpty();
00276 }
00277 }
00278 }else{
00279 edm::Handle<edmNew::DetSetVector<SiPixelCluster> > pixelClusters;
00280 event.getByLabel(pixelClusterProducer, pixelClusters);
00281 const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
00282
00283 if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
00284 for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
00285 i!=thePixelDets.end(); i++) {
00286 (**i).setActiveThisEvent(false);
00287 }
00288 } else {
00289 for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
00290 i!=thePixelDets.end(); i++) {
00291
00292
00293 unsigned int id = (**i).geomDet().geographicalId().rawId();
00294 if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
00295 (**i).setActiveThisEvent(false); continue;
00296 }
00297 edmNew::DetSetVector<SiPixelCluster>::const_iterator it = pixelCollection->find( id );
00298 if ( it != pixelCollection->end() ){
00299
00300 (**i).update( *it, pixelClusters, id );
00301 }else{
00302 (**i).setEmpty();
00303 }
00304 }
00305 }
00306 }
00307
00308 }
00309
00310 void MeasurementTracker::updateStrips( const edm::Event& event) const
00311 {
00312
00313 if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTracker::updateStrips::"+name_)) return;
00314
00315 typedef edmNew::DetSet<SiStripCluster> StripDetSet;
00316
00317 std::vector<uint32_t> rawInactiveDetIds;
00318 if (!theInactiveStripDetectorLabels.empty()) {
00319 edm::Handle<DetIdCollection> detIds;
00320 for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end();
00321 itt != edt; ++itt) {
00322 event.getByLabel(*itt, detIds);
00323 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
00324 }
00325 if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
00326 }
00327
00328
00329 std::string stripClusterProducer = pset_.getParameter<std::string>("stripClusterProducer");
00330
00331
00332 {
00333 std::vector<TkStripMeasurementDet*>::const_iterator end = theStripDets.end()-200;
00334 for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
00335 i!=end; i++) {
00336 (**i).setEmpty();
00337 #ifdef __SSE2__
00338 _mm_prefetch(((char *)(*(i+200))),_MM_HINT_T0);
00339 #endif
00340 }
00341 for (std::vector<TkStripMeasurementDet*>::const_iterator i=end;
00342 i!=theStripDets.end(); i++)
00343 (**i).setEmpty();
00344 }
00345 if( !stripClusterProducer.compare("") ) {
00346 }else{
00347
00348 if(!isRegional_){
00349 edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusterHandle;
00350 event.getByLabel(stripClusterProducer, clusterHandle);
00351 const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
00352
00353 std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
00354 std::vector<TkStripMeasurementDet*>::const_iterator endDet=theStripDets.end();
00355 edmNew::DetSetVector<SiStripCluster>::const_iterator it = (*clusterCollection).begin();
00356 edmNew::DetSetVector<SiStripCluster>::const_iterator endColl = (*clusterCollection).end();
00357
00358 for (;it!=endColl; ++it) {
00359 StripDetSet detSet = *it;
00360 unsigned int id = detSet.id();
00361 while ( id != (**i).rawId()) {
00362 ++i;
00363 if (i==endDet) throw "we have a problem!!!!";
00364 }
00365
00366 if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
00367 (**i).setActiveThisEvent(false); continue;
00368 }
00369
00370 (**i).update( detSet, clusterHandle, id );
00371
00372 }
00373 }else{
00374
00375
00376 edm::Handle<edm::RefGetter<SiStripCluster> > refClusterHandle;
00377 event.getByLabel(stripClusterProducer, refClusterHandle);
00378
00379 std::string lazyGetter = pset_.getParameter<std::string>("stripLazyGetterProducer");
00380 edm::Handle<edm::LazyGetter<SiStripCluster> > lazyClusterHandle;
00381 event.getByLabel(lazyGetter,lazyClusterHandle);
00382
00383 uint32_t tmpId=0;
00384 vector<SiStripCluster>::const_iterator beginIterator;
00385 edm::RefGetter<SiStripCluster>::const_iterator iregion = refClusterHandle->begin();
00386 for(;iregion!=refClusterHandle->end();++iregion) {
00387 const edm::RegionIndex<SiStripCluster>& region = *iregion;
00388 vector<SiStripCluster>::const_iterator icluster = region.begin();
00389 const vector<SiStripCluster>::const_iterator endIterator = region.end();
00390 tmpId = icluster->geographicalId();
00391 beginIterator = icluster;
00392
00393
00394
00395 for (;icluster!=endIterator;icluster++) {
00396
00397
00398
00399
00400 if( icluster->geographicalId() != tmpId){
00401
00402
00403
00404
00405
00406 const TkStripMeasurementDet* theConcreteDet =
00407 dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
00408
00409 if(theConcreteDet == 0)
00410 throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
00411 TkStripMeasurementDet* theConcreteDetUpdatable =
00412 const_cast<TkStripMeasurementDet*>(theConcreteDet);
00413 theConcreteDetUpdatable->update(beginIterator,icluster,lazyClusterHandle,tmpId);
00414
00415
00416 tmpId = icluster->geographicalId();
00417 beginIterator = icluster;
00418 if( icluster == (endIterator-1)){
00419 const TkStripMeasurementDet* theConcreteDet =
00420 dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
00421
00422 if(theConcreteDet == 0)
00423 throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
00424 TkStripMeasurementDet* theConcreteDetUpdatable =
00425 const_cast<TkStripMeasurementDet*>(theConcreteDet);
00426 theConcreteDetUpdatable->update(icluster,endIterator,lazyClusterHandle,tmpId);
00427 }
00428 }else if( icluster == (endIterator-1)){
00429 const TkStripMeasurementDet* theConcreteDet =
00430 dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
00431
00432 if(theConcreteDet == 0)
00433 throw MeasurementDetException("failed casting to TkStripMeasurementDet*");
00434 TkStripMeasurementDet* theConcreteDetUpdatable =
00435 const_cast<TkStripMeasurementDet*>(theConcreteDet);
00436
00437
00438 theConcreteDetUpdatable->update(beginIterator,endIterator,lazyClusterHandle,tmpId);
00439 }
00440 }
00441 }
00442 }
00443 }
00444
00445 }
00446
00447
00448
00449 const MeasurementDet*
00450 MeasurementTracker::idToDet(const DetId& id) const
00451 {
00452 std::map<DetId,MeasurementDet*>::const_iterator it = theDetMap.find(id);
00453 if(it !=theDetMap.end()) {
00454 return it->second;
00455 }else{
00456
00457 }
00458
00459 return 0;
00460 }
00461
00462 void MeasurementTracker::initializeStripStatus(const SiStripQuality *quality, int qualityFlags, int qualityDebugFlags) const {
00463 TkStripMeasurementDet::BadStripCuts badStripCuts[4];
00464 if (qualityFlags & BadStrips) {
00465 edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
00466 badStripCuts[SiStripDetId::TIB-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TIB"));
00467 badStripCuts[SiStripDetId::TOB-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TOB"));
00468 badStripCuts[SiStripDetId::TID-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TID"));
00469 badStripCuts[SiStripDetId::TEC-3] = TkStripMeasurementDet::BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TEC"));
00470 }
00471
00472 if ((quality != 0) && (qualityFlags != 0)) {
00473 edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
00474 unsigned int on = 0, tot = 0;
00475 unsigned int foff = 0, ftot = 0, aoff = 0, atot = 0;
00476 for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
00477 i!=theStripDets.end(); i++) {
00478 uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
00479 if (qualityFlags & BadModules) {
00480 bool isOn = quality->IsModuleUsable(detid);
00481 (*i)->setActive(isOn);
00482 tot++; on += (unsigned int) isOn;
00483 if (qualityDebugFlags & BadModules) {
00484 edm::LogInfo("MeasurementTracker")<< "MeasurementTracker::initializeStripStatus : detid " << detid << " is " << (isOn ? "on" : "off");
00485 }
00486 } else {
00487 (*i)->setActive(true);
00488 }
00489
00490 (*i)->set128StripStatus(true);
00491 if (qualityFlags & BadAPVFibers) {
00492 short badApvs = quality->getBadApvs(detid);
00493 short badFibers = quality->getBadFibers(detid);
00494 for (int j = 0; j < 6; j++) {
00495 atot++;
00496 if (badApvs & (1 << j)) {
00497 (*i)->set128StripStatus(false, j);
00498 aoff++;
00499 }
00500 }
00501 for (int j = 0; j < 3; j++) {
00502 ftot++;
00503 if (badFibers & (1 << j)) {
00504 (*i)->set128StripStatus(false, 2*j);
00505 (*i)->set128StripStatus(false, 2*j+1);
00506 foff++;
00507 }
00508 }
00509 (*i)->setMaskBad128StripBlocks((qualityFlags & MaskBad128StripBlocks) != 0);
00510 }
00511 std::vector<TkStripMeasurementDet::BadStripBlock> &badStrips = (*i)->getBadStripBlocks();
00512 badStrips.clear();
00513 if (qualityFlags & BadStrips) {
00514 SiStripBadStrip::Range range = quality->getRange(detid);
00515 for (SiStripBadStrip::ContainerIterator bit = range.first; bit != range.second; ++bit) {
00516 badStrips.push_back(quality->decode(*bit));
00517 }
00518 (*i)->setBadStripCuts(badStripCuts[SiStripDetId(detid).subdetId()-3]);
00519 }
00520 }
00521 if (qualityDebugFlags & BadModules) {
00522 edm::LogInfo("MeasurementTracker StripModuleStatus") <<
00523 " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
00524 }
00525 if (qualityDebugFlags & BadAPVFibers) {
00526 edm::LogInfo("MeasurementTracker StripAPVStatus") <<
00527 " Total APVs: " << atot << ", active " << (atot-aoff) <<", inactive " << (aoff);
00528 edm::LogInfo("MeasurementTracker StripFiberStatus") <<
00529 " Total Fibers: " << ftot << ", active " << (ftot-foff) <<", inactive " << (foff);
00530 }
00531 } else {
00532 for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
00533 i!=theStripDets.end(); i++) {
00534 (*i)->setActive(true);
00535 (*i)->set128StripStatus(true);
00536 }
00537 }
00538 }
00539
00540 void MeasurementTracker::initializePixelStatus(const SiPixelQuality *quality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags) const {
00541 if ((quality != 0) && (qualityFlags != 0)) {
00542 edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
00543 unsigned int on = 0, tot = 0, badrocs = 0;
00544 for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
00545 i!=thePixelDets.end(); i++) {
00546 uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
00547 if (qualityFlags & BadModules) {
00548 bool isOn = quality->IsModuleUsable(detid);
00549 (*i)->setActive(isOn);
00550 tot++; on += (unsigned int) isOn;
00551 if (qualityDebugFlags & BadModules) {
00552 edm::LogInfo("MeasurementTracker")<< "MeasurementTracker::initializePixelStatus : detid " << detid << " is " << (isOn ? "on" : "off");
00553 }
00554 } else {
00555 (*i)->setActive(true);
00556 }
00557 if ((qualityFlags & BadROCs) && (quality->getBadRocs(detid) != 0)) {
00558 std::vector<LocalPoint> badROCs = quality->getBadRocPositions(detid, *theTrackerGeom, pixelCabling);
00559 badrocs += badROCs.size();
00560 (*i)->setBadRocPositions(badROCs);
00561 } else {
00562 (*i)->clearBadRocPositions();
00563 }
00564 }
00565 if (qualityDebugFlags & BadModules) {
00566 edm::LogInfo("MeasurementTracker PixelModuleStatus") <<
00567 " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
00568 }
00569 if (qualityDebugFlags & BadROCs) {
00570 edm::LogInfo("MeasurementTracker PixelROCStatus") << " Total of bad ROCs: " << badrocs ;
00571 }
00572 } else {
00573 for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
00574 i!=thePixelDets.end(); i++) {
00575 (*i)->setActive(true);
00576 }
00577 }
00578 }
00579