CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Public Attributes
GEMOfflineDQMBase Class Reference

#include <GEMOfflineDQMBase.h>

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

Classes

class  BookingHelper
 

Public Types

typedef std::map< MEMapKey1, MonitorElement * > MEMap1
 
typedef std::map< MEMapKey2, MonitorElement * > MEMap2
 
typedef std::map< MEMapKey3, MonitorElement * > MEMap3
 
typedef std::tuple< int, int > MEMapKey1
 
typedef std::tuple< int, int, bool > MEMapKey2
 
typedef std::tuple< int, int, bool, int > MEMapKey3
 
- 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
 

Public Member Functions

template<typename T >
bool checkRefs (const std::vector< T * > &)
 
template<typename AnyKey >
TString convertKeyToStr (const AnyKey &key)
 
template<typename AnyKey >
void fillME (std::map< AnyKey, MonitorElement * > &, const AnyKey &, const float)
 
template<typename AnyKey >
void fillME (std::map< AnyKey, MonitorElement * > &, const AnyKey &, const float, const float y)
 
 GEMOfflineDQMBase (const edm::ParameterSet &)
 
int getDetOccXBin (const GEMDetId &, const edm::ESHandle< GEMGeometry > &)
 
int getDetOccXBin (const int, const int, const int)
 
int getMaxVFAT (const int)
 
int getNumEtaPartitions (const GEMStation *)
 
int getVFATNumber (const int, const int, const int)
 
int getVFATNumberByStrip (const int, const int, const int)
 
void setDetLabelsEta (MonitorElement *, const GEMStation *)
 
void setDetLabelsVFAT (MonitorElement *, const GEMStation *)
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
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 bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)=0
 
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
 

Public Attributes

std::string log_category_
 

Additional Inherited Members

- 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 11 of file GEMOfflineDQMBase.h.

Member Typedef Documentation

◆ MEMap1

Definition at line 18 of file GEMOfflineDQMBase.h.

◆ MEMap2

Definition at line 19 of file GEMOfflineDQMBase.h.

◆ MEMap3

Definition at line 20 of file GEMOfflineDQMBase.h.

◆ MEMapKey1

typedef std::tuple<int, int> GEMOfflineDQMBase::MEMapKey1

Definition at line 15 of file GEMOfflineDQMBase.h.

◆ MEMapKey2

typedef std::tuple<int, int, bool> GEMOfflineDQMBase::MEMapKey2

Definition at line 16 of file GEMOfflineDQMBase.h.

◆ MEMapKey3

typedef std::tuple<int, int, bool, int> GEMOfflineDQMBase::MEMapKey3

Definition at line 17 of file GEMOfflineDQMBase.h.

Constructor & Destructor Documentation

◆ GEMOfflineDQMBase()

GEMOfflineDQMBase::GEMOfflineDQMBase ( const edm::ParameterSet pset)
explicit

Definition at line 3 of file GEMOfflineDQMBase.cc.

3  {
4  log_category_ = pset.getUntrackedParameter<std::string>("logCategory");
5 }

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

Member Function Documentation

◆ checkRefs()

template<typename T >
bool GEMOfflineDQMBase::checkRefs ( const std::vector< T * > &  refs)
inline

Definition at line 123 of file GEMOfflineDQMBase.h.

123  {
124  if (refs.empty())
125  return false;
126  if (refs.front() == nullptr)
127  return false;
128  return true;
129 }

Referenced by GEMOfflineMonitor::bookDetectorOccupancy(), GEMEfficiencyAnalyzer::bookDetectorOccupancy(), and getNumEtaPartitions().

◆ convertKeyToStr()

template<typename AnyKey >
TString GEMOfflineDQMBase::convertKeyToStr ( const AnyKey &  key)

Definition at line 132 of file GEMOfflineDQMBase.h.

