CMS 3D CMS Logo

RPCChamberQuality.cc
Go to the documentation of this file.
2 
7 
8 #include <fmt/format.h>
9 
11  "Good", "OFF", "Nois.St", "Nois.Ch", "Part.Dead", "Dead", "Bad.Shape"};
12 const std::string RPCChamberQuality::regions_[3] = {"EndcapNegative", "Barrel", "EndcapPositive"};
13 
15  edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: Constructor";
16 
17  prescaleFactor_ = ps.getUntrackedParameter<int>("PrescaleFactor", 5);
18 
19  std::string subsystemFolder = ps.getUntrackedParameter<std::string>("RPCFolder", "RPC");
20  std::string recHitTypeFolder = ps.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
21  std::string summaryFolder = ps.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");
22 
23  summaryDir_ = subsystemFolder + "/" + recHitTypeFolder + "/" + summaryFolder;
24  prefixDir_ = subsystemFolder + "/" + recHitTypeFolder;
25 
26  enableDQMClients_ = ps.getUntrackedParameter<bool>("EnableRPCDqmClient", true);
27 
28  minEvents = ps.getUntrackedParameter<int>("MinimumRPCEvents", 10000);
29  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
30  useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
31  offlineDQM_ = ps.getUntrackedParameter<bool>("OfflineDQM", true);
32 
33  init_ = false;
34  lumiCounter_ = 0;
35 }
36 
37 RPCChamberQuality::~RPCChamberQuality() { edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: Destructor "; }
38 
39 void RPCChamberQuality::beginJob() { edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: Begin job "; }
40 
42  DQMStore::IGetter& igetter,
43  edm::LuminosityBlock const& iLumi,
44  edm::EventSetup const& iSetup) {
45  edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: End Lumi Block";
46 
48  edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: Performing DQM client operation";
49 
50  if (lumiCounter_ == 0) { //book histograms during at firt LB end
51  this->myBooker(ibooker);
53  }
54 
55  if (lumiCounter_ % prescaleFactor_ == 0) { //Fill histograms every N=prescaleFactor_ LBs
56  this->fillMonitorElements(igetter);
57  }
58  }
59  lumiCounter_++;
60 }
61 
63  edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: End Job";
64 
65  if (enableDQMClients_) {
66  edm::LogVerbatim("rpcchamberquality") << "[RPCChamberQuality]: Performing DQM client operation";
67  if (offlineDQM_ && !init_) {
68  this->myBooker(ibooker);
69  }
70  if (init_) {
71  this->fillMonitorElements(igetter);
72  }
73  }
74 }
75 
77  init_ = true;
78 
80 
81  for (int r = 0; r < 3; r++) {
82  const std::string histoName = fmt::format("RPCChamberQuality_{}", regions_[r]);
83  MonitorElement* me = ibooker.book1D(histoName, histoName, 7, 0.5, 7.5);
84 
85  for (int x = 1; x < 8; x++) {
86  me->setBinLabel(x, xLabels_[x - 1]);
87  }
88  }
89 
91  ibooker.book2D("RPC_System_Quality_Overview", "RPC_System_Quality_Overview", 7, 0.5, 7.5, 3, 0.5, 3.5);
92  me->setBinLabel(1, "E-", 2);
93  me->setBinLabel(2, "B", 2);
94  me->setBinLabel(3, "E+", 2);
95 
96  for (int x = 1; x < 8; x++) {
97  me->setBinLabel(x, xLabels_[x - 1]);
98  }
99 
100  for (int w = -2; w < 3; w++) { //Loop on wheels
101 
102  const std::string histoName2D = fmt::format("RPCChamberQuality_Roll_vs_Sector_Wheel{}", w);
103  RPCRollMapHisto::bookBarrel(ibooker, w, histoName2D, histoName2D, useRollInfo_);
104 
105  const std::string histoName1D = fmt::format("RPCChamberQuality_Distribution_Wheel{}", w);
106  MonitorElement* me1D = ibooker.book1D(histoName1D, histoName1D, 7, 0.5, 7.5);
107 
108  for (int x = 1; x < 8; x++) {
109  me1D->setBinLabel(x, xLabels_[x - 1]);
110  }
111  } //end loop on wheels
112 
113  for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) { // Loop on disk
114  if (d == 0)
115  continue;
116  const std::string histoName2D =
117  fmt::format("RPCChamberQuality_Ring_vs_Segment_Disk{}", d); // 2D histo for RPC Qtest
118  RPCRollMapHisto::bookEndcap(ibooker, d, histoName2D, histoName2D, useRollInfo_);
119 
120  const std::string histoName1D = fmt::format("RPCChamberQuality_Distribution_Disk{}", d);
121  MonitorElement* me1D = ibooker.book1D(histoName1D, histoName1D, 7, 0.5, 7.5);
122 
123  for (int x = 1; x < 8; x++) {
124  me1D->setBinLabel(x, xLabels_[x - 1]);
125  }
126  }
127 }
128 
130  int rpcEvents = minEvents;
131  RpcEvents = igetter.get(prefixDir_ + "/RPCEvents");
132 
133  if (RpcEvents)
134  rpcEvents = (int)RpcEvents->getBinContent(1);
135 
136  if (rpcEvents >= minEvents) {
137  init_ = true;
138 
140 
141  for (int r = 0; r < 3; r++) {
142  const std::string meName = fmt::format("{}/RPCChamberQuality_{}", summaryDir_, RPCChamberQuality::regions_[r]);
143  summary[r] = igetter.get(meName);
144 
145  if (summary[r] != nullptr)
146  summary[r]->Reset();
147  }
148 
149  //Barrel
150  for (int wheel = -2; wheel < 3; wheel++) { // loop by Wheels
151  const std::string meName = fmt::format("Roll_vs_Sector_Wheel{}", wheel);
152 
153  this->performeClientOperation(meName, 0, summary[1], igetter);
154  } // loop by Wheels
155 
156  // Endcap
157  for (int i = -numberOfDisks_; i <= numberOfDisks_; i++) { //loop on Disks
158  if (i == 0)
159  continue;
160 
161  const std::string meName = fmt::format("Ring_vs_Segment_Disk{}", i);
162 
163  if (i < 0)
164  this->performeClientOperation(meName, -1, summary[0], igetter);
165  else
166  this->performeClientOperation(meName, 1, summary[2], igetter);
167  } //loop on Disks
168 
169  MonitorElement* RpcOverview = igetter.get(summaryDir_ + "/RPC_System_Quality_Overview");
170  RpcOverview->Reset();
171 
172  if (RpcOverview) { //Fill Overview ME
173  for (int r = 0; r < 3; r++) {
174  if (summary[r] == nullptr)
175  continue;
176  const double entries = summary[r]->getEntries();
177  if (entries == 0)
178  continue;
179  for (int x = 1; x <= 7; x++) {
180  RpcOverview->setBinContent(x, r + 1, (summary[r]->getBinContent(x) / entries));
181  }
182  }
183  } //loop by LimiBloks
184  }
185 }
186 
188  int region,
190  DQMStore::IGetter& igetter) {
191  MonitorElement* RCQ = igetter.get(summaryDir_ + "/RPCChamberQuality_" + MESufix);
192  // if (RCQ) RCQ->Reset();
193 
194  const int pos = MESufix.find_last_of('_');
195  MonitorElement* RCQD = igetter.get(summaryDir_ + "/RPCChamberQuality_Distribution" + MESufix.substr(pos));
196  if (RCQD)
197  RCQD->Reset();
198 
199  //get HV Histo
200  MonitorElement* HV = igetter.get(summaryDir_ + "/HVStatus_" + MESufix);
201  //get LV Histo
202  MonitorElement* LV = igetter.get(summaryDir_ + "/LVStatus_" + MESufix);
203  //Dead
204  MonitorElement* DEAD = igetter.get(summaryDir_ + "/DeadChannelFraction_" + MESufix);
205  //ClusterSize
206  MonitorElement* CLS = igetter.get(summaryDir_ + "/ClusterSizeIn1Bin_" + MESufix);
207  //NoisyStrips
208  MonitorElement* NoisySt = igetter.get(summaryDir_ + "/RPCNoisyStrips_" + MESufix);
209  //Multiplicity
210  MonitorElement* MULT = igetter.get(summaryDir_ + "/NumberOfDigi_Mean_" + MESufix);
211  //Asymetry
212  MonitorElement* Chip = igetter.get(summaryDir_ + "/AsymmetryLeftRight_" + MESufix);
213 
214  int xBinMax, yBinMax;
215 
216  if (region != 0)
217  xBinMax = 37;
218  else
219  xBinMax = 13;
220 
221  for (int x = 1; x < xBinMax; x++) {
222  if (region != 0) {
223  yBinMax = 7;
224  } else {
225  if (x == 4)
226  yBinMax = 22;
227  else if (x == 9 || x == 11)
228  yBinMax = 16;
229  else
230  yBinMax = 18;
231  }
232  for (int y = 1; y < yBinMax; y++) {
233  int hv = 1;
234  int lv = 1;
235  float dead = 0;
236  float firstbin = 0;
237  float noisystrips = 0;
238  float mult = 0;
239  float asy = 0;
240  chamberQualityState chamberState = GoodState;
241 
242  if (HV)
243  hv = (int)HV->getBinContent(x, y);
244  if (LV)
245  lv = (int)LV->getBinContent(x, y);
246 
247  if (hv != 1 || lv != 1) {
248  chamberState = OffState;
249  } else {
250  if (DEAD)
251  dead = DEAD->getBinContent(x, y);
252  if (dead >= 0.80) {
253  chamberState = DeadState;
254  } else if (0.33 <= dead && dead < 0.80) {
255  chamberState = PartiallyDeadState;
256  } else {
257  if (CLS)
258  firstbin = CLS->getBinContent(x, y);
259  if (firstbin >= 0.88) {
260  chamberState = NoisyStripState;
261  } else {
262  if (NoisySt)
263  noisystrips = NoisySt->getBinContent(x, y);
264  if (noisystrips > 0) {
265  chamberState = NoisyStripState;
266  } else {
267  if (MULT)
268  mult = MULT->getBinContent(x, y);
269  if (mult >= 6) {
270  chamberState = NoisyRollState;
271  } else {
272  if (Chip)
273  asy = Chip->getBinContent(x, y);
274  if (asy > 0.35) {
275  chamberState = BadShapeState;
276  } else {
277  chamberState = GoodState;
278  }
279  }
280  }
281  }
282  }
283  }
284  if (RCQ)
285  RCQ->setBinContent(x, y, chamberState);
286  if (RCQD)
287  RCQD->Fill(chamberState);
288  if (quality)
289  quality->Fill(chamberState);
290  }
291  }
292  return;
293 }
RPCChamberQuality::fillMonitorElements
void fillMonitorElements(DQMStore::IGetter &)
Definition: RPCChamberQuality.cc:129
RPCRollMapHisto::bookBarrel
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:8
RPCChamberQuality::lumiCounter_
int lumiCounter_
Definition: RPCChamberQuality.h:36
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
RPCChamberQuality::beginJob
void beginJob() override
Definition: RPCChamberQuality.cc:39
RPCChamberQuality::enableDQMClients_
bool enableDQMClients_
Definition: RPCChamberQuality.h:38
RPCChamberQuality::BadShapeState
Definition: RPCChamberQuality.h:33
RPCChamberQuality::GoodState
Definition: RPCChamberQuality.h:27
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
RPCChamberQuality::DeadState
Definition: RPCChamberQuality.h:32
RPCChamberQuality::NoisyRollState
Definition: RPCChamberQuality.h:30
RPCChamberQuality::chamberQualityState
chamberQualityState
Definition: RPCChamberQuality.h:26
pos
Definition: PixelAliasList.h:18
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
RPCChamberQuality::regions_
static const std::string regions_[3]
Definition: RPCChamberQuality.h:45
RPCChamberQuality::PartiallyDeadState
Definition: RPCChamberQuality.h:31
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
RPCChamberQuality::RPCChamberQuality
RPCChamberQuality(const edm::ParameterSet &ps)
Definition: RPCChamberQuality.cc:14
RPCChamberQuality::prescaleFactor_
int prescaleFactor_
Definition: RPCChamberQuality.h:47
RPCChamberQuality::RpcEvents
MonitorElement * RpcEvents
Definition: RPCChamberQuality.h:25
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
L1DTConfigBti_cff.DEAD
DEAD
Definition: L1DTConfigBti_cff.py:7
RPCRollMapHisto::bookEndcap
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)
Definition: RPCRollMapHisto.cc:81
RPCChamberQuality::offlineDQM_
bool offlineDQM_
Definition: RPCChamberQuality.h:39
dqm-mbProfile.format
format
Definition: dqm-mbProfile.py:16
w
const double w
Definition: UKUtility.cc:23
RPCChamberQuality::performeClientOperation
void performeClientOperation(std::string, int, MonitorElement *, DQMStore::IGetter &)
Definition: RPCChamberQuality.cc:187
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::impl::MonitorElement::Reset
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
Definition: MonitorElement.cc:345
RPCChamberQuality::NoisyStripState
Definition: RPCChamberQuality.h:29
RPCChamberQuality::numberOfDisks_
int numberOfDisks_
Definition: RPCChamberQuality.h:48
RPCRollMapHisto.h
RPCDetId.h
edm::ParameterSet
Definition: ParameterSet.h:47
RPCChamberQuality::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: RPCChamberQuality.cc:41
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
RPCBookFolderStructure.h
createfilelist.int
int
Definition: createfilelist.py:10
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
RPCChamberQuality::xLabels_
static const std::string xLabels_[7]
Definition: RPCChamberQuality.h:44
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:762
RPCChamberQuality::OffState
Definition: RPCChamberQuality.h:28
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCChamberQuality::summaryDir_
std::string summaryDir_
Definition: RPCChamberQuality.h:43
alignCSCRings.r
r
Definition: alignCSCRings.py:93
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:682
RPCChamberQuality.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
RPCChamberQuality::useRollInfo_
bool useRollInfo_
Definition: RPCChamberQuality.h:46
LV
math::XYZTLorentzVectorD LV
Definition: HLTTauDQMPlotter.h:15
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
RPCChamberQuality::init_
bool init_
Definition: RPCChamberQuality.h:50
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
VarParsing.mult
mult
Definition: VarParsing.py:658
dqm::implementation::IBooker
Definition: DQMStore.h:43
ztail.d
d
Definition: ztail.py:151
RPCChamberQuality::minEvents
int minEvents
Definition: RPCChamberQuality.h:52
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
RPCChamberQuality::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: RPCChamberQuality.cc:62
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:583
RPCChamberQuality::prefixDir_
std::string prefixDir_
Definition: RPCChamberQuality.h:43
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
RPCChamberQuality::~RPCChamberQuality
~RPCChamberQuality() override
Definition: RPCChamberQuality.cc:37
RPCChamberQuality::myBooker
void myBooker(DQMStore::IBooker &)
Definition: RPCChamberQuality.cc:76