CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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

Definition at line 20 of file PSimHitSelector.h.

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

Definition at line 38 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(), i, mixLabel_, pSimHitCollectionMap_, AlCaHLTBitMon_QueryRunRegistry::string, and produceOfflineValidationTex::subdetectors.

8 {
9  // Initilize psimhit collection discriminated by sub systems
10  edm::ParameterSet pSimHitCollections = config.getParameter<edm::ParameterSet>("simHitCollections");
11 
12  std::vector<std::string> subdetectors( pSimHitCollections.getParameterNames() );
13 
14  mixLabel_ = config.getParameter<std::string>("mixLabel");
15 
16  for (size_t i = 0; i < subdetectors.size(); ++i)
17  {
18  pSimHitCollectionMap_.insert(
19  std::pair<std::string, std::vector<std::string> >(
20  subdetectors[i],
21  pSimHitCollections.getParameter<std::vector<std::string> >(subdetectors[i])
22  )
23  );
24  }
25 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::string mixLabel_
std::vector< std::string > getParameterNames() const
PSimHitCollectionMap pSimHitCollectionMap_
virtual PSimHitSelector::~PSimHitSelector ( )
inlinevirtual

Virtual destructor.

Definition at line 31 of file PSimHitSelector.h.

31 {}

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 28 of file PSimHitSelector.cc.

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

29 {
30  // Look for all psimhit collections
31  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.begin();
32 
33  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
34 
35  for (; pSimHitCollections != pSimHitCollectionMap_.end(); ++pSimHitCollections)
36  {
37  // Grab all the PSimHit from the different sencitive volumes
39 
40  // Collect the product pointers to the different psimhit collection
41  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i)
42  {
43  event.getByLabel(mixLabel_, pSimHitCollections->second[i], cfPSimHits);
44  cfPSimHitProductPointers.push_back(cfPSimHits.product());
45  }
46  }
47 
48  if (cfPSimHitProductPointers.empty()) return;
49 
50  // Create a mix collection from the different psimhit collections
51  std::auto_ptr<MixCollection<PSimHit> > pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
52 
53  // Select all psimhits
54  for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit)
55  selection.push_back(*pSimHit);
56 }
int i
Definition: DBlmapReader.cc:9
selection
main part
Definition: corrVsCorr.py:98
std::string mixLabel_
T const * product() const
Definition: Handle.h:81
PSimHitCollectionMap pSimHitCollectionMap_

Member Data Documentation

std::string PSimHitSelector::mixLabel_

Definition at line 28 of file PSimHitSelector.h.

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

PSimHitCollectionMap PSimHitSelector::pSimHitCollectionMap_
protected