CMS 3D CMS Logo

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

#include <RPCRecHitValid.h>

Inheritance diagram for RPCRecHitValid:
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) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 RPCRecHitValid (const edm::ParameterSet &pset)
 
 ~RPCRecHitValid ()
 
- 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 ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef MonitorElementMEP
 
typedef RPCRecHitCollection RecHits
 
typedef SimHitTPAssociationProducer::SimHitTPAssociationList SimHitAssoc
 
typedef edm::PSimHitContainer SimHits
 
typedef TrackingParticleCollection SimParticles
 

Private Attributes

std::map< int, int > detIdToIndexMapBarrel_
 
std::map< int, int > detIdToIndexMapEndcap_
 
RPCValidHistograms h_
 
MEP h_eventCount
 
MEP h_matchOccupancyBarrel_detId
 
MEP h_matchOccupancyEndcap_detId
 
MEP h_noiseOccupancyBarrel_detId
 
MEP h_noiseOccupancyEndcap_detId
 
MEP h_nRPCHitPerRecoMuon
 
MEP h_nRPCHitPerRecoMuonBarrel
 
MEP h_nRPCHitPerRecoMuonEndcap
 
MEP h_nRPCHitPerRecoMuonOverlap
 
MEP h_nRPCHitPerSimMuon
 
MEP h_nRPCHitPerSimMuonBarrel
 
MEP h_nRPCHitPerSimMuonEndcap
 
MEP h_nRPCHitPerSimMuonOverlap
 
MEP h_recoMuonBarrel_eta
 
MEP h_recoMuonBarrel_phi
 
MEP h_recoMuonBarrel_pt
 
MEP h_recoMuonEndcap_eta
 
MEP h_recoMuonEndcap_phi
 
MEP h_recoMuonEndcap_pt
 
MEP h_recoMuonNoRPC_eta
 
MEP h_recoMuonNoRPC_phi
 
MEP h_recoMuonNoRPC_pt
 
MEP h_recoMuonOverlap_eta
 
MEP h_recoMuonOverlap_phi
 
MEP h_recoMuonOverlap_pt
 
MEP h_recPunchOccupancyBarrel_station
 
MEP h_recPunchOccupancyBarrel_wheel
 
MEP h_recPunchOccupancyBarrel_wheel_station
 
MEP h_recPunchOccupancyEndcap_disk
 
MEP h_recPunchOccupancyEndcap_disk_ring
 
MEP h_refOccupancyBarrel_detId
 
MEP h_refOccupancyEndcap_detId
 
MEP h_refPunchOccupancyBarrel_station
 
MEP h_refPunchOccupancyBarrel_wheel
 
MEP h_refPunchOccupancyBarrel_wheel_station
 
MEP h_refPunchOccupancyEndcap_disk
 
MEP h_refPunchOccupancyEndcap_disk_ring
 
MEP h_rollAreaBarrel_detId
 
MEP h_rollAreaEndcap_detId
 
MEP h_simMuonBarrel_eta
 
MEP h_simMuonBarrel_phi
 
MEP h_simMuonBarrel_pt
 
MEP h_simMuonEndcap_eta
 
MEP h_simMuonEndcap_phi
 
MEP h_simMuonEndcap_pt
 
MEP h_simMuonNoRPC_eta
 
MEP h_simMuonNoRPC_phi
 
MEP h_simMuonNoRPC_pt
 
MEP h_simMuonOverlap_eta
 
MEP h_simMuonOverlap_phi
 
MEP h_simMuonOverlap_pt
 
MEP h_simParticleType
 
MEP h_simParticleTypeBarrel
 
MEP h_simParticleTypeEndcap
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
edm::EDGetTokenT< RecHitsrecHitToken_
 
edm::EDGetTokenT< SimHitAssocsimHitAssocToken_
 
edm::EDGetTokenT< SimHitssimHitToken_
 
