CMS 3D CMS Logo

PixelPSimHitSelector.cc
Go to the documentation of this file.
1 
3 
6 
8 
10  edm::Event const &event,
11  edm::EventSetup const &setup) const {
12  // Look for psimhit collection associated o the tracker
13  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("pixel");
14 
15  // Check that there are psimhit collections defined for the tracker
16  if (pSimHitCollections == pSimHitCollectionMap_.end())
17  return;
18 
19  // Grab all the PSimHit from the different sencitive volumes
21  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
22 
23  // Collect the product pointers to the different psimhit collection
24  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i) {
25  event.getByLabel("mix", pSimHitCollections->second[i], cfPSimHits);
26  cfPSimHitProductPointers.push_back(cfPSimHits.product());
27  }
28 
29  // Create a mix collection from the different psimhit collections
30  std::unique_ptr<MixCollection<PSimHit>> pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
31 
32  // Accessing dead pixel modules from DB:
33  edm::ESHandle<SiPixelQuality> siPixelBadModule = setup.getHandle(badModuleToken_);
34 
35  // Reading the DB information
36  std::vector<SiPixelQuality::disabledModuleType> badModules(siPixelBadModule->getBadComponentList());
37  SiPixelQuality pixelQuality(badModules);
38 
39  // Select only psimhits from alive modules
40  for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit) {
41  if (!pixelQuality.IsModuleBad(pSimHit->detUnitId()))
42  selection.push_back(*pSimHit);
43  }
44 }
T const * product() const
Definition: Handle.h:70
selection
main part
Definition: corrVsCorr.py:100
const std::vector< disabledModuleType > getBadComponentList() const
std::vector< PSimHit > PSimHitCollection
void select(PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
Pre-process event information.
PSimHitCollectionMap pSimHitCollectionMap_
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > badModuleToken_
Definition: event.py:1