52 coolDbInstance(
const std::string& dbStr,
bool readOnly) {
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);
59 catch (cool::DatabaseDoesNotExist&) {
60 std::cout <<
"Error! Database does not exist!" << std::endl;
67 coolFolderInstance(
const std::string& folderStr) {
69 cool::IFolderPtr
folder = m_coolDb->getFolder(folderStr.c_str());
70 std::cout <<
"Browsing objects of '" << folderStr <<
"'" << std::endl;
73 catch (cool::FolderNotFound&) {
74 std::cout <<
"Error! Folder '" << folderStr <<
"' does not exist!" << std::endl;
81 setSince(cool::Int64
run, cool::Int64
lumi) {
87 setUntil(cool::Int64
run, cool::Int64
lumi) {
93 setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU) {
94 this->setSince(runS, lumiS);
95 this->setUntil(runU, lumiU);
101 setIOV(cool::Int64
run) {
102 this->setSince(
run, 0);
103 this->setUntil(
run, cool::UInt32Max);
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;
119 HistogramDataCOOL (
const std::string& dbStr,
const std::string& folderStr,
int runS,
int lumiS,
int runU,
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);
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);
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);
144 ~HistogramDataCOOL () {
145 m_coolDb->closeDatabase();
146 std::cout <<
"Cleared!" << std::endl;
149 cool::RecordSpecification
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;
167 payload[
"Code"].data<cool::Int32>() = colourCode;
168 payload[
"deadFrac"].data<cool::Float>() = dfrac;
178 cool::RecordSpecification
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);
191 if (!(specH == m_coolFolderH->payloadSpecification())) {
192 std::cout <<
"ERROR Source and destination folder specifications differ. histos" << std::endl;
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) {
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;
228 dump(cool::ChannelSelection
selection, std::string tag_name) {
232 cool::IObjectIteratorPtr
objects = m_coolFolder->browseObjects(m_since, m_until,
selection, tag_name);
234 const cool::IObject& element =
objects->currentRef();
235 std::cout << element << std::endl;
238 catch (cool::Exception&
e) {
239 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
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);
252 dumpall(
const std::string& tag_name) {
259 dumpHisto(cool::ChannelId
channelId, std::string
field, std::string tag_name) {
265 cool::IObjectIteratorPtr
objects = m_coolFolderH->browseObjects(m_since, m_until,
selection, tag_name);
267 const cool::IObject& element =
objects->currentRef();
271 catch (cool::Exception&
e) {
272 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
280 const std::string& algo,
281 int entries,
float par1,
float par2,
float par3,
float par4,
float par5,
282 const std::string& tag_name) {
284 cool::RecordSpecification specH = this->createSpecH();
286 std::cout <<
"Trying to store payload histos [channel " << this->getCoolFolderH()->channelName(
channelId) <<
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;
293 catch (cool::Exception&
e) {
294 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
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) {
303 this->insertH(this->getCoolFolderH()->
channelId(
304 channelName),
code, algo,
entries, par1, par2, par3, par4, par5, tag_name);
306 catch (cool::Exception&
e) {
307 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
314 return this->m_coolFolderH;
319 ntupleDB(
int HistoId,
const std::string&
nameHisto,
const std::string& configuration,
int Irun,
int Frun) {
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);
355 TBranch* b_ChannelID;
366 unsigned int i = HistoId;
367 unsigned int init_run = Irun;
368 unsigned int last_run = Frun;
370 std::string
config = configuration;
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);
378 f =
new TFile(f_name);
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);
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];
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();
415 std::string Algorithm;
420 std::cout <<
" The TTree is empty! Check if the right Folder DB Tag is used" << std::endl;
424 for (Int_t jj = 0; jj <
nentries; jj++) {
427 if (
i == ChannelID && ((RunSince >= init_run) && (RunSince <= last_run))) {
429 if (Algorithm ==
"BinContentComp" && Par5 != 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();
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);
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);
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);
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);
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);
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));
502 if (
i == ChannelID && ((RunSince >= init_run) && (RunSince <= last_run))) {
514 for (
int k = 0;
k < 4;
k++)
npoints = par1_g[
k]->GetN();
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);
523 std::string::size_type loc = Algorithm.find(
"CheckHisto_Mean&GatherData", 0);
524 if (loc != std::string::npos) {
525 Algorithm =
"CheckHisto_Mean&GatherData";
528 if (Algorithm ==
"GatherData" || Algorithm ==
"Histogram_Not_Empty&GatherData" ||
529 Algorithm ==
"CheckHisto_Mean&GatherData" || Algorithm ==
"BinContentComp&GatherData") {
531 if (Par3 > 0 || Par4 > 0) {
534 par1_g[0]->SetPointError(
npoints - 1, 0., Par2);
540 par1_g[0]->SetPointError(
npoints - 1, 0., 0.);
545 if (Algorithm ==
"Simple_gaus_Fit") {
551 par1_g[0]->SetPointError(
npoints - 1, 0., 0.);
557 for (
int k = 0;
k < 4;
k++)
npoints = par2_g[
k]->GetN();
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);
567 par2_g[0]->SetPointError(
npoints - 1, 0., 0.);
570 if ((Algorithm ==
"GatherData" || Algorithm ==
"Histogram_Not_Empty&GatherData") &&
571 (Par3 > 0 || Par4 > 0)) {
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);
580 if ((Algorithm ==
"CheckHisto_Mean&GatherData" || Algorithm ==
"BinContentComp&GatherData"
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);
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);
601 if (Algorithm ==
"Simple_gaus_Fit" || Algorithm ==
"BinContentComp&GatherData"
602 || Algorithm ==
"CheckHisto_Mean&GatherData") {
603 for (
int k = 0;
k < 4;
k++)
npoints = par3_g[
k]->GetN();
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);
613 par3_g[0]->SetPointError(
npoints - 1, 0., 0.);
615 if (Algorithm ==
"CheckHisto_Mean&GatherData") {
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);
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);
634 TFile*
hfile = (TFile*) gROOT->GetListOfFiles()->FindObject(
"c1.root");
636 hfile =
new TFile(
"c1.root",
"RECREATE",
"ROOT file with graphs");
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);
644 std::string status_code[4];
646 status_code[1] =
"Red";
647 status_code[2] =
"Yellow";
648 status_code[3] =
"Green";
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];
663 TCanvas*
c1 =
new TCanvas(
"c1",
" History ");
664 if (Algorithm ==
"Simple_gaus_Fit" || Algorithm ==
"BinContentComp&GatherData" ||
665 Algorithm ==
"CheckHisto_Mean&GatherData") {
666 c1->SetCanvasSize(900, 900);
669 if (Algorithm ==
"BinContentComp") {
670 c1->SetCanvasSize(900, 900);
673 c1->SetCanvasSize(1000, 450);
678 int green = TColor::GetColor(
"#009900");
679 int yellow = TColor::GetColor(
"#ff9933");
684 formatGraph(
c1, entr_g);
685 entr_g->SetTitle(
"N Entries");
686 entr_g->GetYaxis()->SetTitle(
"N entries");
687 entr_g->SetMarkerStyle(20);
689 bool non_zero =
false;
691 if (entr_g->GetMaxSize() != 0) {
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);
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);
709 par1_g[0]->Draw(
"ap");
710 par1_g[1]->Draw(
"p");
711 par1_g[2]->Draw(
"p");
712 par1_g[3]->Draw(
"p");
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);
723 par2_g[1]->SetMarkerColor(2);
724 par2_g[2]->SetMarkerColor(
yellow);
725 par2_g[3]->SetMarkerColor(
green);
727 par2_g[0]->Draw(
"ap");
728 par2_g[1]->Draw(
"p");
729 par2_g[2]->Draw(
"p");
730 par2_g[3]->Draw(
"p");
732 if (Algorithm ==
"Simple_gaus_Fit" || Algorithm ==
"BinContentComp&GatherData" || (Algorithm ==
"BinContentComp") ||
733 Algorithm ==
"CheckHisto_Mean&GatherData") {
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());
743 par3_g[1]->SetMarkerColor(2);
744 par3_g[2]->SetMarkerColor(
yellow);
745 par3_g[3]->SetMarkerColor(
green);
747 par3_g[0]->Draw(
"ap");
748 par3_g[1]->Draw(
"p");
749 par3_g[2]->Draw(
"p");
750 par3_g[3]->Draw(
"p");
754 if (Algorithm ==
"BinContentComp") {
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());
764 par4_g[1]->SetMarkerColor(2);
765 par4_g[2]->SetMarkerColor(
yellow);
766 par4_g[3]->SetMarkerColor(
green);
768 par4_g[0]->Draw(
"ap");
769 par4_g[1]->Draw(
"p");
770 par4_g[2]->Draw(
"p");
771 par4_g[3]->Draw(
"p");
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());
783 par5_g[1]->SetMarkerColor(2);
784 par5_g[2]->SetMarkerColor(
yellow);
785 par5_g[3]->SetMarkerColor(
green);
787 par5_g[0]->Draw(
"ap");
788 par5_g[1]->Draw(
"p");
789 par5_g[2]->Draw(
"p");
790 par5_g[3]->Draw(
"p");
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());
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];
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);
833 auto pRun = std::make_unique<std::array<int, 10000> >();
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;
846 std::ifstream tmp_run(
"runxml");
847 if (!tmp_run.is_open()) {
848 std::cout <<
" Could not open the run list file " << std::endl;
853 while (tmp_run.good()) {
854 tmp_run >> pRun->at(
dummy);
860 std::string tagDB = tag_name;
862 for (
int j = 0; j <
ALL; 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);
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);
888 if (
alg.length() > 0) Algorithm = Algorithm1;
891 TFile*
hfile = (TFile*) gROOT->GetListOfFiles()->FindObject(
"c1.root");
893 hfile =
new TFile(
"c1.root",
"RECREATE",
"ROOT file with graphs");
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];
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();
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);
917 std::string status_code[4];
919 status_code[1] =
"Red";
920 status_code[2] =
"Yellow";
921 status_code[3] =
"Green";
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];
936 for (
int j = 0; j < (
ALL); j++) {
944 std::string::size_type loc = Algorithm.find(
"CheckHisto_Mean&GatherData", 0);
945 if (loc != std::string::npos) {
946 Algorithm =
"CheckHisto_Mean&GatherData";
950 for (
int j = 0; j < (
ALL); j++) {
952 for (
int k = 0;
k < 4;
k++)
npoints = par1_g[
k]->GetN();
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]);
960 if (Algorithm ==
"GatherData" || Algorithm ==
"Histogram_Not_Empty&GatherData" ||
961 Algorithm ==
"CheckHisto_Mean&GatherData" || Algorithm ==
"BinContentComp&GatherData") {
963 if (Par3[j] > 0 || Par4[j] > 0) {
966 par1_g[0]->SetPointError(
npoints - 1, 0., Par2[j]);
970 par1_g[0]->SetPointError(
npoints - 1, 0., Par2[j] / sqrt(
Entries[j]));
972 par1_g[0]->SetPointError(
npoints - 1, 0., 0.);
977 if (Algorithm ==
"Simple_gaus_Fit") {
978 par1_g[0]->SetPointError(
npoints - 1, 0., Par2[j] / sqrt(
Entries[j]));
980 par1_g[0]->SetPointError(
npoints - 1, 0., Par1[j] / sqrt(
Entries[j]));
983 par1_g[0]->SetPointError(
npoints - 1, 0., 0.);
989 for (
int j = 0; j < (
ALL); j++) {
991 for (
int k = 0;
k < 4;
k++)
npoints = par2_g[
k]->GetN();
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]);
999 par2_g[0]->SetPointError(
npoints - 1, 0., Par2[j] / sqrt(
Entries[j]));
1001 par2_g[0]->SetPointError(
npoints - 1, 0., 0.);
1004 if ((Algorithm ==
"GatherData" || Algorithm ==
"Histogram_Not_Empty&GatherData") &&
1005 (Par3[j] > 0 || Par4[j] > 0)) {
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]);
1014 if ((Algorithm ==
"CheckHisto_Mean&GatherData" || Algorithm ==
"BinContentComp&GatherData"
1015 ) && (Par5[j] != 0)) {
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]);
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]);
1035 if (Algorithm ==
"Simple_gaus_Fit" || Algorithm ==
"BinContentComp&GatherData"
1036 || Algorithm ==
"CheckHisto_Mean&GatherData") {
1037 for (
int j = 0; j < (
ALL); j++) {
1039 for (
int k = 0;
k < 4;
k++)
npoints = par3_g[
k]->GetN();
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]);
1047 par3_g[0]->SetPointError(
npoints - 1, 0., Par3[j] / sqrt(
Entries[j]));
1049 par3_g[0]->SetPointError(
npoints - 1, 0., 0.);
1051 if (Algorithm ==
"CheckHisto_Mean&GatherData") {
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]);
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]);
1069 TCanvas*
c1 =
new TCanvas(
"c1",
" History ");
1070 if (Algorithm ==
"Simple_gaus_Fit" || Algorithm ==
"BinContentComp&GatherData"
1071 || (Algorithm ==
"CheckHisto_Mean&GatherData")) {
1072 c1->SetCanvasSize(900, 900);
1075 c1->SetCanvasSize(1000, 450);
1080 int green = TColor::GetColor(
"#009900");
1081 int yellow = TColor::GetColor(
"#ff9933");
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);
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);
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");
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);
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");
1128 if (Algorithm ==
"Simple_gaus_Fit" || Algorithm ==
"BinContentComp&GatherData" ||
1129 Algorithm ==
"CheckHisto_Mean&GatherData") {
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());
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");
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());
1158 c1->Print(
"c1.gif");
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];
1173 defParName(
const std::string& algo,
const std::string&
nameHisto,
int i) {
1174 std::string Algorithm = algo;
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";
1183 if (Algorithm ==
"GatherData" || Algorithm ==
"Histogram_Not_Empty&GatherData") {
1187 if (Algorithm ==
"CheckHisto_Mean&GatherData") {
1190 par3_name =
"XMean";
1191 par4_name =
"YMean";
1193 if (Algorithm ==
"BinContentComp&GatherData") {
1196 par3_name =
"NBins";
1198 if (Algorithm ==
"Bins_Diff_FromAvg") {
1199 par1_name =
"Average";
1200 par2_name =
"NBins_above_Av";
1202 if (Algorithm ==
"Simple_pol1_Fit") {
1203 par1_name =
"par[0]";
1204 par2_name =
"par[1]";
1206 if (Algorithm ==
"Simple_gaus_Fit") {
1207 par1_name =
"Mean gaus";
1208 par2_name =
"RMS gaus";
1209 par3_name =
"Constant gaus";
1211 if (Algorithm ==
"SideBand_Absolute" ||
1212 Algorithm ==
"SideBand_Relative") {
1213 par1_name =
"SideBands";
1214 par2_name =
"Total Integral";
1216 if (Algorithm ==
"CheckHisto_Mean") {
1217 par1_name =
"XMean";
1218 par2_name =
"YMean";
1220 if (Algorithm ==
"CheckHisto_RMS") {
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";
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";
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";
1274 formatGraph(TCanvas*
c, TGraphErrors*
gr)
const {
1275 if (
c == 0 ||
gr == 0)
return;
1277 c->SetLeftMargin(0.15);
1278 c->SetRightMargin(0.13);
1279 c->SetBottomMargin(0.15);
1280 c->SetTopMargin(0.12);
1282 gr->GetXaxis()->SetLabelSize(0.04);
1283 gr->GetYaxis()->SetLabelSize(0.04);
1284 gr->GetXaxis()->SetLabelFont(62);
1285 gr->GetYaxis()->SetLabelFont(62);
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");
1293 gr->GetYaxis()->SetTitleOffset(1.5);
1294 gr->GetXaxis()->SetTitleOffset(0.9);
1296 gr->GetXaxis()->SetNdivisions(504);
1304 return this->m_coolDb;