CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
RPCHitAssociator Class Reference

#include <RPCHitAssociator.h>

Public Types

typedef edm::DetSetVector
< RPCDigiSimLink
RPCDigiSimLinks
 
typedef std::pair< uint32_t,
EncodedEventId
SimHitIdpr
 

Public Member Functions

std::vector< SimHitIdprassociateRecHit (const TrackingRecHit &hit) const
 
std::set< RPCDigiSimLinkfindRPCDigiSimLink (uint32_t rpcDetId, int strip, int bx) const
 
void initEvent (const edm::Event &, const edm::EventSetup &)
 
 RPCHitAssociator (const edm::ParameterSet &, edm::ConsumesCollector &&ic)
 
 RPCHitAssociator (const edm::Event &e, const edm::EventSetup &eventSetup, const edm::ParameterSet &conf)
 
 ~RPCHitAssociator ()
 

Private Attributes

std::map< unsigned int,
edm::PSimHitContainer
_SimHitMap
 
edm::Handle< edm::DetSetVector
< RPCDigiSimLink > > 
_thelinkDigis
 
bool crossingframe
 
edm::InputTag RPCdigisimlinkTag
 
edm::EDGetTokenT
< edm::DetSetVector
< RPCDigiSimLink > > 
RPCdigisimlinkToken_
 
edm::InputTag RPCsimhitsTag
 
edm::EDGetTokenT
< edm::PSimHitContainer
RPCsimhitsToken_
 
edm::InputTag RPCsimhitsXFTag
 
edm::EDGetTokenT
< CrossingFrame< PSimHit > > 
RPCsimhitsXFToken_
 

Detailed Description

Definition at line 32 of file RPCHitAssociator.h.

Member Typedef Documentation

Definition at line 35 of file RPCHitAssociator.h.

typedef std::pair<uint32_t, EncodedEventId> RPCHitAssociator::SimHitIdpr

Definition at line 36 of file RPCHitAssociator.h.

Constructor & Destructor Documentation

RPCHitAssociator::RPCHitAssociator ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  ic 
)

Definition at line 8 of file RPCHitAssociator.cc.

References crossingframe, edm::InputTag::label(), RPCdigisimlinkTag, RPCdigisimlinkToken_, RPCsimhitsTag, RPCsimhitsToken_, RPCsimhitsXFTag, and RPCsimhitsXFToken_.

9  :
10  RPCdigisimlinkTag(conf.getParameter<edm::InputTag>("RPCdigisimlinkTag")),
11  // CrossingFrame used or not ?
12  crossingframe(conf.getParameter<bool>("crossingframe")),
13  RPCsimhitsTag(conf.getParameter<edm::InputTag>("RPCsimhitsTag")),
14  RPCsimhitsXFTag(conf.getParameter<edm::InputTag>("RPCsimhitsXFTag"))
15 {
16  if (crossingframe){
18  } else if (!RPCsimhitsTag.label().empty()) {
20  }
21 
23 }
T getParameter(std::string const &) const
edm::InputTag RPCdigisimlinkTag
edm::EDGetTokenT< CrossingFrame< PSimHit > > RPCsimhitsXFToken_
edm::InputTag RPCsimhitsTag
edm::EDGetTokenT< edm::PSimHitContainer > RPCsimhitsToken_
edm::InputTag RPCsimhitsXFTag
std::string const & label() const
Definition: InputTag.h:42
std::vector< PSimHit > PSimHitContainer
edm::EDGetTokenT< edm::DetSetVector< RPCDigiSimLink > > RPCdigisimlinkToken_
RPCHitAssociator::RPCHitAssociator ( const edm::Event e,
const edm::EventSetup eventSetup,
const edm::ParameterSet conf 
)

Definition at line 25 of file RPCHitAssociator.cc.

References initEvent().

25  :
26  RPCdigisimlinkTag(conf.getParameter<edm::InputTag>("RPCdigisimlinkTag")),
27  // CrossingFrame used or not ?
28  crossingframe(conf.getParameter<bool>("crossingframe")),
29  RPCsimhitsTag(conf.getParameter<edm::InputTag>("RPCsimhitsTag")),
30  RPCsimhitsXFTag(conf.getParameter<edm::InputTag>("RPCsimhitsXFTag"))
31 {
32  initEvent(e,eventSetup);
33 }
T getParameter(std::string const &) const
edm::InputTag RPCdigisimlinkTag
void initEvent(const edm::Event &, const edm::EventSetup &)
edm::InputTag RPCsimhitsTag
edm::InputTag RPCsimhitsXFTag
RPCHitAssociator::~RPCHitAssociator ( )
inline

