Go to the documentation of this file.00001
00002 #include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h"
00003 #include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h"
00004
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006
00007 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
00008 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
00009
00010 #include "SimGeneral/TrackingAnalysis/interface/PixelPSimHitSelector.h"
00011
00012
00013 void PixelPSimHitSelector::select(PSimHitCollection & selection, edm::Event const & event, edm::EventSetup const & setup) const
00014 {
00015
00016 PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("pixel");
00017
00018
00019 if (pSimHitCollections == pSimHitCollectionMap_.end()) return;
00020
00021
00022 edm::Handle<CrossingFrame<PSimHit> > cfPSimHits;
00023 std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
00024
00025
00026 for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i)
00027 {
00028 event.getByLabel("mix", pSimHitCollections->second[i], cfPSimHits);
00029 cfPSimHitProductPointers.push_back(cfPSimHits.product());
00030 }
00031
00032
00033 std::auto_ptr<MixCollection<PSimHit> > pSimHits( new MixCollection<PSimHit>(cfPSimHitProductPointers) );
00034
00035
00036 edm::ESHandle<SiPixelQuality> siPixelBadModule;
00037 setup.get<SiPixelQualityRcd>().get(siPixelBadModule);
00038
00039
00040 std::vector<SiPixelQuality::disabledModuleType> badModules( siPixelBadModule->getBadComponentList() );
00041 SiPixelQuality pixelQuality(badModules);
00042
00043
00044 for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit)
00045 {
00046 if ( !pixelQuality.IsModuleBad(pSimHit->detUnitId()) )
00047 selection.push_back(*pSimHit);
00048 }
00049 }