CMS 3D CMS Logo

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

#include <CastorDigiMonitor.h>

Public Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
 
 CastorDigiMonitor (const edm::ParameterSet &ps)
 
void endRun ()
 
void fillTrigRes (edm::Event const &event, const edm::TriggerResults &TrigResults, double Etot)
 
void getDbData (const edm::EventSetup &iSetup)
 
int ModSecToIndex (int module, int sector)
 
void processEvent (edm::Event const &event, const CastorDigiCollection &cast, const edm::TriggerResults &trig, const CastorDbService &cond)
 
 ~CastorDigiMonitor ()
 

Private Attributes

int fVerbosity
 
MonitorElementh2digierr
 
MonitorElementh2QmeanMap
 
MonitorElementh2QmeantsvsCh
 
MonitorElementh2QrmsTSvsCh
 
MonitorElementh2qualityMap
 
MonitorElementh2repsum
 
MonitorElementh2status
 
MonitorElementh2towEMvsHAD
 
MonitorElementh2TSratio
 
MonitorElementhBX
 
MonitorElementhdigisize
 
MonitorElementhModule
 
MonitorElementhpBXtrig
 
MonitorElementhpTrigRes
 
MonitorElementhQIErms [10]
 
MonitorElementhReport
 
MonitorElementhSector
 
MonitorElementhtowE
 
MonitorElementhTSratio
 
int ievt_
 
float QIEerrThreshold = 0.0001
 
double QmeanTS [224][10]
 
float Qrms_DEAD
 
double QrmsTS [224][10]
 
float RatioThresh1 = 0.
 
std::string subsystemname_
 
int TS_MAX = 10
 
const int TSped = 0
 

Detailed Description

Definition at line 20 of file CastorDigiMonitor.h.

Constructor & Destructor Documentation

CastorDigiMonitor::CastorDigiMonitor ( const edm::ParameterSet ps)

Definition at line 36 of file CastorDigiMonitor.cc.

References hcaldqm::constants::BAD, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

36  {
37  fVerbosity = ps.getUntrackedParameter<int>("debug", 0);
38  subsystemname_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor");
39  EtowerLastModule = ps.getUntrackedParameter<int>("towerLastModule", 6);
40  RatioThresh1 = ps.getUntrackedParameter<double>("ratioThreshold", 0.9);
41  Qrms_DEAD = ps.getUntrackedParameter<double>("QrmsDead", 0.01); // fC
42  HltPaths_ = ps.getParameter<vector<string>>("HltPaths");
43 
45  TS_MAX = ps.getUntrackedParameter<double>("qieTSmax", 6);
46  StatusBadChannel = CastorChannelStatus::StatusBit::BAD;
47  if (fVerbosity > 0)
48  LogPrint("CastorDigi") << "enum CastorChannelStatus::StatusBit::BAD=" << StatusBadChannel
49  << "EtowerLastModule = " << EtowerLastModule << endl;
50 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string subsystemname_
double const BAD
Definition: Constants.h:15
CastorDigiMonitor::~CastorDigiMonitor ( )

Definition at line 52 of file CastorDigiMonitor.cc.

52 {}

Member Function Documentation

void CastorDigiMonitor::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)

Definition at line 54 of file CastorDigiMonitor.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book1DD(), DQMStore::IBooker::book2D(), DQMStore::IBooker::bookFloat(), DQMStore::IBooker::bookProfile(), DQMStore::IBooker::bookProfile2D(), JetChargeProducer_cfi::exp, MonitorElement::getTH1F(), MonitorElement::getTH2F(), MonitorElement::getTProfile(), MonitorElement::getTProfile2D(), cmsBatch::log, alignCSCRings::s, indexGen::s2, DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

