#include <SimMuon/MCTruth/interface/PSimHitMap.h>
Public Member Functions | |
std::vector< int > | detsWithHits () const |
void | fill (const edm::Event &e) |
const edm::PSimHitContainer & | hits (int detId) const |
PSimHitMap (const edm::InputTag &) | |
Private Attributes | |
edm::InputTag | simHitsTag |
edm::PSimHitContainer | theEmptyContainer |
std::map< int, edm::PSimHitContainer > | theMap |
Definition at line 9 of file PSimHitMap.h.
PSimHitMap::PSimHitMap | ( | const edm::InputTag & | collectionTag | ) |
Definition at line 5 of file PSimHitMap.cc.
00006 : theMap(), 00007 theEmptyContainer(), 00008 simHitsTag(collectionTag) 00009 { 00010 }
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 }
edm::InputTag PSimHitMap::simHitsTag [private] |
std::map<int, edm::PSimHitContainer> PSimHitMap::theMap [private] |