CMS 3D CMS Logo

TrackerPSimHitSelector.cc
Go to the documentation of this file.
2 
5 
7 
9 
11  edm::Event const &event,
12  edm::EventSetup const &setup) const {
13  // Look for psimhit collection associated o the tracker
14  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("tracker");
15 
16  // Check that there are psimhit collections defined for the tracker
17  if (pSimHitCollections == pSimHitCollectionMap_.end())
18  return;
19 
20  // Grab all the PSimHit from the different sencitive volumes
22  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
23 
24  // Collect the product pointers to the different psimhit collection
25  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i) {
26  event.getByLabel(mixLabel_, pSimHitCollections->second[i], cfPSimHits);
27  cfPSimHitProductPointers.push_back(cfPSimHits.product());
28  }
29 
30  // Create a mix collection from the different psimhit collections
31  std::unique_ptr<MixCollection<PSimHit>> pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
32 
33  // Setup the cabling mapping
34  std::map<uint32_t, std::vector<int>> theDetIdList;
35  edm::ESHandle<SiStripDetCabling> detCabling = setup.getHandle(cableToken_);
36  detCabling->addConnected(theDetIdList);
37 
38  // Select only psimhits from alive modules
39  std::vector<std::pair<const PSimHit *, int>> psimhits(SimHitSelectorFromDB().getSimHit(pSimHits, theDetIdList));
40 
41  // Add the selected psimhit to the main list
42  for (std::size_t i = 0; i < psimhits.size(); ++i)
43  selection.push_back(*(const_cast<PSimHit *>(psimhits[i].first)));
44 }
void addConnected(std::map< uint32_t, std::vector< int >> &) const
T const * product() const
Definition: Handle.h:70
selection
main part
Definition: corrVsCorr.py:100
std::string mixLabel_
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > cableToken_
std::vector< PSimHit > PSimHitCollection
void select(PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
Pre-process event information.
PSimHitCollectionMap pSimHitCollectionMap_
Definition: event.py:1