56  {
57  char s[60];
58  string st;
59  if (fVerbosity > 0)
60  LogPrint("CastorMonitorModule") << "Digi bookHist(start)";
61 
62  getDbData(iSetup);
63 
64  char sTileIndex[50];
65  sprintf(sTileIndex, "Cell(=moduleZ*16+sector#phi)");
66 
67  ievt_ = 0;
68 
69  ibooker.setCurrentFolder(subsystemname_);
70  hBX = ibooker.bookProfile(
71  "average E(digi) in BX", "Castor average E (digi);Event.BX;fC", 3601, -0.5, 3600.5, 0., 1.e10, "");
72  hBX->getTProfile()->SetOption("hist");
73 
74  string trname = HltPaths_[0];
75  hpBXtrig = ibooker.bookProfile("average E(digi) in BXtrig",
76  "Castor average E (digi) trigger:'" + trname + "';Event.BX;fC",
77  3601,
78  -0.5,
79  3600.5,
80  0.,
81  1.e10,
82  "");
83  hpBXtrig->getTProfile()->SetOption("hist");
84 
85  hpTrigRes = ibooker.bookProfile(
86  "E(digi)vsTriggerIndex", "Castor average E(digi) by triggerIndex;triggerIndex;fC", 512, 0., 512, 0., 1.e10, "");
87  hpTrigRes->getTProfile()->SetOption("hist");
88 
89  ibooker.setCurrentFolder(subsystemname_ + "/CastorDigiMonitor");
90 
91  std::string s2 = "CASTOR QIE_capID+er+dv";
92  h2digierr = ibooker.bookProfile2D(s2, s2, 14, 0., 14., 16, 0., 16., 100, 0, 1.e10, "");
93  h2digierr->getTProfile2D()->GetXaxis()->SetTitle("Module Z");
94  h2digierr->getTProfile2D()->GetYaxis()->SetTitle("Sector #phi");
95  h2digierr->getTProfile2D()->SetMaximum(1.);
96  h2digierr->getTProfile2D()->SetMinimum(QIEerrThreshold);
97  h2digierr->getTProfile2D()->SetOption("colz");
98 
99  sprintf(s, "CASTORreportSummaryMap");
100  h2repsum = ibooker.bookProfile2D(s, s, 14, 0., 14., 16, 0., 16., 100, 0, 1.e10, "");
101  h2repsum->getTProfile2D()->GetXaxis()->SetTitle("Module Z");
102  h2repsum->getTProfile2D()->GetYaxis()->SetTitle("Sector #phi");
103  h2repsum->getTProfile2D()->SetMaximum(1.);
104  h2repsum->getTProfile2D()->SetMinimum(QIEerrThreshold);
105  h2repsum->getTProfile2D()->SetOption("colz");
106 
107  sprintf(s, "CASTOR BadChannelsMap");
108  h2status = ibooker.book2D(s, s, 14, 0., 14., 16, 0., 16.);
109  h2status->getTH2F()->GetXaxis()->SetTitle("Module Z");
110  h2status->getTH2F()->GetYaxis()->SetTitle("Sector #phi");
111  h2status->getTH2F()->SetOption("colz");
112 
113  sprintf(s, "CASTOR TSmax Significance Map");
114  h2TSratio = ibooker.book2D(s, s, 14, 0., 14., 16, 0., 16.);
115  h2TSratio->getTH2F()->GetXaxis()->SetTitle("Module Z");
116  h2TSratio->getTH2F()->GetYaxis()->SetTitle("Sector #phi");
117  h2TSratio->getTH2F()->SetOption("colz");
118 
119  sprintf(s, "CASTOR TSmax Significance All chan");
120  hTSratio = ibooker.book1D(s, s, 105, 0., 1.05);
121 
122  sprintf(s, "DigiSize");
123  hdigisize = ibooker.book1DD(s, s, 20, 0., 20.);
124  sprintf(s, "ModuleZ(fC)_allTS");
125  hModule = ibooker.book1D(s, s, 14, 0., 14.);
126  hModule->getTH1F()->GetXaxis()->SetTitle("ModuleZ");
127  hModule->getTH1F()->GetYaxis()->SetTitle("QIE(fC)");
128  sprintf(s, "Sector #phi(fC)_allTS");
129  hSector = ibooker.book1D(s, s, 16, 0., 16.);
130  hSector->getTH1F()->GetXaxis()->SetTitle("Sector #phi");
131  hSector->getTH1F()->GetYaxis()->SetTitle("QIE(fC)");
132 
133  st = "Castor cells avr digi(fC) per event Map TS vs Channel";
134  h2QmeantsvsCh =
135  ibooker.bookProfile2D(st, st + ";" + string(sTileIndex) + ";TS", 224, 0., 224., 10, 0., 10., 0., 1.e10, "");
136  h2QmeantsvsCh->getTProfile2D()->SetOption("colz");
137 
138  st = "Castor cells avr digiRMS(fC) per event Map TS vs Channel";
139  h2QrmsTSvsCh = ibooker.book2D(st, st + ";" + string(sTileIndex) + ";TS", 224, 0., 224., 10, 0., 10.);
140  h2QrmsTSvsCh->getTH2F()->SetOption("colz");
141 
142  sprintf(s, "CASTOR data quality");
143  h2qualityMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
144  h2qualityMap->getTH2F()->GetXaxis()->SetTitle("module Z");
145  h2qualityMap->getTH2F()->GetYaxis()->SetTitle("Sector #phi");
146  h2qualityMap->getTH2F()->SetOption("colz");
147 
148  hReport = ibooker.bookFloat("CASTOR reportSummary");
149 
150  sprintf(s, "QmeanfC_map(allTS)");
151  h2QmeanMap = ibooker.book2D(s, s, 14, 0., 14., 16, 0., 16.);
152  h2QmeanMap->getTH2F()->GetXaxis()->SetTitle("Module Z");
153  h2QmeanMap->getTH2F()->GetYaxis()->SetTitle("Sector #phi");
154  h2QmeanMap->getTH2F()->SetOption("textcolz");
155 
156  const int NEtow = 20;
157  float EhadTow[NEtow + 1];
158  float EMTow[NEtow + 1];
159  float ETower[NEtow + 2];
160  double E0tow = 500. / 1024.;
161  EMTow[0] = 0.;
162  EMTow[1] = E0tow;
163  EhadTow[0] = 0.;
164  EhadTow[1] = E0tow;
165  ETower[0] = 0.;
166  ETower[1] = E0tow;
167  double lnBtow = log(1.8); // 2.
168  for (int j = 1; j < NEtow; j++)
169  EMTow[j + 1] = E0tow * exp(j * lnBtow);
170  for (int j = 1; j < NEtow; j++)
171  EhadTow[j + 1] = E0tow * exp(j * lnBtow);
172  for (int j = 1; j <= NEtow; j++)
173  ETower[j + 1] = E0tow * exp(j * lnBtow);
174 
175  sprintf(s, "CASTOR_Tower_EMvsEhad(fC)");
176  h2towEMvsHAD = ibooker.book2D(s, s, NEtow, EhadTow, NEtow, EMTow);
177  h2towEMvsHAD->getTH2F()->GetXaxis()->SetTitle("Ehad [fC]");
178  h2towEMvsHAD->getTH2F()->GetYaxis()->SetTitle("EM [fC]");
179  h2towEMvsHAD->getTH2F()->SetOption("colz");
180 
181  sprintf(s, "CASTOR_TowerTotalEnergy(fC)");
182  htowE = ibooker.book1D(s, s, NEtow + 1, ETower);
183  htowE->getTH1F()->GetXaxis()->SetTitle("fC");
184 
185  for (int ts = 0; ts <= 1; ts++) {
186  sprintf(s, "QIErms_TS=%d", ts);
187  hQIErms[ts] = ibooker.book1D(s, s, 1000, 0., 100.);
188  hQIErms[ts]->getTH1F()->GetXaxis()->SetTitle("QIErms(fC)");
189  }
190 
191  for (int ind = 0; ind < 224; ind++)
192  for (int ts = 0; ts < 10; ts++)
193  QrmsTS[ind][ts] = QmeanTS[ind][ts] = 0.;
194 
195  return;
196 }
TProfile * getTProfile() const
MonitorElement * h2towEMvsHAD
MonitorElement * h2TSratio
double QrmsTS[224][10]
TProfile2D * getTProfile2D() const
MonitorElement * h2qualityMap
MonitorElement * hTSratio
TH1F * getTH1F() const
MonitorElement * hpTrigRes
MonitorElement * h2status
MonitorElement * h2digierr
MonitorElement * hModule
void getDbData(const edm::EventSetup &iSetup)
MonitorElement * h2QmeanMap
TH2F * getTH2F() const
std::string subsystemname_
MonitorElement * h2QrmsTSvsCh
MonitorElement * hBX
MonitorElement * hdigisize
MonitorElement * hSector
double QmeanTS[224][10]
MonitorElement * h2repsum
MonitorElement * hQIErms[10]
MonitorElement * hReport
MonitorElement * htowE
MonitorElement * h2QmeantsvsCh
MonitorElement * hpBXtrig
void CastorDigiMonitor::endRun ( )

