CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Attributes
PSimHitSelector Class Reference

PSimHitSelector class. More...

#include <PSimHitSelector.h>

Inheritance diagram for PSimHitSelector:
MuonPSimHitSelector PixelPSimHitSelector TrackerPSimHitSelector

Public Types

typedef std::vector< PSimHitPSimHitCollection
 

Public Member Functions

 PSimHitSelector (edm::ParameterSet const &, edm::ConsumesCollector &)
 Constructor by pset. More...
 
virtual void select (PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const
 Select the psimhit add them to a PSimHitCollection. More...
 
virtual ~PSimHitSelector ()=default
 Virtual destructor. More...
 

Public Attributes

std::string mixLabel_
 

Protected Types

typedef std::map< std::string, std::vector< std::string > > PSimHitCollectionMap
 

Protected Attributes

PSimHitCollectionMap pSimHitCollectionMap_
 

Detailed Description

PSimHitSelector class.

Definition at line 16 of file PSimHitSelector.h.

Member Typedef Documentation

◆ PSimHitCollection

Definition at line 18 of file PSimHitSelector.h.

◆ PSimHitCollectionMap

typedef std::map<std::string, std::vector<std::string> > PSimHitSelector::PSimHitCollectionMap
protected

Definition at line 35 of file PSimHitSelector.h.

Constructor & Destructor Documentation

◆ PSimHitSelector()

PSimHitSelector::PSimHitSelector ( edm::ParameterSet const &  config,
edm::ConsumesCollector  
)

Constructor by pset.

Definition at line 7 of file PSimHitSelector.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), mps_fire::i, mixLabel_, pSimHitCollectionMap_, AlCaHLTBitMon_QueryRunRegistry::string, and TrackingMonitor_cfi::subdetectors.

7  {
8  // Initilize psimhit collection discriminated by sub systems
9  edm::ParameterSet pSimHitCollections = config.getParameter<edm::ParameterSet>("simHitCollections");
10 
11  std::vector<std::string> subdetectors(pSimHitCollections.getParameterNames());
12 
13  mixLabel_ = config.getParameter<std::string>("mixLabel");
14 
15  for (size_t i = 0; i < subdetectors.size(); ++i) {
16  pSimHitCollectionMap_.insert(std::pair<std::string, std::vector<std::string>>(
17  subdetectors[i], pSimHitCollections.getParameter<std::vector<std::string>>(subdetectors[i])));
18  }
19 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string mixLabel_
Definition: config.py:1
PSimHitCollectionMap pSimHitCollectionMap_
std::vector< std::string > getParameterNames() const

◆ ~PSimHitSelector()

virtual PSimHitSelector::~PSimHitSelector ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ select()

void PSimHitSelector::select ( PSimHitCollection selection,
edm::Event const &  event,
edm::EventSetup const &  setup 
) const
virtual

Select the psimhit add them to a PSimHitCollection.

Reimplemented in MuonPSimHitSelector, PixelPSimHitSelector, and TrackerPSimHitSelector.

Definition at line 21 of file PSimHitSelector.cc.

References mps_fire::i, mixLabel_, edm::Handle< T >::product(), pSimHitCollectionMap_, and corrVsCorr::selection.

23  {
24  // Look for all psimhit collections
25  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.begin();
26 
27  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
28 
29  for (; pSimHitCollections != pSimHitCollectionMap_.end(); ++pSimHitCollections) {
30  // Grab all the PSimHit from the different sencitive volumes
32 
33  // Collect the product pointers to the different psimhit collection
34  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i) {
35  event.getByLabel(mixLabel_, pSimHitCollections->second[i], cfPSimHits);
36  cfPSimHitProductPointers.push_back(cfPSimHits.product());
37  }
38  }
39 
40  if (cfPSimHitProductPointers.empty())
41  return;
42 
43  // Create a mix collection from the different psimhit collections
44  std::unique_ptr<MixCollection<PSimHit>> pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
45 
46  // Select all psimhits
47  for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit)
48  selection.push_back(*pSimHit);
49 }
T const * product() const
Definition: Handle.h:70
selection
main part
Definition: corrVsCorr.py:100
std::string mixLabel_
PSimHitCollectionMap pSimHitCollectionMap_

Member Data Documentation

◆ mixLabel_

std::string PSimHitSelector::mixLabel_

Definition at line 26 of file PSimHitSelector.h.

Referenced by PSimHitSelector(), TrackerPSimHitSelector::select(), and select().

◆ pSimHitCollectionMap_

PSimHitCollectionMap PSimHitSelector::pSimHitCollectionMap_
protected