Definition at line 45 of file RPCHitAssociator.h.

45 {}

Member Function Documentation

std::vector< RPCHitAssociator::SimHitIdpr > RPCHitAssociator::associateRecHit ( const TrackingRecHit hit) const

Definition at line 79 of file RPCHitAssociator.cc.

References RPCRecHit::BunchX(), RPCRecHit::clusterSize(), spr::find(), findRPCDigiSimLink(), RPCRecHit::firstClusterStrip(), i, electronStore::links, DetId::rawId(), and RPCRecHit::rpcId().

Referenced by MuonAssociatorByHitsHelper::getMatchedIds().

79  {
80 
81  std::vector<SimHitIdpr> matched;
82 
83  const TrackingRecHit * hitp = &hit;
84  const RPCRecHit * rpcrechit = dynamic_cast<const RPCRecHit *>(hitp);
85 
86  if (rpcrechit) {
87 
88  RPCDetId rpcDetId = rpcrechit->rpcId();
89  int fstrip = rpcrechit->firstClusterStrip();
90  int cls = rpcrechit->clusterSize();
91  int bx = rpcrechit->BunchX();
92 
93  for(int i = fstrip; i < fstrip+cls; ++i) {
94  std::set<RPCDigiSimLink> links = findRPCDigiSimLink(rpcDetId.rawId(),i,bx);
95 
96  if (links.empty()) edm::LogWarning("RPCHitAssociator")
97  <<"*** WARNING in RPCHitAssociator::associateRecHit, RPCRecHit "<<*rpcrechit<<", strip "<<i<<" has no associated RPCDigiSimLink !"<<endl;
98 
99  for(std::set<RPCDigiSimLink>::iterator itlink = links.begin(); itlink != links.end(); ++itlink) {
100  SimHitIdpr currentId(itlink->getTrackId(),itlink->getEventId());
101  if(find(matched.begin(),matched.end(),currentId ) == matched.end())
102  matched.push_back(currentId);
103  }
104  }
105 
106  } else edm::LogWarning("RPCHitAssociator")<<"*** WARNING in RPCHitAssociator::associateRecHit, null dynamic_cast !";
107 
108  return matched;
109 }
int firstClusterStrip() const
Definition: RPCRecHit.h:105
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int clusterSize() const
Definition: RPCRecHit.h:109
RPCDetId rpcId() const
Return the rpcId.
Definition: RPCRecHit.h:97
std::pair< uint32_t, EncodedEventId > SimHitIdpr
std::set< RPCDigiSimLink > findRPCDigiSimLink(uint32_t rpcDetId, int strip, int bx) const
int BunchX() const
Definition: RPCRecHit.h:101
std::set< RPCDigiSimLink > RPCHitAssociator::findRPCDigiSimLink ( uint32_t  rpcDetId,
int  strip,
int  bx 
) const

Definition at line 111 of file RPCHitAssociator.cc.

References _thelinkDigis, edm::DetSetVector< T >::begin(), cond::rpcobgas::detid, edm::DetSetVector< T >::end(), and electronStore::links.

Referenced by associateRecHit().

111  {
112 
113  std::set<RPCDigiSimLink> links;
114 
116  for(edm::DetSet<RPCDigiSimLink>::const_iterator digi_iter=itlink->data.begin();digi_iter != itlink->data.end();++digi_iter){
117 
118  uint32_t detid = digi_iter->getDetUnitId();
119  int str = digi_iter->getStrip();
120  int bunchx = digi_iter->getBx();
121 
122  if(detid == rpcDetId && str == strip && bunchx == bx){
123  links.insert(*digi_iter);
124  }
125 
126  }
127  }
128 
129  return links;
130 }
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:350
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108
edm::Handle< edm::DetSetVector< RPCDigiSimLink > > _thelinkDigis
void RPCHitAssociator::initEvent ( const edm::Event e,
const edm::EventSetup eventSetup 
)

