CMS 3D CMS Logo

RPCChamberQuality.cc
Go to the documentation of this file.
1 #include <sstream>
5 // Framework
7 //DataFormats
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 
82  std::stringstream histoName;
83 
84  rpcdqm::utils rpcUtils;
85 
86  for (int r = 0; r < 3; r++) {
87  histoName.str("");
88  histoName << "RPCChamberQuality_" << regions_[r];
89  me = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 7, 0.5, 7.5);
90 
91  for (int x = 1; x < 8; x++) {
92  me->setBinLabel(x, xLabels_[x - 1]);
93  }
94  }
95 
96  histoName.str("");
97  histoName << "RPC_System_Quality_Overview";
98  me = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 7, 0.5, 7.5, 3, 0.5, 3.5);
99  me->setBinLabel(1, "E-", 2);
100  me->setBinLabel(2, "B", 2);
101  me->setBinLabel(3, "E+", 2);
102 
103  for (int x = 1; x < 8; x++) {
104  me->setBinLabel(x, xLabels_[x - 1]);
105  }
106 
107  for (int w = -2; w < 3; w++) { //Loop on wheels
108 
109  histoName.str("");
110  histoName << "RPCChamberQuality_Roll_vs_Sector_Wheel" << w;
111  me = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
112 
113  rpcUtils.labelXAxisSector(me);
114  rpcUtils.labelYAxisRoll(me, 0, w, useRollInfo_);
115 
116  histoName.str("");
117  histoName << "RPCChamberQuality_Distribution_Wheel" << w;
118  me = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 7, 0.5, 7.5);
119 
120  for (int x = 1; x < 8; x++) {
121  me->setBinLabel(x, xLabels_[x - 1]);
122  }
123  } //end loop on wheels
124 
125  for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) { // Loop on disk
126  if (d == 0)
127  continue;
128  histoName.str("");
129  histoName << "RPCChamberQuality_Ring_vs_Segment_Disk" << d; // 2D histo for RPC Qtest
130  me = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 36, 0.5, 36.5, 6, 0.5, 6.5);
131  rpcUtils.labelXAxisSegment(me);
132  rpcUtils.labelYAxisRing(me, 2, useRollInfo_);
133 
134  histoName.str("");
135  histoName << "RPCChamberQuality_Distribution_Disk" << d;
136  me = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 7, 0.5, 7.5);
137 
138  for (int x = 1; x < 8; x++) {
139  me->setBinLabel(x, xLabels_[x - 1]);
140  }
141  }
142 }
143 
145  std::stringstream meName;
146 
147  meName.str("");
148  meName << prefixDir_ << "/RPCEvents";
149  int rpcEvents = minEvents;
150  RpcEvents = igetter.get(meName.str());
151 
152  if (RpcEvents)
153  rpcEvents = (int)RpcEvents->getBinContent(1);
154 
155  if (rpcEvents >= minEvents) {
156  init_ = true;
157 
159 
160  for (int r = 0; r < 3; r++) {
161  meName.str("");
162  meName << summaryDir_ << "/RPCChamberQuality_" << RPCChamberQuality::regions_[r];
163  summary[r] = igetter.get(meName.str());
164 
165  if (summary[r] != nullptr)
166  summary[r]->Reset();
167  }
168 
169  //Barrel
170  for (int wheel = -2; wheel < 3; wheel++) { // loop by Wheels
171  meName.str("");
172  meName << "Roll_vs_Sector_Wheel" << wheel;
173 
174  this->performeClientOperation(meName.str(), 0, summary[1], igetter);
175  } // loop by Wheels
176 
177  // Endcap
178  for (int i = -numberOfDisks_; i <= numberOfDisks_; i++) { //loop on Disks
179  if (i == 0)
180  continue;
181 
182  meName.str("");
183  meName << "Ring_vs_Segment_Disk" << i;
184 
185  if (i < 0)
186  this->performeClientOperation(meName.str(), -1, summary[0], igetter);
187  else
188  this->performeClientOperation(meName.str(), 1, summary[2], igetter);
189  } //loop on Disks
190 
191  MonitorElement* RpcOverview = nullptr;
192  meName.str("");
193  meName << summaryDir_ << "/RPC_System_Quality_Overview";
194  RpcOverview = igetter.get(meName.str());
195  RpcOverview->Reset();
196 
197  if (RpcOverview) { //Fill Overview ME
198  for (int r = 0; r < 3; r++) {
199  if (summary[r] == nullptr)
200  continue;
201  double entries = summary[r]->getEntries();
202  if (entries == 0)
203  continue;
204  for (int x = 1; x <= 7; x++) {
205  RpcOverview->setBinContent(x, r + 1, (summary[r]->getBinContent(x) / entries));
206  }
207  }
208  } //loop by LimiBloks
209  }
210 }
211 
213  int region,
215  DQMStore::IGetter& igetter) {
216  MonitorElement* RCQ = nullptr;
217  MonitorElement* RCQD = nullptr;
218 
219  MonitorElement* DEAD = nullptr;
220  MonitorElement* CLS = nullptr;
221  MonitorElement* MULT = nullptr;
222  MonitorElement* NoisySt = nullptr;
223  MonitorElement* Chip = nullptr;
224  MonitorElement* HV = nullptr;
225  MonitorElement* LV = nullptr;
226  std::stringstream meName;
227 
228  meName.str("");
229  meName << summaryDir_ << "/RPCChamberQuality_" << MESufix;
230  RCQ = igetter.get(meName.str());
231  // if (RCQ) RCQ->Reset();
232 
233  int pos = MESufix.find_last_of('_');
234  meName.str("");
235  meName << summaryDir_ << "/RPCChamberQuality_Distribution" << MESufix.substr(pos);
236  RCQD = igetter.get(meName.str());
237  if (RCQD)
238  RCQD->Reset();
239 
240  //get HV Histo
241  meName.str("");
242  meName << summaryDir_ << "/HVStatus_" << MESufix;
243  HV = igetter.get(meName.str());
244  //get LV Histo
245  meName.str("");
246  meName << summaryDir_ << "/LVStatus_" << MESufix;
247  LV = igetter.get(meName.str());
248  //Dead
249  meName.str("");
250  meName << summaryDir_ << "/DeadChannelFraction_" << MESufix;
251  DEAD = igetter.get(meName.str());
252  //ClusterSize
253  meName.str("");
254  meName << summaryDir_ << "/ClusterSizeIn1Bin_" << MESufix;
255  CLS = igetter.get(meName.str());
256  //NoisyStrips
257  meName.str("");
258  meName << summaryDir_ << "/RPCNoisyStrips_" << MESufix;
259  NoisySt = igetter.get(meName.str());
260  //Multiplicity
261  meName.str("");
262  meName << summaryDir_ << "/NumberOfDigi_Mean_" << MESufix;
263  MULT = igetter.get(meName.str());
264  //Asymetry
265  meName.str("");
266  meName << summaryDir_ << "/AsymmetryLeftRight_" << MESufix;
267  Chip = igetter.get(meName.str());
268 
269  int xBinMax, yBinMax;
270 
271  if (region != 0)
272  xBinMax = 37;
273  else
274  xBinMax = 13;
275 
276  for (int x = 1; x < xBinMax; x++) {
277  if (region != 0) {
278  yBinMax = 7;
279  } else {
280  if (x == 4)
281  yBinMax = 22;
282  else if (x == 9 || x == 11)
283  yBinMax = 16;
284  else
285  yBinMax = 18;
286  }
287  for (int y = 1; y < yBinMax; y++) {
288  int hv = 1;
289  int lv = 1;
290  float dead = 0;
291  float firstbin = 0;
292  float noisystrips = 0;
293  float mult = 0;
294  float asy = 0;
295  chamberQualityState chamberState = GoodState;
296 
297  if (HV)
298  hv = (int)HV->getBinContent(x, y);
299  if (LV)
300  lv = (int)LV->getBinContent(x, y);
301 
302  if (hv != 1 || lv != 1) {
303  chamberState = OffState;
304  } else {
305  if (DEAD)
306  dead = DEAD->getBinContent(x, y);
307  if (dead >= 0.80) {
308  chamberState = DeadState;
309  } else if (0.33 <= dead && dead < 0.80) {
310  chamberState = PartiallyDeadState;
311  } else {
312  if (CLS)
313  firstbin = CLS->getBinContent(x, y);
314  if (firstbin >= 0.88) {
315  chamberState = NoisyStripState;
316  } else {
317  if (NoisySt)
318  noisystrips = NoisySt->getBinContent(x, y);
319  if (noisystrips > 0) {
320  chamberState = NoisyStripState;
321  } else {
322  if (MULT)
323  mult = MULT->getBinContent(x, y);
324  if (mult >= 6) {
325  chamberState = NoisyRollState;
326  } else {
327  if (Chip)
328  asy = Chip->getBinContent(x, y);
329  if (asy > 0.35) {
330  chamberState = BadShapeState;
331  } else {
332  chamberState = GoodState;
333  }
334  }
335  }
336  }
337  }
338  }
339  if (RCQ)
340  RCQ->setBinContent(x, y, chamberState);
341  if (RCQD)
342  RCQD->Fill(chamberState);
343  if (quality)
344  quality->Fill(chamberState);
345  }
346  }
347  return;
348 }
rpcdqm::utils::labelXAxisSegment
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:247
RPCChamberQuality::fillMonitorElements
void fillMonitorElements(DQMStore::IGetter &)
Definition: RPCChamberQuality.cc:144
RPCChamberQuality::lumiCounter_
int lumiCounter_
Definition: RPCChamberQuality.h:39
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:41
RPCChamberQuality::BadShapeState
Definition: RPCChamberQuality.h:36
RPCChamberQuality::GoodState
Definition: RPCChamberQuality.h:30
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
RPCChamberQuality::DeadState
Definition: RPCChamberQuality.h:35
RPCChamberQuality::NoisyRollState
Definition: RPCChamberQuality.h:33
RPCChamberQuality::chamberQualityState
chamberQualityState
Definition: RPCChamberQuality.h:29
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:48
RPCChamberQuality::PartiallyDeadState
Definition: RPCChamberQuality.h:34
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
rpcdqm::utils::labelYAxisRoll
void labelYAxisRoll(MonitorElement *myMe, int region, int ring, bool useRollInfo)
Definition: utils.h:265
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:50
RPCChamberQuality::RpcEvents
MonitorElement * RpcEvents
Definition: RPCChamberQuality.h:28
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
L1DTConfigBti_cff.DEAD
DEAD
Definition: L1DTConfigBti_cff.py:7
rpcdqm::utils
Definition: utils.h:29
RPCChamberQuality::offlineDQM_
bool offlineDQM_
Definition: RPCChamberQuality.h:42
w
const double w
Definition: UKUtility.cc:23
RPCChamberQuality::performeClientOperation
void performeClientOperation(std::string, int, MonitorElement *, DQMStore::IGetter &)
Definition: RPCChamberQuality.cc:212
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:354
RPCChamberQuality::NoisyStripState
Definition: RPCChamberQuality.h:32
RPCChamberQuality::numberOfDisks_
int numberOfDisks_
Definition: RPCChamberQuality.h:51
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:88271
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:47
RPCChamberQuality::OffState
Definition: RPCChamberQuality.h:31
rpcdqm::utils::labelYAxisRing
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:291
edm::EventSetup
Definition: EventSetup.h:58
utils.h
RPCChamberQuality::summaryDir_
std::string summaryDir_
Definition: RPCChamberQuality.h:46
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:691
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:49
LV
math::XYZTLorentzVectorD LV
Definition: HLTTauDQMPlotter.h:15
rpcdqm::utils::labelXAxisSector
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:231
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
RPCChamberQuality::init_
bool init_
Definition: RPCChamberQuality.h:53
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
VarParsing.mult
mult
Definition: VarParsing.py:659
dqm::implementation::IBooker
Definition: DQMStore.h:43
ztail.d
d
Definition: ztail.py:151
RPCChamberQuality::minEvents
int minEvents
Definition: RPCChamberQuality.h:55
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:592
RPCChamberQuality::prefixDir_
std::string prefixDir_
Definition: RPCChamberQuality.h:46
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