CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PSimHitMap Class Reference

#include <PSimHitMap.h>

Public Member Functions

std::vector< int > detsWithHits () const
 
void fill (const edm::Event &e)
 
const edm::PSimHitContainerhits (int detId) const
 
 PSimHitMap (const edm::InputTag &iT, edm::ConsumesCollector &&iC)
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
 
edm::PSimHitContainer theEmptyContainer
 
std::map< int, edm::PSimHitContainertheMap
 

Detailed Description

Definition at line 11 of file PSimHitMap.h.

Constructor & Destructor Documentation

◆ PSimHitMap()

PSimHitMap::PSimHitMap ( const edm::InputTag iT,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 13 of file PSimHitMap.h.

13  : theMap(), theEmptyContainer() {
15  }

References sh_token.

Member Function Documentation

◆ detsWithHits()

std::vector< int > PSimHitMap::detsWithHits ( ) const

Definition at line 28 of file PSimHitMap.cc.

28  {
29  std::vector<int> result;
30  result.reserve(theMap.size());
31  for (std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.begin(), mapEnd = theMap.end();
32  mapItr != mapEnd;
33  ++mapItr) {
34  result.push_back(mapItr->first);
35  }
36  return result;
37 }

References mps_fire::result, and theMap.

Referenced by CSCRecHit2DValidation::analyze(), and CSCSegmentValidation::fillLayerHitsPerChamber().

◆ fill()

void PSimHitMap::fill ( const edm::Event e)

Definition at line 4 of file PSimHitMap.cc.

4  {
5  theMap.clear();
7  LogTrace("PSimHitMap") << "getting CrossingFrame<PSimHit> collection ";
8  e.getByToken(sh_token, cf);
9 
11  LogTrace("PSimHitMap") << "... size = " << simHits.size();
12 
13  // arrange the hits by detUnit
14  for (MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
15  theMap[hitItr->detUnitId()].push_back(*hitItr);
16  }
17 }

References MillePedeFileConverter_cfg::e, LogTrace, edm::Handle< T >::product(), sh_token, FastTrackerRecHitCombiner_cfi::simHits, and theMap.

Referenced by CSCRecHitValidation::analyze(), and CSCDigiValidation::analyze().

◆ hits()

const edm::PSimHitContainer & PSimHitMap::hits ( int  detId) const

Definition at line 19 of file PSimHitMap.cc.

19  {
20  std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.find(detId);
21  if (mapItr != theMap.end()) {
22  return mapItr->second;
23  } else {
24  return theEmptyContainer;
25  }
26 }

References theEmptyContainer, and theMap.

Referenced by CSCRecHit2DValidation::analyze(), CSCWireDigiValidation::analyze(), CSCSegmentValidation::fillLayerHitsPerChamber(), and CSCSegmentValidation::keyHit().

Member Data Documentation

◆ sh_token

edm::EDGetTokenT<CrossingFrame<PSimHit> > PSimHitMap::sh_token
private

Definition at line 27 of file PSimHitMap.h.

Referenced by fill(), and PSimHitMap().

◆ theEmptyContainer

edm::PSimHitContainer PSimHitMap::theEmptyContainer
private

Definition at line 25 of file PSimHitMap.h.

Referenced by hits().

◆ theMap

std::map<int, edm::PSimHitContainer> PSimHitMap::theMap
private

Definition at line 24 of file PSimHitMap.h.

Referenced by detsWithHits(), fill(), and hits().

edm::Handle::product
T const * product() const
Definition: Handle.h:70
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:62
PSimHitMap::sh_token
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:27
PSimHitMap::theMap
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:24
CrossingFrame
Definition: CrossingFrame.h:38
MixCollection
Definition: MixCollection.h:11
PSimHitMap::theEmptyContainer
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:25
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37