CMS 3D CMS Logo

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

#include <RPCPointVsRecHit.h>

Inheritance diagram for RPCPointVsRecHit:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 RPCPointVsRecHit (const edm::ParameterSet &pset)
 
 ~RPCPointVsRecHit ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

RPCValidHistograms h_
 
edm::EDGetTokenT
< RPCRecHitCollection
recHitToken_
 
edm::EDGetTokenT
< RPCRecHitCollection
refHitToken_
 
std::string subDir_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 19 of file RPCPointVsRecHit.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file RPCPointVsRecHit.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

16 {
17  refHitToken_ = consumes<RPCRecHitCollection>(pset.getParameter<edm::InputTag>("refHit"));
18  recHitToken_ = consumes<RPCRecHitCollection>(pset.getParameter<edm::InputTag>("recHit"));
19 
20  subDir_ = pset.getParameter<std::string>("subDir");
21 }
T getParameter(std::string const &) const
edm::EDGetTokenT< RPCRecHitCollection > refHitToken_
std::string subDir_
edm::EDGetTokenT< RPCRecHitCollection > recHitToken_
RPCPointVsRecHit::~RPCPointVsRecHit ( )
inline

Definition at line 23 of file RPCPointVsRecHit.h.

23 {};

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 23 of file RPCPointVsRecHit.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), RPCRoll::id(), match(), RPCDetId::region(), HLT_25ns14e33_v3_cff::region, relativeConstraints::ring, RPCDetId::ring(), mathSSE::sqrt(), relativeConstraints::station, and RPCDetId::station().

