43 bool dbgLevel =
false;
45 if (dbgLevel) std::cout <<
"--> HLTMETDQFlagSummary: Updating histograms in HLT/METMon*/DQPlots " << std::endl;
48 TIter next_run(
f->GetListOfKeys());
50 while ((key_run =
dynamic_cast<TKey*
> (next_run())) != 0) {
51 if (!key_run->IsFolder())
continue;
52 run_dir = key_run->GetName();
53 if (!run_dir.Contains(
"run")) {
57 TDirectory* tdir_run =
dynamic_cast<TDirectory*
>(key_run);
59 std::string run_dir2 = run_dir.Data();
70 TString hlt_top = run_dir +
"/HLT";
71 TString met_efdir =
"/EFMissingET_Fex";
72 TString met_l2dir =
"/L2MissingET_Fex";
73 TString dqflag_dir =
"/DQFlags";
75 std::vector<TString> met_fexs, met_l2hists, met_efhists;
77 met_fexs.push_back(
"/METMon");
82 met_l2hists.push_back(
"/L2_MET_status");
83 met_l2hists.push_back(
"/L2_MEx_log");
84 met_l2hists.push_back(
"/L2_MEy_log");
85 met_l2hists.push_back(
"/L2_MET_log");
86 met_l2hists.push_back(
"/L2_SumEt_log");
88 met_efhists.push_back(
"/EF_MET_status");
89 met_efhists.push_back(
"/EF_MET_lin");
90 met_efhists.push_back(
"/EF_MET_lin1");
91 met_efhists.push_back(
"/EF_SumEt_lin");
92 met_efhists.push_back(
"/EF_MET_phi");
93 met_efhists.push_back(
"/EF_MET_phi1");
94 met_efhists.push_back(
"/EF_MEx_log");
95 met_efhists.push_back(
"/EF_MEy_log");
96 met_efhists.push_back(
"/compN_compSumEt_lin");
97 met_efhists.push_back(
"/compN_EF_MET_status");
99 std::vector<TString> lbnDirs;
100 TString lbn_dqhist =
"/trmet_lbn_flag";
107 TString theL2Path = hlt_top + (*itFex) + met_l2dir;
108 TString theEFPath = hlt_top + (*itFex) + met_efdir;
109 TString theDQPath = hlt_top + (*itFex) + dqflag_dir;
111 TDirectory* dirl2 =
f->GetDirectory(theL2Path);
113 std::cerr <<
"--> HLTMETDQFlagSummary: directory " << theL2Path <<
" not found" << std::endl;
116 TDirectory* diref =
f->GetDirectory(theEFPath);
118 std::cerr <<
"--> HLTMETDQFlagSummary: directory " << theEFPath <<
" not found" << std::endl;
121 TDirectory* dirdq =
f->GetDirectory(theDQPath);
123 std::cerr <<
"--> HLTMETDQFlagSummary: directory " << theDQPath <<
" not found" << std::endl;
128 TString histL2 = (theL2Path + *itHist);
129 TString histL2C = (theDQPath + *itHist);
130 TH1* hl2(0), *hl2c(0);
131 if (!
f->Get(histL2)) {
132 if (dbgLevel) std::cerr <<
"--> HLTMETDQFlagSummary: no histogram " << histL2 << std::endl;
135 if (!
f->Get(histL2C)) {
136 if (dbgLevel) std::cerr <<
"--> HLTMETDQFlagSummary: no histogram " << histL2C << std::endl;
139 hl2 = (TH1*) (
f->Get(histL2));
141 bool save_status_hist =
false;
142 if (*itHist ==
"/L2_MET_status") {
143 if (hl2->GetMaximum() < 1.e-3) {
144 save_status_hist =
true;
145 for (
int ibin = 1; ibin <= hl2->GetNbinsX(); ibin++) {
146 hl2->SetBinContent(ibin, 0.05);
150 hl2c = (TH1*) (
f->Get(histL2C));
156 hl2c->Write(
"", TObject::kOverwrite);
157 if (save_status_hist) {
158 if (
f->cd(theL2Path)) hl2->Write(
"", TObject::kOverwrite);
164 TString histEF = (theEFPath + *itHist);
165 TString histEFC = (theDQPath + *itHist);
166 TH1* hef(0), *hefc(0);
167 if (!
f->Get(histEF)) {
168 if (dbgLevel) std::cerr <<
"--> HLTMETDQFlagSummary: no histogram " << histEF << std::endl;
171 if (!
f->Get(histEFC)) {
172 if (dbgLevel) std::cerr <<
"--> HLTMETDQFlagSummary: no histogram " << histEFC << std::endl;
175 hef = (TH1*) (
f->Get(histEF));
176 bool save_status_hist =
false;
177 if (*itHist ==
"/EF_MET_status") {
178 if (hef->GetMaximum() < 1.e-3) {
179 save_status_hist =
true;
180 for (
int ibin = 1; ibin <= hef->GetNbinsX(); ibin++) {
181 hef->SetBinContent(ibin, 0.05);
185 hefc = (TH1*) (
f->Get(histEFC));
190 if (save_status_hist) {
191 if (
f->cd(theEFPath)) hef->Write(
"", TObject::kOverwrite);
193 hefc->Write(
"", TObject::kOverwrite);
198 TString histLBN = theDQPath + lbn_dqhist;
200 if (!
f->Get(histLBN)) {
201 if (dbgLevel) std::cerr <<
"--> HLTMETDQFlagSummary: no histogram " << histLBN << std::endl;
204 hlb = (TH1*) (
f->Get(histLBN));
205 unsigned int nbinx = (
unsigned int) hlb->GetNbinsX(), nbiny = (
unsigned int) hlb->GetNbinsY(),
k = 1;
206 if (nbinx != nbiny)
continue;
208 if (lbn_range < nbinx) {
209 hlb->GetXaxis()->SetRangeUser(0, Double_t(lbn_range));
210 hlb->GetYaxis()->SetRangeUser(0, Double_t(lbn_range));
214 if (
k > nbinx)
continue;
215 TString histLBstat = run_dir + TString(
"/") + *
it + TString(
"/HLT") + (*itFex) +
"/lbnstatus/EF_MET_status";
216 if (!
f->Get(histLBstat)) {
217 if (dbgLevel) std::cerr <<
"--> HLTMETDQFlagSummary: no histogram " << histLBstat << std::endl;
220 hlbstat = (TH1I*) (
f->Get(histLBstat));
224 label.ReplaceAll(
"lowStat_",
"");
225 hlb->GetXaxis()->SetBinLabel(
k,
label.Data());
226 hlb->GetYaxis()->SetBinLabel(
k,
label.Data());
227 hlb->SetBinContent(
k,
k,
flag);
229 hlb->Write(
"", TObject::kOverwrite);
231 std::cerr <<
"--> HLTMETDQFlagSummary: lowStat_* directories: found none " << std::endl;
241 if (!run_dir)
return 0;
245 bool dbgLevel =
false;
246 if (dbgLevel) std::cout <<
"--> HLTMETGetDQLBNRange: lowStat_* directories: ";
249 TIter next_lbn(run_dir->GetListOfKeys());
251 TString lbn_dir =
"";
253 while ((key_lbn =
dynamic_cast<TKey*
> (next_lbn())) != 0) {
254 if (!key_lbn->IsFolder())
continue;
255 lbn_dir = key_lbn->GetName();
256 if (!lbn_dir.Contains(
"lowStat_")) {
259 lbnDirs.push_back(lbn_dir);
263 unsigned int nLBNDirs = lbnDirs.size();
264 if (dbgLevel) std::cout <<
"found " << nLBNDirs << std::endl;
276 float epsilon = 1.e-3;
278 yellmin = (yellmin > 0 && yellmin <=
nbins) ? yellmin : 1;
279 yellmax = (yellmax > 0 && yellmax <=
nbins) ? yellmax :
nbins;
280 redmin = (redmin > 0 && redmin <=
nbins) ? redmin : 1;
281 redmax = (redmax > 0 && redmax <=
nbins) ? redmax :
nbins;
283 float theVal =
hist->GetBinContent(
k);
285 if (theVal > epsilon) {
286 if (
k >= yellmin &&
k <= yellmax)
flag = 100;
287 if (
k >= redmin &&
k <= redmax)
flag = 1000;