Definition at line 364 of file CastorDigiMonitor.cc.

References mps_fire::i.

364  {
365  if (fVerbosity > 0)
366  LogPrint("CastorDigiMonitor") << "DigiMonitor::endRun: trigger max index = " << TrigIndexMax
367  << " TriggerIndexies(N):" << endl;
368  for (int i = 1; i < hpTrigRes->getTProfile()->GetNbinsX(); i++)
369  if (hpTrigRes->getTProfile()->GetBinContent(i) > 0)
370  LogPrint("CastorDigiMonitor") << i - 1 << "(" << hpTrigRes->getTProfile()->GetBinContent(i) << ") ";
371 }
TProfile * getTProfile() const
MonitorElement * hpTrigRes
void CastorDigiMonitor::fillTrigRes ( edm::Event const &  event,
const edm::TriggerResults TrigResults,
double  Etot 
)

Definition at line 373 of file CastorDigiMonitor.cc.

References edm::HLTGlobalStatus::accept(), edm::EventBase::bunchCrossing(), createfilelist::int, gen::n, edm::HLTGlobalStatus::size(), edm::TriggerNames::triggerIndex(), edm::TriggerNames::triggerName(), and edm::TriggerNames::triggerNames().

373  {
374  int nTriggers = TrigResults.size();
375  const edm::TriggerNames &trigName = event.triggerNames(TrigResults);
376  bool event_triggered = false;
377  if (nTriggers > 0)
378  for (int iTrig = 0; iTrig < nTriggers; ++iTrig) {
379  if (TrigResults.accept(iTrig)) {
380  int index = trigName.triggerIndex(trigName.triggerName(iTrig));
381  if (TrigIndexMax < index)
382  TrigIndexMax = index;
383  if (fVerbosity > 0)
384  LogPrint("CastorDigi") << "trigger[" << iTrig << "] name:" << trigName.triggerName(iTrig)
385  << " index= " << index << endl;
386  hpTrigRes->Fill(index, Etotal);
387  for (int n = 0; n < int(HltPaths_.size()); n++) {
388  if (trigName.triggerName(iTrig).find(HltPaths_[n]) != std::string::npos)
389  event_triggered = true;
390  }
391  } // end if(TrigResults.accept(iTrig)
392  }
393 
394  if (event_triggered)
395  hpBXtrig->Fill(event.bunchCrossing(), Etotal);
396  return;
397 }
bool accept() const
Has at least one path accepted the event?
MonitorElement * hpTrigRes
Strings const & triggerNames() const
Definition: TriggerNames.cc:20
void Fill(long long x)
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
unsigned int size() const
Get number of paths stored.
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
Definition: event.py:1
MonitorElement * hpBXtrig
void CastorDigiMonitor::getDbData ( const edm::EventSetup iSetup)