edm::EDGetTokenT< SimParticlessimParticleToken_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
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::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (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 24 of file RPCRecHitValid.h.

Member Typedef Documentation

Definition at line 46 of file RPCRecHitValid.h.

Definition at line 35 of file RPCRecHitValid.h.

Definition at line 37 of file RPCRecHitValid.h.

Definition at line 34 of file RPCRecHitValid.h.

Definition at line 36 of file RPCRecHitValid.h.

Constructor & Destructor Documentation

RPCRecHitValid::RPCRecHitValid ( const edm::ParameterSet pset)

Definition at line 26 of file RPCRecHitValid.cc.

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

27 {
28  simHitToken_ = consumes<SimHits>(pset.getParameter<edm::InputTag>("simHit"));
29  recHitToken_ = consumes<RecHits>(pset.getParameter<edm::InputTag>("recHit"));
30  simParticleToken_ = consumes<SimParticles>(pset.getParameter<edm::InputTag>("simTrack"));
31  simHitAssocToken_ = consumes<SimHitAssoc>(pset.getParameter<edm::InputTag>("simHitAssoc"));
32  muonToken_ = consumes<reco::MuonCollection>(pset.getParameter<edm::InputTag>("muon"));
33 
34  subDir_ = pset.getParameter<std::string>("subDir");
35 }
T getParameter(std::string const &) const
edm::EDGetTokenT< RecHits > recHitToken_
edm::EDGetTokenT< SimHitAssoc > simHitAssocToken_
edm::EDGetTokenT< SimParticles > simParticleToken_
std::string subDir_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
edm::EDGetTokenT< SimHits > simHitToken_
RPCRecHitValid::~RPCRecHitValid ( )
inline

Definition at line 28 of file RPCRecHitValid.h.

References analyze(), and bookHistograms().

28 {};

Member Function Documentation

void RPCRecHitValid::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
override

Definition at line 314 of file RPCRecHitValid.cc.

References funct::abs(), DEFINE_FWK_MODULE, DetId::det(), fftjetvertexadder_cfi::errX, edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, RPCRoll::id(), RPCRoll::isIRPC(), match(), electronMatch_cfi::matched, DetId::Muon, metsig::muon, gen::n, or, DetId::rawId(), rpcPointValidation_cfi::recHit, RPCDetId::region(), relativeConstraints::ring, RPCDetId::ring(), RPCGeometry::roll(), MuonSubdetId::RPC, rpcPointValidation_cfi::simHit, SimHitTPAssociationProducer::simHitTPAssociationListGreater(), mathSSE::sqrt(), relativeConstraints::station, RPCDetId::station(), DetId::subdetId(), and ntuplemaker::time.

Referenced by ~RPCRecHitValid().

315 {
316  h_eventCount->Fill(1);
317 
318  // Get the RPC Geometry
320  eventSetup.get<MuonGeometryRecord>().get(rpcGeom);
321 
322  // Retrieve SimHits from the event
324  if ( !event.getByToken(simHitToken_, simHitHandle) )
325  {
326  edm::LogInfo("RPCRecHitValid") << "Cannot find simHit collection\n";
327  return;
328  }
329 
330  // Retrieve RecHits from the event
332  if ( !event.getByToken(recHitToken_, recHitHandle) )
333  {
334  edm::LogInfo("RPCRecHitValid") << "Cannot find recHit collection\n";
335  return;
336  }
337 
338  // Get SimParticles
339  edm::Handle<TrackingParticleCollection> simParticleHandle;
340  if ( !event.getByToken(simParticleToken_, simParticleHandle) )
341  {
342  edm::LogInfo("RPCRecHitValid") << "Cannot find TrackingParticle collection\n";
343  return;
344  }
345 
346  // Get SimParticle to SimHit association map
348  if ( !event.getByToken(simHitAssocToken_, simHitsTPAssoc) )
349  {
350  edm::LogInfo("RPCRecHitValid") << "Cannot find TrackingParticle to SimHit association map\n";
351  return;
352  }
353 
354  // Get RecoMuons
356  if ( !event.getByToken(muonToken_, muonHandle) )
357  {
358  edm::LogInfo("RPCRecHitValid") << "Cannot find muon collection\n";
359  return;
360  }
361 
362  typedef edm::PSimHitContainer::const_iterator SimHitIter;
363  typedef RPCRecHitCollection::const_iterator RecHitIter;
364  typedef std::vector<TrackPSimHitRef> SimHitRefs;
365 
366  // TrackingParticles with (and without) RPC simHits
367  SimHitRefs muonSimHits, pthrSimHits;
368 
369  for ( int i=0, n=simParticleHandle->size(); i<n; ++i )
370  {
371  TrackingParticleRef simParticle(simParticleHandle, i);
372  if ( simParticle->pt() < 1.0 or simParticle->p() < 2.5 ) continue; // globalMuon acceptance
373 
374  // Collect SimHits from this Tracking Particle
375  SimHitRefs simHitsFromParticle;
376  auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
377  std::make_pair(simParticle, TrackPSimHitRef()),
379  for ( auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
380  {
381  auto simHit = simParticleToHit->second;
382  const DetId detId(simHit->detUnitId());
383  if ( detId.det() != DetId::Muon or detId.subdetId() != MuonSubdetId::RPC ) continue;
384 
385  simHitsFromParticle.push_back(simParticleToHit->second);
386  }
387  const int nRPCHit = simHitsFromParticle.size();
388  const bool hasRPCHit = nRPCHit > 0;
389 
390  if ( abs(simParticle->pdgId()) == 13 )
391  {
392  muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
393 
394  // Count number of Barrel hits and Endcap hits
395  int nRPCHitBarrel = 0;
396  int nRPCHitEndcap = 0;
397  for ( auto simHit : simHitsFromParticle )
398  {
399  const RPCDetId rpcDetId = static_cast<const RPCDetId>(simHit->detUnitId());
400  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(rpcDetId));
401  if ( !roll ) continue;
402 
403  if ( rpcDetId.region() == 0 ) ++nRPCHitBarrel;
404  else ++nRPCHitEndcap;
405  }
406 
407  // Fill TrackingParticle related histograms
408  h_nRPCHitPerSimMuon->Fill(nRPCHit);
409  if ( nRPCHitBarrel and nRPCHitEndcap )
410  {
412  h_simMuonOverlap_pt->Fill(simParticle->pt());
413  h_simMuonOverlap_eta->Fill(simParticle->eta());
414  h_simMuonOverlap_phi->Fill(simParticle->phi());
415  }
416  else if ( nRPCHitBarrel )
417  {
419  h_simMuonBarrel_pt->Fill(simParticle->pt());
420  h_simMuonBarrel_eta->Fill(simParticle->eta());
421  h_simMuonBarrel_phi->Fill(simParticle->phi());
422  }
423  else if ( nRPCHitEndcap )
424  {
426  h_simMuonEndcap_pt->Fill(simParticle->pt());
427  h_simMuonEndcap_eta->Fill(simParticle->eta());
428  h_simMuonEndcap_phi->Fill(simParticle->phi());
429  }
430  else
431  {
432  h_simMuonNoRPC_pt->Fill(simParticle->pt());
433  h_simMuonNoRPC_eta->Fill(simParticle->eta());
434  h_simMuonNoRPC_phi->Fill(simParticle->phi());
435  }
436  }
437  else
438  {
439  pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
440  }
441 
442  if ( hasRPCHit )
443  {
444  switch ( simParticle->pdgId() )
445  {
446  case 13: h_simParticleType->Fill( 0); break;
447  case -13: h_simParticleType->Fill( 1); break;
448  case 11: h_simParticleType->Fill( 2); break;
449  case -11: h_simParticleType->Fill( 3); break;
450  case 211: h_simParticleType->Fill( 4); break;
451  case -211: h_simParticleType->Fill( 5); break;
452  case 321: h_simParticleType->Fill( 6); break;
453  case -321: h_simParticleType->Fill( 7); break;
454  case 2212: h_simParticleType->Fill( 8); break;
455  case -2212: h_simParticleType->Fill( 9); break;
456  default: h_simParticleType->Fill(10); break;
457  }
458  }
459  }
460 
461  // Loop over muon simHits, fill histograms which does not need associations
462  int nRefHitBarrel = 0, nRefHitEndcap = 0;
463  for ( auto simHit : muonSimHits )
464  {
465  const RPCDetId detId = static_cast<const RPCDetId>(simHit->detUnitId());
466  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId));
467 
468  const int region = roll->id().region();
469  const int ring = roll->id().ring();
470  //const int sector = roll->id().sector();
471  const int station = roll->id().station();
472  //const int layer = roll->id().layer();
473  //const int subSector = roll->id().subsector();
474 
475  if ( region == 0 )
476  {
477  ++nRefHitBarrel;
481 
483  }
484  else
485  {
486  ++nRefHitEndcap;
487  h_.refHitOccupancyEndcap_disk->Fill(region*station);
488  h_.refHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
489 
491  }
492  }
493 
494  // Loop over punch-through simHits, fill histograms which does not need associations
495  for ( auto simHit : pthrSimHits )
496  {
497  const RPCDetId detId = static_cast<const RPCDetId>(simHit->detUnitId());
498  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId()));
499 
500  const int region = roll->id().region();
501  const int ring = roll->id().ring();
502  //const int sector = roll->id().sector();
503  const int station = roll->id().station();
504  //const int layer = roll->id().layer();
505  //const int subSector = roll->id().subsector();
506 
507  if ( region == 0 )
508  {
509  ++nRefHitBarrel;
513 
515  }
516  else
517  {
518  ++nRefHitEndcap;
519  h_refPunchOccupancyEndcap_disk->Fill(region*station);
520  h_refPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
521 
523  }
524  }
525  h_.nRefHitBarrel->Fill(nRefHitBarrel);
526  h_.nRefHitEndcap->Fill(nRefHitEndcap);
527 
528  // Loop over recHits, fill histograms which does not need associations
529  int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
530  int nRecHitBarrel = 0, nRecHitEndcap = 0;
531  for ( RecHitIter recHitIter = recHitHandle->begin();
532  recHitIter != recHitHandle->end(); ++recHitIter )
533  {
534  const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
535  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId()));
536  if ( !roll ) continue;
537 
538  const int region = roll->id().region();
539  const int ring = roll->id().ring();
540  //const int sector = roll->id().sector();
541  const int station = roll->id().station();
542  //const int layer = roll->id().layer();
543  //const int subSector = roll->id().subsector();
544 
545  const double time = recHitIter->timeError() >= 0 ? recHitIter->time() : recHitIter->BunchX()*25;
546 
547  h_.clusterSize->Fill(recHitIter->clusterSize());
548 
549  if ( region == 0 )
550  {
551  ++nRecHitBarrel;
552  sumClusterSizeBarrel += recHitIter->clusterSize();
553  h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
557 
558  h_.timeBarrel->Fill(time);
559  }
560  else
561  {
562  ++nRecHitEndcap;
563  sumClusterSizeEndcap += recHitIter->clusterSize();
564  h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
565  h_.recHitOccupancyEndcap_disk->Fill(region*station);
566  h_.recHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
567 
568  h_.timeEndcap->Fill(time);
569  }
570 
571  if ( roll->isIRPC() ) {
572  h_.timeIRPC->Fill(time);
573  }
574  else {
575  h_.timeCRPC->Fill(time);
576  }
577 
578  }
579  const double nRecHit = nRecHitBarrel+nRecHitEndcap;
580  h_.nRecHitBarrel->Fill(nRecHitBarrel);
581  h_.nRecHitEndcap->Fill(nRecHitEndcap);
582  if ( nRecHit > 0 )
583  {
584  const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
585  h_.avgClusterSize->Fill(double(sumClusterSize)/nRecHit);
586 
587  if ( nRecHitBarrel > 0 )
588  {
589  h_.avgClusterSizeBarrel->Fill(double(sumClusterSizeBarrel)/nRecHitBarrel);
590  }
591  if ( nRecHitEndcap > 0 )
592  {
593  h_.avgClusterSizeEndcap->Fill(double(sumClusterSizeEndcap)/nRecHitEndcap);
594  }
595  }
596 
597  // Start matching SimHits to RecHits
598  typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
599  SimToRecHitMap simToRecHitMap;
600 
601  for ( auto simHit : muonSimHits )
602  {
603  const RPCDetId simDetId = static_cast<const RPCDetId>(simHit->detUnitId());
604  //const RPCRoll* simRoll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(simDetId));
605 
606  const double simX = simHit->localPosition().x();
607 
608  for ( RecHitIter recHitIter = recHitHandle->begin();
609  recHitIter != recHitHandle->end(); ++recHitIter )
610  {
611  const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
612  const RPCRoll* recRoll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(recDetId));
613  if ( !recRoll ) continue;
614 
615  if ( simDetId != recDetId ) continue;
616 
617  const double recX = recHitIter->localPosition().x();
618  const double newDx = fabs(recX - simX);
619 
620  // Associate SimHit to RecHit
621  SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
622  if ( prevSimToReco == simToRecHitMap.end() )
623  {
624  simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
625  }
626  else
627  {
628  const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
629 
630  if ( newDx < oldDx )
631  {
632  simToRecHitMap[simHit] = recHitIter;
633  }
634  }
635  }
636  }
637 
638  // Now we have simHit-recHit mapping
639  // So we can fill up relavant histograms
640  int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
641  for ( auto match : simToRecHitMap )
642  {
643  TrackPSimHitRef simHit = match.first;
644  RecHitIter recHitIter = match.second;
645 
646  const RPCDetId detId = static_cast<const RPCDetId>(simHit->detUnitId());
647  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId));
648 
649  const int region = roll->id().region();
650  const int ring = roll->id().ring();
651  //const int sector = roll->id().sector();
652  const int station = roll->id().station();
653  //const int layer = roll->id().layer();
654  //const int subsector = roll->id().subsector();
655 
656  const double simX = simHit->localPosition().x();
657  const double recX = recHitIter->localPosition().x();
658  const double errX = sqrt(recHitIter->localPositionError().xx());
659  const double dX = recX - simX;
660  const double pull = errX == 0 ? -999 : dX/errX;
661 
662  //const GlobalPoint simPos = roll->toGlobal(simHitIter->localPosition());
663  //const GlobalPoint recPos = roll->toGlobal(recHitIter->localPosition());
664 
665  if ( region == 0 )
666  {
667  ++nMatchHitBarrel;
668  h_.resBarrel->Fill(dX);
669  h_.pullBarrel->Fill(pull);
673 
674  h_.res_wheel_res->Fill(ring, dX);
675  h_.res_station_res->Fill(station, dX);
676  h_.pull_wheel_pull->Fill(ring, pull);
677  h_.pull_station_pull->Fill(station, pull);
678 
680  }
681  else
682  {
683  ++nMatchHitEndcap;
684  h_.resEndcap->Fill(dX);
685  h_.pullEndcap->Fill(pull);
686  h_.matchOccupancyEndcap_disk->Fill(region*station);
687  h_.matchOccupancyEndcap_disk_ring->Fill(region*station, ring);
688 
689  h_.res_disk_res->Fill(region*station, dX);
690  h_.res_ring_res->Fill(ring, dX);
691  h_.pull_disk_pull->Fill(region*station, pull);
692  h_.pull_ring_pull->Fill(ring, pull);
693 
695  }
696 
697  }
698  h_.nMatchHitBarrel->Fill(nMatchHitBarrel);
699  h_.nMatchHitEndcap->Fill(nMatchHitEndcap);
700 
701  // Reco Muon hits
702  for ( reco::MuonCollection::const_iterator muon = muonHandle->begin();
703  muon != muonHandle->end(); ++muon )
704  {
705  if ( !muon->isGlobalMuon() ) continue;
706 
707  int nRPCHitBarrel = 0;
708  int nRPCHitEndcap = 0;
709 
710  const reco::TrackRef glbTrack = muon->globalTrack();
711  for ( trackingRecHit_iterator recHit = glbTrack->recHitsBegin();
712  recHit != glbTrack->recHitsEnd(); ++recHit )
713  {
714  if ( !(*recHit)->isValid() ) continue;
715  const DetId detId = (*recHit)->geographicalId();
716  if ( detId.det() != DetId::Muon or detId.subdetId() != MuonSubdetId::RPC ) continue;
717  const RPCDetId rpcDetId = static_cast<const RPCDetId>(detId);
718 
719  if ( rpcDetId.region() == 0 ) ++nRPCHitBarrel;
720  else ++nRPCHitEndcap;
721  }
722 
723  const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
724  h_nRPCHitPerRecoMuon->Fill(nRPCHit);
725  if ( nRPCHitBarrel and nRPCHitEndcap )
726  {
731  }
732  else if ( nRPCHitBarrel )
733  {
735  h_recoMuonBarrel_pt->Fill(muon->pt());
736  h_recoMuonBarrel_eta->Fill(muon->eta());
737  h_recoMuonBarrel_phi->Fill(muon->phi());
738  }
739  else if ( nRPCHitEndcap )
740  {
742  h_recoMuonEndcap_pt->Fill(muon->pt());
743  h_recoMuonEndcap_eta->Fill(muon->eta());
744  h_recoMuonEndcap_phi->Fill(muon->phi());
745  }
746  else
747  {
748  h_recoMuonNoRPC_pt->Fill(muon->pt());
749  h_recoMuonNoRPC_eta->Fill(muon->eta());
750  h_recoMuonNoRPC_phi->Fill(muon->phi());
751  }
752  }
753 
754  // Find Non-muon hits
755  for ( RecHitIter recHitIter = recHitHandle->begin();
756  recHitIter != recHitHandle->end(); ++recHitIter )
757  {
758  const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
759  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(detId));
760 
761  const int region = roll->id().region();
762  const int ring = roll->id().ring();
763  //const int sector = roll->id().sector();
764  const int station = roll->id().station();
765  //const int layer = roll->id().layer();
766  //const int subsector = roll->id().subsector();
767 
768  bool matched = false;
769  for ( auto match : simToRecHitMap )
770  {
771  if ( recHitIter == match.second )
772  {
773  matched = true;
774  break;
775  }
776  }
777 
778  if ( !matched )
779  {
780  int nPunchMatched = 0;
781  // Check if this recHit came from non-muon simHit
782  for ( auto simHit : pthrSimHits )
783  {
784  const int absSimHitPType = abs(simHit->particleType());
785  if ( absSimHitPType == 13 ) continue;
786 
787  const RPCDetId simDetId = static_cast<const RPCDetId>(simHit->detUnitId());
788  if ( simDetId == detId ) ++nPunchMatched;
789  }
790 
791  if ( nPunchMatched > 0 )
792  {
793  if ( region == 0 )
794  {
798  }
799  else
800  {
801  h_recPunchOccupancyEndcap_disk->Fill(region*station);
802  h_recPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
803  }
804  }
805  }
806  }
807 
808  // Find noise recHits : RecHits without SimHit match
809  for ( RecHitIter recHitIter = recHitHandle->begin();
810  recHitIter != recHitHandle->end(); ++recHitIter )
811  {
812  const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
813  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(recDetId));
814 
815  const int region = roll->id().region();
816  // const int ring = roll->id().ring(); // UNUSED VARIABLE
817  //const int sector = roll->id().sector();
818  // const int station = roll->id().station(); // UNUSED VARIABLE
819  //const int layer = roll->id().layer();
820  //const int subsector = roll->id().subsector();
821 
822  const double recX = recHitIter->localPosition().x();
823  const double recErrX = sqrt(recHitIter->localPositionError().xx());
824 
825  bool matched = false;
826  for ( SimHitIter simHitIter = simHitHandle->begin();
827  simHitIter != simHitHandle->end(); ++simHitIter )
828  {
829  const RPCDetId simDetId = static_cast<const RPCDetId>(simHitIter->detUnitId());
830  const RPCRoll* simRoll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(simDetId));
831  if ( !simRoll ) continue;
832 
833  if ( simDetId != recDetId ) continue;
834 
835  const double simX = simHitIter->localPosition().x();
836  const double dX = fabs(recX-simX);
837 
838  if ( dX/recErrX < 5 )
839  {
840  matched = true;
841  break;
842  }
843  }
844 
845  if ( !matched )
846  {
847  if ( region == 0 )
848  {
850  }
851  else
852  {
854  }
855  }
856  }
857 
858  h_eventCount->Fill(2);
859 
860 }
edm::EDGetTokenT< RecHits > recHitToken_
std::map< int, int > detIdToIndexMapEndcap_
edm::EDGetTokenT< SimHitAssoc > simHitAssocToken_
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
edm::EDGetTokenT< SimParticles > simParticleToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
MEP h_nRPCHitPerRecoMuonBarrel
std::map< int, int > detIdToIndexMapBarrel_
MEP h_nRPCHitPerSimMuonBarrel
MEP h_nRPCHitPerSimMuonOverlap
MEP h_recPunchOccupancyEndcap_disk_ring
MEP h_refPunchOccupancyBarrel_wheel
MEP h_refPunchOccupancyEndcap_disk
MEP h_matchOccupancyBarrel_detId
MEP h_recPunchOccupancyEndcap_disk
void Fill(long long x)
bool isIRPC() const
Definition: RPCRoll.h:38
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
RPCDetId id() const
Definition: RPCRoll.cc:24
MEP h_matchOccupancyEndcap_detId
MEP h_noiseOccupancyBarrel_detId
int ring() const
Definition: RPCDetId.h:72
T sqrt(T t)
Definition: SSEVec.h:18
MEP h_nRPCHitPerSimMuonEndcap
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
MEP h_nRPCHitPerRecoMuonEndcap
RPCValidHistograms h_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MEP h_recPunchOccupancyBarrel_wheel_station
MEP h_refPunchOccupancyBarrel_wheel_station
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
MEP h_refPunchOccupancyEndcap_disk_ring
MEP h_refPunchOccupancyBarrel_station
MEP h_nRPCHitPerRecoMuonOverlap
Definition: DetId.h:18
MEP h_refOccupancyBarrel_detId
const T & get() const
Definition: EventSetup.h:56
MEP h_recPunchOccupancyBarrel_wheel
edm::EDGetTokenT< reco::MuonCollection > muonToken_
static const int RPC
Definition: MuonSubdetId.h:14
MEP h_refOccupancyEndcap_detId
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
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< SimHits > simHitToken_
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
MEP h_noiseOccupancyEndcap_detId
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:75
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
MEP h_recPunchOccupancyBarrel_station
void RPCRecHitValid::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  run,
edm::EventSetup const &  eventSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 37 of file RPCRecHitValid.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::bookProfile(), RPCGeometry::dets(), edm::EventSetup::get(), MonitorElement::getTH1(), MonitorElement::getTH2F(), mps_fire::i, diffTreeTool::index, StripTopology::nstrips(), Pi, StripTopology::pitch(), RPCGeometry::roll(), RPCChamber::rolls(), DQMStore::IBooker::setCurrentFolder(), RPCRoll::specificTopology(), and StripTopology::stripLength().

