CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDQM_EventProcessor_updateEffHistos.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: EventProcessor_updateEffHistos.cc
5  *
6  * Description: Update Efficiency histograms and parameters
7  *
8  * Version: 1.0
9  * Created: 10/06/2008 11:44:34 AM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius, valdas.rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
19 #include "CSCDQM_EventProcessor.h"
20 
21 namespace cscdqm {
22 
27 
28  MonitorObject *me = 0, *me1 = 0;
29 
30  if (config->getNEvents() > 0) {
31 
33 
34  const TH2* rep = dynamic_cast<const TH2*>(me->getTH1());
35 
37  const TObject *tobj = me->getRefRootObject();
38 
42  if (tobj) {
43  const TH2* ref = dynamic_cast<const TH2*>(tobj);
44  summary.ReadReportingChambersRef(rep, ref, config->getEFF_COLD_THRESHOLD(), config->getEFF_COLD_SIGFAIL(), config->getEFF_HOT_THRESHOLD(), config->getEFF_HOT_SIGFAIL());
45  } else {
47  }
48 
50  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
51  summary.ReadErrorChambers(rep, err, FORMAT_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
52  }
53 
55  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
56  summary.ReadErrorChambers(rep, err, L1SYNC_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
57  }
58 
60  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
61  summary.ReadErrorChambers(rep, err, FIFOFULL_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
62  }
63 
65  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
66  summary.ReadErrorChambers(rep, err, INPUTTO_ERR, config->getEFF_ERR_THRESHOLD(), config->getEFF_ERR_SIGFAIL());
67  }
68 
69  if (getEMUHisto(h::EMU_CSC_WO_ALCT, me1)) {
70  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
71  summary.ReadErrorChambers(rep, err, NODATA_ALCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
72  }
73 
74  if (getEMUHisto(h::EMU_CSC_WO_CLCT, me1)) {
75  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
76  summary.ReadErrorChambers(rep, err, NODATA_CLCT, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
77  }
78 
79  if (getEMUHisto(h::EMU_CSC_WO_CFEB, me1)) {
80  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
81  summary.ReadErrorChambers(rep, err, NODATA_CFEB, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
82  }
83 
85  const TH2* err = dynamic_cast<const TH2*>(me1->getTH1());
86  summary.ReadErrorChambers(rep, err, CFEB_BWORDS, config->getEFF_NODATA_THRESHOLD(), config->getEFF_NODATA_SIGFAIL());
87  }
88 
89  }
90 
92 
98  LockType lock(me->mutex);
99  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
100  summary.Write(tmp, 1);
101  }
102 
104  LockType lock(me->mutex);
105  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
106  summary.Write(tmp, 2);
107  }
108 
110  LockType lock(me->mutex);
111  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
112  summary.Write(tmp, 3);
113  }
114 
116  LockType lock(me->mutex);
117  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
118  summary.Write(tmp, 4);
119  }
120 
121  if (getEMUHisto(h::EMU_PHYSICS_EMU, me)) {
122  LockType lock(me->mutex);
123  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
124  summary.WriteMap(tmp);
125  }
126 
127  }
128 
133  if (config->getPROCESS_EFF_PARAMETERS()) {
134 
135  { // Compute DQM information parameters
136 
137  Address adr;
138  adr.mask.side = adr.mask.station = adr.mask.ring = true;
139  adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
140 
141  double e_detector = 0.0, e_side = 0.0, e_station = 0.0, e_ring = 0.0;
142  uint32_t e_detector_ch = 0, e_side_ch = 0, e_station_ch = 0;
143 
144  const HistoId parameters [] = {
173  };
174 
175  bool calc = (config->getNEvents() > 0);
176 
177  if (!calc) {
178  e_detector = e_side = e_station = e_ring = -1.0;
179  }
180 
181  unsigned int parameter = 0;
182  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
183 
184  if (calc) {
185  e_side = 0.0;
186  e_side_ch = 0;
187  }
188 
189  adr.mask.station = true;
190  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
191 
192  if (calc) {
193  e_station = 0.0;
194  e_station_ch = 0;
195  }
196 
197  adr.mask.ring = true;
198  for (adr.ring = 1; adr.ring <= summary.getDetector().NumberOfRings(adr.station); adr.ring++) {
199 
200  if (calc) {
201  e_ring = summary.GetEfficiencyHW(adr);
202  uint32_t ch = summary.getDetector().NumberOfChambers(adr.station, adr.ring);
203  e_station += (e_ring * ch);
204  e_station_ch += ch;
205  }
206 
207  if (summary.getDetector().NumberOfRings(adr.station) > 1) {
208  if (getParHisto(parameters[parameter++], me)) me->Fill(e_ring);
209  }
210 
211  }
212 
213  adr.mask.ring = false;
214  if (calc) {
215  e_side += e_station;
216  e_side_ch += e_station_ch;
217  e_station = e_station / e_station_ch;
218  }
219 
220  if (getParHisto(parameters[parameter++], me)) me->Fill(e_station);
221 
222  }
223 
224  adr.mask.station = false;
225  if (calc) {
226  e_detector += e_side;
227  e_detector_ch += e_side_ch;
228  e_side = e_side / e_side_ch;
229  }
230 
231  if (getParHisto(parameters[parameter++], me)) me->Fill(e_side);
232 
233  }
234 
235  if (calc) {
236  e_detector = e_detector / e_detector_ch;
237  }
238 
239  if (getParHisto(h::PAR_REPORT_SUMMARY, me)) me->Fill(e_detector);
240 
241  }
242 
243  }
244 
245  }
246 
248 
249  MonitorObject *me = 0;
250 
251  //const int COLOR_WHITE = 0;
252  const int COLOR_GREEN = 1;
253  const int COLOR_RED = 2;
254  const int COLOR_BLUE = 3;
255  const int COLOR_GREY = 4;
256  const int COLOR_STANDBY = 5;
257 
259  LockType lock(me->mutex);
260  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
261  if (!config->getIN_FULL_STANDBY()) {
262  summary.WriteChamberState(tmp, 0x1, COLOR_GREEN, true, false);
263  summary.WriteChamberState(tmp, HWSTATUSERRORBITS, COLOR_RED, false, true);
264  }
265  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
266  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false);
267  }
268 
270  LockType lock(me->mutex);
271  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
272  if (!config->getIN_FULL_STANDBY()) {
273  summary.WriteChamberState(tmp, 0x4, COLOR_RED, true, false);
274  summary.WriteChamberState(tmp, 0x8, COLOR_BLUE, false, false);
275  }
276  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
277  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
278  }
279 
281  LockType lock(me->mutex);
282  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
283  if (!config->getIN_FULL_STANDBY()) {
284  summary.WriteChamberState(tmp, 0x10, COLOR_RED, true, false);
285  }
286  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
287  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
288  }
289 
291  LockType lock(me->mutex);
292  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
293  if (!config->getIN_FULL_STANDBY()) {
294  summary.WriteChamberState(tmp, 0x20, COLOR_RED, true, false);
295  }
296  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
297  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
298  }
299 
301  LockType lock(me->mutex);
302  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
303  if (!config->getIN_FULL_STANDBY()) {
304  summary.WriteChamberState(tmp, 0x40, COLOR_RED, true, false);
305  }
306  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
307  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
308  }
309 
311  LockType lock(me->mutex);
312  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
313  if (!config->getIN_FULL_STANDBY()) {
314  summary.WriteChamberState(tmp, 0x80, COLOR_RED, true, false);
315  }
316  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
317  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
318  }
319 
321  LockType lock(me->mutex);
322  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
323  if (!config->getIN_FULL_STANDBY()) {
324  summary.WriteChamberState(tmp, 0x100, COLOR_RED, true, false);
325  }
326  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
327  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
328  }
329 
331  LockType lock(me->mutex);
332  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
333  if (!config->getIN_FULL_STANDBY()) {
334  summary.WriteChamberState(tmp, 0x200, COLOR_RED, true, false);
335  }
336  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
337  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
338  }
339 
341  LockType lock(me->mutex);
342  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
343  if (!config->getIN_FULL_STANDBY()) {
344  summary.WriteChamberState(tmp, 0x400, COLOR_RED, true, false);
345  }
346  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
347  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
348  }
349 
351  LockType lock(me->mutex);
352  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
353  if (!config->getIN_FULL_STANDBY()) {
354  summary.WriteChamberState(tmp, 0x800, COLOR_RED, true, false);
355  }
356  summary.WriteChamberState(tmp, 0x1000, COLOR_STANDBY, false);
357  summary.WriteChamberState(tmp, 0x2, COLOR_GREY, false, false);
358  }
359 
360  }
361 
367 
368  Address adr;
369  adr.mask.side = true;
370  adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
371 
372  adr.side = 1;
373  summary.SetValue(adr, STANDBY, (standby.MeP ? 1 : 0));
374  if (!standby.MeP) {
375  summary.SetValue(adr, WAS_ON);
376  }
377 
378  adr.side = 2;
379  summary.SetValue(adr, STANDBY, (standby.MeM ? 1 : 0));
380  if (!standby.MeM) {
381  summary.SetValue(adr, WAS_ON);
382  }
383 
384  MonitorObject *me = 0;
386  LockType lock(me->mutex);
387  TH2* tmp = dynamic_cast<TH2*>(me->getTH1Lock());
388 
389  // All standby
390  summary.WriteChamberState(tmp, 0x1000, 5);
391 
392  // Temporary in standby (was ON)
393  summary.WriteChamberState(tmp, 0x3000, 1, false);
394 
395  }
396 
397  }
398 
399 }
400 
string rep
Definition: cuy.py:1188
dictionary parameters
Definition: Parameters.py:2
void ReadReportingChambers(const TH2 *&h2, const double threshold=1.0)
Read Reporting Chamber histogram and fill in detector map.
HW element in standby mode.
const unsigned long getNEvents() const
Data with CFEB BWORDS.
#define HWSTATUSERRORBITS
void Write(TH2 *&h2, const unsigned int station) const
Write detector map to H1 histogram (linear data) for the selected adr.station.
virtual const TObject * getRefRootObject(void) const =0
virtual void Fill(float x)=0
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
void updateEfficiencyHistos()
Update Efficiency MOs.
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
HW element is cold comparing with reference histogram.
string COLOR_GREEN
Definition: dqmd_manager.py:10
virtual const TH1 * getTH1(void) const =0
Format errors.
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
unsigned int HistoId
void ReadReportingChambersRef(const TH2 *&h2, const TH2 *&refh2, const double cold_coef=0.1, const double cold_Sfail=5.0, const double hot_coef=2.0, const double hot_Sfail=5.0)
Read Reporting Chamber histogram and fill in detector map based on reference histogram.
virtual TH1 * getTH1Lock(void)=0
const bool getParHisto(const HistoId &histo, MonitorObject *&me)
Get Parameter Monitoring Object.
void WriteMap(TH2 *&h2)
Write PhysicsReady Map to H2 histogram.
unsigned int station
const Detector getDetector() const
#define N_STATIONS
No CFEB data.
DMB Input timeout error.
void ReadErrorChambers(const TH2 *&evs, const TH2 *&err, const HWStatusBit bit, const double eps_max=0.1, const double Sfail=5.0)
Read Error data for Chambers.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
string COLOR_RED
Definition: dqmd_manager.py:12
L1A out of sync errors.
#define N_SIDES
DMB FIFO full error.
string COLOR_BLUE
Definition: dqmd_manager.py:9
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void WriteChamberState(TH2 *&h2, const int mask, const int value=1, const bool reset=true, const bool op_any=false) const
Write State information to chamber histogram.
No CLCT data.
AddressMask mask
unsigned int side
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
void standbyEfficiencyHistos(HWStandbyType &standby)
apply standby flags/parameters
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.
Structure to store detector addresses of any granularity: from whole detector to the single HV elemen...
unsigned int ring
No ALCT data.