132  {
133  if constexpr (std::is_same_v<AnyKey, MEMapKey1>) {
134  return TString::Format("Region %d, Station %d.", std::get<0>(key), std::get<1>(key));
135 
136  } else if constexpr (std::is_same_v<AnyKey, MEMapKey2>) {
137  const char* superchamber_type = std::get<2>(key) ? "Odd" : "Even";
138  return TString::Format(
139  "Region %d, Station %d, %s Superchamber", std::get<0>(key), std::get<1>(key), superchamber_type);
140 
141  } else if constexpr (std::is_same_v<AnyKey, MEMapKey3>) {
142  const char* superchamber_type = std::get<2>(key) ? "Odd" : "Even";
143  return TString::Format("Region %d, Station %d, %s Superchamber, Roll %d",
144  std::get<0>(key),
145  std::get<1>(key),
146  superchamber_type,
147  std::get<3>(key));
148 
149  } else {
150  return TString::Format("unknown key type: %s", typeid(key).name());
151  }
152 }

References crabWrapper::key, and Skims_PA_cff::name.

Referenced by fillME().

◆ fillME() [1/2]

template<typename AnyKey >
void GEMOfflineDQMBase::fillME ( std::map< AnyKey, MonitorElement * > &  me_map,
const AnyKey &  key,
const float  x 
)

Definition at line 155 of file GEMOfflineDQMBase.h.

155  {
156  if (me_map.find(key) == me_map.end()) {
157  const TString&& key_str = convertKeyToStr(key);
158  edm::LogError(log_category_) << "got invalid key: " << key_str << std::endl;
159 
160  } else {
161  me_map[key]->Fill(x);
162  }
163 }

References convertKeyToStr(), crabWrapper::key, log_category_, and x.

Referenced by GEMOfflineMonitor::analyze(), and GEMEfficiencyAnalyzer::analyze().

◆ fillME() [2/2]

template<typename AnyKey >
void GEMOfflineDQMBase::fillME ( std::map< AnyKey, MonitorElement * > &  me_map,
const AnyKey &  key,
const float  x,
const float  y 
)

Definition at line 166 of file GEMOfflineDQMBase.h.

169  {
170  if (me_map.find(key) == me_map.end()) {
171  const TString&& key_str = convertKeyToStr(key);
172  edm::LogError(log_category_) << "got invalid key: " << key_str << std::endl;
173 
174  } else {
175  me_map[key]->Fill(x, y);
176  }
177 }

References convertKeyToStr(), crabWrapper::key, log_category_, x, and y.

◆ getDetOccXBin() [1/2]

int GEMOfflineDQMBase::getDetOccXBin ( const GEMDetId gem_id,
const edm::ESHandle< GEMGeometry > &  gem 
)

Definition at line 7 of file GEMOfflineDQMBase.cc.

7  {
8  const GEMSuperChamber* superchamber = gem->superChamber(gem_id);
9  if (superchamber == nullptr) {
10  return -1;
11  }
12  return getDetOccXBin(gem_id.chamber(), gem_id.layer(), superchamber->nChambers());
13 }

References GEMDetId::chamber(), getDetOccXBin(), GEMDetId::layer(), and GEMSuperChamber::nChambers().

◆ getDetOccXBin() [2/2]

int GEMOfflineDQMBase::getDetOccXBin ( const int  chamber,
const int  layer,
const int  n_chambers 
)
inline

Definition at line 118 of file GEMOfflineDQMBase.h.

118  {
119  return n_chambers * (chamber - 1) + layer;
120 }

References relativeConstraints::chamber.

Referenced by GEMOfflineMonitor::analyze(), GEMEfficiencyAnalyzer::analyze(), getDetOccXBin(), setDetLabelsEta(), and setDetLabelsVFAT().

◆ getMaxVFAT()

int GEMOfflineDQMBase::getMaxVFAT ( const int  station)
inline

Definition at line 99 of file GEMOfflineDQMBase.h.

99  {
100  if (station == 1)
101  return GEMeMap::maxVFatGE11_;
102  else if (station == 2)
103  return GEMeMap::maxVFatGE21_;
104  else
105  return -1;
106 }

References GEMeMap::maxVFatGE11_, GEMeMap::maxVFatGE21_, and relativeConstraints::station.

