CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 &)
 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 ()
 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 15 of file PSimHitSelector.h.

Member Typedef Documentation

◆ PSimHitCollection

Definition at line 17 of file PSimHitSelector.h.

◆ PSimHitCollectionMap

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

Definition at line 34 of file PSimHitSelector.h.

Constructor & Destructor Documentation

◆ PSimHitSelector()

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

Constructor by pset.

Definition at line 7 of file PSimHitSelector.cc.

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 }

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

◆ ~PSimHitSelector()

virtual PSimHitSelector::~PSimHitSelector ( )
inlinevirtual

Virtual destructor.

Definition at line 28 of file PSimHitSelector.h.

28 {}

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.

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 }

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

Member Data Documentation

◆ mixLabel_

std::string PSimHitSelector::mixLabel_

Definition at line 25 of file PSimHitSelector.h.

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

◆ pSimHitCollectionMap_

PSimHitCollectionMap PSimHitSelector::pSimHitCollectionMap_
protected
mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:61
PSimHitSelector::pSimHitCollectionMap_
PSimHitCollectionMap pSimHitCollectionMap_
Definition: PSimHitSelector.h:36
TrackingMonitor_cfi.subdetectors
subdetectors
Definition: TrackingMonitor_cfi.py:181
config
Definition: config.py:1
MixCollection
Definition: MixCollection.h:10
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterSet::getParameterNames
std::vector< std::string > getParameterNames() const
Definition: ParameterSet.cc:663
PSimHitSelector::mixLabel_
std::string mixLabel_
Definition: PSimHitSelector.h:25
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303