CMS 3D CMS Logo

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

#include <RPCPointVsRecHit.h>

Inheritance diagram for RPCPointVsRecHit:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 RPCPointVsRecHit (const edm::ParameterSet &pset)
 
 ~RPCPointVsRecHit () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

RPCValidHistograms h_
 
edm::EDGetTokenT< RPCRecHitCollectionrecHitToken_
 
edm::EDGetTokenT< RPCRecHitCollectionrefHitToken_
 
std::string subDir_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 19 of file RPCPointVsRecHit.h.

Constructor & Destructor Documentation

◆ RPCPointVsRecHit()

RPCPointVsRecHit::RPCPointVsRecHit ( const edm::ParameterSet pset)

Definition at line 15 of file RPCPointVsRecHit.cc.

15  {
16  refHitToken_ = consumes<RPCRecHitCollection>(pset.getParameter<edm::InputTag>("refHit"));
17  recHitToken_ = consumes<RPCRecHitCollection>(pset.getParameter<edm::InputTag>("recHit"));
18 
19  subDir_ = pset.getParameter<std::string>("subDir");
20 }

References muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~RPCPointVsRecHit()

RPCPointVsRecHit::~RPCPointVsRecHit ( )
inlineoverride

Definition at line 22 of file RPCPointVsRecHit.h.

22 {};

Member Function Documentation

◆ analyze()

void RPCPointVsRecHit::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 22 of file RPCPointVsRecHit.cc.

22  {
23  // Get the RPC Geometry
25  eventSetup.get<MuonGeometryRecord>().get(rpcGeom);
26 
27  // Retrieve RefHits from the event
29  if (!event.getByToken(refHitToken_, refHitHandle)) {
30  edm::LogInfo("RPCPointVsRecHit") << "Cannot find reference hit collection\n";
31  return;
32  }
33 
34  // Retrieve RecHits from the event
36  if (!event.getByToken(recHitToken_, recHitHandle)) {
37  edm::LogInfo("RPCPointVsRecHit") << "Cannot find recHit collection\n";
38  return;
39  }
40 
41  typedef RPCRecHitCollection::const_iterator RecHitIter;
42 
43  // Loop over refHits, fill histograms which does not need associations
44  int nRefHitBarrel = 0, nRefHitEndcap = 0;
45  for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
46  const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
47  const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId()));
48  if (!roll)
49  continue;
50 
51  const int region = roll->id().region();
52  const int ring = roll->id().ring();
53  // const int sector = roll->id().sector();
54  const int station = roll->id().station();
55  // const int layer = roll->id().layer();
56  // const int subSector = roll->id().subsector();
57 
58  if (region == 0) {
62  } else {
65  }
66  }
67  h_.nRefHitBarrel->Fill(nRefHitBarrel);
68  h_.nRefHitEndcap->Fill(nRefHitEndcap);
69 
70  // Loop over recHits, fill histograms which does not need associations
71  int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
72  int nRecHitBarrel = 0, nRecHitEndcap = 0;
73  for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
74  const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
75  const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId()));
76  if (!roll)
77  continue;
78 
79  const int region = roll->id().region();
80  const int ring = roll->id().ring();
81  // const int sector = roll->id().sector();
82  const int station = (roll->id().station());
83  // const int layer = roll->id().layer();
84  // const int subSector = roll->id().subsector();
85 
86  h_.clusterSize->Fill(recHitIter->clusterSize());
87 
88  if (region == 0) {
89  ++nRecHitBarrel;
90  sumClusterSizeBarrel += recHitIter->clusterSize();
91  h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
95  } else {
96  ++nRecHitEndcap;
97  sumClusterSizeEndcap += recHitIter->clusterSize();
98  h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
101  }
102  }
103  const double nRecHit = nRecHitBarrel + nRecHitEndcap;
104  h_.nRecHitBarrel->Fill(nRecHitBarrel);
105  h_.nRecHitEndcap->Fill(nRecHitEndcap);
106  if (nRecHit > 0) {
107  const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
108  h_.avgClusterSize->Fill(double(sumClusterSize) / nRecHit);
109 
110  if (nRecHitBarrel > 0) {
111  h_.avgClusterSizeBarrel->Fill(double(sumClusterSizeBarrel) / nRecHitBarrel);
112  }
113  if (nRecHitEndcap > 0) {
114  h_.avgClusterSizeEndcap->Fill(double(sumClusterSizeEndcap) / nRecHitEndcap);
115  }
116  }
117 
118  // Start matching RefHits to RecHits
119  typedef std::map<RecHitIter, RecHitIter> RecToRecHitMap;
120  RecToRecHitMap refToRecHitMap;
121 
122  for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
123  const RPCDetId refDetId = static_cast<const RPCDetId>(refHitIter->rpcId());
124  const RPCRoll *refRoll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(refDetId));
125  if (!refRoll)
126  continue;
127 
128  const double refX = refHitIter->localPosition().x();
129 
130  for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
131  const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
132  const RPCRoll *recRoll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(recDetId));
133  if (!recRoll)
134  continue;
135 
136  if (refDetId != recDetId)
137  continue;
138 
139  const double recX = recHitIter->localPosition().x();
140  const double newDx = fabs(recX - refX);
141 
142  // Associate RefHit to RecHit
143  RecToRecHitMap::const_iterator prevRefToReco = refToRecHitMap.find(refHitIter);
144  if (prevRefToReco == refToRecHitMap.end()) {
145  refToRecHitMap.insert(std::make_pair(refHitIter, recHitIter));
146  } else {
147  const double oldDx = fabs(prevRefToReco->second->localPosition().x() - refX);
148 
149  if (newDx < oldDx) {
150  refToRecHitMap[refHitIter] = recHitIter;
151  }
152  }
153  }
154  }
155 
156  // Now we have refHit-recHit mapping
157  // So we can fill up relavant histograms
158  for (RecToRecHitMap::const_iterator match = refToRecHitMap.begin(); match != refToRecHitMap.end(); ++match) {
159  RecHitIter refHitIter = match->first;
160  RecHitIter recHitIter = match->second;
161 
162  const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
163  const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId));
164 
165  const int region = roll->id().region();
166  const int ring = roll->id().ring();
167  // const int sector = roll->id().sector();
168  const int station = roll->id().station();
169  // const int layer = roll->id().layer();
170  // const int subsector = roll->id().subsector();
171 
172  const double refX = refHitIter->localPosition().x();
173  const double recX = recHitIter->localPosition().x();
174  const double errX = sqrt(recHitIter->localPositionError().xx());
175  const double dX = recX - refX;
176  const double pull = errX == 0 ? -999 : dX / errX;
177 
178  // const GlobalPoint refPos = roll->toGlobal(refHitIter->localPosition());
179  // const GlobalPoint recPos = roll->toGlobal(recHitIter->localPosition());
180 
181  if (region == 0) {
182  h_.resBarrel->Fill(dX);
183  h_.pullBarrel->Fill(pull);
187 
188  h_.res_wheel_res->Fill(ring, dX);
190  h_.pull_wheel_pull->Fill(ring, pull);
192  } else {
193  h_.resEndcap->Fill(dX);
194  h_.pullEndcap->Fill(pull);
197 
199  h_.res_ring_res->Fill(ring, dX);
200  h_.pull_disk_pull->Fill(region * station, pull);
201  h_.pull_ring_pull->Fill(ring, pull);
202  }
203  }
204 }

