ATLAS Offline Software
Functions
HistogramDataCOOL.cxx File Reference
#include "DataQualityUtils/HistogramDataCOOL.h"
#include "CoralBase/Attribute.h"
#include "CoolKernel/IDatabase.h"
#include "CoolKernel/IFolder.h"
#include "CoolKernel/IObjectIterator.h"
#include "CoolKernel/IObject.h"
#include "CoolKernel/Record.h"
#include "CoolKernel/Exception.h"
#include "CoolKernel/IDatabaseSvc.h"
#include "CoolKernel/StorageType.h"
#include "CoolKernel/ConstRecordAdapter.h"
#include <sstream>
#include <fstream>
#include <string>
#include <TCanvas.h>
#include <TDirectory.h>
#include <TFile.h>
#include <TGraph.h>
#include <TGraphErrors.h>
#include <TH1.h>
#include <TH2.h>
#include <TIterator.h>
#include <TKey.h>
#include <TLegend.h>
#include <TProfile.h>
#include <TROOT.h>
#include <TStyle.h>
#include <TLatex.h>
#include <TMath.h>
#include <TColor.h>
#include <TTree.h>

Go to the source code of this file.

Functions

 ClassImp (dqutils::HistogramDataCOOL) namespace dqutils
 

Function Documentation

◆ ClassImp()

Definition at line 47 of file HistogramDataCOOL.cxx.