Definition at line 36 of file RPCHitAssociator.cc.

References _SimHitMap, _thelinkDigis, crossingframe, edm::Event::getByLabel(), edm::InputTag::label(), LogTrace, edm::Handle< T >::product(), RPCdigisimlinkTag, RPCsimhitsTag, and RPCsimhitsXFTag.

Referenced by RPCHitAssociator().

39 {
40  if (crossingframe) {
41 
43  LogTrace("RPCHitAssociator") <<"getting CrossingFrame<PSimHit> collection - "<<RPCsimhitsXFTag;
45 
46  std::auto_ptr<MixCollection<PSimHit> >
47  RPCsimhits( new MixCollection<PSimHit>(cf.product()) );
48  LogTrace("RPCHitAssociator") <<"... size = "<<RPCsimhits->size();
49 
50  // MixCollection<PSimHit> & simHits = *hits;
51 
52  for(MixCollection<PSimHit>::MixItr hitItr = RPCsimhits->begin();
53  hitItr != RPCsimhits->end(); ++hitItr)
54  {
55  _SimHitMap[hitItr->detUnitId()].push_back(*hitItr);
56  }
57 
58  } else if (!RPCsimhitsTag.label().empty()) {
60  LogTrace("RPCHitAssociator") <<"getting PSimHit collection - "<<RPCsimhitsTag;
61  e.getByLabel(RPCsimhitsTag, RPCsimhits);
62  LogTrace("RPCHitAssociator") <<"... size = "<<RPCsimhits->size();
63 
64  // arrange the hits by detUnit
65  for(edm::PSimHitContainer::const_iterator hitItr = RPCsimhits->begin();
66  hitItr != RPCsimhits->end(); ++hitItr)
67  {
68  _SimHitMap[hitItr->detUnitId()].push_back(*hitItr);
69  }
70  }
71 
73  LogTrace("RPCHitAssociator") <<"getting RPCDigiSimLink collection - "<<RPCdigisimlinkTag;
74  e.getByLabel(RPCdigisimlinkTag, thelinkDigis);
75  _thelinkDigis = thelinkDigis;
76 }
edm::InputTag RPCdigisimlinkTag
std::map< unsigned int, edm::PSimHitContainer > _SimHitMap
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
#define LogTrace(id)
edm::InputTag RPCsimhitsTag
T const * product() const
Definition: Handle.h:81
edm::InputTag RPCsimhitsXFTag
std::string const & label() const
Definition: InputTag.h:42
edm::Handle< edm::DetSetVector< RPCDigiSimLink > > _thelinkDigis

Member Data Documentation

std::map<unsigned int, edm::PSimHitContainer> RPCHitAssociator::_SimHitMap
private

Definition at line 64 of file RPCHitAssociator.h.

Referenced by initEvent().

edm::Handle< edm::DetSetVector<RPCDigiSimLink> > RPCHitAssociator::_thelinkDigis
private

Definition at line 53 of file RPCHitAssociator.h.

Referenced by findRPCDigiSimLink(), and initEvent().

bool RPCHitAssociator::crossingframe
private

Definition at line 56 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

edm::InputTag RPCHitAssociator::RPCdigisimlinkTag
private

Definition at line 54 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

edm::EDGetTokenT<edm::DetSetVector<RPCDigiSimLink> > RPCHitAssociator::RPCdigisimlinkToken_
private

Definition at line 62 of file RPCHitAssociator.h.

Referenced by RPCHitAssociator().

edm::InputTag RPCHitAssociator::RPCsimhitsTag
private

Definition at line 57 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

edm::EDGetTokenT<edm::PSimHitContainer> RPCHitAssociator::RPCsimhitsToken_
private

Definition at line 61 of file RPCHitAssociator.h.

Referenced by RPCHitAssociator().

edm::InputTag RPCHitAssociator::RPCsimhitsXFTag
private

Definition at line 58 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

edm::EDGetTokenT<CrossingFrame<PSimHit> > RPCHitAssociator::RPCsimhitsXFToken_
private

Definition at line 60 of file RPCHitAssociator.h.

Referenced by RPCHitAssociator().