CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackerPSimHitSelector Class Reference

TrackerPSimHitSelector class. More...

#include <TrackerPSimHitSelector.h>

Inheritance diagram for TrackerPSimHitSelector:
PSimHitSelector

Public Member Functions

void select (PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
 Pre-process event information. More...
 
 TrackerPSimHitSelector (edm::ParameterSet const &config, edm::ConsumesCollector &iC)
 Constructor by pset. More...
 
- Public Member Functions inherited from PSimHitSelector
 PSimHitSelector (edm::ParameterSet const &, edm::ConsumesCollector &)
 Constructor by pset. More...
 
virtual ~PSimHitSelector ()=default
 Virtual destructor. More...
 

Private Attributes

edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcdcableToken_
 

Additional Inherited Members

- Public Types inherited from PSimHitSelector
typedef std::vector< PSimHitPSimHitCollection
 
- Public Attributes inherited from PSimHitSelector
std::string mixLabel_
 
- Protected Types inherited from PSimHitSelector
typedef std::map< std::string, std::vector< std::string > > PSimHitCollectionMap
 
- Protected Attributes inherited from PSimHitSelector
PSimHitCollectionMap pSimHitCollectionMap_
 

Detailed Description

TrackerPSimHitSelector class.

Definition at line 9 of file TrackerPSimHitSelector.h.

Constructor & Destructor Documentation

◆ TrackerPSimHitSelector()

TrackerPSimHitSelector::TrackerPSimHitSelector ( edm::ParameterSet const &  config,
edm::ConsumesCollector iC 
)
inline

Constructor by pset.

Definition at line 16 of file TrackerPSimHitSelector.h.

Definition: config.py:1
PSimHitSelector(edm::ParameterSet const &, edm::ConsumesCollector &)
Constructor by pset.
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > cableToken_

Member Function Documentation

◆ select()

void TrackerPSimHitSelector::select ( PSimHitCollection selection,
edm::Event const &  event,
edm::EventSetup const &  setup 
) const
overridevirtual

Pre-process event information.

Reimplemented from PSimHitSelector.

Definition at line 10 of file TrackerPSimHitSelector.cc.

References SiStripDetCabling::addConnected(), cableToken_, mps_fire::i, PSimHitSelector::mixLabel_, edm::Handle< T >::product(), PSimHitSelector::pSimHitCollectionMap_, corrVsCorr::selection, and singleTopDQM_cfi::setup.

12  {
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_
PSimHitCollectionMap pSimHitCollectionMap_

Member Data Documentation

◆ cableToken_

edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> TrackerPSimHitSelector::cableToken_
private

Definition at line 23 of file TrackerPSimHitSelector.h.

Referenced by select().