49  {
50  cool::IDatabasePtr
51  HistogramDataCOOL::
52  coolDbInstance(const std::string& dbStr, bool readOnly) {
53  try {
54  std::cout << "Opening database '" << dbStr << "'...";
55  cool::IDatabaseSvc& dbSvc = this->databaseService();
56  std::cout << "done." << std::endl;
57  return dbSvc.openDatabase(dbStr.c_str(), readOnly);
58  }
59  catch (cool::DatabaseDoesNotExist&) {
60  std::cout << "Error! Database does not exist!" << std::endl;
61  throw;
62  }
63  }
64 
65  cool::IFolderPtr
66  HistogramDataCOOL::
67  coolFolderInstance(const std::string& folderStr) {
68  try {
69  cool::IFolderPtr folder = m_coolDb->getFolder(folderStr.c_str());
70  std::cout << "Browsing objects of '" << folderStr << "'" << std::endl;
71  return folder;
72  }
73  catch (cool::FolderNotFound&) {
74  std::cout << "Error! Folder '" << folderStr << "' does not exist!" << std::endl;
75  throw;
76  }
77  }
78 
79  void
80  HistogramDataCOOL::
81  setSince(cool::Int64 run, cool::Int64 lumi) {
82  m_since = ((run << 32) + lumi);
83  }
84 
85  void
86  HistogramDataCOOL::
87  setUntil(cool::Int64 run, cool::Int64 lumi) {
88  m_until = ((run << 32) + lumi);
89  }
90 
91  void
92  HistogramDataCOOL::
93  setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU) {
94  this->setSince(runS, lumiS);
95  this->setUntil(runU, lumiU);
96  this->printIOV();
97  }
98 
99  void
100  HistogramDataCOOL::
101  setIOV(cool::Int64 run) {
102  this->setSince(run, 0);
103  this->setUntil(run, cool::UInt32Max);
104  //this->printIOV();
105  }
106 
107  void
108  HistogramDataCOOL::
109  printIOV() {
110  cool::Int64 runS = m_since >> 32;
111  cool::Int64 lumiS = m_since - (runS << 32);
112  cool::Int64 runU = m_until >> 32;
113  cool::Int64 lumiU = m_until - (runU << 32);
114  std::cout << "Using IOVrange [(" << runS << "," << lumiS << "),(" << runU << "," << lumiU << ")] " << "[" <<
115  m_since << "," << m_until << "]" << std::endl;
116  }
117 
118  HistogramDataCOOL::
119  HistogramDataCOOL (const std::string& dbStr, const std::string& folderStr, int runS, int lumiS, int runU,
120  int lumiU) {
121  m_coolDb = this->coolDbInstance(dbStr, false);
122  m_coolFolder = this->coolFolderInstance(folderStr);
123  m_coolFolderH = this->coolFolderInstance(folderStr);
124  this->setIOV(runS, lumiS, runU, lumiU);
125  }
126 
127  HistogramDataCOOL::
128  HistogramDataCOOL (int runS, int lumiS, int runU, int lumiU) {
129  m_coolDb = this->coolDbInstance("COOLOFL_GLOBAL/OFLP200", false);
130  m_coolFolder = this->coolFolderInstance("/GLOBAL/DETSTATUS/DQMFOFL");
131  m_coolFolderH = this->coolFolderInstance("/GLOBAL/DETSTATUS/DQMFOFLH");
132  this->setIOV(runS, lumiS, runU, lumiU);
133  }
134 
135  HistogramDataCOOL::
136  HistogramDataCOOL() {
137  m_coolDb = this->coolDbInstance("COOLOFL_GLOBAL/OFLP200", false);
138  m_coolFolder = this->coolFolderInstance("/GLOBAL/DETSTATUS/DQMFOFL");
139  m_coolFolderH = this->coolFolderInstance("/GLOBAL/DETSTATUS/DQMFOFLH");
140  this->setIOV(0, 0, 0, 0);
141  }
142 
143  HistogramDataCOOL::
144  ~HistogramDataCOOL () {
145  m_coolDb->closeDatabase();
146  std::cout << "Cleared!" << std::endl;
147  }
148 
149  cool::RecordSpecification
150  HistogramDataCOOL::
151  createSpec() {
152  //std::cout << "Preparing RecordSpecification" << std::endl;
153  cool::RecordSpecification spec;
154  spec.extend("Code", cool::StorageType::Int32);
155  spec.extend("deadFrac", cool::StorageType::Float);
156  spec.extend("Thrust", cool::StorageType::Float);
157  if (!(spec == m_coolFolder->payloadSpecification())) {
158  std::cout << "ERROR Source and destination folder specifications differ." << std::endl;
159  }
160  return spec;
161  }
162 
165  createPayload(int colourCode, float dfrac, float thrust, const cool::RecordSpecification& spec) {
166  coral::AttributeList payload = cool::Record(spec).attributeList();
167  payload["Code"].data<cool::Int32>() = colourCode;
168  payload["deadFrac"].data<cool::Float>() = dfrac;
169  payload["Thrust"].data<cool::Float>() = thrust;
170  //std::cout << "Creating payload: ";
171  //std::cout << "[Code : " << colourCode << "],";
172  //std::cout << "[DeadFraction : " << dfrac << "],";
173  //std::cout << "[Thrust : " << thrust << "]" << std::endl;
174  return payload;
175  }
176 
177  // Monica 4/6/2008, modified 24/6/2008 to allocate more quantities
178  cool::RecordSpecification
179  HistogramDataCOOL::
180  createSpecH() {
181  cool::RecordSpecification specH;
182  specH.extend("Code", cool::StorageType::Int32);
183  specH.extend("Algo", cool::StorageType::String255);
184  specH.extend("Entries", cool::StorageType::Int32);
185  specH.extend("Par1", cool::StorageType::Float);
186  specH.extend("Par2", cool::StorageType::Float);
187  specH.extend("Par3", cool::StorageType::Float);
188  specH.extend("Par4", cool::StorageType::Float);
189  specH.extend("Par5", cool::StorageType::Float);
190 
191  if (!(specH == m_coolFolderH->payloadSpecification())) {
192  std::cout << "ERROR Source and destination folder specifications differ. histos" << std::endl;
193  }
194  return specH;
195  }
196 
198  HistogramDataCOOL::
199  createPayloadH(int colourCode,
200  const std::string& algo,
201  int entries, float par1, float par2, float par3, float par4, float par5,
202  const cool::RecordSpecification& specH) {
203  coral::AttributeList payloadH = cool::Record(specH).attributeList();
204  payloadH["Code"].data<cool::Int32>() = colourCode;
205  payloadH["Algo"].data<cool::String255>() = algo;
206  payloadH["Entries"].data<cool::Int32>() = entries;
207  payloadH["Par1"].data<cool::Float>() = par1;
208  payloadH["Par2"].data<cool::Float>() = par2;
209  payloadH["Par3"].data<cool::Float>() = par3;
210  payloadH["Par4"].data<cool::Float>() = par4;
211  payloadH["Par5"].data<cool::Float>() = par5;
212  std::cout << "Creating payload histos: ";
213  std::cout << "[Code : " << colourCode << "],";
214  std::cout << "[Algo : " << algo << "],";
215  std::cout << "[Entries : " << entries << "],";
216  std::cout << "[Par1 : " << par1 << "],";
217  std::cout << "[Par2 : " << par2 << "],";
218  std::cout << "[Par3 : " << par3 << "],";
219  std::cout << "[Par4 : " << par4 << "],";
220  std::cout << "[Par5 : " << par5 << "]" << std::endl;
221  return payloadH;
222  }
223 
224  // end of modification in create new folder and payload (Monica 4/6/2008)
225 
226  void
228  dump(cool::ChannelSelection selection, std::string tag_name) {
229  try {
230  // cool::IObjectIteratorPtr objects = m_coolFolder->browseObjects(m_since, m_until,
231  // selection,"DetStatusDQMFOFLH-FDR2-01");
232  cool::IObjectIteratorPtr objects = m_coolFolder->browseObjects(m_since, m_until, selection, tag_name);
233  while (objects->goToNext()) {
234  const cool::IObject& element = objects->currentRef();
235  std::cout << element << std::endl;
236  }
237  }
238  catch (cool::Exception& e) {
239  std::cout << "Unknown exception caught!" << e.what() << std::endl;
240  }
241  }
242 
243  int
244  HistogramDataCOOL::
245  dumpCode(const std::string& channelName, const std::string& tag_name) {
246  std::string result = this->dumpHisto(this->getCoolFolderH()->channelId(channelName.c_str()), "Code", tag_name);
247  return atoi(result.c_str());
248  }
249 
250  void
251  HistogramDataCOOL::
252  dumpall(const std::string& tag_name) {
253  this->dump(cool::ChannelSelection::all(), tag_name);
254  }
255 
256  // Monica 4/6/2208
257  std::string
258  HistogramDataCOOL::
259  dumpHisto(cool::ChannelId channelId, std::string field, std::string tag_name) {
260  std::string result = "";
261  try {
262  cool::ChannelSelection selection = cool::ChannelSelection(channelId);
263  // cool::IObjectIteratorPtr objects = m_coolFolderH->browseObjects(m_since, m_until,
264  // selection,"DetStatusDQMFOFLH-FDR2-01");
265  cool::IObjectIteratorPtr objects = m_coolFolderH->browseObjects(m_since, m_until, selection, tag_name);
266  while (objects->goToNext()) {
267  const cool::IObject& element = objects->currentRef();
268  result = element.payloadValue(field);
269  }
270  }
271  catch (cool::Exception& e) {
272  std::cout << "Unknown exception caught!" << e.what() << std::endl;
273  }
274  return result;
275  }
276 
277  void
278  HistogramDataCOOL::
279  insertH(cool::ChannelId channelId, int code,
280  const std::string& algo,
281  int entries, float par1, float par2, float par3, float par4, float par5,
282  const std::string& tag_name) {
283  try {
284  cool::RecordSpecification specH = this->createSpecH();
285  coral::AttributeList payloadH = this->createPayloadH(code, algo, entries, par1, par2, par3, par4, par5, specH);
286  std::cout << "Trying to store payload histos [channel " << this->getCoolFolderH()->channelName(channelId) <<
287  " (" << channelId << ")]...";
288  // m_coolFolderH->storeObject(m_since, m_until, payloadH, channelId, "DetStatusDQMFOFLH-FDR2-01", true);
289  m_coolFolderH->storeObject(m_since, m_until, cool::Record(
290  m_coolFolder->payloadSpecification(), payloadH), channelId, tag_name, true);
291  std::cout << "stored!" << std::endl;
292  }
293  catch (cool::Exception& e) {
294  std::cout << "Unknown exception caught!" << e.what() << std::endl;
295  }
296  }
297 
298  void
299  HistogramDataCOOL::
300  insertH(std::string channelName, int code, std::string algo, int entries, float par1, float par2, float par3,
301  float par4, float par5, std::string tag_name) {
302  try {
303  this->insertH(this->getCoolFolderH()->channelId(
304  channelName), code, algo, entries, par1, par2, par3, par4, par5, tag_name);
305  }
306  catch (cool::Exception& e) {
307  std::cout << "Unknown exception caught!" << e.what() << std::endl;
308  }
309  }
310 
311  cool::IFolderPtr
312  HistogramDataCOOL::
313  getCoolFolderH() {
314  return this->m_coolFolderH;
315  }
316 
317  void
318  HistogramDataCOOL::
319  ntupleDB(int HistoId, const std::string& nameHisto, const std::string& configuration, int Irun, int Frun) {
320  gROOT->Reset();
321  gROOT->SetBatch();
322  gStyle->SetFrameBorderMode(0);
323  gStyle->SetCanvasBorderMode(0);
324  gStyle->SetPadBorderMode(0);
325  gStyle->SetPadColor(0);
326  gStyle->SetCanvasColor(0);
327  gStyle->SetTitleColor(1);
328  gStyle->SetStatColor(0);
329  gStyle->SetFillColor(1);
330  gStyle->SetPalette(1, 0);
331  gStyle->SetTitleFontSize(0.06);
332  gStyle->SetTitleH(0.06);
333 
334  // Declaration of leave types
335  UInt_t RunSince;
336  UInt_t RunUntil;
337  UInt_t LBSince;
338  UInt_t LBUntil;
339  UInt_t ChannelID;
340  Char_t TagID[26];
341  Int_t Code;
342  Char_t Algo[100];
343  Int_t Entries;
344  Float_t Par1;
345  Float_t Par2;
346  Float_t Par3;
347  Float_t Par4;
348  Float_t Par5;
349 
350  // List of branches
351  TBranch* b_RunSince;
352  TBranch* b_RunUntil;
353  TBranch* b_LBSince;
354  TBranch* b_LBUntil;
355  TBranch* b_ChannelID;
356  TBranch* b_TagID;
357  TBranch* b_Code;
358  TBranch* b_Algo;
359  TBranch* b_Entries;
360  TBranch* b_Par1;
361  TBranch* b_Par2;
362  TBranch* b_Par3;
363  TBranch* b_Par4;
364  TBranch* b_Par5;
365 
366  unsigned int i = HistoId;
367  unsigned int init_run = Irun;
368  unsigned int last_run = Frun;
369  std::string nameh = nameHisto;
370  std::string config = configuration;
371 
372  char f_name[200];
373  char dir_name[200];
374  sprintf(f_name, "dqmfoflh_%s.root", config.c_str());
375  sprintf(dir_name, "dqmfoflh_%s.root:/COOL/GLOBAL/DETSTATUS", config.c_str());
376  TFile* f = (TFile*) gROOT->GetListOfFiles()->FindObject(f_name);
377  if (!f) {
378  f = new TFile(f_name);
379  f->cd(dir_name);
380  }
381  TTree* tree = (TTree*) gDirectory->Get("DQMFOFLH");
382 
383  if (!tree) return;
384 
385  tree->SetBranchAddress("RunSince", &RunSince, &b_RunSince);
386  tree->SetBranchAddress("RunUntil", &RunUntil, &b_RunUntil);
387  tree->SetBranchAddress("LBSince", &LBSince, &b_LBSince);
388  tree->SetBranchAddress("LBUntil", &LBUntil, &b_LBUntil);
389  tree->SetBranchAddress("ChannelID", &ChannelID, &b_ChannelID);
390  tree->SetBranchAddress("TagID", TagID, &b_TagID);
391  tree->SetBranchAddress("Code", &Code, &b_Code);
392  tree->SetBranchAddress("Algo", Algo, &b_Algo);
393  tree->SetBranchAddress("Entries", &Entries, &b_Entries);
394  tree->SetBranchAddress("Par1", &Par1, &b_Par1);
395  tree->SetBranchAddress("Par2", &Par2, &b_Par2);
396  tree->SetBranchAddress("Par3", &Par3, &b_Par3);
397  tree->SetBranchAddress("Par4", &Par4, &b_Par4);
398  tree->SetBranchAddress("Par5", &Par5, &b_Par5);
399 
400  TGraphErrors* entr_g = new TGraphErrors();
401  TGraphErrors* par1_g[4];
402  TGraphErrors* par2_g[4];
403  TGraphErrors* par3_g[4];
404  TGraphErrors* par4_g[4];
405  TGraphErrors* par5_g[4];
406 
407  for (int k = 0; k < 4; k++) {
408  par1_g[k] = new TGraphErrors();
409  par2_g[k] = new TGraphErrors();
410  par3_g[k] = new TGraphErrors();
411  par4_g[k] = new TGraphErrors();
412  par5_g[k] = new TGraphErrors();
413  }
414 
415  std::string Algorithm;
416 
417  Int_t nentries = tree->GetEntries();
418 
419  if (nentries < 1) {
420  std::cout << " The TTree is empty! Check if the right Folder DB Tag is used" << std::endl;
421  return;
422  }
423 
424  for (Int_t jj = 0; jj < nentries; jj++) {
425  tree->GetEntry(jj);
426 
427  if (i == ChannelID && ((RunSince >= init_run) && (RunSince <= last_run))) {
428  Algorithm = Algo;
429  if (Algorithm == "BinContentComp" && Par5 != 0.) {
430  int npoints = 0;
431 
432  // N Entries
433  npoints = entr_g->GetN();
434  npoints++;
435  entr_g->Set(npoints);
436  entr_g->SetPoint(npoints - 1, RunSince, Entries);
437  entr_g->SetPointError(npoints - 1, 0., sqrt(Entries));
438 
439  // Par 1
440  int npoints1 = 0;
441  int npoints2 = 0;
442  int npoints3 = 0;
443  int npoints4 = 0;
444  int npoints5 = 0;
445  npoints1 = 0;
446  npoints2 = 0;
447  npoints3 = 0;
448  npoints4 = 0;
449  npoints5 = 0;
450  for (int k = 0; k < 4; k++) npoints1 = par1_g[k]->GetN();
451  for (int k = 0; k < 4; k++) npoints2 = par2_g[k]->GetN();
452  for (int k = 0; k < 4; k++) npoints3 = par3_g[k]->GetN();
453  for (int k = 0; k < 4; k++) npoints4 = par4_g[k]->GetN();
454  for (int k = 0; k < 4; k++) npoints5 = par5_g[k]->GetN();
455  npoints1++;
456  npoints2++;
457  npoints3++;
458  npoints4++;
459  npoints5++;
460  for (int k = 0; k < 4; k++) {
461  par1_g[k]->Set(npoints1);
462  par2_g[k]->Set(npoints2);
463  par3_g[k]->Set(npoints3);
464  par4_g[k]->Set(npoints4);
465  par5_g[k]->Set(npoints5);
466  }
467  par1_g[0]->SetPoint(npoints1 - 1, RunSince, Par1);
468  par2_g[0]->SetPoint(npoints2 - 1, RunSince, Par2);
469  par3_g[0]->SetPoint(npoints3 - 1, RunSince, Par3);
470  par4_g[0]->SetPoint(npoints4 - 1, RunSince, Par4);
471  par5_g[0]->SetPoint(npoints5 - 1, RunSince, Par5);
472  if (Code == 1) {
473  par1_g[1]->SetPoint(npoints1 - 1, RunSince, Par1);
474  par2_g[1]->SetPoint(npoints2 - 1, RunSince, Par2);
475  par3_g[1]->SetPoint(npoints3 - 1, RunSince, Par3);
476  par4_g[1]->SetPoint(npoints4 - 1, RunSince, Par4);
477  par5_g[1]->SetPoint(npoints5 - 1, RunSince, Par5);
478  }
479  if (Code == 2) {
480  par1_g[2]->SetPoint(npoints1 - 1, RunSince, Par1);
481  par2_g[2]->SetPoint(npoints2 - 1, RunSince, Par2);
482  par3_g[2]->SetPoint(npoints3 - 1, RunSince, Par3);
483  par4_g[2]->SetPoint(npoints4 - 1, RunSince, Par4);
484  par5_g[2]->SetPoint(npoints5 - 1, RunSince, Par5);
485  }
486  if (Code == 3) {
487  par1_g[3]->SetPoint(npoints1 - 1, RunSince, Par1);
488  par2_g[3]->SetPoint(npoints2 - 1, RunSince, Par2);
489  par3_g[3]->SetPoint(npoints3 - 1, RunSince, Par3);
490  par4_g[3]->SetPoint(npoints4 - 1, RunSince, Par4);
491  par5_g[3]->SetPoint(npoints5 - 1, RunSince, Par5);
492  }
493 
494  par1_g[0]->SetPointError(npoints1 - 1, 0., 0.);
495  par2_g[0]->SetPointError(npoints2 - 1, 0., Par2 / sqrt(Entries));
496  par3_g[0]->SetPointError(npoints3 - 1, 0., Par3 / sqrt(Entries));
497  par4_g[0]->SetPointError(npoints4 - 1, 0., Par4 / sqrt(Entries));
498  par5_g[0]->SetPointError(npoints5 - 1, 0., Par5 / sqrt(Entries));
499  }
500  }
501 
502  if (i == ChannelID && ((RunSince >= init_run) && (RunSince <= last_run))) {
503  Algorithm = Algo;
504  int npoints = 0;
505  // N Entries
506  npoints = entr_g->GetN();
507  npoints++;
508  entr_g->Set(npoints);
509  entr_g->SetPoint(npoints - 1, RunSince, Entries);
510  entr_g->SetPointError(npoints - 1, 0., sqrt(Entries));
511 
512  // Par 1
513  npoints = 0;
514  for (int k = 0; k < 4; k++) npoints = par1_g[k]->GetN();
515  npoints++;
516  for (int k = 0; k < 4; k++) par1_g[k]->Set(npoints);
517  par1_g[0]->SetPoint(npoints - 1, RunSince, Par1);
518  if (Code == 1) par1_g[1]->SetPoint(npoints - 1, RunSince, Par1);
519  if (Code == 2) par1_g[2]->SetPoint(npoints - 1, RunSince, Par1);
520  if (Code == 3) par1_g[3]->SetPoint(npoints - 1, RunSince, Par1);
521 
522 
523  std::string::size_type loc = Algorithm.find("CheckHisto_Mean&GatherData", 0);
524  if (loc != std::string::npos) {
525  Algorithm = "CheckHisto_Mean&GatherData";
526  }
527 
528  if (Algorithm == "GatherData" || Algorithm == "Histogram_Not_Empty&GatherData" ||
529  Algorithm == "CheckHisto_Mean&GatherData" || Algorithm == "BinContentComp&GatherData") {
530  // in this case, Par1=Mean, error depends on the algorithm
531  if (Par3 > 0 || Par4 > 0) {
532  // this is the new GatherData: return Mean, EMean, RMS, ERMS or
533  // Mean, EMean, RMS, ERMS + XMean or Mean, EMean, NBins, RMS, ERMS
534  par1_g[0]->SetPointError(npoints - 1, 0., Par2);
535  } else {
536  // this is the old GatherData: return Mean and RMS only
537  if (Entries > 0.) {
538  par1_g[0]->SetPointError(npoints - 1, 0., Par2 / sqrt(Entries));
539  } else {
540  par1_g[0]->SetPointError(npoints - 1, 0., 0.);
541  }
542  }
543  } else {
544  if (Entries > 0.) {
545  if (Algorithm == "Simple_gaus_Fit") {
546  par1_g[0]->SetPointError(npoints - 1, 0., Par2 / sqrt(Entries));
547  } else {
548  par1_g[0]->SetPointError(npoints - 1, 0., Par1 / sqrt(Entries));
549  }
550  } else {
551  par1_g[0]->SetPointError(npoints - 1, 0., 0.);
552  }
553  }
554 
555  // Par2
556  npoints = 0;
557  for (int k = 0; k < 4; k++) npoints = par2_g[k]->GetN();
558  npoints++;
559  for (int k = 0; k < 4; k++) par2_g[k]->Set(npoints);
560  par2_g[0]->SetPoint(npoints - 1, RunSince, Par2);
561  if (Code == 1) par2_g[1]->SetPoint(npoints - 1, RunSince, Par2);
562  if (Code == 2) par2_g[2]->SetPoint(npoints - 1, RunSince, Par2);
563  if (Code == 3) par2_g[3]->SetPoint(npoints - 1, RunSince, Par2);
564  if (Entries > 0.) {
565  par2_g[0]->SetPointError(npoints - 1, 0., Par2 / sqrt(Entries));
566  } else {
567  par2_g[0]->SetPointError(npoints - 1, 0., 0.);
568  }
569 
570  if ((Algorithm == "GatherData" || Algorithm == "Histogram_Not_Empty&GatherData") &&
571  (Par3 > 0 || Par4 > 0)) {
572  // this is the new GatherData: return Mean, EMean, RMS, ERMS
573  par2_g[0]->SetPoint(npoints - 1, RunSince, Par3);
574  if (Code == 1) par2_g[1]->SetPoint(npoints - 1, RunSince, Par3);
575  if (Code == 2) par2_g[2]->SetPoint(npoints - 1, RunSince, Par3);
576  if (Code == 3) par2_g[3]->SetPoint(npoints - 1, RunSince, Par3);
577  par2_g[0]->SetPointError(npoints - 1, 0., Par4);
578  }
579 
580  if ((Algorithm == "CheckHisto_Mean&GatherData" || Algorithm == "BinContentComp&GatherData"
581  ) && (Par5 != 0)) {
582  // this is the new GatherData: return Mean, EMean, RMS, ERMS + XMean or Mean, EMean, NBins, RMS, ERMS
583  if (Algorithm == "BinContentComp&GatherData") {
584  par2_g[0]->SetPoint(npoints - 1, RunSince, Par4);
585  if (Code == 1) par2_g[1]->SetPoint(npoints - 1, RunSince, Par4);
586  if (Code == 2) par2_g[2]->SetPoint(npoints - 1, RunSince, Par4);
587  if (Code == 3) par2_g[3]->SetPoint(npoints - 1, RunSince, Par4);
588  par2_g[0]->SetPointError(npoints - 1, 0., Par5);
589  }
590  if (Algorithm == "CheckHisto_Mean&GatherData") {
591  par2_g[0]->SetPoint(npoints - 1, RunSince, Par3);
592  if (Code == 1) par2_g[1]->SetPoint(npoints - 1, RunSince, Par3);
593  if (Code == 2) par2_g[2]->SetPoint(npoints - 1, RunSince, Par3);
594  if (Code == 3) par2_g[3]->SetPoint(npoints - 1, RunSince, Par3);
595  par2_g[0]->SetPointError(npoints - 1, 0., Par4);
596  }
597  }
598 
599  //Par3
600  npoints = 0;
601  if (Algorithm == "Simple_gaus_Fit" || Algorithm == "BinContentComp&GatherData"
602  || Algorithm == "CheckHisto_Mean&GatherData") { //currently the only algorithms with third parameter filled
603  for (int k = 0; k < 4; k++) npoints = par3_g[k]->GetN();
604  npoints++;
605  for (int k = 0; k < 4; k++) par3_g[k]->Set(npoints);
606  par3_g[0]->SetPoint(npoints - 1, RunSince, Par3);
607  if (Code == 1) par3_g[1]->SetPoint(npoints - 1, RunSince, Par3);
608  if (Code == 2) par3_g[2]->SetPoint(npoints - 1, RunSince, Par3);
609  if (Code == 3) par3_g[3]->SetPoint(npoints - 1, RunSince, Par3);
610  if (Entries > 0.) {
611  par3_g[0]->SetPointError(npoints - 1, 0., Par3 / sqrt(Entries));
612  } else {
613  par3_g[0]->SetPointError(npoints - 1, 0., 0.);
614  }
615  if (Algorithm == "CheckHisto_Mean&GatherData") {
616  if (Par5 != 0) {
617  par3_g[0]->SetPoint(npoints - 1, RunSince, Par5);
618  if (Code == 1) par3_g[1]->SetPoint(npoints - 1, RunSince, Par5);
619  if (Code == 2) par3_g[2]->SetPoint(npoints - 1, RunSince, Par5);
620  if (Code == 3) par3_g[3]->SetPoint(npoints - 1, RunSince, Par5);
621  par3_g[0]->SetPointError(npoints - 1, 0., Par4);
622  } else {
623  par3_g[0]->SetPoint(npoints - 1, RunSince, Par3);
624  if (Code == 1) par3_g[1]->SetPoint(npoints - 1, RunSince, Par3);
625  if (Code == 2) par3_g[2]->SetPoint(npoints - 1, RunSince, Par3);
626  if (Code == 3) par3_g[3]->SetPoint(npoints - 1, RunSince, Par3);
627  if (Entries > 0.) par3_g[0]->SetPointError(npoints - 1, 0., Par2 / sqrt(Entries));
628  }
629  }
630  }
631  } // end channel selection and run range selection
632  }
633 
634  TFile* hfile = (TFile*) gROOT->GetListOfFiles()->FindObject("c1.root");
635  if (hfile) hfile->Close();
636  hfile = new TFile("c1.root", "RECREATE", "ROOT file with graphs");
637 
638  std::string par1_name = defParName(Algorithm, nameh, 1);
639  std::string par2_name = defParName(Algorithm, nameh, 2);
640  std::string par3_name = defParName(Algorithm, nameh, 3);
641  std::string par4_name = defParName(Algorithm, nameh, 4);
642  std::string par5_name = defParName(Algorithm, nameh, 5);
643 
644  std::string status_code[4];
645  status_code[0] = "";
646  status_code[1] = "Red";
647  status_code[2] = "Yellow";
648  status_code[3] = "Green";
649 
650  std::string par1_g_name[4];
651  std::string par2_g_name[4];
652  std::string par3_g_name[4];
653  std::string par4_g_name[4];
654  std::string par5_g_name[4];
655  for (int k = 0; k < 4; k++) {
656  par1_g_name[k] = "Par1, Algo:" + Algorithm + " " + status_code[k];
657  par2_g_name[k] = "Par2, Algo:" + Algorithm + " " + status_code[k];
658  par3_g_name[k] = "Par3, Algo:" + Algorithm + " " + status_code[k];
659  par4_g_name[k] = "Par4, Algo:" + Algorithm + " " + status_code[k];
660  par5_g_name[k] = "Par5, Algo:" + Algorithm + " " + status_code[k];
661  }
662 
663  TCanvas* c1 = new TCanvas("c1", " History ");
664  if (Algorithm == "Simple_gaus_Fit" || Algorithm == "BinContentComp&GatherData" ||
665  Algorithm == "CheckHisto_Mean&GatherData") { //currently the only algorithms with third parameter filled
666  c1->SetCanvasSize(900, 900);
667  c1->Divide(2, 2);
668  } else {
669  if (Algorithm == "BinContentComp") {
670  c1->SetCanvasSize(900, 900);
671  c1->Divide(2, 3);
672  } else {
673  c1->SetCanvasSize(1000, 450);
674  c1->Divide(3, 1);
675  }
676  }
677  c1->Update();
678  int green = TColor::GetColor("#009900");
679  int yellow = TColor::GetColor("#ff9933");
680 
681  c1->cd(1);
682  gPad->SetGridx();
683  gPad->SetGridy();
684  formatGraph(c1, entr_g);
685  entr_g->SetTitle("N Entries");
686  entr_g->GetYaxis()->SetTitle("N entries");
687  entr_g->SetMarkerStyle(20);
688 
689  bool non_zero = false;
690 
691  if (entr_g->GetMaxSize() != 0) {
692  entr_g->Draw("ap");
693  non_zero = true;
694  }
695 
696  c1->cd(2);
697  gPad->SetGridx();
698  gPad->SetGridy();
699  formatGraph(c1, par1_g[0]);
700  for (int k = 0; k < 4; k++) {
701  par1_g[k]->SetTitle(par1_g_name[k].c_str());
702  par1_g[k]->SetMarkerStyle(20);
703  }
704  par1_g[0]->GetYaxis()->SetTitle(par1_name.c_str());
705  par1_g[1]->SetMarkerColor(2);
706  par1_g[2]->SetMarkerColor(yellow);
707  par1_g[3]->SetMarkerColor(green);
708  if (non_zero) {
709  par1_g[0]->Draw("ap");
710  par1_g[1]->Draw("p");
711  par1_g[2]->Draw("p");
712  par1_g[3]->Draw("p");
713  }
714  c1->cd(3);
715  gPad->SetGridx();
716  gPad->SetGridy();
717  formatGraph(c1, par2_g[0]);
718  par2_g[0]->GetYaxis()->SetTitle(par2_name.c_str());
719  for (int k = 0; k < 4; k++) {
720  par2_g[k]->SetTitle(par2_g_name[k].c_str());
721  par2_g[k]->SetMarkerStyle(20);
722  }
723  par2_g[1]->SetMarkerColor(2);
724  par2_g[2]->SetMarkerColor(yellow);
725  par2_g[3]->SetMarkerColor(green);
726  if (non_zero) {
727  par2_g[0]->Draw("ap");
728  par2_g[1]->Draw("p");
729  par2_g[2]->Draw("p");
730  par2_g[3]->Draw("p");
731  }
732  if (Algorithm == "Simple_gaus_Fit" || Algorithm == "BinContentComp&GatherData" || (Algorithm == "BinContentComp") ||
733  Algorithm == "CheckHisto_Mean&GatherData") { //currently the only algorithm with third parameter filled
734  c1->cd(4);
735  gPad->SetGridx();
736  gPad->SetGridy();
737  formatGraph(c1, par3_g[0]);
738  par3_g[0]->GetYaxis()->SetTitle(par3_name.c_str());
739  for (int k = 0; k < 4; k++) {
740  par3_g[k]->SetMarkerStyle(20);
741  par3_g[k]->SetTitle(par3_g_name[k].c_str());
742  }
743  par3_g[1]->SetMarkerColor(2);
744  par3_g[2]->SetMarkerColor(yellow);
745  par3_g[3]->SetMarkerColor(green);
746  if (non_zero) {
747  par3_g[0]->Draw("ap");
748  par3_g[1]->Draw("p");
749  par3_g[2]->Draw("p");
750  par3_g[3]->Draw("p");
751  }
752  }
753 
754  if (Algorithm == "BinContentComp") {
755  c1->cd(5);
756  gPad->SetGridx();
757  gPad->SetGridy();
758  formatGraph(c1, par4_g[0]);
759  par4_g[0]->GetYaxis()->SetTitle(par4_name.c_str());
760  for (int k = 0; k < 4; k++) {
761  par4_g[k]->SetMarkerStyle(20);
762  par4_g[k]->SetTitle(par4_g_name[k].c_str());
763  }
764  par4_g[1]->SetMarkerColor(2);
765  par4_g[2]->SetMarkerColor(yellow);
766  par4_g[3]->SetMarkerColor(green);
767  if (non_zero) {
768  par4_g[0]->Draw("ap");
769  par4_g[1]->Draw("p");
770  par4_g[2]->Draw("p");
771  par4_g[3]->Draw("p");
772  }
773 
774  c1->cd(6);
775  gPad->SetGridx();
776  gPad->SetGridy();
777  formatGraph(c1, par5_g[0]);
778  par5_g[0]->GetYaxis()->SetTitle(par5_name.c_str());
779  for (int k = 0; k < 4; k++) {
780  par5_g[k]->SetMarkerStyle(20);
781  par5_g[k]->SetTitle(par5_g_name[k].c_str());
782  }
783  par5_g[1]->SetMarkerColor(2);
784  par5_g[2]->SetMarkerColor(yellow);
785  par5_g[3]->SetMarkerColor(green);
786  if (non_zero) {
787  par5_g[0]->Draw("ap");
788  par5_g[1]->Draw("p");
789  par5_g[2]->Draw("p");
790  par5_g[3]->Draw("p");
791  }
792  }
793 
794  entr_g->Write("Nentr");
795  for (int k = 0; k < 4; k++) {
796  if (par1_g[k]) par1_g[k]->Write(par1_g_name[k].c_str());
797  if (par2_g[k]) par2_g[k]->Write(par2_g_name[k].c_str());
798  if (par3_g[k]) par3_g[k]->Write(par3_g_name[k].c_str());
799  if (par4_g[k]) par4_g[k]->Write(par4_g_name[k].c_str());
800  if (par5_g[k]) par5_g[k]->Write(par5_g_name[k].c_str());
801  }
802 
803  hfile->Close();
804  if (non_zero) {
805  c1->Print("c1.gif");
806  }
807  delete entr_g;
808  for (int k = 0; k < 4; k++) {
809  if (par1_g[k]) delete par1_g[k];
810  if (par2_g[k]) delete par2_g[k];
811  if (par3_g[k]) delete par3_g[k];
812  if (par4_g[k]) delete par4_g[k];
813  if (par5_g[k]) delete par5_g[k];
814  }
815  f->Close();
816  }
817 
818  void
819  HistogramDataCOOL::
820  historyDB(int HistoId, const std::string& nameHisto, const std::string& tag_name) {
821  gStyle->SetFrameBorderMode(0);
822  gStyle->SetCanvasBorderMode(0);
823  gStyle->SetPadBorderMode(0);
824  gStyle->SetPadColor(0);
825  gStyle->SetCanvasColor(0);
826  gStyle->SetTitleColor(1);
827  gStyle->SetStatColor(0);
828  gStyle->SetFillColor(1);
829  gStyle->SetPalette(1, 0);
830  gStyle->SetTitleFontSize(0.06);
831  gStyle->SetTitleH(0.06);
832 
833  auto pRun = std::make_unique<std::array<int, 10000> >();
834  float StatusH[1000];
835  float Entries[1000];
836  float Par1[1000] = {};
837  float Par2[1000] = {};
838  float Par3[1000] = {};
839  float Par4[1000] = {};
840  float Par5[1000] = {};
841  std::string Algorithm;
842  std::string Algorithm1;
843 
844  gROOT->SetBatch();
845 
846  std::ifstream tmp_run("runxml");
847  if (!tmp_run.is_open()) {
848  std::cout << " Could not open the run list file " << std::endl;
849  return;
850  }
851 
852  Int_t dummy = 0;
853  while (tmp_run.good()) {
854  tmp_run >> pRun->at(dummy);
855  dummy++;
856  }
857  int ALL = dummy - 1;
858  int i = HistoId;
859  std::string nameh = nameHisto;
860  std::string tagDB = tag_name;
861 
862  for (int j = 0; j < ALL; j++) {
863  setIOV(pRun->at(j));
864  StatusH[j] = dumpCode(nameh, tagDB);
865  std::string entr = dumpHisto(i, "Entries", tagDB);
866  std::string alg = dumpHisto(i, "Algo", tagDB);
867  std::string aa = dumpHisto(i, "Par1", tagDB);
868  std::string cc = dumpHisto(i, "Par2", tagDB);
869  std::string ee = dumpHisto(i, "Par3", tagDB);
870  std::string gg = dumpHisto(i, "Par4", tagDB);
871  std::string ll = dumpHisto(i, "Par5", tagDB);
872 
873  std::istringstream entri(entr);
874  std::istringstream algo(alg);
875  std::istringstream bb(aa);
876  std::istringstream dd(cc);
877  std::istringstream ff(ee);
878  std::istringstream hh(gg);
879  std::istringstream mm(ll);
880 
881  entri >> Entries[j];
882  algo >> Algorithm1;
883  bb >> Par1[j];
884  dd >> Par2[j];
885  ff >> Par3[j];
886  hh >> Par4[j];
887  mm >> Par5[j];
888  if (alg.length() > 0) Algorithm = Algorithm1;
889  }
890 
891  TFile* hfile = (TFile*) gROOT->GetListOfFiles()->FindObject("c1.root");
892  if (hfile) hfile->Close();
893  hfile = new TFile("c1.root", "RECREATE", "ROOT file with graphs");
894 
895  TGraphErrors* entr_g = new TGraphErrors();
896  TGraphErrors* par1_g[4];
897  TGraphErrors* par2_g[4];
898  TGraphErrors* par3_g[4];
899  TGraphErrors* par4_g[4];
900  // TGraphErrors *par5_g[4];
901 
902  for (int k = 0; k < 4; k++) {
903  par1_g[k] = new TGraphErrors();
904  par2_g[k] = new TGraphErrors();
905  par3_g[k] = new TGraphErrors();
906  par4_g[k] = new TGraphErrors();
907  // par5_g[k] = new TGraphErrors();
908  }
909 
910 
911  std::string par1_name = defParName(Algorithm, nameh, 1);
912  std::string par2_name = defParName(Algorithm, nameh, 2);
913  std::string par3_name = defParName(Algorithm, nameh, 3);
914  std::string par4_name = defParName(Algorithm, nameh, 4);
915  std::string par5_name = defParName(Algorithm, nameh, 5);
916 
917  std::string status_code[4];
918  status_code[0] = "";
919  status_code[1] = "Red";
920  status_code[2] = "Yellow";
921  status_code[3] = "Green";
922 
923  std::string par1_g_name[4];
924  std::string par2_g_name[4];
925  std::string par3_g_name[4];
926  std::string par4_g_name[4];
927  std::string par5_g_name[4];
928  for (int k = 0; k < 4; k++) {
929  par1_g_name[k] = "Par1, Algo:" + Algorithm + " " + status_code[k];
930  par2_g_name[k] = "Par2, Algo:" + Algorithm + " " + status_code[k];
931  par3_g_name[k] = "Par3, Algo:" + Algorithm + " " + status_code[k];
932  par4_g_name[k] = "Par4, Algo:" + Algorithm + " " + status_code[k];
933  par5_g_name[k] = "Par5, Algo:" + Algorithm + " " + status_code[k];
934  }
935 
936  for (int j = 0; j < (ALL); j++) {
937  int npoints = entr_g->GetN();
938  npoints++;
939  entr_g->Set(npoints);
940  entr_g->SetPoint(npoints - 1, pRun->at(j), Entries[j]);
941  entr_g->SetPointError(npoints - 1, 0., sqrt(Entries[j]));
942  }
943 
944  std::string::size_type loc = Algorithm.find("CheckHisto_Mean&GatherData", 0);
945  if (loc != std::string::npos) {
946  Algorithm = "CheckHisto_Mean&GatherData";
947  }
948 
949  //Par1
950  for (int j = 0; j < (ALL); j++) {
951  int npoints;
952  for (int k = 0; k < 4; k++) npoints = par1_g[k]->GetN();
953  npoints++;
954  for (int k = 0; k < 4; k++) par1_g[k]->Set(npoints);
955  par1_g[0]->SetPoint(npoints - 1, pRun->at(j), Par1[j]);
956  if (StatusH[j] == 1) par1_g[1]->SetPoint(npoints - 1, pRun->at(j), Par1[j]);
957  if (StatusH[j] == 2) par1_g[2]->SetPoint(npoints - 1, pRun->at(j), Par1[j]);
958  if (StatusH[j] == 3) par1_g[3]->SetPoint(npoints - 1, pRun->at(j), Par1[j]);
959 
960  if (Algorithm == "GatherData" || Algorithm == "Histogram_Not_Empty&GatherData" ||
961  Algorithm == "CheckHisto_Mean&GatherData" || Algorithm == "BinContentComp&GatherData") {
962  // in this case, Par1=Mean, error depends on the algorithm
963  if (Par3[j] > 0 || Par4[j] > 0) {
964  // this is the new GatherData: return Mean, EMean, RMS, ERMS or
965  // Mean, EMean, RMS, ERMS + XMean or Mean, EMean, NBins, RMS, ERMS
966  par1_g[0]->SetPointError(npoints - 1, 0., Par2[j]);
967  } else {
968  // this is the old GatherData: return Mean and RMS only
969  if (Entries[j] > 0.) {
970  par1_g[0]->SetPointError(npoints - 1, 0., Par2[j] / sqrt(Entries[j]));
971  } else {
972  par1_g[0]->SetPointError(npoints - 1, 0., 0.);
973  }
974  }
975  } else {
976  if (Entries[j] > 0.) {
977  if (Algorithm == "Simple_gaus_Fit") {
978  par1_g[0]->SetPointError(npoints - 1, 0., Par2[j] / sqrt(Entries[j]));
979  } else {
980  par1_g[0]->SetPointError(npoints - 1, 0., Par1[j] / sqrt(Entries[j]));
981  }
982  } else {
983  par1_g[0]->SetPointError(npoints - 1, 0., 0.);
984  }
985  }
986  }
987 
988  //Par2
989  for (int j = 0; j < (ALL); j++) {
990  int npoints;
991  for (int k = 0; k < 4; k++) npoints = par2_g[k]->GetN();
992  npoints++;
993  for (int k = 0; k < 4; k++) par2_g[k]->Set(npoints);
994  par2_g[0]->SetPoint(npoints - 1, pRun->at(j), Par2[j]);
995  if (StatusH[j] == 1) par2_g[1]->SetPoint(npoints - 1, pRun->at(j), Par2[j]);
996  if (StatusH[j] == 2) par2_g[2]->SetPoint(npoints - 1, pRun->at(j), Par2[j]);
997  if (StatusH[j] == 3) par2_g[3]->SetPoint(npoints - 1, pRun->at(j), Par2[j]);
998  if (Entries[j] > 0.) {
999  par2_g[0]->SetPointError(npoints - 1, 0., Par2[j] / sqrt(Entries[j]));
1000  } else {
1001  par2_g[0]->SetPointError(npoints - 1, 0., 0.);
1002  }
1003 
1004  if ((Algorithm == "GatherData" || Algorithm == "Histogram_Not_Empty&GatherData") &&
1005  (Par3[j] > 0 || Par4[j] > 0)) {
1006  // this is the new GatherData: return Mean, EMean, RMS, ERMS
1007  par2_g[0]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1008  if (StatusH[j] == 1) par2_g[1]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1009  if (StatusH[j] == 2) par2_g[2]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1010  if (StatusH[j] == 3) par2_g[3]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1011  par2_g[0]->SetPointError(npoints - 1, 0., Par4[j]);
1012  }
1013 
1014  if ((Algorithm == "CheckHisto_Mean&GatherData" || Algorithm == "BinContentComp&GatherData"
1015  ) && (Par5[j] != 0)) {
1016  // this is the new GatherData: return Mean, EMean, RMS, ERMS + XMean or Mean, EMean, NBins, RMS, ERMS
1017  if (Algorithm == "BinContentComp&GatherData") {
1018  par2_g[0]->SetPoint(npoints - 1, pRun->at(j), Par4[j]);
1019  if (StatusH[j] == 1) par2_g[1]->SetPoint(npoints - 1, pRun->at(j), Par4[j]);
1020  if (StatusH[j] == 2) par2_g[2]->SetPoint(npoints - 1, pRun->at(j), Par4[j]);
1021  if (StatusH[j] == 3) par2_g[3]->SetPoint(npoints - 1, pRun->at(j), Par4[j]);
1022  par2_g[0]->SetPointError(npoints - 1, 0., Par5[j]);
1023  }
1024  if (Algorithm == "CheckHisto_Mean&GatherData") {
1025  par2_g[0]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1026  if (StatusH[j] == 1) par2_g[1]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1027  if (StatusH[j] == 2) par2_g[2]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1028  if (StatusH[j] == 3) par2_g[3]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1029  par2_g[0]->SetPointError(npoints - 1, 0., Par4[j]);
1030  }
1031  }
1032  }
1033 
1034  //Par3
1035  if (Algorithm == "Simple_gaus_Fit" || Algorithm == "BinContentComp&GatherData"
1036  || Algorithm == "CheckHisto_Mean&GatherData") { //currently the only algorithms with third parameter filled
1037  for (int j = 0; j < (ALL); j++) {
1038  int npoints;
1039  for (int k = 0; k < 4; k++) npoints = par3_g[k]->GetN();
1040  npoints++;
1041  for (int k = 0; k < 4; k++) par3_g[k]->Set(npoints);
1042  par3_g[0]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1043  if (StatusH[j] == 1) par3_g[1]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1044  if (StatusH[j] == 2) par3_g[2]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1045  if (StatusH[j] == 3) par3_g[3]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1046  if (Entries[j] > 0.) {
1047  par3_g[0]->SetPointError(npoints - 1, 0., Par3[j] / sqrt(Entries[j]));
1048  } else {
1049  par3_g[0]->SetPointError(npoints - 1, 0., 0.);
1050  }
1051  if (Algorithm == "CheckHisto_Mean&GatherData") {
1052  if (Par5[j] != 0) {
1053  par3_g[0]->SetPoint(npoints - 1, pRun->at(j), Par5[j]);
1054  if (StatusH[j] == 1) par3_g[1]->SetPoint(npoints - 1, pRun->at(j), Par5[j]);
1055  if (StatusH[j] == 2) par3_g[2]->SetPoint(npoints - 1, pRun->at(j), Par5[j]);
1056  if (StatusH[j] == 3) par3_g[3]->SetPoint(npoints - 1, pRun->at(j), Par5[j]);
1057  par3_g[0]->SetPointError(npoints - 1, 0., Par4[j]);
1058  } else {
1059  par3_g[0]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1060  if (StatusH[j] == 1) par3_g[1]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1061  if (StatusH[j] == 2) par3_g[2]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1062  if (StatusH[j] == 3) par3_g[3]->SetPoint(npoints - 1, pRun->at(j), Par3[j]);
1063  if (Entries[j] > 0.) par3_g[0]->SetPointError(npoints - 1, 0., Par2[j] / sqrt(Entries[j]));
1064  }
1065  }
1066  }
1067  }
1068 
1069  TCanvas* c1 = new TCanvas("c1", " History ");
1070  if (Algorithm == "Simple_gaus_Fit" || Algorithm == "BinContentComp&GatherData"
1071  || (Algorithm == "CheckHisto_Mean&GatherData")) { //currently the only algorithms with third parameter filled
1072  c1->SetCanvasSize(900, 900);
1073  c1->Divide(2, 2);
1074  } else {
1075  c1->SetCanvasSize(1000, 450);
1076  c1->Divide(3, 1);
1077  }
1078 
1079  c1->Update();
1080  int green = TColor::GetColor("#009900");
1081  int yellow = TColor::GetColor("#ff9933");
1082 
1083  c1->cd(1);
1084  gPad->SetGridx();
1085  gPad->SetGridy();
1086  formatGraph(c1, entr_g);
1087  entr_g->SetTitle("N Entries");
1088  entr_g->GetXaxis()->SetRange(pRun->at(0), pRun->at(ALL - 1));
1089  entr_g->GetYaxis()->SetTitle("N entries");
1090  entr_g->SetMarkerStyle(20);
1091  entr_g->Draw("ap");
1092 
1093  c1->cd(2);
1094  gPad->SetGridx();
1095  gPad->SetGridy();
1096  formatGraph(c1, par1_g[0]);
1097  for (int k = 0; k < 4; k++) {
1098  par1_g[k]->SetTitle(par1_g_name[k].c_str());
1099  par1_g[k]->SetMarkerStyle(20);
1100  }
1101  par1_g[0]->GetYaxis()->SetTitle(par1_name.c_str());
1102  par1_g[1]->SetMarkerColor(2);
1103  par1_g[2]->SetMarkerColor(yellow);
1104  par1_g[3]->SetMarkerColor(green);
1105  par1_g[0]->Draw("ap");
1106  par1_g[1]->Draw("p");
1107  par1_g[2]->Draw("p");
1108  par1_g[3]->Draw("p");
1109 
1110  c1->cd(3);
1111  gPad->SetGridx();
1112  gPad->SetGridy();
1113  formatGraph(c1, par2_g[0]);
1114  par2_g[0]->GetYaxis()->SetTitle(par2_name.c_str());
1115  for (int k = 0; k < 4; k++) {
1116  par2_g[k]->SetTitle(par2_g_name[k].c_str());
1117  par2_g[k]->SetMarkerStyle(20);
1118  }
1119  par2_g[1]->SetMarkerColor(2);
1120  par2_g[2]->SetMarkerColor(yellow);
1121  par2_g[3]->SetMarkerColor(green);
1122  par2_g[0]->Draw("ap");
1123  par2_g[1]->Draw("p");
1124  par2_g[2]->Draw("p");
1125  par2_g[3]->Draw("p");
1126 
1127 
1128  if (Algorithm == "Simple_gaus_Fit" || Algorithm == "BinContentComp&GatherData" ||
1129  Algorithm == "CheckHisto_Mean&GatherData") { //currently the only algorithm with third parameter filled
1130  c1->cd(4);
1131  gPad->SetGridx();
1132  gPad->SetGridy();
1133  formatGraph(c1, par3_g[0]);
1134  par3_g[0]->GetYaxis()->SetTitle(par3_name.c_str());
1135  for (int k = 0; k < 4; k++) {
1136  par3_g[k]->SetMarkerStyle(20);
1137  par3_g[k]->SetTitle(par3_g_name[k].c_str());
1138  }
1139  par3_g[1]->SetMarkerColor(2);
1140  par3_g[2]->SetMarkerColor(yellow);
1141  par3_g[3]->SetMarkerColor(green);
1142  par3_g[0]->Draw("ap");
1143  par3_g[1]->Draw("p");
1144  par3_g[2]->Draw("p");
1145  par3_g[3]->Draw("p");
1146  }
1147 
1148 
1149  entr_g->Write("Nentr");
1150  for (int k = 0; k < 4; k++) {
1151  if (par1_g[k]) par1_g[k]->Write(par1_g_name[k].c_str());
1152  if (par2_g[k]) par2_g[k]->Write(par2_g_name[k].c_str());
1153  if (par3_g[k]) par3_g[k]->Write(par3_g_name[k].c_str());
1154  if (par4_g[k]) par4_g[k]->Write(par4_g_name[k].c_str());
1155  }
1156 
1157  hfile->Close();
1158  c1->Print("c1.gif");
1159 
1160  delete entr_g;
1161  for (int k = 0; k < 4; k++) {
1162  if (par1_g[k]) delete par1_g[k];
1163  if (par2_g[k]) delete par2_g[k];
1164  if (par3_g[k]) delete par3_g[k];
1165  if (par4_g[k]) delete par4_g[k];
1166  }
1167 
1168  return;
1169  }
1170 
1171  std::string
1172  HistogramDataCOOL::
1173  defParName(const std::string& algo, const std::string& nameHisto, int i) {
1174  std::string Algorithm = algo;
1175  std::string nameh = nameHisto;
1176  std::string par1_name = "Par1";
1177  std::string par2_name = "Par2";
1178  std::string par3_name = "Par3";
1179  std::string par4_name = "Par4";
1180  std::string par5_name = "Par5";
1181 
1182 
1183  if (Algorithm == "GatherData" || Algorithm == "Histogram_Not_Empty&GatherData") {
1184  par1_name = "Mean";
1185  par2_name = "RMS";
1186  }
1187  if (Algorithm == "CheckHisto_Mean&GatherData") {
1188  par1_name = "Mean";
1189  par2_name = "RMS";
1190  par3_name = "XMean";
1191  par4_name = "YMean";
1192  }
1193  if (Algorithm == "BinContentComp&GatherData") {
1194  par1_name = "Mean";
1195  par2_name = "RMS";
1196  par3_name = "NBins";
1197  }
1198  if (Algorithm == "Bins_Diff_FromAvg") {
1199  par1_name = "Average";
1200  par2_name = "NBins_above_Av";
1201  }
1202  if (Algorithm == "Simple_pol1_Fit") {
1203  par1_name = "par[0]";
1204  par2_name = "par[1]";
1205  }
1206  if (Algorithm == "Simple_gaus_Fit") {
1207  par1_name = "Mean gaus";
1208  par2_name = "RMS gaus";
1209  par3_name = "Constant gaus";
1210  }
1211  if (Algorithm == "SideBand_Absolute" ||
1212  Algorithm == "SideBand_Relative") {
1213  par1_name = "SideBands";
1214  par2_name = "Total Integral";
1215  }
1216  if (Algorithm == "CheckHisto_Mean") {
1217  par1_name = "XMean";
1218  par2_name = "YMean";
1219  }
1220  if (Algorithm == "CheckHisto_RMS") {
1221  par1_name = "XRMS";
1222  par2_name = "YRMS";
1223  }
1224  if (Algorithm == "Histogram_Not_Empty" ||
1225  Algorithm == "Histogram_Empty" ||
1226  Algorithm == "No_OverFlows" ||
1227  Algorithm == "No_UnderFlows" ||
1228  Algorithm == "Histogram_Effective_Empty") {
1229  par1_name = "NULL par";
1230  par2_name = "NULL par";
1231  }
1232 
1233  if (Algorithm == "Bins_LessThan_Threshold" ||
1234  Algorithm == "Bins_LessThanEqual_Threshold" ||
1235  Algorithm == "Bins_GreaterThan_Threshold" ||
1236  Algorithm == "Bins_GreaterThanEqual_Threshold" ||
1237  Algorithm == "Bins_Equal_Threshold" ||
1238  Algorithm == "Bins_NotEqual_Threshold") {
1239  par1_name = "NBins Less/Equal/NotEqual/Above Threshold";
1240  par2_name = "NULL par";
1241  }
1242 
1243  if (Algorithm == "BinContentComp") {
1244  par1_name = "NBins";
1245  par2_name = "Pix L0";
1246  par3_name = "Pix L1";
1247  par4_name = "Pix L2";
1248  par5_name = "SCT L0 S0";
1249  }
1250 
1251  if (i == 1) {
1252  return par1_name;
1253  } else {
1254  if (i == 2) {
1255  return par2_name;
1256  } else {
1257  if (i == 3) {
1258  return par3_name;
1259  } else {
1260  if (i == 4) {
1261  return par4_name;
1262  } else {
1263  if (i == 5) {
1264  return par5_name;
1265  } else return "";
1266  }
1267  }
1268  }
1269  }
1270  }
1271 
1272  void
1273  HistogramDataCOOL::
1274  formatGraph(TCanvas* c, TGraphErrors* gr) const {
1275  if (c == 0 || gr == 0) return;
1276 
1277  c->SetLeftMargin(0.15);
1278  c->SetRightMargin(0.13);
1279  c->SetBottomMargin(0.15);
1280  c->SetTopMargin(0.12);
1281 
1282  gr->GetXaxis()->SetLabelSize(0.04);
1283  gr->GetYaxis()->SetLabelSize(0.04);
1284  gr->GetXaxis()->SetLabelFont(62);
1285  gr->GetYaxis()->SetLabelFont(62);
1286 
1287  gr->GetXaxis()->SetTitleSize(0.04);
1288  gr->GetYaxis()->SetTitleSize(0.04);
1289  gr->GetXaxis()->SetTitleFont(62);
1290  gr->GetYaxis()->SetTitleFont(62);
1291  gr->GetXaxis()->SetTitle("Runs");
1292 
1293  gr->GetYaxis()->SetTitleOffset(1.5);
1294  gr->GetXaxis()->SetTitleOffset(0.9);
1295 
1296  gr->GetXaxis()->SetNdivisions(504);
1297  }
1298 
1299  // end of modification in insert functions (Monica 4/6/2008)
1300 
1301  cool::IDatabasePtr
1302  HistogramDataCOOL::
1303  getCoolDb() {
1304  return this->m_coolDb;
1305  }
1306 } //namespace dqutils
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
SGout2dot.alg
alg
Definition: SGout2dot.py:243
get_generator_info.result
result
Definition: get_generator_info.py:21
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:56
Entries
double Entries(TH1 *h)
Definition: computils.cxx:50
DiTauMassTools::TauTypes::hh
@ hh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:49
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
extractSporadic.nameHisto
nameHisto
Definition: extractSporadic.py:120
extractSporadic.c1
c1
Definition: extractSporadic.py:134
tree
TChain * tree
Definition: tile_monitor.h:30
python.FakeAthena.Algorithm
def Algorithm(name)
Definition: FakeAthena.py:41
yodamerge_tmp.npoints
npoints
Definition: yodamerge_tmp.py:250
gr
#define gr
ALL
@ ALL
Definition: sTGCenumeration.h:14
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
LArBadChannelDBTools::createPayload
AthenaAttributeList * createPayload(const std::vector< Entry > &data, const coral::AttributeListSpecification &spec)
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
yellow
@ yellow
Definition: BinsDiffFromStripMedian.h:18
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
lumiFormat.i
int i
Definition: lumiFormat.py:92
D3PDSizeSummary.ff
ff
Definition: D3PDSizeSummary.py:305
FourMomUtils::thrust
CLHEP::Hep3Vector thrust(const I4MomIter_t &iBeg, const I4MomIter_t &iEnd, double &thrust_major, double &thrust_minor, bool useThreeD=false)
Definition: Event/FourMomUtils/src/Thrust.cxx:19
python.xAODType.dummy
dummy
Definition: xAODType.py:4
run
Definition: run.py:1
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
selection
std::string selection
Definition: fbtTestBasics.cxx:73
CaloNoise_fillDB.dbSvc
dbSvc
Definition: CaloNoise_fillDB.py:108
Set
struct _Set Set
Represents a set of values.
Definition: set.h:59
pmontree.code
code
Definition: pmontree.py:443
green
@ green
Definition: BinsDiffFromStripMedian.h:18
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
library_scraper.dd
list dd
Definition: library_scraper.py:46
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64
lumiFormat.lumi
lumi
Definition: lumiFormat.py:113
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
entries
double entries
Definition: listroot.cxx:49
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
FourMomUtils::dump
std::ostream & dump(std::ostream &out, const I4MomIter iBeg, const I4MomIter iEnd)
Helper to stream out a range of I4Momentum objects.
Definition: P4Dumper.h:24
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
python.compressB64.c
def c
Definition: compressB64.py:93
defineDB.hfile
string hfile
Definition: JetTagCalibration/share/defineDB.py:37
fitman.k
k
Definition: fitman.py:528
python.handimod.cc
int cc
Definition: handimod.py:523
DiTauMassTools::TauTypes::ll
@ ll
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:49