CMS 3D CMS Logo

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

Detailed Description

Definition at line 11 of file PSimHitMap.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file PSimHitMap.h.

References sh_token.

16  {
18  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:28
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:30
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:27

Member Function Documentation

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

Definition at line 37 of file PSimHitMap.cc.

References query::result, and theMap.

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

38 {
39  std::vector<int> result;
40  result.reserve(theMap.size());
41  for(std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.begin(),
42  mapEnd = theMap.end();
43  mapItr != mapEnd;
44  ++mapItr)
45  {
46  result.push_back(mapItr->first);
47  }
48  return result;
49 }
tuple result
Definition: query.py:137
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:27
void PSimHitMap::fill ( const edm::Event e)

Definition at line 4 of file PSimHitMap.cc.

References edm::Event::getByToken(), LogTrace, edm::Handle< T >::product(), sh_token, trackerHits::simHits, and theMap.

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

5 {
6  theMap.clear();
8  LogTrace("MuonCSCDigis") << "getting CrossingFrame<PSimHit> collection ";
9  e.getByToken(sh_token, cf);
10 
12  LogTrace("MuonCSCDigis") <<"... size = "<<simHits.size();
13 
14  // arrange the hits by detUnit
15  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
16  hitItr != simHits.end(); ++hitItr)
17  {
18  theMap[hitItr->detUnitId()].push_back(*hitItr);
19  }
20 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetTokenT< CrossingFrame< PSimHit > > sh_token
Definition: PSimHitMap.h:30
#define LogTrace(id)
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:27
T const * product() const
Definition: Handle.h:81
tuple simHits
Definition: trackerHits.py:16
const edm::PSimHitContainer & PSimHitMap::hits ( int  detId) const

Definition at line 22 of file PSimHitMap.cc.

References theEmptyContainer, and theMap.

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

23 {
24  std::map<int, edm::PSimHitContainer>::const_iterator mapItr
25  = theMap.find(detId);
26  if(mapItr != theMap.end())
27  {
28  return mapItr->second;
29  }
30  else
31  {
32  return theEmptyContainer;
33  }
34 }
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:28
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:27

Member Data Documentation

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

Definition at line 30 of file PSimHitMap.h.

Referenced by fill(), and PSimHitMap().

edm::PSimHitContainer PSimHitMap::theEmptyContainer
private

Definition at line 28 of file PSimHitMap.h.

Referenced by hits().

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

Definition at line 27 of file PSimHitMap.h.

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