Definition at line 399 of file CastorDigiMonitor.cc.

References edm::EventSetup::get(), CastorCondObjectContainer< Item >::getAllChannels(), CastorChannelStatus::getValue(), CastorCondObjectContainer< Item >::getValues(), edm::ESHandleBase::isValid(), mod(), HcalCastorDetId::module(), jets_cff::quality, CastorChannelStatus::rawId(), HcalCastorDetId::sector(), and relativeConstraints::value.

399  {
401  iSetup.get<CastorChannelQualityRcd>().get(dbChQuality);
402  if (fVerbosity > 0) {
403  LogPrint("CastorDigiMonitor") << " CastorChQuality in CondDB=" << dbChQuality.isValid() << endl;
404  }
405 
406  int chInd = 0;
407  for (int mod = 0; mod < 14; mod++)
408  for (int sec = 0; sec < 16; sec++)
409  ChannelStatus[mod][sec] = 0;
410  std::vector<DetId> channels = dbChQuality->getAllChannels();
411  N_GoodChannels = 224 - channels.size();
412  if (fVerbosity > 0)
413  LogPrint("CastorDigiMonitor") << "CastorDigiMonitor::getDBData: QualityRcdSize=" << channels.size();
414  for (std::vector<DetId>::iterator ch = channels.begin(); ch != channels.end(); ch++) {
415  const CastorChannelStatus *quality = dbChQuality->getValues(*ch);
416  int value = quality->getValue();
417  int rawId = quality->rawId();
418  chInd++;
419  int mod = HcalCastorDetId(*ch).module() - 1;
420  int sec = HcalCastorDetId(*ch).sector() - 1;
421  if (mod > 0 && mod < 16 && sec > 0 && sec < 16)
422  ChannelStatus[mod][sec] = value;
423  if (fVerbosity > 0)
424  LogPrint("CastorDigiMonitor") << chInd << " module=" << mod << " sec=" << sec << " rawId=" << rawId
425  << " value=" << value << endl;
426  } // end for(std::vector<DetId>::it...
427  return;
428 }
int sector() const
get the sector (1-16)
std::vector< DetId > getAllChannels() const
int module() const
get the module (1-2 for EM, 1-12 for HAD)
const Item * getValues(DetId fId, bool throwOnFail=true) const
uint32_t getValue() const
Definition: value.py:1
T get() const
Definition: EventSetup.h:71
bool isValid() const
Definition: ESHandle.h:44
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
uint32_t rawId() const
int CastorDigiMonitor::ModSecToIndex ( int  module,
int  sector 
)

