CMS 3D CMS Logo

PSimHitMap Class Reference

#include <SimMuon/MCTruth/interface/PSimHitMap.h>

List of all members.

Public Member Functions

std::vector< intdetsWithHits () 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.

00006 :  theMap(),
00007    theEmptyContainer(),  
00008    simHitsTag(collectionTag)
00009 {
00010 }


Member Function Documentation

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

Definition at line 47 of file PSimHitMap.cc.

References HLT_VtxMuL3::result, and theMap.

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

00048 {
00049   std::vector<int> result;
00050   result.reserve(theMap.size());
00051   for(std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.begin(),
00052       mapEnd = theMap.end();
00053       mapItr != mapEnd;
00054       ++mapItr)
00055   {
00056     result.push_back(mapItr->first);
00057   }
00058   return result;
00059 } 

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 CSCEfficiency::analyze(), CSCDigiValidation::analyze(), CSCRecHitValidation::analyze(), and MuonTruth::eventSetup().

00014 {
00015   theMap.clear();
00016   edm::Handle<CrossingFrame<PSimHit> > cf;
00017   LogTrace("PSimHitMap") <<"getting CrossingFrame<PSimHit> collection - "<<simHitsTag;
00018   e.getByLabel(simHitsTag, cf);
00019 
00020   MixCollection<PSimHit> simHits(cf.product());
00021   LogTrace("PSimHitMap") <<"... size = "<<simHits.size();
00022 
00023   // arrange the hits by detUnit
00024   for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
00025       hitItr != simHits.end(); ++hitItr)
00026   {
00027     theMap[hitItr->detUnitId()].push_back(*hitItr);
00028   }
00029 }

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

Definition at line 32 of file PSimHitMap.cc.

References theEmptyContainer, and theMap.

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

00033 {
00034   std::map<int, edm::PSimHitContainer>::const_iterator mapItr
00035     = theMap.find(detId);
00036   if(mapItr != theMap.end())
00037   {
00038     return mapItr->second;
00039   }
00040   else
00041   {
00042     return theEmptyContainer;
00043   }
00044 }


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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:22 2009 for CMSSW by  doxygen 1.5.4