7 #include <experimental/filesystem>
11 #include "TGraphErrors.h"
12 #include "TMultiGraph.h"
19 #include "TLegendEntry.h"
22 #include "TPaveLabel.h"
23 #include "TPaveText.h"
26 #include "Alignment/OfflineValidation/plugins/ColorParser.C"
29 namespace fs = std::experimental::filesystem;
38 #define lumiFactor 1000.
42 #define DMRFactor 10000.
71 :
run(
Run),
scale(ScaleFactor),
mu(y1), sigma(y2), muplus(y3), muminus(y5), sigmaplus(y4), sigmaminus(y6) {}
76 Point(
float Run,
float ScaleFactor, TH1 *
histo, TH1 *histoplus, TH1 *histominus)
80 histo->GetMeanError(),
82 histoplus->GetMeanError(),
83 histominus->GetMean(),
84 histominus->GetMeanError()) {}
89 Point(
float Run,
float ScaleFactor, TH1 *
histo) :
Point(Run, ScaleFactor, histo->GetMean(), histo->GetMeanError()) {}
113 return scale * (muplus - muminus);
116 if (sigmaplus ==
DUMMY && sigmaminus ==
DUMMY)
119 return scale * hypot(sigmaplus, sigmaminus);
131 bool checkrunlist(vector<int>
runs, vector<int> IOVlist = {}, TString Year =
"2018");
132 TString
lumifileperyear(TString Year =
"2018",
string RunOrIOV =
"IOV");
134 vector<pair<int, double>>
lumiperIOV(vector<int> IOVlist, TString Year =
"2018");
137 TString Year =
"2018",
138 bool showlumi =
false,
139 vector<int> pixelupdateruns = {314881, 316758, 317527, 318228, 320377});
142 TString Variable =
"median",
143 vector<string>
labels = {
"MB"},
144 TString Year =
"2018",
145 string myValidation =
"/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/",
146 vector<string> geometries = {
"GT",
"SG",
"MP pix LBL",
"PIX HLS+ML STR fix"},
147 vector<Color_t> colours = {kBlue, kRed, kGreen, kCyan},
149 "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/",
150 bool pixelupdate =
false,
151 vector<int> pixelupdateruns = {314881, 316758, 317527, 318228, 320377},
152 bool showlumi =
false);
155 TString Variable =
"median",
156 vector<string>
labels = {
"MB"},
157 TString Year =
"2018",
158 string myValidation =
"/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/",
159 vector<string> geometries = {
"GT",
"SG",
"MP pix LBL",
"PIX HLS+ML STR fix"},
160 bool showlumi =
false,
164 vector<string> Variables = {
"median",
"DrmsNR"},
165 vector<string>
labels = {
"MB"},
166 TString Year =
"2018",
167 string myValidation =
"/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/",
168 vector<string> geometries = {
"GT",
"SG",
"MP pix LBL",
"PIX HLS+ML STR fix"},
169 vector<Color_t> colours = {kBlue, kRed, kGreen, kCyan},
171 "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/",
172 bool pixelupdate =
false,
173 vector<int> pixelupdateruns = {314881, 316758, 317527, 318228, 320377},
174 bool showlumi =
false,
237 geometry.ReplaceAll(
" ",
"_");
238 TString
name = geometry +
"_" + structure;
240 if (structure ==
"TID" || structure ==
"TEC")
256 return {{
"BPIX", 3}, {
"FPIX", 2}, {
"TIB", 4}, {
"TID", 3}, {
"TOB", 6}, {
"TEC", 9}};
258 return {{
"BPIX", 4}, {
"FPIX", 3}, {
"TIB", 4}, {
"TID", 3}, {
"TOB", 6}, {
"TEC", 9}};
268 TString LumiFile = std::getenv(
"CMSSW_BASE");
269 LumiFile +=
"/src/Alignment/OfflineValidation/data/lumiper";
270 if (RunOrIOV !=
"run" && RunOrIOV !=
"IOV") {
271 cout <<
"ERROR: Please specify \"run\" or \"IOV\" to retrieve the luminosity run by run or for each IOV" << endl;
274 LumiFile += RunOrIOV;
275 if (Year !=
"2016" && Year !=
"2017" && Year !=
"2018") {
276 cout <<
"ERROR: Only 2016, 2017 and 2018 lumi-per-run files are available, please check!" << endl;
292 cout <<
"ERROR: Empty file " <<
path.c_str() << endl;
295 TGraph *
scale =
new TGraph(filename.Data());
296 double *xscale = scale->GetX();
297 size_t N = scale->GetN();
299 for (
size_t i = 0;
i <
N;
i++)
300 runs.push_back(xscale[
i]);
308 bool checkrunlist(vector<int> runs, vector<int> IOVlist, TString Year) {
310 vector<int> missingruns;
311 vector<int> lostruns;
312 bool problemfound =
false;
313 for (
int run : IOVlist) {
314 if (
find(runlist.begin(), runlist.end(),
run) == runlist.end()) {
316 missingruns.push_back(
run);
319 if (!IOVlist.empty())
320 for (
int IOV : IOVlist) {
321 if (
find(runs.begin(), runs.end(),
IOV) == runs.end()) {
323 lostruns.push_back(
IOV);
326 std::sort(missingruns.begin(), missingruns.end());
328 if (!lostruns.empty()) {
329 cout <<
"WARNING: some IOVs where not found among the list of available DMRs" << endl
330 <<
"List of missing IOVs:" << endl;
331 for (
int lostrun : lostruns)
332 cout << to_string(lostrun) <<
" ";
335 if (!missingruns.empty()) {
336 cout <<
"WARNING: some IOVs are missing in the run/luminosity txt file" << endl
337 <<
"List of missing runs:" << endl;
338 for (
int missingrun : missingruns)
339 cout << to_string(missingrun) <<
" ";
351 vector<string> Variables,
355 vector<string> geometries,
356 vector<Color_t> colours,
359 vector<int> pixelupdateruns,
363 if (!(fs::exists(
path))) {
364 cout <<
"WARNING: Output directory (" << outputdir.Data() <<
") not found, it will be created automatically!"
367 fs::create_directory(
path);
368 if (!(fs::exists(
path))) {
369 cout <<
"ERROR: Output directory (" << outputdir.Data() <<
") has not been created!" << endl
370 <<
"At least the parent directory needs to exist, please check!" << endl;
374 for (
const auto &Variable : Variables) {
375 compileDMRTrends(IOVlist, Variable, labels, Year, myValidation, geometries, showlumi, FORCE);
376 cout <<
"Begin plotting" << endl;
400 vector<string> geometries,
404 vector<int> RunNumbers;
405 vector<TString> filenames;
406 TRegexp regexp(
"[0-9][0-9][0-9][0-9][0-9][0-9]");
407 for (
const auto &
entry : fs::recursive_directory_iterator(myValidation)) {
408 bool found_all_labels =
true;
409 for (
const string &
label : labels) {
410 if (
entry.path().string().find(
label) == std::string::npos)
411 found_all_labels =
false;
413 if ((
entry.path().string().find(
"ExtendedOfflineValidation_Images/OfflineValidationSummary.root") !=
414 std::string::npos) &&
417 cout <<
"ERROR: Empty file " <<
entry.path() << endl;
421 TString runstring(
filename(regexp));
422 if (runstring.IsFloat()) {
423 int runN = runstring.Atoi();
424 RunNumbers.push_back(runN);
429 if (RunNumbers.empty()) {
430 cout <<
"ERROR: No available DMRs found!" << endl
431 <<
"Please check that the OfflineValidationSummary.root file is in any directory where the DMR per IOV have "
436 cout <<
"Please check the DMRs that have been produced!" << endl;
441 vector<TString> structures{
"BPIX",
"BPIX_y",
"FPIX",
"FPIX_y",
"TIB",
"TID",
"TOB",
"TEC"};
446 if (Variable ==
"DrmsNR")
449 map<pair<pair<TString, int>, TString>,
Geometry> mappoints;
451 std::sort(filenames.begin(), filenames.end());
452 for (
const TString &
filename : filenames) {
454 TString runstring(
filename(regexp));
455 if (runstring.IsFloat()) {
456 runN = runstring.Atoi();
458 cout <<
"ERROR: run number not retrieved for file " <<
filename << endl;
464 for (TString &structure : structures) {
465 TString structname = structure;
466 structname.ReplaceAll(
"_y",
"");
467 size_t layersnumber = nlayers.at(structname);
469 for (
const string &
geometry : geometries) {
471 TH1F *
histo =
dynamic_cast<TH1F *
>(f->Get(name));
481 cout <<
"Run" << runN <<
" Histogram: " << name <<
" not found" << endl;
484 point =
new Point(runN, ScaleFactor);
485 }
else if (structure !=
"TID" && structure !=
"TEC") {
486 TH1F *histoplus =
dynamic_cast<TH1F *
>(f->Get((name +
"_plus")));
487 TH1F *histominus =
dynamic_cast<TH1F *
>(f->Get((name +
"_minus")));
488 if (!histoplus || !histominus) {
489 cout <<
"Run" << runN <<
" Histogram: " << name <<
" plus or minus not found" << endl;
492 point =
new Point(runN, ScaleFactor, histo);
494 point =
new Point(runN, ScaleFactor, histo, histoplus, histominus);
497 point =
new Point(runN, ScaleFactor, histo);
498 mappoints[make_pair(make_pair(structure,
layer),
geometry)].points.push_back(*point);
504 TString
outname = myValidation +
"DMRtrends";
505 for (
const auto &
label : labels) {
510 cout << outname << endl;
511 TFile *
fout = TFile::Open(outname,
"RECREATE");
512 for (TString &structure : structures) {
513 TString structname = structure;
514 structname.ReplaceAll(
"_y",
"");
515 size_t layersnumber = nlayers.at(structname);
517 for (
const string &
geometry : geometries) {
520 using Trend = vector<float> (
Geometry::*)()
const;
530 "mu",
"sigma",
"muplus",
"sigmaplus",
"muminus",
"sigmaminus",
"deltamu",
"sigmadeltamu"};
531 vector<float> runs = geom.
Run();
532 size_t n = runs.size();
533 vector<float> emptyvec;
534 for (
size_t i = 0;
i < runs.size();
i++)
535 emptyvec.push_back(0.);
536 for (
size_t iVar = 0; iVar <
variables.size(); iVar++) {
537 Trend trend = trends.at(iVar);
538 TGraphErrors *
g =
new TGraphErrors(n, runs.data(), (geom.*trend)().data(), emptyvec.data(), emptyvec.data());
540 g->Write(name +
"_" +
variables.at(iVar));
546 vector<pair<TString, TString>> variablepairs{make_pair(
"mu",
"sigma"),
547 make_pair(
"muplus",
"sigmaplus"),
548 make_pair(
"muminus",
"sigmaminus"),
549 make_pair(
"deltamu",
"sigmadeltamu")};
550 for (
size_t iVar = 0; iVar < variablepairs.size(); iVar++) {
551 Trend meantrend = trendspair.at(iVar).first;
552 Trend sigmatrend = trendspair.at(iVar).second;
553 TGraphErrors *
g =
new TGraphErrors(
554 n, runs.data(), (geom.*meantrend)().data(), emptyvec.data(), (geom.*sigmatrend)().data());
556 TString graphname = name +
"_" + variablepairs.at(iVar).first;
557 graphname += variablepairs.at(iVar).second;
569 void PixelUpdateLines(TCanvas *c, TString Year,
bool showlumi, vector<int> pixelupdateruns) {
570 vector<TPaveText *>
labels;
571 double lastlumi = 0.;
574 for (
int pixelupdaterun : pixelupdateruns) {
581 lumi = pixelupdaterun;
582 TLine *
line =
new TLine(lumi, c->GetUymin(),
lumi, c->GetUymax());
583 line->SetLineColor(kBlue);
584 line->SetLineStyle(9);
590 int iw = gPad->GetWw();
591 int ih = gPad->GetWh();
592 double x1p, y1p, x2p, y2p;
593 gPad->GetPadPar(x1p, y1p, x2p, y2p);
594 ix1 = (Int_t)(iw * x1p);
595 ix2 = (Int_t)(iw * x2p);
596 double wndc =
TMath::Min(1., (
double)iw / (
double)ih);
597 double rw = wndc / (double)iw;
598 double x1ndc = (double)ix1 * rw;
599 double x2ndc = (double)ix2 * rw;
601 double rx1, ry1, rx2, ry2;
602 gPad->GetRange(rx1, ry1, rx2, ry2);
603 double rx = (x2ndc - x1ndc) / (rx2 - rx1);
606 _sx = rx * (lumi - rx1) + x1ndc;
608 if (_sx < lastlumi) {
612 TPaveText *box =
new TPaveText(_sx + 0.0015, 0.86 - index * 0.04, _sx + 0.035, 0.89 - index * 0.04,
"blNDC");
613 box->SetFillColor(10);
614 box->SetBorderSize(1);
615 box->SetLineColor(kBlack);
616 TText *textRun = box->AddText(Form(
"%i",
int(pixelupdaterun)));
617 textRun->SetTextSize(0.025);
618 labels.push_back(box);
619 lastlumi = _sx + 0.035;
624 for (
auto label : labels) {
636 int Nscale = scale->GetN();
637 double *xscale = scale->GetX();
638 double *yscale = scale->GetY();
642 for (
int j = 0;
j < Nscale;
j++) {
644 if (run >= xscale[
j]) {
660 size_t N = g->GetN();
661 vector<double> x, y, xerr, yerr;
664 size_t Nscale = lumiIOVpairs.size();
669 g->GetPoint(i, run, yvalue);
671 for (
size_t j = 0;
j < Nscale;
j++) {
672 if (run == (lumiIOVpairs.at(
j)
676 }
else if (run > (lumiIOVpairs.at(
j).first))
679 if (lumiIOVpairs.at(index).second == 0 || index < 0.) {
686 x.push_back(xvalue + (lumiIOVpairs.at(index).second / (
lumiFactor * 2.)));
687 if (yvalue <=
DUMMY) {
692 yerr.push_back(g->GetErrorY(i));
694 xerr.push_back(lumiIOVpairs.at(index).second / (
lumiFactor * 2.));
698 g->GetHistogram()->Delete();
699 g->SetHistogram(
nullptr);
700 for (
size_t i = 0; i <
N; i++) {
701 g->SetPoint(i, x.at(i), y.at(i));
702 g->SetPointError(i, xerr.at(i), yerr.at(i));
710 vector<pair<int, double>>
lumiperIOV(vector<int> IOVlist, TString Year) {
711 size_t N = IOVlist.size();
714 size_t Nscale = scale->GetN();
715 double *xscale = scale->GetX();
716 double *yscale = scale->GetY();
727 for (
size_t j = index;
j < Nscale;
j++) {
728 if (run == xscale[
j]) {
735 lumiperIOV.push_back(make_pair(0, lumi));
737 lumiperIOV.push_back(make_pair(IOVlist.at(i - 1),
lumi));
741 double lumiInput = 0;
742 double lumiOutput = 0.;
743 for (
size_t j = 0;
j < Nscale;
j++)
744 lumiInput += yscale[
j];
746 for (
size_t j = 0;
j < lumiperIOV.size();
j++)
747 lumiOutput += lumiperIOV.at(
j).second;
749 if (
abs(lumiInput - lumiOutput) > 0.5) {
750 cout <<
"ERROR: luminosity retrieved for IOVs does not match the one for the runs" << endl
751 <<
"Please check that all IOV first runs are part of the run-per-lumi file!" << endl;
762 size_t N = g->GetN();
763 double *x = g->GetX();
764 double *y = g->GetY();
765 double *xerr = g->GetEX();
767 bins.push_back(x[0] - xerr[0]);
768 for (
size_t i = 1;
i <
N;
i++) {
769 if ((x[
i - 1] + xerr[
i - 1]) > (bins.back() +
pow(10, -6)))
770 bins.push_back(x[
i - 1] + xerr[
i - 1]);
771 if ((x[
i] - xerr[
i]) > (bins.back() +
pow(10, -6)))
772 bins.push_back(x[i] - xerr[i]);
774 bins.push_back(x[N - 1] + xerr[N - 1]);
775 TString histoname =
"histo_";
776 histoname += g->GetName();
777 TH1F *
histo =
new TH1F(histoname, g->GetTitle(), bins.size() - 1, bins.data());
778 for (
size_t i = 0;
i <
N;
i++) {
779 histo->Fill(x[
i], y[i]);
780 histo->SetBinError(histo->FindBin(x[i]),
pow(10, -6));
794 vector<string> geometries,
795 vector<Color_t> colours,
798 vector<int> pixelupdateruns,
802 vector<TString> structures{
"BPIX",
"BPIX_y",
"FPIX",
"FPIX_y",
"TIB",
"TID",
"TOB",
"TEC"};
806 vector<pair<int, double>> lumiIOVpairs;
810 TString
filename = myValidation +
"DMRtrends";
811 for (
const auto &
label : labels) {
816 cout << filename << endl;
817 TFile *
in =
new TFile(filename);
818 for (TString &structure : structures) {
819 TString structname = structure;
820 structname.ReplaceAll(
"_y",
"");
821 int layersnumber = nlayers.at(structname);
834 "deltamusigmadeltamu"};
835 vector<string> YaxisNames{
837 "#sigma_{#mu} [#mum]",
838 "#mu outward [#mum]",
839 "#sigma_{#mu outward} [#mum]",
841 "#sigma_{#mu inward} [#mum]",
843 "#sigma_{#Delta#mu} [#mum]",
845 "#mu outward [#mum]",
849 if (Variable ==
"DrmsNR")
851 "RMS(x'_{pred}-x'_{hit} /#sigma)",
852 "#sigma_{RMS(x'_{pred}-x'_{hit} /#sigma)}",
853 "RMS(x'_{pred}-x'_{hit} /#sigma) outward",
854 "#sigma_{#mu outward}",
855 "RMS(x'_{pred}-x'_{hit} /#sigma) inward",
856 "#sigma_{RMS(x'_{pred}-x'_{hit} /#sigma) inward}",
857 "#DeltaRMS(x'_{pred}-x'_{hit} /#sigma)",
858 "#sigma_{#DeltaRMS(x'_{pred}-x'_{hit} /#sigma)}",
859 "RMS(x'_{pred}-x'_{hit} /#sigma)",
860 "RMS(x'_{pred}-x'_{hit} /#sigma) outward",
861 "RMS(x'_{pred}-x'_{hit} /#sigma) inward",
862 "#DeltaRMS(x'_{pred}-x'_{hit} /#sigma)",
867 if (variable.Contains(
"plus") || variable.Contains(
"minus") || variable.Contains(
"delta")) {
868 if (structname ==
"TEC" || structname ==
"TID")
871 TCanvas *c =
new TCanvas(
"dummy",
"", 2000, 800);
873 vector<Color_t>::iterator colour = colours.begin();
875 TMultiGraph *mg =
new TMultiGraph(structure, structure);
876 THStack *mh =
new THStack(structure, structure);
878 for (
const string &
geometry : geometries) {
880 TGraphErrors *
g =
dynamic_cast<TGraphErrors *
>(in->Get(name +
"_" +
variables.at(
i)));
884 g->SetLineColor(*colour);
885 g->SetFillColorAlpha(*colour, 0.2);
887 vector<vector<double>> vectors;
891 g->SetLineColor(*colour);
892 g->SetMarkerColor(*colour);
894 h->SetLineColor(*colour);
895 h->SetMarkerColor(*colour);
910 gStyle->SetOptTitle(0);
911 gStyle->SetPadLeftMargin(0.08);
912 gStyle->SetPadRightMargin(0.05);
915 gStyle->SetLegendTextSize(0.025);
919 if (Variable ==
"DrmsNR") {
920 if (variable.Contains(
"delta")) {
930 if (((variable ==
"sigma" || variable ==
"sigmaplus" || variable ==
"sigmaminus" ||
931 variable ==
"sigmadeltamu") &&
936 mg->SetMaximum(max + range * 0.1);
937 mg->SetMinimum(min - range * 0.3);
946 char *Ytitle = (
char *)YaxisNames.at(
i).c_str();
947 mg->GetYaxis()->SetTitle(Ytitle);
948 mg->GetXaxis()->SetTitle(showlumi ?
"Integrated lumi [1/fb]" :
"IOV number");
949 mg->GetXaxis()->CenterTitle(
true);
950 mg->GetYaxis()->CenterTitle(
true);
951 mg->GetYaxis()->SetTitleOffset(.5);
952 mg->GetYaxis()->SetTitleSize(.05);
953 mg->GetXaxis()->SetTitleSize(.04);
955 mg->GetXaxis()->SetLimits(0., mg->GetXaxis()->GetXmax());
959 TLegend *legend = c->BuildLegend();
961 int Ngeom = geometries.size();
963 legend->SetNColumns(2);
965 legend->SetNColumns(3);
967 legend->SetNColumns(1);
968 TString structtitle =
"#bf{";
969 if (structure.Contains(
"PIX") && !(structure.Contains(
"_y")))
970 structtitle += structure +
" (x)";
971 else if (structure.Contains(
"_y")) {
972 TString substring(structure(0, 4));
973 structtitle += substring +
" (y)";
975 structtitle += structure;
977 if (structure ==
"TID" || structure ==
"TEC" || structure ==
"FPIX" || structure ==
"FPIX_y")
978 structtitle +=
" disc ";
980 structtitle +=
" layer ";
981 structtitle +=
layer;
986 TPaveText *CMSworkInProgress =
new TPaveText(
987 0, mg->GetYaxis()->GetXmax() + range * 0.02, 2.5, mg->GetYaxis()->GetXmax() + range * 0.12,
"nb");
988 CMSworkInProgress->AddText(
"#scale[1.1]{CMS} #bf{Internal}");
989 CMSworkInProgress->SetTextAlign(12);
990 CMSworkInProgress->SetTextSize(0.04);
991 CMSworkInProgress->SetFillColor(10);
992 CMSworkInProgress->Draw();
993 TPaveText *TopRightCorner =
new TPaveText(0.95 * (mg->GetXaxis()->GetXmax()),
994 mg->GetYaxis()->GetXmax() + range * 0.02,
995 (mg->GetXaxis()->GetXmax()),
996 mg->GetYaxis()->GetXmax() + range * 0.12,
998 TopRightCorner->AddText(Year +
" pp collisions");
999 TopRightCorner->SetTextAlign(32);
1000 TopRightCorner->SetTextSize(0.04);
1001 TopRightCorner->SetFillColor(10);
1002 TopRightCorner->Draw();
1003 TPaveText *structlabel =
new TPaveText(0.95 * (mg->GetXaxis()->GetXmax()),
1004 mg->GetYaxis()->GetXmin() + range * 0.02,
1005 0.99 * (mg->GetXaxis()->GetXmax()),
1006 mg->GetYaxis()->GetXmin() + range * 0.12,
1008 structlabel->AddText(structtitle.Data());
1009 structlabel->SetTextAlign(32);
1010 structlabel->SetTextSize(0.04);
1011 structlabel->SetFillColor(10);
1012 structlabel->Draw();
1015 mh->Draw(
"nostack same");
1017 TString structandlayer =
getName(structure,
layer,
"");
1018 TString printfile = outputdir;
1019 if (!(outputdir.EndsWith(
"/")))
1021 for (
const auto &
label : labels) {
1025 printfile += Variable;
1027 printfile += variable + structandlayer;
1028 c->SaveAs(printfile +
".pdf");
1029 c->SaveAs(printfile +
".eps");
1030 c->SaveAs(printfile +
".png");
1055 vector<int> IOVlist = {314881, 315257, 315488, 315489, 315506, 316239, 316271, 316361, 316363, 316378, 316456,
1056 316470, 316505, 316569, 316665, 316758, 317080, 317182, 317212, 317295, 317339, 317382,
1057 317438, 317527, 317661, 317664, 318712, 319337, 319460, 320841, 320854, 320856, 320888,
1058 320916, 320933, 320980, 321009, 321119, 321134, 321164, 321261, 321294, 321310, 321393,
1059 321397, 321431, 321461, 321710, 321735, 321773, 321774, 321778, 321820, 321831, 321880,
1060 321960, 322014, 322510, 322603, 323232, 323423, 323472, 323475, 323693, 323794, 323976,
1061 324202, 324206, 324245, 324729, 324764, 324840, 324999, 325097, 325110};
1062 vector<int> pixelupdateruns{316758, 317527, 317661, 317664, 318227, 320377};
1065 cout <<
"WARNING: Running function with arguments specified in DMRtrends.cc" << endl
1066 <<
"If you want to specify the arguments from command line run the macro as follows:" << endl
1067 <<
"DMRtrends labels pathtoDMRs geometriesandcolourspairs outputdirectory showpixelupdate showlumi FORCE"
1074 {
"median",
"DrmsNR"},
1077 "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/adewit/UL18_DMR_MB_eoj_v3/",
1078 {
"1-step hybrid",
"mid18 rereco",
"counter twist"},
1079 {kBlue, kBlack, kGreen + 3},
1080 "/afs/cern.ch/user/a/acardini/commonValidation/results/acardini/DMRs/DMRTrends/test/",
1086 }
else if (argc < 12) {
1087 cout <<
"DMRtrends IOVlist labels Year pathtoDMRs geometriesandcolourspairs outputdirectory pixelupdatelist "
1088 "showpixelupdate showlumi FORCE"
1094 TString
runlist = argv[1], all_variables = argv[2], all_labels = argv[3], Year = argv[4], pathtoDMRs = argv[5],
1095 geometrieandcolours = argv[6],
1096 outputdirectory = argv[7], pixelupdatelist = argv[8];
1097 bool showpixelupdate = argv[9], showlumi = argv[10], FORCE = argv[11];
1098 TObjArray *vararray = all_variables.Tokenize(
",");
1099 vector<string> Variables;
1100 Variables.reserve(vararray->GetEntries());
1101 for (
int i = 0;
i < vararray->GetEntries();
i++)
1102 Variables.push_back((
string)(vararray->At(
i)->GetName()));
1103 TObjArray *labelarray = all_labels.Tokenize(
",");
1105 labels.reserve(labelarray->GetEntries());
1106 for (
int i = 0;
i < labelarray->GetEntries();
i++)
1107 labels.push_back((
string)(labelarray->At(
i)->GetName()));
1108 TObjArray *IOVarray = runlist.Tokenize(
",");
1109 vector<int> IOVlist;
1110 IOVlist.reserve(IOVarray->GetEntries());
1111 for (
int i = 0;
i < IOVarray->GetEntries();
i++)
1112 IOVlist.push_back(stoi(IOVarray->At(
i)->GetName()));
1113 vector<int> pixelupdateruns;
1114 TObjArray *PIXarray = pixelupdatelist.Tokenize(
",");
1115 pixelupdateruns.reserve(PIXarray->GetEntries());
1116 for (
int i = 0;
i < PIXarray->GetEntries();
i++)
1117 pixelupdateruns.push_back(stoi(PIXarray->At(
i)->GetName()));
1118 vector<string> geometries;
1120 vector<Color_t> colours;
1121 TObjArray *geometrieandcolourspairs = geometrieandcolours.Tokenize(
",");
1122 for (
int i = 0;
i < geometrieandcolourspairs->GetEntries();
i++) {
1123 TObjArray *geomandcolourvec = TString(geometrieandcolourspairs->At(
i)->GetName()).Tokenize(
":");
1124 geometries.push_back(geomandcolourvec->At(0)->GetName());
1125 colours.push_back(ColorParser(geomandcolourvec->At(1)->GetName()));
1134 outputdirectory.Data(),
void PlotDMRTrends(vector< int > IOVlist, TString Variable="median", vector< string > labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT","SG","MP pix LBL","PIX HLS+ML STR fix"}, vector< Color_t > colours={kBlue, kRed, kGreen, kCyan}, TString outputdir="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/", bool pixelupdate=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377}, bool showlumi=false)
vector< float > SigmaPlus() const
const edm::EventSetup & c
Geometry & operator=(const Geometry &geom)
vector< float > SigmaDeltaMu() const
TString lumifileperyear(TString Year="2018", string RunOrIOV="IOV")
Point(float Run=-999., float ScaleFactor=10000., float y1=-999., float y2=-999., float y3=-999., float y4=-999., float y5=-999., float y6=-999.)
double getintegratedlumiuptorun(int run, TString Year="2018", double min=0.)
Point(float Run, float ScaleFactor, TH1 *histo, TH1 *histoplus, TH1 *histominus)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void SetTitle(TString Title)
vector< float > DeltaMu() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
bool checkrunlist(vector< int > runs, vector< int > IOVlist={}, TString Year="2018")
constexpr std::array< uint8_t, layerIndexSize > layer
const uint16_t range(const Frame &aFrame)
vector< float > MuMinus() const
Point & operator=(const Point &p)
vector< pair< int, double > > lumiperIOV(vector< int > IOVlist, TString Year="2018")
vector< int > runlistfromlumifile(TString Year="2018")
Class Geometry Contains vector for fit parameters (mean, sigma, etc.) obtained from multiple IOVs See...
vector< float > Run() const
vector< float > Sigma() const
Abs< T >::type abs(const T &t)
float GetSigmaMinus() const
void DMRtrends(vector< int > IOVlist, vector< string > Variables={"median","DrmsNR"}, vector< string > labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT","SG","MP pix LBL","PIX HLS+ML STR fix"}, vector< Color_t > colours={kBlue, kRed, kGreen, kCyan}, TString outputdir="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/", bool pixelupdate=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377}, bool showlumi=false, bool FORCE=false)
vector< float > Mu() const
TString getName(TString structure, int layer, TString geometry)
const map< TString, int > numberOfLayers(TString Year="2018")
void compileDMRTrends(vector< int > IOVlist, TString Variable="median", vector< string > labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT","SG","MP pix LBL","PIX HLS+ML STR fix"}, bool showlumi=false, bool FORCE=false)
float GetSigmaDeltaMu() const
Point(float Run, float ScaleFactor, TH1 *histo)
float GetSigmaPlus() const
vector< float > SigmaMinus() const
Structure Point Contains parameters of Gaussian fits to DMRs.
void scalebylumi(TGraphErrors *g, vector< pair< int, double >> lumiIOVpairs)
vector< float > MuPlus() const
vector< float > GetQuantity(float(Point::*getter)() const) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void PixelUpdateLines(TCanvas *c, TString Year="2018", bool showlumi=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377})
Power< A, B >::type pow(const A &a, const B &b)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
TH1F * ConvertToHist(TGraphErrors *g)