CMS 3D CMS Logo

List of all members | Public Member Functions
TrackerPSimHitSelector Class Reference

TrackerPSimHitSelector class. More...

#include <TrackerPSimHitSelector.h>

Inheritance diagram for TrackerPSimHitSelector:
PSimHitSelector

Public Member Functions

void select (PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
 Pre-process event information. More...
 
 TrackerPSimHitSelector (edm::ParameterSet const &config)
 Constructor by pset. More...
 
- Public Member Functions inherited from PSimHitSelector
 PSimHitSelector (edm::ParameterSet const &)
 Constructor by pset. More...
 
virtual ~PSimHitSelector ()
 Virtual destructor. More...
 

Additional Inherited Members

- Public Types inherited from PSimHitSelector
typedef std::vector< PSimHitPSimHitCollection
 
- Public Attributes inherited from PSimHitSelector
std::string mixLabel_
 
- Protected Types inherited from PSimHitSelector
typedef std::map< std::string, std::vector< std::string > > PSimHitCollectionMap
 
- Protected Attributes inherited from PSimHitSelector
PSimHitCollectionMap pSimHitCollectionMap_
 

Detailed Description

TrackerPSimHitSelector class.

Definition at line 7 of file TrackerPSimHitSelector.h.

Constructor & Destructor Documentation

TrackerPSimHitSelector::TrackerPSimHitSelector ( edm::ParameterSet const &  config)
inline

Constructor by pset.

Definition at line 17 of file TrackerPSimHitSelector.h.

References select().

PSimHitSelector(edm::ParameterSet const &)
Constructor by pset.
Definition: config.py:1

Member Function Documentation

void TrackerPSimHitSelector::select ( PSimHitCollection selection,
edm::Event const &  event,
edm::EventSetup const &  setup 
) const
overridevirtual

Pre-process event information.

Reimplemented from PSimHitSelector.

Definition at line 16 of file TrackerPSimHitSelector.cc.

References SiStripDetCabling::addConnected(), edm::EventSetup::get(), mps_fire::i, PSimHitSelector::mixLabel_, edm::Handle< T >::product(), and PSimHitSelector::pSimHitCollectionMap_.

Referenced by TrackerPSimHitSelector().

17 {
18  // Look for psimhit collection associated o the tracker
19  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("tracker");
20 
21  // Check that there are psimhit collections defined for the tracker
22  if (pSimHitCollections == pSimHitCollectionMap_.end()) return;
23 
24  // Grab all the PSimHit from the different sencitive volumes
26  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
27 
28  // Collect the product pointers to the different psimhit collection
29  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i)
30  {
31  event.getByLabel(mixLabel_, pSimHitCollections->second[i], cfPSimHits);
32  cfPSimHitProductPointers.push_back(cfPSimHits.product());
33  }
34 
35  // Create a mix collection from the different psimhit collections
36  std::unique_ptr<MixCollection<PSimHit> > pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
37 
38  // Setup the cabling mapping
39  std::map<uint32_t, std::vector<int> > theDetIdList;
41  setup.get<SiStripDetCablingRcd>().get( detCabling );
42  detCabling->addConnected(theDetIdList);
43 
44  // Select only psimhits from alive modules
45  std::vector<std::pair<const PSimHit*,int> > psimhits(SimHitSelectorFromDB().getSimHit(pSimHits, theDetIdList));
46 
47  // Add the selected psimhit to the main list
48  for (std::size_t i = 0; i < psimhits.size(); ++i)
49  selection.push_back( *(const_cast<PSimHit*>(psimhits[i].first)) );
50 }
selection
main part
Definition: corrVsCorr.py:98
std::string mixLabel_
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
T const * product() const
Definition: Handle.h:81
PSimHitCollectionMap pSimHitCollectionMap_
void addConnected(std::map< uint32_t, std::vector< int > > &) const