References fftjetvertexadder_cfi::errX, options_cfi::eventSetup, get, match(), HLT_2018_cff::region, relativeConstraints::ring, RPCGeometry::roll(), mathSSE::sqrt(), and relativeConstraints::station.

◆ bookHistograms()

void RPCPointVsRecHit::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  run,
edm::EventSetup const &  eventSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 206 of file RPCPointVsRecHit.cc.

208  {
209  // Book MonitorElements
210  h_.bookHistograms(booker, subDir_);
211 }

Member Data Documentation

◆ h_

RPCValidHistograms RPCPointVsRecHit::h_
private

Definition at line 31 of file RPCPointVsRecHit.h.

◆ recHitToken_

edm::EDGetTokenT<RPCRecHitCollection> RPCPointVsRecHit::recHitToken_
private

Definition at line 28 of file RPCPointVsRecHit.h.

◆ refHitToken_

edm::EDGetTokenT<RPCRecHitCollection> RPCPointVsRecHit::refHitToken_
private

Definition at line 28 of file RPCPointVsRecHit.h.

◆ subDir_

std::string RPCPointVsRecHit::subDir_
private

Definition at line 30 of file RPCPointVsRecHit.h.

RPCRoll
Definition: RPCRoll.h:12
RPCValidHistograms::refHitOccupancyBarrel_wheel_station
MEP refHitOccupancyBarrel_wheel_station
Definition: RPCValidHistograms.h:37
RPCValidHistograms::res_ring_res
MEP res_ring_res
Definition: RPCValidHistograms.h:43
RPCPointVsRecHit::subDir_
std::string subDir_
Definition: RPCPointVsRecHit.h:30
RPCValidHistograms::refHitOccupancyEndcap_disk
MEP refHitOccupancyEndcap_disk
Definition: RPCValidHistograms.h:32
RPCPointVsRecHit::h_
RPCValidHistograms h_
Definition: RPCPointVsRecHit.h:31
relativeConstraints.station
station
Definition: relativeConstraints.py:67
RPCValidHistograms::refHitOccupancyBarrel_wheel
MEP refHitOccupancyBarrel_wheel
Definition: RPCValidHistograms.h:32
RPCDetId
Definition: RPCDetId.h:16
edm::LogInfo
Definition: MessageLogger.h:254
RPCValidHistograms::recHitOccupancyBarrel_wheel_station
MEP recHitOccupancyBarrel_wheel_station
Definition: RPCValidHistograms.h:38
RPCValidHistograms::resEndcap
MEP resEndcap
Definition: RPCValidHistograms.h:42
RPCGeometry::roll
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
RPCValidHistograms::pull_station_pull
MEP pull_station_pull
Definition: RPCValidHistograms.h:47
RPCValidHistograms::pull_disk_pull
MEP pull_disk_pull
Definition: RPCValidHistograms.h:47
edm::Handle< RPCRecHitCollection >
RPCValidHistograms::matchOccupancyBarrel_wheel
MEP matchOccupancyBarrel_wheel
Definition: RPCValidHistograms.h:34
RPCValidHistograms::bookHistograms
void bookHistograms(DQMStore::IBooker &booker, const std::string &subDir)
Definition: RPCValidHistograms.cc:5
RPCValidHistograms::avgClusterSizeEndcap
MEP avgClusterSizeEndcap
Definition: RPCValidHistograms.h:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
RPCValidHistograms::res_station_res
MEP res_station_res
Definition: RPCValidHistograms.h:43
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
RPCValidHistograms::recHitOccupancyBarrel_station
MEP recHitOccupancyBarrel_station
Definition: RPCValidHistograms.h:33
edm::ESHandle< RPCGeometry >
RPCValidHistograms::clusterSize
MEP clusterSize
Definition: RPCValidHistograms.h:22
RPCValidHistograms::nRecHitEndcap
MEP nRecHitEndcap
Definition: RPCValidHistograms.h:26
RPCValidHistograms::resBarrel
MEP resBarrel
Definition: RPCValidHistograms.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCPointVsRecHit::recHitToken_
edm::EDGetTokenT< RPCRecHitCollection > recHitToken_
Definition: RPCPointVsRecHit.h:28
RPCValidHistograms::matchOccupancyBarrel_station
MEP matchOccupancyBarrel_station
Definition: RPCValidHistograms.h:34
RPCPointVsRecHit::refHitToken_
edm::EDGetTokenT< RPCRecHitCollection > refHitToken_
Definition: RPCPointVsRecHit.h:28
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
RPCValidHistograms::matchOccupancyBarrel_wheel_station
MEP matchOccupancyBarrel_wheel_station
Definition: RPCValidHistograms.h:39
RPCValidHistograms::avgClusterSizeBarrel
MEP avgClusterSizeBarrel
Definition: RPCValidHistograms.h:23
RPCValidHistograms::res_disk_res
MEP res_disk_res
Definition: RPCValidHistograms.h:43
RPCValidHistograms::pullBarrel
MEP pullBarrel
Definition: RPCValidHistograms.h:46
RPCValidHistograms::pullEndcap
MEP pullEndcap
Definition: RPCValidHistograms.h:46
get
#define get
RPCValidHistograms::matchOccupancyEndcap_disk_ring
MEP matchOccupancyEndcap_disk_ring
Definition: RPCValidHistograms.h:39
RPCValidHistograms::recHitOccupancyEndcap_disk
MEP recHitOccupancyEndcap_disk
Definition: RPCValidHistograms.h:33
RPCValidHistograms::recHitOccupancyEndcap_disk_ring
MEP recHitOccupancyEndcap_disk_ring
Definition: RPCValidHistograms.h:38
RPCValidHistograms::avgClusterSize
MEP avgClusterSize
Definition: RPCValidHistograms.h:23
RPCValidHistograms::res_wheel_res
MEP res_wheel_res
Definition: RPCValidHistograms.h:43
RPCValidHistograms::refHitOccupancyEndcap_disk_ring
MEP refHitOccupancyEndcap_disk_ring
Definition: RPCValidHistograms.h:37
RPCValidHistograms::nRefHitEndcap
MEP nRefHitEndcap
Definition: RPCValidHistograms.h:25
RPCValidHistograms::matchOccupancyEndcap_disk
MEP matchOccupancyEndcap_disk
Definition: RPCValidHistograms.h:34
options_cfi.eventSetup
eventSetup
Definition: options_cfi.py:12
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
RPCValidHistograms::refHitOccupancyBarrel_station
MEP refHitOccupancyBarrel_station
Definition: RPCValidHistograms.h:32
RPCValidHistograms::recHitOccupancyBarrel_wheel
MEP recHitOccupancyBarrel_wheel
Definition: RPCValidHistograms.h:33
RPCValidHistograms::pull_wheel_pull
MEP pull_wheel_pull
Definition: RPCValidHistograms.h:47
RPCValidHistograms::nRecHitBarrel
MEP nRecHitBarrel
Definition: RPCValidHistograms.h:26
RPCValidHistograms::pull_ring_pull
MEP pull_ring_pull
Definition: RPCValidHistograms.h:47
RPCValidHistograms::nRefHitBarrel
MEP nRefHitBarrel
Definition: RPCValidHistograms.h:25
event
Definition: event.py:1
RPCValidHistograms::clusterSizeEndcap
MEP clusterSizeEndcap
Definition: RPCValidHistograms.h:22
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
fftjetvertexadder_cfi.errX
errX
Definition: fftjetvertexadder_cfi.py:37
edm::InputTag
Definition: InputTag.h:15
RPCValidHistograms::clusterSizeBarrel
MEP clusterSizeBarrel
Definition: RPCValidHistograms.h:22
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27