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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

RPCValidHistograms h_
 
edm::EDGetTokenT< RPCRecHitCollectionrecHitToken_
 
edm::EDGetTokenT< RPCRecHitCollectionrefHitToken_
 
edm::ESGetToken< RPCGeometry, MuonGeometryRecordrpcGeomToken_
 
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 >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 21 of file RPCPointVsRecHit.h.

Constructor & Destructor Documentation

◆ RPCPointVsRecHit()

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

Definition at line 13 of file RPCPointVsRecHit.cc.

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

References DeDxTools::esConsumes(), muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~RPCPointVsRecHit()

RPCPointVsRecHit::~RPCPointVsRecHit ( )
inlineoverride

Definition at line 24 of file RPCPointVsRecHit.h.

24 {};

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

References fftjetvertexadder_cfi::errX, edm::EventSetup::getHandle(), match(), HLT_FULL_cff::region, relativeConstraints::ring, 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 205 of file RPCPointVsRecHit.cc.

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

Member Data Documentation

◆ h_

RPCValidHistograms RPCPointVsRecHit::h_
private

Definition at line 34 of file RPCPointVsRecHit.h.

◆ recHitToken_

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

Definition at line 30 of file RPCPointVsRecHit.h.

◆ refHitToken_

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

Definition at line 30 of file RPCPointVsRecHit.h.

◆ rpcGeomToken_

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> RPCPointVsRecHit::rpcGeomToken_
private

Definition at line 31 of file RPCPointVsRecHit.h.

◆ subDir_

std::string RPCPointVsRecHit::subDir_
private

Definition at line 33 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:33
RPCValidHistograms::refHitOccupancyEndcap_disk
MEP refHitOccupancyEndcap_disk
Definition: RPCValidHistograms.h:32
RPCPointVsRecHit::h_
RPCValidHistograms h_
Definition: RPCPointVsRecHit.h:34
relativeConstraints.station
station
Definition: relativeConstraints.py:67
RPCValidHistograms::refHitOccupancyBarrel_wheel
MEP refHitOccupancyBarrel_wheel
Definition: RPCValidHistograms.h:32
RPCDetId
Definition: RPCDetId.h:16
RPCValidHistograms::recHitOccupancyBarrel_wheel_station
MEP recHitOccupancyBarrel_wheel_station
Definition: RPCValidHistograms.h:38
RPCValidHistograms::resEndcap
MEP resEndcap
Definition: RPCValidHistograms.h:42
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
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
RPCValidHistograms::clusterSize
MEP clusterSize
Definition: RPCValidHistograms.h:22
RPCValidHistograms::nRecHitEndcap
MEP nRecHitEndcap
Definition: RPCValidHistograms.h:26
RPCValidHistograms::resBarrel
MEP resBarrel
Definition: RPCValidHistograms.h:42
RPCPointVsRecHit::recHitToken_
edm::EDGetTokenT< RPCRecHitCollection > recHitToken_
Definition: RPCPointVsRecHit.h:30
RPCPointVsRecHit::rpcGeomToken_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
Definition: RPCPointVsRecHit.h:31
RPCValidHistograms::matchOccupancyBarrel_station
MEP matchOccupancyBarrel_station
Definition: RPCValidHistograms.h:34
RPCPointVsRecHit::refHitToken_
edm::EDGetTokenT< RPCRecHitCollection > refHitToken_
Definition: RPCPointVsRecHit.h:30
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
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
RPCValidHistograms::matchOccupancyBarrel_wheel_station
MEP matchOccupancyBarrel_wheel_station
Definition: RPCValidHistograms.h:39
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
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
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
RPCValidHistograms::clusterSizeEndcap
MEP clusterSizeEndcap
Definition: RPCValidHistograms.h:22
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