PSimHitSelector class. More...
#include <PSimHitSelector.h>
Public Types | |
typedef std::vector< PSimHit > | PSimHitCollection |
Public Member Functions | |
PSimHitSelector (edm::ParameterSet const &) | |
Constructor by pset. | |
virtual void | select (PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const |
Select the psimhit add them to a PSimHitCollection. | |
virtual | ~PSimHitSelector () |
Virtual destructor. | |
Protected Types | |
typedef std::map< std::string, std::vector< std::string > > | PSimHitCollectionMap |
Protected Attributes | |
PSimHitCollectionMap | pSimHitCollectionMap_ |
PSimHitSelector class.
Definition at line 15 of file PSimHitSelector.h.
typedef std::vector<PSimHit> PSimHitSelector::PSimHitCollection |
Definition at line 20 of file PSimHitSelector.h.
typedef std::map<std::string, std::vector<std::string> > PSimHitSelector::PSimHitCollectionMap [protected] |
Definition at line 37 of file PSimHitSelector.h.
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, and pSimHitCollectionMap_.
{ // Initilize psimhit collection discriminated by sub systems edm::ParameterSet pSimHitCollections = config.getParameter<edm::ParameterSet>("simHitCollections"); std::vector<std::string> subdetectors( pSimHitCollections.getParameterNames() ); for (size_t i = 0; i < subdetectors.size(); ++i) { pSimHitCollectionMap_.insert( std::pair<std::string, std::vector<std::string> >( subdetectors[i], pSimHitCollections.getParameter<std::vector<std::string> >(subdetectors[i]) ) ); } }
virtual PSimHitSelector::~PSimHitSelector | ( | ) | [inline, virtual] |
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 26 of file PSimHitSelector.cc.
References MixCollection< T >::begin(), i, edm::Handle< T >::product(), and pSimHitCollectionMap_.
Referenced by TrackingTruthProducer::produce().
{ // Look for all psimhit collections PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.begin(); std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers; for (; pSimHitCollections != pSimHitCollectionMap_.end(); ++pSimHitCollections) { // Grab all the PSimHit from the different sencitive volumes edm::Handle<CrossingFrame<PSimHit> > cfPSimHits; // Collect the product pointers to the different psimhit collection for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i) { event.getByLabel("mix", pSimHitCollections->second[i], cfPSimHits); cfPSimHitProductPointers.push_back(cfPSimHits.product()); } } if (cfPSimHitProductPointers.empty()) return; // Create a mix collection from the different psimhit collections std::auto_ptr<MixCollection<PSimHit> > pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers)); // Select all psimhits for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit) selection.push_back(*pSimHit); }
Definition at line 39 of file PSimHitSelector.h.
Referenced by PSimHitSelector(), PixelPSimHitSelector::select(), MuonPSimHitSelector::select(), TrackerPSimHitSelector::select(), and select().