CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimGeneral/TrackingAnalysis/src/PixelPSimHitSelector.cc

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     // Look for psimhit collection associated o the tracker
00016     PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("pixel");
00017 
00018     // Check that there are psimhit collections defined for the tracker
00019     if (pSimHitCollections == pSimHitCollectionMap_.end()) return;
00020 
00021     // Grab all the PSimHit from the different sencitive volumes
00022     edm::Handle<CrossingFrame<PSimHit> > cfPSimHits;
00023     std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
00024 
00025     // Collect the product pointers to the different psimhit collection
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     // Create a mix collection from the different psimhit collections
00033     std::auto_ptr<MixCollection<PSimHit> > pSimHits( new MixCollection<PSimHit>(cfPSimHitProductPointers) );
00034 
00035     // Accessing dead pixel modules from DB:
00036     edm::ESHandle<SiPixelQuality> siPixelBadModule;
00037     setup.get<SiPixelQualityRcd>().get(siPixelBadModule);
00038 
00039     // Reading the DB information
00040     std::vector<SiPixelQuality::disabledModuleType> badModules( siPixelBadModule->getBadComponentList() );
00041     SiPixelQuality pixelQuality(badModules);
00042 
00043     // Select only psimhits from alive modules
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 }