Definition at line 430 of file CastorDigiMonitor.cc.

430  {
431  int ind = sector + module * 16;
432  if (ind > 223)
433  ind = 223;
434  return (ind);
435 }
Definition: vlib.h:208
void CastorDigiMonitor::processEvent ( edm::Event const &  event,
const CastorDigiCollection cast,
const edm::TriggerResults trig,
const CastorDbService cond 
)

Definition at line 198 of file CastorDigiMonitor.cc.

References a, HcalQIESample::adc(), edm::SortedCollection< T, SORT >::begin(), edm::EventBase::bunchCrossing(), HcalQIESample::capid(), HcalQIESample::dv(), edm::SortedCollection< T, SORT >::empty(), edm::SortedCollection< T, SORT >::end(), HcalQIESample::er(), objects.autophobj::float, mps_fire::i, CastorDataFrame::id(), isum, LedMonAdc2fc, funct::m, mod(), HcalCastorDetId::module(), lumiQueryAPI::q, alignCSCRings::r, alignCSCRings::s, CastorDataFrame::sample(), HcalCastorDetId::sector(), CastorDataFrame::size(), and mathSSE::sqrt().

201  {
202  if (fVerbosity > 1)
203  LogPrint("CastorDigiMonitor") << "processEvent(begin)";
204 
205  if (castorDigis.empty()) {
206  for (int mod = 0; mod < 14; mod++)
207  for (int sec = 0; sec < 16; sec++)
208  h2repsum->Fill(mod, sec, 0.);
209  hBX->Fill(event.bunchCrossing(), 0.);
210  fillTrigRes(event, TrigResults, 0.);
211  return;
212  }
213 
214  float Ecell[14][16]{};
215  for (CastorDigiCollection::const_iterator j = castorDigis.begin(); j != castorDigis.end(); j++) {
216  const CastorDataFrame digi = (const CastorDataFrame)(*j);
217 
218  int module = digi.id().module() - 1;
219  int sector = digi.id().sector() - 1;
220  if (ChannelStatus[module][sector] == StatusBadChannel)
221  continue;
222 
223  int capid1 = digi.sample(0).capid();
224  hdigisize->Fill(digi.size());
225  double sum = 0.;
226  int err = 0, err2 = 0;
227  for (int i = 0; i < digi.size(); i++) {
228  int capid = digi.sample(i).capid();
229  int dv = digi.sample(i).dv();
230  int er = digi.sample(i).er();
231  int rawd = digi.sample(i).adc();
232  rawd = rawd & 0x7F;
233  err |= (capid != capid1) | er << 1 | (!dv) << 2; // =0
234  err2 += (capid != capid1) | er | (!dv); // =0
235  // if(err !=0) continue;
236  int ind = ModSecToIndex(module, sector);
237  h2QmeantsvsCh->Fill(ind, i, LedMonAdc2fc[rawd]);
238  float q = LedMonAdc2fc[rawd];
239  Ecell[module][sector] = q;
240  sum += q; // sum += LedMonAdc2fc[rawd];
241  QrmsTS[ind][i] += (q * q);
242  QmeanTS[ind][i] += q;
243  if (err != 0 && fVerbosity > 0)
244  LogPrint("CastorDigiMonitor") << "event/idigi=" << ievt_ << "/" << i << " cap=cap1_dv_er_err: " << capid << "="
245  << capid1 << " " << dv << " " << er << " " << err;
246  if (capid1 < 3)
247  capid1 = capid + 1;
248  else
249  capid1 = 0;
250  }
251  h2digierr->Fill(module, sector, err);
252  h2repsum->Fill(module, sector, 1. - err2 / digi.size());
253  } // end for(CastorDigiCollection::const_iterator ...
254 
255  ievt_++;
256 
257  double Etotal = 0.;
258  for (int sec = 0; sec < 16; sec++)
259  for (int mod = 0; mod < 14; mod++)
260  Etotal = Ecell[mod][sec];
261  hBX->Fill(event.bunchCrossing(), Etotal);
262  fillTrigRes(event, TrigResults, Etotal);
263 
264  for (int sec = 0; sec < 16; sec++) {
265  float em = Ecell[0][sec] + Ecell[1][sec];
266  double ehad = 0.;
267  for (int mod = 2; mod < EtowerLastModule; mod++)
268  ehad += Ecell[mod][sec];
269  h2towEMvsHAD->Fill(em, ehad);
270  htowE->Fill(em + ehad);
271  }
272 
273  const float repChanBAD = 0.9;
274  const float repChanWarning = 0.95;
275  if (ievt_ % 100 != 0)
276  return;
277 
278  float ModuleSum[14], SectorSum[16];
279  for (int m = 0; m < 14; m++)
280  ModuleSum[m] = 0.;
281  for (int s = 0; s < 16; s++)
282  SectorSum[s] = 0.;
283  for (int mod = 0; mod < 14; mod++)
284  for (int sec = 0; sec < 16; sec++) {
285  for (int ts = 0; ts <= 1; ts++) {
286  int ind = ModSecToIndex(mod, sec);
287  double Qmean = QmeanTS[ind][ts] / ievt_;
288  double Qrms = sqrt(QrmsTS[ind][ts] / ievt_ - Qmean * Qmean);
289  hQIErms[ts]->Fill(Qrms);
290  }
291 
292  double sum = 0.;
293  for (int ts = 1; ts <= TS_MAX; ts++) {
294  int ind = ModSecToIndex(mod, sec) + 1;
295  double a = //(1) h2QtsvsCh->getTH2D()->GetBinContent(ind,ts);
296  h2QmeantsvsCh->getTProfile2D()->GetBinContent(ind, ts);
297  sum += a;
298  double Qmean = QmeanTS[ind - 1][ts - 1] / ievt_;
299  double Qrms = QrmsTS[ind - 1][ts - 1] / ievt_ - Qmean * Qmean;
300  h2QrmsTSvsCh->getTH2F()->SetBinContent(ind, ts, sqrt(Qrms));
301  }
302  ModuleSum[mod] += sum;
303  SectorSum[sec] += sum;
304  float isum = float(int(sum * 10. + 0.5)) / 10.;
305  if (ChannelStatus[mod][sec] != StatusBadChannel)
306  h2QmeanMap->getTH2F()->SetBinContent(mod + 1, sec + 1, isum);
307  } // end for(int mod=0; mod<14; mod++) for(int sec=0;...
308 
309  for (int mod = 0; mod < 14; mod++)
310  hModule->getTH1F()->SetBinContent(mod + 1, ModuleSum[mod]);
311  for (int sec = 0; sec < 16; sec++)
312  hSector->getTH1F()->SetBinContent(sec + 1, SectorSum[sec]);
313 
314  int nGoodCh = 0;
315  hTSratio->Reset();
316  for (int mod = 0; mod < 14; mod++)
317  for (int sec = 0; sec < 16; sec++) {
318  if (ChannelStatus[mod][sec] == StatusBadChannel)
319  continue;
320  int ind = ModSecToIndex(mod, sec);
321  double Qmean = QmeanTS[ind][TSped] / ievt_;
322  double Qrms = QrmsTS[ind][TSped] / ievt_ - Qmean * Qmean;
323  float ChanStatus = 0.;
324  if (Qrms < Qrms_DEAD)
325  ChanStatus = 1.;
326  h2status->getTH2F()->SetBinContent(mod + 1, sec + 1, ChanStatus);
327 
328  float am = 0.;
329  for (int ts = 0; ts < TS_MAX - 1; ts++) {
330  float a = h2QmeantsvsCh->getTProfile2D()->GetBinContent(ind + 1, ts + 1) +
331  h2QmeantsvsCh->getTProfile2D()->GetBinContent(ind + 1, ts + 2);
332  if (am < a)
333  am = a;
334  }
335 
336  double sum = 0.;
337  for (int ts = 0; ts < TS_MAX; ts++)
338  sum += h2QmeantsvsCh->getTProfile2D()->GetBinContent(ind + 1, ts + 1);
339 
340  float r = 0.; // worth case - no peak
341  if (am > 0.)
342  r = 1. - (sum - am) / (TS_MAX - 2) / am * 2.;
343  // if(r<0.|| r>1.) cout<<"ievt="<<ievt<<" r="<<r<<" amax= "<<am<<"
344  // sum="<<sum<<endl;
345  h2TSratio->getTH2F()->SetBinContent(mod + 1, sec + 1, r);
346  hTSratio->Fill(r);
347 
348  float statusTS = 1.0;
349  if (r > RatioThresh1)
350  statusTS = repChanWarning;
351  else if (r > 0.99)
352  statusTS = repChanBAD;
353  float gChanStatus = statusTS;
354  if (ChanStatus > 0.)
355  gChanStatus = repChanBAD; // RMS
356  h2qualityMap->getTH2F()->SetBinContent(mod + 1, sec + 1, gChanStatus);
357  if (gChanStatus > repChanBAD)
358  ++nGoodCh;
359  }
360  hReport->Fill(float(nGoodCh) / N_GoodChannels);
361  return;
362 }
MonitorElement * h2towEMvsHAD
MonitorElement * h2TSratio
double QrmsTS[224][10]
TProfile2D * getTProfile2D() const
MonitorElement * h2qualityMap
int sector() const
get the sector (1-16)
MonitorElement * hTSratio
constexpr bool er() const
is the error bit set?
Definition: HcalQIESample.h:69
TH1F * getTH1F() const
const HcalQIESample & sample(int i) const
access a sample
std::vector< T >::const_iterator const_iterator
int module() const
get the module (1-2 for EM, 1-12 for HAD)
double isum
void Fill(long long x)
MonitorElement * h2status
MonitorElement * h2digierr
MonitorElement * hModule
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * h2QmeanMap
void Reset()
reset ME (ie. contents, errors, etc)
void fillTrigRes(edm::Event const &event, const edm::TriggerResults &TrigResults, double Etot)
constexpr int adc() const
get the ADC sample
Definition: HcalQIESample.h:59
TH2F * getTH2F() const
MonitorElement * h2QrmsTSvsCh
static const float LedMonAdc2fc[128]
MonitorElement * hBX
int ModSecToIndex(int module, int sector)
constexpr bool dv() const
is the Data Valid bit set?
Definition: HcalQIESample.h:67
MonitorElement * hdigisize
MonitorElement * hSector
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:65
double a
Definition: hdecay.h:121
double QmeanTS[224][10]
MonitorElement * h2repsum
MonitorElement * hQIErms[10]
const HcalCastorDetId & id() const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int size() const
total number of samples in the digi
Definition: vlib.h:208
MonitorElement * hReport
Definition: event.py:1
MonitorElement * htowE
MonitorElement * h2QmeantsvsCh

