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 &)
 

Private Attributes

edm::InputTag simHitsTag
 
edm::PSimHitContainer theEmptyContainer
 
std::map< int,
edm::PSimHitContainer
theMap
 

Detailed Description

Definition at line 9 of file PSimHitMap.h.

Constructor & Destructor Documentation

PSimHitMap::PSimHitMap ( const edm::InputTag collectionTag)

Definition at line 5 of file PSimHitMap.cc.

6 : theMap(),
8  simHitsTag(collectionTag)
9 {
10 }
edm::InputTag simHitsTag
Definition: PSimHitMap.h:23
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:22
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:21

Member Function Documentation

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

Definition at line 47 of file PSimHitMap.cc.

References query::result, and theMap.

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

48 {
49  std::vector<int> result;
50  result.reserve(theMap.size());
51  for(std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.begin(),
52  mapEnd = theMap.end();
53  mapItr != mapEnd;
54  ++mapItr)
55  {
56  result.push_back(mapItr->first);
57  }
58  return result;
59 }
tuple result
Definition: query.py:137
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:21
void PSimHitMap::fill ( const edm::Event e)

Definition at line 13 of file PSimHitMap.cc.

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

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

14 {
15  theMap.clear();
17  LogTrace("PSimHitMap") <<"getting CrossingFrame<PSimHit> collection - "<<simHitsTag;
18  e.getByLabel(simHitsTag, cf);
19 
21  LogTrace("PSimHitMap") <<"... size = "<<simHits.size();
22 
23  // arrange the hits by detUnit
24  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
25  hitItr != simHits.end(); ++hitItr)
26  {
27  theMap[hitItr->detUnitId()].push_back(*hitItr);
28  }
29 }
edm::InputTag simHitsTag
Definition: PSimHitMap.h:23
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:21
tuple simHits
Definition: trackerHits.py:16
T const * product() const
Definition: Handle.h:74
const edm::PSimHitContainer & PSimHitMap::hits ( int  detId) const

Definition at line 32 of file PSimHitMap.cc.

References theEmptyContainer, and theMap.

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

33 {
34  std::map<int, edm::PSimHitContainer>::const_iterator mapItr
35  = theMap.find(detId);
36  if(mapItr != theMap.end())
37  {
38  return mapItr->second;
39  }
40  else
41  {
42  return theEmptyContainer;
43  }
44 }
edm::PSimHitContainer theEmptyContainer
Definition: PSimHitMap.h:22
std::map< int, edm::PSimHitContainer > theMap
Definition: PSimHitMap.h:21

Member Data Documentation

edm::InputTag PSimHitMap::simHitsTag
private

Definition at line 23 of file PSimHitMap.h.

Referenced by fill().

edm::PSimHitContainer PSimHitMap::theEmptyContainer
private

Definition at line 22 of file PSimHitMap.h.

Referenced by hits().

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

Definition at line 21 of file PSimHitMap.h.

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