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.

References sh_token.

13  : theMap(), theEmptyContainer() {
15  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:25
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:27
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:24

Member Function Documentation

◆ detsWithHits()

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

Definition at line 29 of file PSimHitMap.cc.

References mps_fire::result, and theMap.

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

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

◆ fill()

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

Definition at line 5 of file PSimHitMap.cc.

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

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

5  {
6  theMap.clear();
8  LogTrace("PSimHitMap") << "getting CrossingFrame<PSimHit> collection ";
9  e.getByToken(sh_token, cf);
10 
12  LogTrace("PSimHitMap") << "... size = " << simHits.size();
13 
14  // arrange the hits by detUnit
15  for (MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
16  theMap[hitItr->detUnitId()].push_back(*hitItr);
17  }
18 }
T const * product() const
Definition: Handle.h:70
#define LogTrace(id)
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:27
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:24

◆ hits()

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

Definition at line 20 of file PSimHitMap.cc.

References hcalRecHitTable_cff::detId, theEmptyContainer, and theMap.

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

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

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().