5 #ifndef dqutilsHanOutputFile_h
6 #define dqutilsHanOutputFile_h
8 #include <TObjString.h>
13 #include <nlohmann/json.hpp>
40 typedef std::map<std::string, TDirectory*>
DirMap_t;
42 typedef std::map<std::string, std::string>
AssMap_t;
45 static void getAllGroupDirs(
DirMap_t& dirmap, TDirectory*
dir,
const std::string& dirName);
52 static void getAllGroupDirs_V2(
DirStrMap_t& dirstrmap, TObject*
obj,
53 const std::string& objName);
54 static void getAllAssessments(
AssMap_t& dirmap, TDirectory*
dir);
59 static void printDQGroupJSON(
const nlohmann::json& j,
const std::string& location,
const char* path_to_file);
61 static std::string getStringName(
const std::string& location,
int file_version);
62 static std::string getInfo(
const std::string& location,
int file_version);
63 static std::string getInfo(
const std::string& JSON_str);
64 static std::string processJSON_ingetInfo(
const nlohmann::ordered_json& j);
66 static std::string getIndentation(
const std::string&
pathName,
const std::string& leadingSpace =
"");
74 virtual bool setFile(
const std::string&
fileName);
76 virtual int getFileVersion();
78 virtual void printAllDQGroups();
80 virtual void printAllDQAssessments();
81 virtual void printHistoAssessments();
85 virtual std::string stringHistoAssessments();
86 virtual std::string stringAllHistograms();
88 virtual void streamAllDQAssessments(std::ostream& o,
bool streamAll);
89 virtual void streamHistoAssessments(std::ostream& o,
bool streamAll);
90 virtual void streamAllHistograms(std::ostream& o,
bool streamAll);
95 const static int GENERATE_PNG = 1;
96 const static int GENERATE_JSON = 2;
97 virtual int saveAllHistograms(
const std::string& location,
bool drawRefs,
const std::string& run_min_LB,
100 static bool containsDir(std::string
dirname, std::string
maindir);
112 static std::optional<std::string> containsKeyInJSON(
113 const std::string& pathInJSON,
const std::string& jsonName,
const std::string& path_to_JSON);
115 virtual bool saveHistogramToFile(
const std::string& nameHis, std::string location, TDirectory* groupDir,
117 const std::string& run_min_LB,
const std::string&
pathName,
int cnvsType = 1);
119 virtual std::pair<std::string, std::string> getHistogram(
const std::string& nameHis, TDirectory* groupDir,
121 const std::string& run_min_LB,
const std::string&
pathName,
124 virtual std::string getHistogramPNG(
125 const std::string& nameHis, TDirectory* groupDir,
bool drawRefs,
const std::string& run_min_LB,
128 virtual std::pair<std::string, std::string> getHistogramJSON(
129 const std::string& nameHis, TDirectory* groupDir,
bool drawRefs,
const std::string& run_min_LB,
132 virtual bool saveHistogramToFileSuperimposed(
const std::string& nameHis, std::string location,
133 TDirectory* groupDir1,
134 TDirectory* groupDir2,
bool drawRefs,
const std::string& run_min_LB,
135 const std::string&
pathName,
int cnvsType = 1);
138 virtual bool drawH2(TCanvas*
canv, TH2*
hist, std::string& drawopt, std::string&
display);
143 virtual bool drawReference(
144 TCanvas*
canv, TH1* hRef, TH1*
h, std::string& drawopt, std::string&
display, std::string& AlgoName);
147 virtual void ratioplot(TCanvas* myC_main, TH1*
h, TH1* href, std::string
str);
149 virtual void ratioplot2D(TCanvas*
canvas, TH2* h2, TH2* h2Ref, std::string
display);
151 virtual void attachFits(TH1*
hist, std::string& drawopt, std::string&
display);
153 virtual void setupCanvas(std::string& drawopt, std::string&
display);
154 virtual void polynomial(TCanvas*
c, std::string
str, TH1*
h);
156 virtual void displayExtra(TCanvas*
c,
const std::string&
str);
157 virtual void axisOption(std::string
str, TH1*
h);
159 virtual void formatTH1(TCanvas*
c, TH1*
h)
const;
160 virtual void formatTH2(TCanvas*
c, TH2*
h)
const;
161 virtual void formatTGraph(TCanvas*
c, TGraph*
g)
const;
162 virtual void formatTEfficiency(TCanvas*
c, TEfficiency*
e)
const;
164 virtual double getNEntries(std::string location, std::string
histname);
165 virtual double getNEntries(
const TObject*
obj);
167 virtual void clearData();
168 virtual void convertToGraphics(
169 int cnvsType, TCanvas* myC, std::string&
json, TImage** img = 0,
char**
x = 0,
int*
y = 0);
170 virtual void convertToGraphics(
int cnvsType, TCanvas* myC,
const std::string& namePNG,
const std::string& nameJSON);
172 virtual bool saveFile(
173 int cnvsType,
const std::string& pngfName,
const std::string& pngContent,
const std::string& jsonfName,
174 const std::string& jsonfContent);