CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
RPCHitAssociator Class Reference

#include <RPCHitAssociator.h>

Public Types

typedef edm::DetSetVector< RPCDigiSimLinkRPCDigiSimLinks
 
typedef std::pair< uint32_t, EncodedEventIdSimHitIdpr
 

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::Event &e, const edm::EventSetup &eventSetup, const edm::ParameterSet &conf)
 
 RPCHitAssociator (const edm::ParameterSet &, edm::ConsumesCollector &&ic)
 
 ~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::PSimHitContainerRPCsimhitsToken_
 
edm::InputTag RPCsimhitsXFTag
 
edm::EDGetTokenT< CrossingFrame< PSimHit > > RPCsimhitsXFToken_
 

Detailed Description

Definition at line 32 of file RPCHitAssociator.h.

Member Typedef Documentation

◆ RPCDigiSimLinks

Definition at line 34 of file RPCHitAssociator.h.

◆ SimHitIdpr

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

Definition at line 35 of file RPCHitAssociator.h.

Constructor & Destructor Documentation

◆ RPCHitAssociator() [1/2]

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

Definition at line 7 of file RPCHitAssociator.cc.

8  : RPCdigisimlinkTag(conf.getParameter<edm::InputTag>("RPCdigisimlinkTag")),
9  // CrossingFrame used or not ?
10  crossingframe(conf.getParameter<bool>("crossingframe")),
11  RPCsimhitsTag(conf.getParameter<edm::InputTag>("RPCsimhitsTag")),
12  RPCsimhitsXFTag(conf.getParameter<edm::InputTag>("RPCsimhitsXFTag")) {
13  if (crossingframe) {
15  } else if (!RPCsimhitsTag.label().empty()) {
17  }
18 
20 }

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

◆ RPCHitAssociator() [2/2]

RPCHitAssociator::RPCHitAssociator ( const edm::Event e,
const edm::EventSetup eventSetup,
const edm::ParameterSet conf 
)

Definition at line 22 of file RPCHitAssociator.cc.

25  : RPCdigisimlinkTag(conf.getParameter<edm::InputTag>("RPCdigisimlinkTag")),
26  // CrossingFrame used or not ?
27  crossingframe(conf.getParameter<bool>("crossingframe")),
28  RPCsimhitsTag(conf.getParameter<edm::InputTag>("RPCsimhitsTag")),
29  RPCsimhitsXFTag(conf.getParameter<edm::InputTag>("RPCsimhitsXFTag")) {
30  initEvent(e, eventSetup);
31 }

References MillePedeFileConverter_cfg::e, and initEvent().

◆ ~RPCHitAssociator()

RPCHitAssociator::~RPCHitAssociator ( )
inline

Definition at line 44 of file RPCHitAssociator.h.

44 {}

Member Function Documentation

◆ associateRecHit()

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

Definition at line 69 of file RPCHitAssociator.cc.

69  {
70  std::vector<SimHitIdpr> matched;
71 
72  const TrackingRecHit *hitp = &hit;
73  const RPCRecHit *rpcrechit = dynamic_cast<const RPCRecHit *>(hitp);
74 
75  if (rpcrechit) {
76  RPCDetId rpcDetId = rpcrechit->rpcId();
77  int fstrip = rpcrechit->firstClusterStrip();
78  int cls = rpcrechit->clusterSize();
79  int bx = rpcrechit->BunchX();
80 
81  for (int i = fstrip; i < fstrip + cls; ++i) {
82  std::set<RPCDigiSimLink> links = findRPCDigiSimLink(rpcDetId.rawId(), i, bx);
83 
84  if (links.empty())
85  LogTrace("RPCHitAssociator") << "*** WARNING in RPCHitAssociator::associateRecHit, RPCRecHit " << *rpcrechit
86  << ", strip " << i << " has no associated RPCDigiSimLink !" << endl;
87 
88  for (std::set<RPCDigiSimLink>::iterator itlink = links.begin(); itlink != links.end(); ++itlink) {
89  SimHitIdpr currentId(itlink->getTrackId(), itlink->getEventId());
90  if (find(matched.begin(), matched.end(), currentId) == matched.end())
91  matched.push_back(currentId);
92  }
93  }
94 
95  } else
96  LogTrace("RPCHitAssociator") << "*** WARNING in RPCHitAssociator::associateRecHit, null "
97  "dynamic_cast !";
98 
99  return matched;
100 }