24 {
25  // Get the RPC Geometry
27  eventSetup.get<MuonGeometryRecord>().get(rpcGeom);
28 
29  // Retrieve RefHits from the event
31  if ( !event.getByToken(refHitToken_, refHitHandle) )
32  {
33  edm::LogInfo("RPCPointVsRecHit") << "Cannot find reference hit collection\n";
34  return;
35  }
36 
37  // Retrieve RecHits from the event
39  if ( !event.getByToken(recHitToken_, recHitHandle) )
40  {
41  edm::LogInfo("RPCPointVsRecHit") << "Cannot find recHit collection\n";
42  return;
43  }
44 
45  typedef RPCRecHitCollection::const_iterator RecHitIter;
46 
47  // Loop over refHits, fill histograms which does not need associations
48  int nRefHitBarrel = 0, nRefHitEndcap = 0;
49  for ( RecHitIter refHitIter = refHitHandle->begin();
50  refHitIter != refHitHandle->end(); ++refHitIter )
51  {
52  const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
53  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId()));
54  if ( !roll ) continue;
55 
56  const int region = roll->id().region();
57  const int ring = roll->id().ring();
58  //const int sector = roll->id().sector();
59  const int station = roll->id().station();
60  //const int layer = roll->id().layer();
61  //const int subSector = roll->id().subsector();
62 
63  if ( region == 0 )
64  {
68  }
69  else
70  {
71  h_.refHitOccupancyEndcap_disk->Fill(region*station);
72  h_.refHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
73  }
74 
75  }
76  h_.nRefHitBarrel->Fill(nRefHitBarrel);
77  h_.nRefHitEndcap->Fill(nRefHitEndcap);
78 
79  // Loop over recHits, fill histograms which does not need associations
80  int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
81  int nRecHitBarrel = 0, nRecHitEndcap = 0;
82  for ( RecHitIter recHitIter = recHitHandle->begin();
83  recHitIter != recHitHandle->end(); ++recHitIter )
84  {
85  const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
86  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId()));
87  if ( !roll ) continue;
88 
89  const int region = roll->id().region();
90  const int ring = roll->id().ring();
91  //const int sector = roll->id().sector();
92  const int station = (roll->id().station());
93  //const int layer = roll->id().layer();
94  //const int subSector = roll->id().subsector();
95 
96  h_.clusterSize->Fill(recHitIter->clusterSize());
97 
98  if ( region == 0 )
99  {
100  ++nRecHitBarrel;
101  sumClusterSizeBarrel += recHitIter->clusterSize();
102  h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
106  }
107  else
108  {
109  ++nRecHitEndcap;
110  sumClusterSizeEndcap += recHitIter->clusterSize();
111  h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
112  h_.recHitOccupancyEndcap_disk->Fill(region*station);
113  h_.recHitOccupancyEndcap_disk_ring->Fill(ring, region*station);
114  }
115 
116  }
117  const double nRecHit = nRecHitBarrel+nRecHitEndcap;
118  h_.nRecHitBarrel->Fill(nRecHitBarrel);
119  h_.nRecHitEndcap->Fill(nRecHitEndcap);
120  if ( nRecHit > 0 )
121  {
122  const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
123  h_.avgClusterSize->Fill(double(sumClusterSize)/nRecHit);
124 
125  if ( nRecHitBarrel > 0 )
126  {
127  h_.avgClusterSizeBarrel->Fill(double(sumClusterSizeBarrel)/nRecHitBarrel);
128  }
129  if ( nRecHitEndcap > 0 )
130  {
131  h_.avgClusterSizeEndcap->Fill(double(sumClusterSizeEndcap)/nRecHitEndcap);
132  }
133  }
134 
135  // Start matching RefHits to RecHits
136  typedef std::map<RecHitIter, RecHitIter> RecToRecHitMap;
137  RecToRecHitMap refToRecHitMap;
138 
139  for ( RecHitIter refHitIter = refHitHandle->begin();
140  refHitIter != refHitHandle->end(); ++refHitIter )
141  {
142  const RPCDetId refDetId = static_cast<const RPCDetId>(refHitIter->rpcId());
143  const RPCRoll* refRoll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(refDetId));
144  if ( !refRoll ) continue;
145 
146  const double refX = refHitIter->localPosition().x();
147 
148  for ( RecHitIter recHitIter = recHitHandle->begin();
149  recHitIter != recHitHandle->end(); ++recHitIter )
150  {
151  const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
152  const RPCRoll* recRoll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(recDetId));
153  if ( !recRoll ) continue;
154 
155  if ( refDetId != recDetId ) continue;
156 
157  const double recX = recHitIter->localPosition().x();
158  const double newDx = fabs(recX - refX);
159 
160  // Associate RefHit to RecHit
161  RecToRecHitMap::const_iterator prevRefToReco = refToRecHitMap.find(refHitIter);
162  if ( prevRefToReco == refToRecHitMap.end() )
163  {
164  refToRecHitMap.insert(std::make_pair(refHitIter, recHitIter));
165  }
166  else
167  {
168  const double oldDx = fabs(prevRefToReco->second->localPosition().x() - refX);
169 
170  if ( newDx < oldDx )
171  {
172  refToRecHitMap[refHitIter] = recHitIter;
173  }
174  }
175  }
176  }
177 
178  // Now we have refHit-recHit mapping
179  // So we can fill up relavant histograms
180  for ( RecToRecHitMap::const_iterator match = refToRecHitMap.begin();
181  match != refToRecHitMap.end(); ++match )
182  {
183  RecHitIter refHitIter = match->first;
184  RecHitIter recHitIter = match->second;
185 
186  const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
187  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId));
188 
189  const int region = roll->id().region();
190  const int ring = roll->id().ring();
191  //const int sector = roll->id().sector();
192  const int station = roll->id().station();
193  //const int layer = roll->id().layer();
194  //const int subsector = roll->id().subsector();
195 
196  const double refX = refHitIter->localPosition().x();
197  const double recX = recHitIter->localPosition().x();
198  const double errX = sqrt(recHitIter->localPositionError().xx());
199  const double dX = recX - refX;
200  const double pull = errX == 0 ? -999 : dX/errX;
201 
202  //const GlobalPoint refPos = roll->toGlobal(refHitIter->localPosition());
203  //const GlobalPoint recPos = roll->toGlobal(recHitIter->localPosition());
204 
205  if ( region == 0 )
206  {
207  h_.resBarrel->Fill(dX);
208  h_.pullBarrel->Fill(pull);
212 
213  h_.res_wheel_res->Fill(ring, dX);
214  h_.res_station_res->Fill(station, dX);
215  h_.pull_wheel_pull->Fill(ring, pull);
216  h_.pull_station_pull->Fill(station, pull);
217  }
218  else
219  {
220  h_.resEndcap->Fill(dX);
221  h_.pullEndcap->Fill(pull);
222  h_.matchOccupancyEndcap_disk->Fill(region*station);
223  h_.matchOccupancyEndcap_disk_ring->Fill(region*station, ring);
224 
225  h_.res_disk_res->Fill(region*station, dX);
226  h_.res_ring_res->Fill(ring, dX);
227  h_.pull_disk_pull->Fill(region*station, pull);
228  h_.pull_ring_pull->Fill(ring, pull);
229  }
230  }
231 
232 /*
233  // Find Lost hits
234  for ( RecHitIter refHitIter = refHitHandle->begin();
235  refHitIter != refHitHandle->end(); ++refHitIter )
236  {
237  const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
238  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId));
239 
240  const int region = roll->id().region();
241  const int ring = roll->id().ring();
242  //const int sector = roll->id().sector();
243  const int station = roll->id().station();
244  //const int layer = roll->id().layer();
245  //const int subsector = roll->id().subsector();
246 
247  bool matched = false;
248  for ( RecToRecHitMap::const_iterator match = refToRecHitMap.begin();
249  match != refToRecHitMap.end(); ++match )
250  {
251  if ( refHitIter == match->first )
252  {
253  matched = true;
254  break;
255  }
256  }
257 
258  if ( !matched )
259  {
260  if ( region == 0 )
261  {
262  h_.nUrefHitOccupancyBarrel_wheel->Fill(ring);
263  h_.nUrefHitOccupancyBarrel_wheel_ring->Fill(ring, station);
264  }
265  else
266  {
267  h_.nUnMatchedRefHit_disk->Fill(region*station);
268  h_.nUnMatchedRefHit_disk_ring->Fill(region*station, ring);
269  }
270  }
271  }
272 */
273 
274  // Find Noisy hits
275  for ( RecHitIter recHitIter = recHitHandle->begin();
276  recHitIter != recHitHandle->end(); ++recHitIter )
277  {
278  const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
279  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId));
280 
281  const int region = roll->id().region();
282  const int ring = roll->id().ring();
283  //const int sector = roll->id().sector();
284  const int station = roll->id().station();
285  //const int layer = roll->id().layer();
286  //const int subsector = roll->id().subsector();
287 
288  bool matched = false;
289  for ( RecToRecHitMap::const_iterator match = refToRecHitMap.begin();
290  match != refToRecHitMap.end(); ++match )
291  {
292  if ( recHitIter == match->second )
293  {
294  matched = true;
295  break;
296  }
297  }
298 
299  if ( !matched )
300  {
301  if ( region == 0 )
302  {
305  h_.umOccupancyBarrel_wheel_station->Fill(ring, station);
306  }
307  else
308  {
309  h_.umOccupancyEndcap_disk->Fill(region*station);
310  h_.umOccupancyEndcap_disk_ring->Fill(region*station, ring);
311  }
312 
313  //const GlobalPoint pos = roll->toGlobal(recHitIter->localPosition());
314  //h_[HName::NoisyHitEta]->Fill(pos.eta());
315  }
316  }
317 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::EDGetTokenT< RPCRecHitCollection > refHitToken_
void Fill(long long x)
RPCDetId id() const
Definition: RPCRoll.cc:24
int ring() const
Definition: RPCDetId.h:72
T sqrt(T t)
Definition: SSEVec.h:48
const T & get() const
Definition: EventSetup.h:56
RPCValidHistograms h_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::EDGetTokenT< RPCRecHitCollection > recHitToken_
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
void RPCPointVsRecHit::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  run,
edm::EventSetup const &  eventSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 319 of file RPCPointVsRecHit.cc.

321 {
322  // Book MonitorElements
323  h_.bookHistograms(booker, subDir_);
324 }
void bookHistograms(DQMStore::IBooker &booker, const std::string &subDir)
std::string subDir_
RPCValidHistograms h_

Member Data Documentation

RPCValidHistograms RPCPointVsRecHit::h_
private

Definition at line 32 of file RPCPointVsRecHit.h.

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

Definition at line 29 of file RPCPointVsRecHit.h.

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

Definition at line 29 of file RPCPointVsRecHit.h.

std::string RPCPointVsRecHit::subDir_
private

Definition at line 31 of file RPCPointVsRecHit.h.