Referenced by GEMOfflineMonitor::bookDetectorOccupancy(), getVFATNumber(), and setDetLabelsVFAT().

◆ getNumEtaPartitions()

int GEMOfflineDQMBase::getNumEtaPartitions ( const GEMStation station)

Definition at line 77 of file GEMOfflineDQMBase.cc.

77  {
78  const auto&& superchambers = station->superChambers();
79  if (not checkRefs(superchambers)) {
80  edm::LogError(log_category_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
81  return 0;
82  }
83 
84  const auto& chambers = superchambers.front()->chambers();
85  if (not checkRefs(chambers)) {
86  edm::LogError(log_category_) << "failed to get a valid vector of GEMChamber ptrs" << std::endl;
87  return 0;
88  }
89 
90  return chambers.front()->nEtaPartitions();
91 }

References chambers, checkRefs(), log_category_, and relativeConstraints::station.

Referenced by GEMOfflineMonitor::bookDetectorOccupancy(), GEMEfficiencyAnalyzer::bookDetectorOccupancy(), GEMEfficiencyAnalyzer::bookHistograms(), setDetLabelsEta(), and setDetLabelsVFAT().

◆ getVFATNumber()

int GEMOfflineDQMBase::getVFATNumber ( const int  station,
const int  ieta,
const int  vfat_phi 
)
inline

Definition at line 108 of file GEMOfflineDQMBase.h.

108  {
109  const int max_vfat = getMaxVFAT(station);
110  return max_vfat * (ieta - 1) + vfat_phi;
111 }

References getMaxVFAT(), LEDCalibrationChannels::ieta, and relativeConstraints::station.

Referenced by getVFATNumberByStrip(), and setDetLabelsVFAT().

◆ getVFATNumberByStrip()

int GEMOfflineDQMBase::getVFATNumberByStrip ( const int  station,
const int  ieta,
const int  strip 
)
inline

Definition at line 113 of file GEMOfflineDQMBase.h.

113  {
114  const int vfat_phi = (strip % GEMeMap::maxChan_) ? strip / GEMeMap::maxChan_ + 1 : strip / GEMeMap::maxChan_;
115  return getVFATNumber(station, ieta, vfat_phi);
116 };

References getVFATNumber(), LEDCalibrationChannels::ieta, GEMeMap::maxChan_, relativeConstraints::station, and digitizers_cfi::strip.

Referenced by GEMOfflineMonitor::analyze().

◆ setDetLabelsEta()

void GEMOfflineDQMBase::setDetLabelsEta ( MonitorElement me,
const GEMStation station 
)

Definition at line 50 of file GEMOfflineDQMBase.cc.

50  {
51  if (me == nullptr) {
52  edm::LogError(log_category_) << "MonitorElement* is nullptr" << std::endl;
53  return;
54  }
55 
56  me->setAxisTitle("Superchamber / Chamber", 1);
57  for (const GEMSuperChamber* superchamber : station->superChambers()) {
58  const int num_chambers = superchamber->nChambers();
59 
60  for (const GEMChamber* chamber : superchamber->chambers()) {
61  const int sc = chamber->id().chamber();
62  const int ch = chamber->id().layer();
63  const int xbin = getDetOccXBin(sc, ch, num_chambers);
64  const char* label = Form("%d/%d", sc, ch);
65  me->setBinLabel(xbin, label, 1);
66  }
67  }
68 
69  const int num_etas = getNumEtaPartitions(station);
70  me->setAxisTitle("i#eta", 2);
71  for (int ieta = 1; ieta <= num_etas; ieta++) {
72  const std::string&& label = std::to_string(ieta);
73  me->setBinLabel(ieta, label, 2);
74  }
75 }

References relativeConstraints::chamber, getDetOccXBin(), getNumEtaPartitions(), LEDCalibrationChannels::ieta, label, log_category_, hlt_dqm_clientPB-live_cfg::me, relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEMOfflineMonitor::bookDetectorOccupancy(), and GEMEfficiencyAnalyzer::bookDetectorOccupancy().

◆ setDetLabelsVFAT()

void GEMOfflineDQMBase::setDetLabelsVFAT ( MonitorElement me,
const GEMStation station 
)

Definition at line 15 of file GEMOfflineDQMBase.cc.

15  {
16  if (me == nullptr) {
17  edm::LogError(log_category_) << "MonitorElement* is nullptr" << std::endl;
18  return;
19  }
20 
21  me->setAxisTitle("Superchamber / Chamber", 1);
22  for (const GEMSuperChamber* superchamber : station->superChambers()) {
23  const int num_chambers = superchamber->nChambers();
24  for (const GEMChamber* chamber : superchamber->chambers()) {
25  const int sc = chamber->id().chamber();
26  const int ch = chamber->id().layer();
27  const int xbin = getDetOccXBin(sc, ch, num_chambers);
28  const char* label = Form("%d/%d", sc, ch);
29  me->setBinLabel(xbin, label, 1);
30  }
31  }
32 
33  me->setAxisTitle("VFAT (i#eta)", 2);
34  const int max_vfat = getMaxVFAT(station->station());
35  if (max_vfat < 0) {
36  edm::LogError(log_category_) << "Wrong max VFAT: " << max_vfat << " at Station " << station->station() << std::endl;
37  return;
38  }
39 
40  const int num_etas = getNumEtaPartitions(station);
41  for (int ieta = 1; ieta <= num_etas; ieta++) {
42  for (int vfat_phi = 1; vfat_phi <= max_vfat; vfat_phi++) {
43  const int ybin = getVFATNumber(station->station(), ieta, vfat_phi);
44  const char* label = Form("%d (%d)", ybin, ieta);
45  me->setBinLabel(ybin, label, 2);
46  }
47  }
48 }

References relativeConstraints::chamber, getDetOccXBin(), getMaxVFAT(), getNumEtaPartitions(), getVFATNumber(), LEDCalibrationChannels::ieta, label, log_category_, hlt_dqm_clientPB-live_cfg::me, and relativeConstraints::station.

Referenced by GEMOfflineMonitor::bookDetectorOccupancy().

Member Data Documentation

◆ log_category_

std::string GEMOfflineDQMBase::log_category_
DDAxes::y
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:184
relativeConstraints.station
station
Definition: relativeConstraints.py:67
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
GEMSuperChamber::nChambers
int nChambers() const
Return numbers of chambers.
Definition: GEMSuperChamber.cc:25
DDAxes::x
GEMOfflineDQMBase::getMaxVFAT
int getMaxVFAT(const int)
Definition: GEMOfflineDQMBase.h:99
GEMOfflineDQMBase::getVFATNumber
int getVFATNumber(const int, const int, const int)
Definition: GEMOfflineDQMBase.h:108
GEMeMap::maxVFatGE21_
static const int maxVFatGE21_
Definition: GEMeMap.h:68
GEMOfflineDQMBase::log_category_
std::string log_category_
Definition: GEMOfflineDQMBase.h:45
GEMOfflineDQMBase::getNumEtaPartitions
int getNumEtaPartitions(const GEMStation *)
Definition: GEMOfflineDQMBase.cc:77
GEMeMap::maxVFatGE11_
static const int maxVFatGE11_
Definition: GEMeMap.h:67
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:177
edm::LogError
Definition: MessageLogger.h:183
GEMOfflineDQMBase::checkRefs
bool checkRefs(const std::vector< T * > &)
Definition: GEMOfflineDQMBase.h:123
GEMOfflineDQMBase::convertKeyToStr
TString convertKeyToStr(const AnyKey &key)
Definition: GEMOfflineDQMBase.h:132
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
gem
Definition: AMC13Event.h:6
GEMChamber
Definition: GEMChamber.h:19
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
crabWrapper.key
key
Definition: crabWrapper.py:19
label
const char * label
Definition: PFTauDecayModeTools.cc:11
GEMeMap::maxChan_
static const int maxChan_
Definition: GEMeMap.h:69
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
GEMOfflineDQMBase::getDetOccXBin
int getDetOccXBin(const int, const int, const int)
Definition: GEMOfflineDQMBase.h:118