References RPCRecHit::BunchX(), l1GtPatternGenerator_cfi::bx, RPCRecHit::clusterSize(), spr::find(), findRPCDigiSimLink(), RPCRecHit::firstClusterStrip(), mps_fire::i, electronStore::links, LogTrace, muonTagProbeFilters_cff::matched, DetId::rawId(), and RPCRecHit::rpcId().

Referenced by MuonAssociatorByHitsHelper::getMatchedIds().

◆ findRPCDigiSimLink()

std::set< RPCDigiSimLink > RPCHitAssociator::findRPCDigiSimLink ( uint32_t  rpcDetId,
int  strip,
int  bx 
) const

Definition at line 102 of file RPCHitAssociator.cc.

102  {
103  std::set<RPCDigiSimLink> links;
104 
106  itlink != _thelinkDigis->end();
107  itlink++) {
108  for (edm::DetSet<RPCDigiSimLink>::const_iterator digi_iter = itlink->data.begin(); digi_iter != itlink->data.end();
109  ++digi_iter) {
110  uint32_t detid = digi_iter->getDetUnitId();
111  int str = digi_iter->getStrip();
112  int bunchx = digi_iter->getBx();
113 
114  if (detid == rpcDetId && str == strip && bunchx == bx) {
115  links.insert(*digi_iter);
116  }
117  }
118  }
119 
120  return links;
121 }

References _thelinkDigis, edm::DetSetVector< T >::begin(), l1GtPatternGenerator_cfi::bx, edm::DetSetVector< T >::end(), electronStore::links, str, and digitizers_cfi::strip.

Referenced by associateRecHit().

◆ initEvent()

void RPCHitAssociator::initEvent ( const edm::Event e,
const edm::EventSetup eventSetup 
)

Definition at line 33 of file RPCHitAssociator.cc.

35 {
36  if (crossingframe) {
38  LogTrace("RPCHitAssociator") << "getting CrossingFrame<PSimHit> collection - " << RPCsimhitsXFTag;
39  e.getByLabel(RPCsimhitsXFTag, cf);
40 
41  std::unique_ptr<MixCollection<PSimHit>> RPCsimhits(new MixCollection<PSimHit>(cf.product()));
42  LogTrace("RPCHitAssociator") << "... size = " << RPCsimhits->size();
43 
44  // MixCollection<PSimHit> & simHits = *hits;
45 
46  for (MixCollection<PSimHit>::MixItr hitItr = RPCsimhits->begin(); hitItr != RPCsimhits->end(); ++hitItr) {
47  _SimHitMap[hitItr->detUnitId()].push_back(*hitItr);
48  }
49 
50  } else if (!RPCsimhitsTag.label().empty()) {
52  LogTrace("RPCHitAssociator") << "getting PSimHit collection - " << RPCsimhitsTag;
53  e.getByLabel(RPCsimhitsTag, RPCsimhits);
54  LogTrace("RPCHitAssociator") << "... size = " << RPCsimhits->size();
55 
56  // arrange the hits by detUnit
57  for (edm::PSimHitContainer::const_iterator hitItr = RPCsimhits->begin(); hitItr != RPCsimhits->end(); ++hitItr) {
58  _SimHitMap[hitItr->detUnitId()].push_back(*hitItr);
59  }
60  }
61 
63  LogTrace("RPCHitAssociator") << "getting RPCDigiSimLink collection - " << RPCdigisimlinkTag;
64  e.getByLabel(RPCdigisimlinkTag, thelinkDigis);
65  _thelinkDigis = thelinkDigis;
66 }

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

Referenced by RPCHitAssociator().

Member Data Documentation

◆ _SimHitMap

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

Definition at line 62 of file RPCHitAssociator.h.

Referenced by initEvent().

◆ _thelinkDigis

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

Definition at line 51 of file RPCHitAssociator.h.