Referenced by ~RPCRecHitValid().

39 {
40  // Book MonitorElements
41  h_.bookHistograms(booker, subDir_);
42 
43  // SimHit plots, not compatible to RPCPoint-RPCRecHit comparison
44  booker.setCurrentFolder(subDir_+"/HitProperty");
45  h_simParticleType = booker.book1D("SimHitPType", "SimHit particle type", 11, 0, 11);
46  h_simParticleType->getTH1()->SetMinimum(0);
47  if ( TH1* h = h_simParticleType->getTH1() )
48  {
49  h->GetXaxis()->SetBinLabel(1 , "#mu^{-}");
50  h->GetXaxis()->SetBinLabel(2 , "#mu^{+}");
51  h->GetXaxis()->SetBinLabel(3 , "e^{-}" );
52  h->GetXaxis()->SetBinLabel(4 , "e^{+}" );
53  h->GetXaxis()->SetBinLabel(5 , "#pi^{+}");
54  h->GetXaxis()->SetBinLabel(6 , "#pi^{-}");
55  h->GetXaxis()->SetBinLabel(7 , "K^{+}" );
56  h->GetXaxis()->SetBinLabel(8 , "K^{-}" );
57  h->GetXaxis()->SetBinLabel(9 , "p^{+}" );
58  h->GetXaxis()->SetBinLabel(10, "p^{-}" );
59  h->GetXaxis()->SetBinLabel(11, "Other" );
60  }
61 
62  booker.setCurrentFolder(subDir_+"/Track");
63 
64  h_nRPCHitPerSimMuon = booker.book1D("NRPCHitPerSimMuon" , "Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
65  h_nRPCHitPerSimMuonBarrel = booker.book1D("NRPCHitPerSimMuonBarrel" , "Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
66  h_nRPCHitPerSimMuonOverlap = booker.book1D("NRPCHitPerSimMuonOverlap", "Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
67  h_nRPCHitPerSimMuonEndcap = booker.book1D("NRPCHitPerSimMuonEndcap" , "Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
68 
69  h_nRPCHitPerRecoMuon = booker.book1D("NRPCHitPerRecoMuon" , "Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
70  h_nRPCHitPerRecoMuonBarrel = booker.book1D("NRPCHitPerRecoMuonBarrel" , "Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
71  h_nRPCHitPerRecoMuonOverlap = booker.book1D("NRPCHitPerRecoMuonOverlap", "Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
72  h_nRPCHitPerRecoMuonEndcap = booker.book1D("NRPCHitPerRecoMuonEndcap" , "Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
73 
74  h_nRPCHitPerSimMuon ->getTH1()->SetMinimum(0);
75  h_nRPCHitPerSimMuonBarrel ->getTH1()->SetMinimum(0);
76  h_nRPCHitPerSimMuonOverlap ->getTH1()->SetMinimum(0);
77  h_nRPCHitPerSimMuonEndcap ->getTH1()->SetMinimum(0);
78 
79  h_nRPCHitPerRecoMuon ->getTH1()->SetMinimum(0);
80  h_nRPCHitPerRecoMuonBarrel ->getTH1()->SetMinimum(0);
81  h_nRPCHitPerRecoMuonOverlap->getTH1()->SetMinimum(0);
82  h_nRPCHitPerRecoMuonEndcap ->getTH1()->SetMinimum(0);
83 
84  float ptBins[] = {0, 1, 2, 5, 10, 20, 30, 50, 100, 200, 300, 500};
85  const int nPtBins = sizeof(ptBins)/sizeof(float)-1;
86  h_simMuonBarrel_pt = booker.book1D("SimMuonBarrel_pt" , "SimMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
87  h_simMuonOverlap_pt = booker.book1D("SimMuonOverlap_pt" , "SimMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
88  h_simMuonEndcap_pt = booker.book1D("SimMuonEndcap_pt" , "SimMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
89  h_simMuonNoRPC_pt = booker.book1D("SimMuonNoRPC_pt" , "SimMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
90  h_simMuonBarrel_eta = booker.book1D("SimMuonBarrel_eta" , "SimMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
91  h_simMuonOverlap_eta = booker.book1D("SimMuonOverlap_eta", "SimMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
92  h_simMuonEndcap_eta = booker.book1D("SimMuonEndcap_eta" , "SimMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
93  h_simMuonNoRPC_eta = booker.book1D("SimMuonNoRPC_eta", "SimMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
94  h_simMuonBarrel_phi = booker.book1D("SimMuonBarrel_phi" , "SimMuon RPCHit in Barrel #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
95  h_simMuonOverlap_phi = booker.book1D("SimMuonOverlap_phi", "SimMuon RPCHit in Overlap #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
96  h_simMuonEndcap_phi = booker.book1D("SimMuonEndcap_phi" , "SimMuon RPCHit in Endcap #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
97  h_simMuonNoRPC_phi = booker.book1D("SimMuonNoRPC_phi", "SimMuon without RPCHit #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
98 
99  h_recoMuonBarrel_pt = booker.book1D("RecoMuonBarrel_pt" , "RecoMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
100  h_recoMuonOverlap_pt = booker.book1D("RecoMuonOverlap_pt" , "RecoMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
101  h_recoMuonEndcap_pt = booker.book1D("RecoMuonEndcap_pt" , "RecoMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
102  h_recoMuonNoRPC_pt = booker.book1D("RecoMuonNoRPC_pt" , "RecoMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
103  h_recoMuonBarrel_eta = booker.book1D("RecoMuonBarrel_eta" , "RecoMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
104  h_recoMuonOverlap_eta = booker.book1D("RecoMuonOverlap_eta", "RecoMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
105  h_recoMuonEndcap_eta = booker.book1D("RecoMuonEndcap_eta" , "RecoMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
106  h_recoMuonNoRPC_eta = booker.book1D("RecoMuonNoRPC_eta", "RecoMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
107  h_recoMuonBarrel_phi = booker.book1D("RecoMuonBarrel_phi" , "RecoMuon RPCHit in Barrel #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
108  h_recoMuonOverlap_phi = booker.book1D("RecoMuonOverlap_phi", "RecoMuon RPCHit in Overlap #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
109  h_recoMuonEndcap_phi = booker.book1D("RecoMuonEndcap_phi" , "RecoMuon RPCHit in Endcap #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
110  h_recoMuonNoRPC_phi = booker.book1D("RecoMuonNoRPC_phi", "RecoMuon without RPCHit #phi;#phi", 36, -TMath::Pi(), TMath::Pi());
111 
112  h_simMuonBarrel_pt ->getTH1()->SetMinimum(0);
113  h_simMuonOverlap_pt ->getTH1()->SetMinimum(0);
114  h_simMuonEndcap_pt ->getTH1()->SetMinimum(0);
115  h_simMuonNoRPC_pt ->getTH1()->SetMinimum(0);
116  h_simMuonBarrel_eta ->getTH1()->SetMinimum(0);
117  h_simMuonOverlap_eta ->getTH1()->SetMinimum(0);
118  h_simMuonEndcap_eta ->getTH1()->SetMinimum(0);
119  h_simMuonNoRPC_eta ->getTH1()->SetMinimum(0);
120  h_simMuonBarrel_phi ->getTH1()->SetMinimum(0);
121  h_simMuonOverlap_phi ->getTH1()->SetMinimum(0);
122  h_simMuonEndcap_phi ->getTH1()->SetMinimum(0);
123  h_simMuonNoRPC_phi ->getTH1()->SetMinimum(0);
124 
125  h_recoMuonBarrel_pt ->getTH1()->SetMinimum(0);
126  h_recoMuonOverlap_pt ->getTH1()->SetMinimum(0);
127  h_recoMuonEndcap_pt ->getTH1()->SetMinimum(0);
128  h_recoMuonNoRPC_pt ->getTH1()->SetMinimum(0);
129  h_recoMuonBarrel_eta ->getTH1()->SetMinimum(0);
130  h_recoMuonOverlap_eta->getTH1()->SetMinimum(0);
131  h_recoMuonEndcap_eta ->getTH1()->SetMinimum(0);
132  h_recoMuonNoRPC_eta ->getTH1()->SetMinimum(0);
133  h_recoMuonBarrel_phi ->getTH1()->SetMinimum(0);
134  h_recoMuonOverlap_phi->getTH1()->SetMinimum(0);
135  h_recoMuonEndcap_phi ->getTH1()->SetMinimum(0);
136  h_recoMuonNoRPC_phi ->getTH1()->SetMinimum(0);
137 
138  booker.setCurrentFolder(subDir_+"/Occupancy");
139 
140  h_eventCount = booker.book1D("EventCount", "Event count", 3, 1, 4);
141  h_eventCount->getTH1()->SetMinimum(0);
142  if ( h_eventCount )
143  {
144  TH1* h = h_eventCount->getTH1();
145  h->GetXaxis()->SetBinLabel(1, "eventBegin");
146  h->GetXaxis()->SetBinLabel(2, "eventEnd");
147  h->GetXaxis()->SetBinLabel(3, "run");
148  }
149  h_eventCount->Fill(3);
150 
151  h_refPunchOccupancyBarrel_wheel = booker.book1D("RefPunchOccupancyBarrel_wheel" , "RefPunchthrough occupancy", 5, -2.5, 2.5);
152  h_refPunchOccupancyEndcap_disk = booker.book1D("RefPunchOccupancyEndcap_disk" , "RefPunchthrough occupancy", 9, -4.5, 4.5);
153  h_refPunchOccupancyBarrel_station = booker.book1D("RefPunchOccupancyBarrel_station", "RefPunchthrough occupancy", 4, 0.5, 4.5);
154  h_recPunchOccupancyBarrel_wheel = booker.book1D("RecPunchOccupancyBarrel_wheel" , "Punchthrough recHit occupancy", 5, -2.5, 2.5);
155  h_recPunchOccupancyEndcap_disk = booker.book1D("RecPunchOccupancyEndcap_disk" , "Punchthrough recHit occupancy", 9, -4.5, 4.5);
156  h_recPunchOccupancyBarrel_station = booker.book1D("RecPunchOccupancyBarrel_station", "Punchthrough recHit occupancy", 4, 0.5, 4.5);
157 
158  h_refPunchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
159  h_refPunchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
160  h_refPunchOccupancyBarrel_station ->getTH1()->SetMinimum(0);
161  h_recPunchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
162  h_recPunchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
163  h_recPunchOccupancyBarrel_station ->getTH1()->SetMinimum(0);
164 
165  h_refPunchOccupancyBarrel_wheel_station = booker.book2D("RefPunchOccupancyBarrel_wheel_station", "RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
166  h_refPunchOccupancyEndcap_disk_ring = booker.book2D("RefPunchOccupancyEndcap_disk_ring" , "RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
167  h_recPunchOccupancyBarrel_wheel_station = booker.book2D("RecPunchOccupancyBarrel_wheel_station", "Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
168  h_recPunchOccupancyEndcap_disk_ring = booker.book2D("RecPunchOccupancyEndcap_disk_ring" , "Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
169 
170  h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
171  h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
172  h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
173  h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
174 
176  h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
178  h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
179 
184 
186  h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
188  h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
189 
190  for ( int i=1; i<=5; ++i )
191  {
192  TString binLabel = Form("Wheel %d", i-3);
193  h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(i, binLabel);
194  h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
195  h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(i, binLabel);
196  h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
197  }
198 
199  for ( int i=1; i<=9; ++i )
200  {
201  TString binLabel = Form("Disk %d", i-5);
202  h_refPunchOccupancyEndcap_disk ->getTH1()->GetXaxis()->SetBinLabel(i, binLabel);
203  h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
204  h_recPunchOccupancyEndcap_disk ->getTH1()->GetXaxis()->SetBinLabel(i, binLabel);
205  h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
206  }
207 
208  for ( int i=1; i<=4; ++i )
209  {
210  TString binLabel = Form("Station %d", i);
211  h_refPunchOccupancyBarrel_station ->getTH1()->GetXaxis()->SetBinLabel(i, binLabel);
212  h_refPunchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
213  h_recPunchOccupancyBarrel_station ->getTH1()->GetXaxis()->SetBinLabel(i, binLabel);
214  h_recPunchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
215  }
216 
217  for ( int i=1; i<=4; ++i )
218  {
219  TString binLabel = Form("Ring %d", i);
220  h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
221  h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
222  }
223 
224  // Book roll-by-roll histograms
226  eventSetup.get<MuonGeometryRecord>().get(rpcGeom);
227 
228  int nRPCRollBarrel = 0, nRPCRollEndcap = 0;
229 
230  TrackingGeometry::DetContainer rpcDets = rpcGeom->dets();
231  for ( auto det : rpcDets )
232  {
233  auto rpcCh = dynamic_cast<const RPCChamber*>(det);
234  if ( !rpcCh ) continue;
235 
236  std::vector<const RPCRoll*> rolls = rpcCh->rolls();
237  for ( auto roll : rolls )
238  {
239  if ( !roll ) continue;
240 
241  //RPCGeomServ rpcSrv(roll->id());
242  const int rawId = roll->geographicalId().rawId();
243  //if ( !roll->specs()->isRPC() ) { cout << "\nNoRPC : " << rpcSrv.name() << ' ' << rawId << endl; continue; }
244 
245  if ( roll->isBarrel() )
246  {
247  detIdToIndexMapBarrel_[rawId] = nRPCRollBarrel;
248  //rollIdToNameMapBarrel_[rawId] = rpcSrv.name();
249  ++nRPCRollBarrel;
250  }
251  else
252  {
253  detIdToIndexMapEndcap_[rawId] = nRPCRollEndcap;
254  //rollIdToNameMapEndcap_[rawId] = rpcSrv.name();
255  ++nRPCRollEndcap;
256  }
257  }
258  }
259 
260  booker.setCurrentFolder(subDir_+"/Occupancy");
261  h_matchOccupancyBarrel_detId = booker.book1D("MatchOccupancyBarrel_detId", "Matched hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
262  h_matchOccupancyEndcap_detId = booker.book1D("MatchOccupancyEndcap_detId", "Matched hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
263  h_refOccupancyBarrel_detId = booker.book1D("RefOccupancyBarrel_detId", "Reference hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
264  h_refOccupancyEndcap_detId = booker.book1D("RefOccupancyEndcap_detId", "Reference hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
265  h_noiseOccupancyBarrel_detId = booker.book1D("NoiseOccupancyBarrel_detId", "Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
266  h_noiseOccupancyEndcap_detId = booker.book1D("NoiseOccupancyEndcap_detId", "Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
267 
268  h_matchOccupancyBarrel_detId->getTH1()->SetMinimum(0);
269  h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0);
270  h_refOccupancyBarrel_detId ->getTH1()->SetMinimum(0);
271  h_refOccupancyEndcap_detId ->getTH1()->SetMinimum(0);
272  h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0);
273  h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0);
274 
275  h_rollAreaBarrel_detId = booker.bookProfile("RollAreaBarrel_detId", "Roll area;roll index;Area", nRPCRollBarrel, 0., 1.*nRPCRollBarrel, 0., 1e5);
276  h_rollAreaEndcap_detId = booker.bookProfile("RollAreaEndcap_detId", "Roll area;roll index;Area", nRPCRollEndcap, 0., 1.*nRPCRollEndcap, 0., 1e5);
277 
278  for ( auto detIdToIndex : detIdToIndexMapBarrel_ )
279  {
280  const int rawId = detIdToIndex.first;
281  const int index = detIdToIndex.second;
282 
283  const RPCDetId rpcDetId = static_cast<const RPCDetId>(rawId);
284  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(rpcDetId));
285 
286  //RPCGeomServ rpcSrv(roll->id());
287  //if ( !roll->specs()->isRPC() ) { cout << "\nNoRPC : " << rpcSrv.name() << ' ' << rawId << endl; continue; }
288 
289  const StripTopology& topol = roll->specificTopology();
290  const double area = topol.stripLength()*topol.nstrips()*topol.pitch();
291 
292  h_rollAreaBarrel_detId->Fill(index, area);
293  }
294 
295  for ( auto detIdToIndex : detIdToIndexMapEndcap_ )
296  {
297  const int rawId = detIdToIndex.first;
298  const int index = detIdToIndex.second;
299 
300  const RPCDetId rpcDetId = static_cast<const RPCDetId>(rawId);
301  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(rpcDetId));
302 
303  //RPCGeomServ rpcSrv(roll->id());
304  //if ( !roll->specs()->isRPC() ) { cout << "\nNoRPC : " << rpcSrv.name() << ' ' << rawId << endl; continue; }
305 
306  const StripTopology& topol = roll->specificTopology();
307  const double area = topol.stripLength()*topol.nstrips()*topol.pitch();
308 
309  h_rollAreaEndcap_detId->Fill(index, area);
310  }
311 
312 }
const double Pi
virtual float stripLength() const =0
std::map< int, int > detIdToIndexMapEndcap_
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
MEP h_nRPCHitPerRecoMuonBarrel
std::map< int, int > detIdToIndexMapBarrel_
MEP h_nRPCHitPerSimMuonBarrel
MEP h_nRPCHitPerSimMuonOverlap
MEP h_recPunchOccupancyEndcap_disk_ring
MEP h_refPunchOccupancyBarrel_wheel
MEP h_refPunchOccupancyEndcap_disk
MEP h_matchOccupancyBarrel_detId
MEP h_recPunchOccupancyEndcap_disk
const StripTopology & specificTopology() const
Definition: RPCRoll.cc:107
void bookHistograms(DQMStore::IBooker &booker, const std::string &subDir)
void Fill(long long x)
MEP h_matchOccupancyEndcap_detId
MEP h_rollAreaEndcap_detId
MEP h_noiseOccupancyBarrel_detId
MEP h_rollAreaBarrel_detId
MEP h_nRPCHitPerSimMuonEndcap
MEP h_nRPCHitPerRecoMuonEndcap
RPCValidHistograms h_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:68
TH1 * getTH1(void) const
MEP h_recPunchOccupancyBarrel_wheel_station
MEP h_refPunchOccupancyBarrel_wheel_station
MEP h_refPunchOccupancyEndcap_disk_ring
MEP h_refPunchOccupancyBarrel_station
MEP h_nRPCHitPerRecoMuonOverlap
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MEP h_refOccupancyBarrel_detId
virtual const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: RPCGeometry.cc:33
virtual int nstrips() const =0
std::string subDir_
MEP h_recPunchOccupancyBarrel_wheel
MEP h_refOccupancyEndcap_detId
virtual float pitch() const =0
TH2F * getTH2F(void) const
std::vector< GeomDet const * > DetContainer
MEP h_noiseOccupancyEndcap_detId
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:75
MEP h_recPunchOccupancyBarrel_station

Member Data Documentation

std::map<int, int> RPCRecHitValid::detIdToIndexMapBarrel_
private

Definition at line 75 of file RPCRecHitValid.h.

std::map<int, int> RPCRecHitValid::detIdToIndexMapEndcap_
private

Definition at line 75 of file RPCRecHitValid.h.

RPCValidHistograms RPCRecHitValid::h_
private

Definition at line 47 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_eventCount
private

Definition at line 49 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_matchOccupancyBarrel_detId
private

Definition at line 66 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_matchOccupancyEndcap_detId
private

Definition at line 67 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_noiseOccupancyBarrel_detId
private

Definition at line 70 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_noiseOccupancyEndcap_detId
private

Definition at line 71 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerRecoMuon
private

Definition at line 52 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerRecoMuonBarrel
private

Definition at line 52 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerRecoMuonEndcap
private

Definition at line 52 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerRecoMuonOverlap
private

Definition at line 52 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerSimMuon
private

Definition at line 51 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerSimMuonBarrel
private

Definition at line 51 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerSimMuonEndcap
private

Definition at line 51 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_nRPCHitPerSimMuonOverlap
private

Definition at line 51 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonBarrel_eta
private

Definition at line 57 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonBarrel_phi
private

Definition at line 58 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonBarrel_pt
private

Definition at line 56 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonEndcap_eta
private

Definition at line 57 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonEndcap_phi
private

Definition at line 58 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonEndcap_pt
private

Definition at line 56 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonNoRPC_eta
private

Definition at line 57 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonNoRPC_phi
private

Definition at line 58 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonNoRPC_pt
private

Definition at line 56 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonOverlap_eta
private

Definition at line 57 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonOverlap_phi
private

Definition at line 58 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recoMuonOverlap_pt
private

Definition at line 56 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recPunchOccupancyBarrel_station
private

Definition at line 63 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recPunchOccupancyBarrel_wheel
private

Definition at line 63 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recPunchOccupancyBarrel_wheel_station
private

Definition at line 64 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recPunchOccupancyEndcap_disk
private

Definition at line 63 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_recPunchOccupancyEndcap_disk_ring
private

Definition at line 64 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refOccupancyBarrel_detId
private

Definition at line 68 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refOccupancyEndcap_detId
private

Definition at line 69 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refPunchOccupancyBarrel_station
private

Definition at line 61 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refPunchOccupancyBarrel_wheel
private

Definition at line 61 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refPunchOccupancyBarrel_wheel_station
private

Definition at line 62 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refPunchOccupancyEndcap_disk
private

Definition at line 61 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_refPunchOccupancyEndcap_disk_ring
private

Definition at line 62 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_rollAreaBarrel_detId
private

Definition at line 72 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_rollAreaEndcap_detId
private

Definition at line 73 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonBarrel_eta
private

Definition at line 54 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonBarrel_phi
private

Definition at line 55 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonBarrel_pt
private

Definition at line 53 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonEndcap_eta
private

Definition at line 54 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonEndcap_phi
private

Definition at line 55 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonEndcap_pt
private

Definition at line 53 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonNoRPC_eta
private

Definition at line 54 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonNoRPC_phi
private

Definition at line 55 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonNoRPC_pt
private

Definition at line 53 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonOverlap_eta
private

Definition at line 54 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonOverlap_phi
private

Definition at line 55 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simMuonOverlap_pt
private

Definition at line 53 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simParticleType
private

Definition at line 59 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simParticleTypeBarrel
private

Definition at line 59 of file RPCRecHitValid.h.

MEP RPCRecHitValid::h_simParticleTypeEndcap
private

Definition at line 59 of file RPCRecHitValid.h.

edm::EDGetTokenT<reco::MuonCollection> RPCRecHitValid::muonToken_
private

Definition at line 44 of file RPCRecHitValid.h.

edm::EDGetTokenT<RecHits> RPCRecHitValid::recHitToken_
private

Definition at line 41 of file RPCRecHitValid.h.

edm::EDGetTokenT<SimHitAssoc> RPCRecHitValid::simHitAssocToken_
private

Definition at line 43 of file RPCRecHitValid.h.

edm::EDGetTokenT<SimHits> RPCRecHitValid::simHitToken_
private

Definition at line 40 of file RPCRecHitValid.h.

edm::EDGetTokenT<SimParticles> RPCRecHitValid::simParticleToken_
private

Definition at line 42 of file RPCRecHitValid.h.

std::string RPCRecHitValid::subDir_
private

Definition at line 39 of file RPCRecHitValid.h.