CMS 3D CMS Logo

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