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 &)
 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

Definition at line 17 of file PSimHitSelector.h.

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 ( edm::ParameterSet const &  config)

Constructor by pset.

Definition at line 7 of file PSimHitSelector.cc.

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

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
std::string mixLabel_
Definition: config.py:1
std::vector< std::string > getParameterNames() const
PSimHitCollectionMap pSimHitCollectionMap_
virtual PSimHitSelector::~PSimHitSelector ( )
inlinevirtual

Virtual destructor.

Definition at line 28 of file PSimHitSelector.h.

References select().

28 {}

Member Function Documentation

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(), and pSimHitCollectionMap_.

Referenced by ~PSimHitSelector().

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 }
selection
main part
Definition: corrVsCorr.py:100
std::string mixLabel_
T const * product() const
Definition: Handle.h:74
PSimHitCollectionMap pSimHitCollectionMap_

Member Data Documentation

std::string PSimHitSelector::mixLabel_

Definition at line 25 of file PSimHitSelector.h.

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

PSimHitCollectionMap PSimHitSelector::pSimHitCollectionMap_
protected