Referenced by findRPCDigiSimLink(), and initEvent().

◆ crossingframe

bool RPCHitAssociator::crossingframe
private

Definition at line 54 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

◆ RPCdigisimlinkTag

edm::InputTag RPCHitAssociator::RPCdigisimlinkTag
private

Definition at line 52 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

◆ RPCdigisimlinkToken_

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

Definition at line 60 of file RPCHitAssociator.h.

Referenced by RPCHitAssociator().

◆ RPCsimhitsTag

edm::InputTag RPCHitAssociator::RPCsimhitsTag
private

Definition at line 55 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

◆ RPCsimhitsToken_

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

Definition at line 59 of file RPCHitAssociator.h.

Referenced by RPCHitAssociator().

◆ RPCsimhitsXFTag

edm::InputTag RPCHitAssociator::RPCsimhitsXFTag
private

Definition at line 56 of file RPCHitAssociator.h.

Referenced by initEvent(), and RPCHitAssociator().

◆ RPCsimhitsXFToken_

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

Definition at line 58 of file RPCHitAssociator.h.

Referenced by RPCHitAssociator().

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
edm::DetSetVector< RPCDigiSimLink >
mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
SimHitIdpr
std::pair< uint32_t, EncodedEventId > SimHitIdpr
Definition: TrackerHitAssociator.h:54
RPCHitAssociator::_thelinkDigis
edm::Handle< edm::DetSetVector< RPCDigiSimLink > > _thelinkDigis
Definition: RPCHitAssociator.h:51
RPCHitAssociator::initEvent
void initEvent(const edm::Event &, const edm::EventSetup &)
Definition: RPCHitAssociator.cc:33
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
RPCDetId
Definition: RPCDetId.h:16
RPCRecHit::BunchX
int BunchX() const
Definition: RPCRecHit.h:73
RPCHitAssociator::crossingframe
bool crossingframe
Definition: RPCHitAssociator.h:54
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
RPCHitAssociator::RPCsimhitsToken_
edm::EDGetTokenT< edm::PSimHitContainer > RPCsimhitsToken_
Definition: RPCHitAssociator.h:59
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:61
RPCHitAssociator::RPCdigisimlinkToken_
edm::EDGetTokenT< edm::DetSetVector< RPCDigiSimLink > > RPCdigisimlinkToken_
Definition: RPCHitAssociator.h:60
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CrossingFrame
Definition: CrossingFrame.h:37
RPCHitAssociator::RPCsimhitsXFTag
edm::InputTag RPCsimhitsXFTag
Definition: RPCHitAssociator.h:56
MixCollection
Definition: MixCollection.h:10
RPCRecHit
Definition: RPCRecHit.h:14
str
#define str(s)
Definition: TestProcessor.cc:52
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
RPCRecHit::clusterSize
int clusterSize() const
Definition: RPCRecHit.h:77
RPCHitAssociator::findRPCDigiSimLink
std::set< RPCDigiSimLink > findRPCDigiSimLink(uint32_t rpcDetId, int strip, int bx) const
Definition: RPCHitAssociator.cc:102
TrackingRecHit
Definition: TrackingRecHit.h:21
RPCHitAssociator::RPCdigisimlinkTag
edm::InputTag RPCdigisimlinkTag
Definition: RPCHitAssociator.h:52
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
electronStore.links
links
Definition: electronStore.py:149
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
RPCHitAssociator::_SimHitMap
std::map< unsigned int, edm::PSimHitContainer > _SimHitMap
Definition: RPCHitAssociator.h:62
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
RPCHitAssociator::RPCsimhitsTag
edm::InputTag RPCsimhitsTag
Definition: RPCHitAssociator.h:55
RPCRecHit::rpcId
RPCDetId rpcId() const
Return the rpcId.
Definition: RPCRecHit.h:71
RPCRecHit::firstClusterStrip
int firstClusterStrip() const
Definition: RPCRecHit.h:75
RPCHitAssociator::RPCsimhitsXFToken_
edm::EDGetTokenT< CrossingFrame< PSimHit > > RPCsimhitsXFToken_
Definition: RPCHitAssociator.h:58
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31