Member Data Documentation

int CastorDigiMonitor::fVerbosity
private

Definition at line 37 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2digierr
private

Definition at line 48 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2QmeanMap
private

Definition at line 53 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2QmeantsvsCh
private

Definition at line 52 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2QrmsTSvsCh
private

Definition at line 43 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2qualityMap
private

Definition at line 50 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2repsum
private

Definition at line 49 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2status
private

Definition at line 47 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2towEMvsHAD
private

Definition at line 57 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::h2TSratio
private

Definition at line 46 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hBX
private

Definition at line 41 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hdigisize
private

Definition at line 56 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hModule
private

Definition at line 54 of file CastorDigiMonitor.h.

MonitorElement * CastorDigiMonitor::hpBXtrig
private

Definition at line 41 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hpTrigRes
private

Definition at line 42 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hQIErms[10]
private

Definition at line 44 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hReport
private

Definition at line 51 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hSector
private

Definition at line 55 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::htowE
private

Definition at line 58 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::hTSratio
private

Definition at line 45 of file CastorDigiMonitor.h.

int CastorDigiMonitor::ievt_
private

Definition at line 38 of file CastorDigiMonitor.h.

float CastorDigiMonitor::QIEerrThreshold = 0.0001
private

Definition at line 62 of file CastorDigiMonitor.h.

double CastorDigiMonitor::QmeanTS[224][10]
private

Definition at line 63 of file CastorDigiMonitor.h.

float CastorDigiMonitor::Qrms_DEAD
private

Definition at line 39 of file CastorDigiMonitor.h.

double CastorDigiMonitor::QrmsTS[224][10]
private

Definition at line 63 of file CastorDigiMonitor.h.

float CastorDigiMonitor::RatioThresh1 = 0.
private

Definition at line 61 of file CastorDigiMonitor.h.

std::string CastorDigiMonitor::subsystemname_
private

Definition at line 36 of file CastorDigiMonitor.h.

int CastorDigiMonitor::TS_MAX = 10
private

Definition at line 60 of file CastorDigiMonitor.h.

const int CastorDigiMonitor::TSped = 0
private

Definition at line 64 of file CastorDigiMonitor.h.