48 for (
int iVer = 0; iVer <
fpObjDB->GetNofVersions(); ++iVer) {
50 auto* pInFile =
new ((*fpInputFiles)[iVer]) TFile(filename.data(),
"READONLY");
51 LOG(info) <<
"File: " << pInFile->GetName();
52 LOG_IF(fatal, !pInFile->IsOpen()) <<
"FileHandler: file " << filename <<
" cannot be opened";
56 LOG_IF(fatal, !
fpObjDB.get()) <<
"FileHandler: attempt to register a null pointer for the object database";
57 LOG_IF(fatal, !
fpOutDir) <<
"FileHandler: attempt to register a null pointer for the output directory";
58 LOG_IF(fatal,
fDatasetID < 0) <<
"FileHandler: attempt to register undefined dataset index";
59 LOG_IF(fatal,
fFileID < 0) <<
"FileHandler: attempt to register undefined file index";
86 std::vector<Result> bCmpResult;
88 int nVersions =
fpObjDB->GetNofVersions();
92 LOG(warn) <<
"FileHandler: No objects were passed to file \"" << nObjects <<
". Skipping file";
97 LOG(info) <<
"Number of object parameters: " <<
fpObjDB->GetNofObjectParameters();
98 LOG(info) <<
"FileHandler: processing objects: ...";
105 for (
int iObj = 0; iObj < nObjects; ++iObj) {
106 std::vector<TNamed*> vpObjects(nVersions,
nullptr);
107 bool skipObj =
false;
109 const std::string& objName = objPair.first;
110 const uint32_t paramIndex = objPair.second;
111 const auto& params =
fpObjDB->GetObjectParameters(paramIndex);
114 for (
int iVer = 0; iVer < nVersions; ++iVer) {
115 auto* pInputFile =
static_cast<TFile*
>(
fpInputFiles->At(iVer));
120 vpObjects[iVer] =
dynamic_cast<TNamed*
>(pInputFile->Get(objName.c_str()));
121 if (!vpObjects[iVer]) {
126 if (skipObj)
continue;
128 std::string sOption = params.compMethod;
129 for (
auto& ch : sOption)
130 ch = std::tolower(ch);
131 bool bSuppressCanvases = sOption.find(
"b") != std::string::npos;
132 bool bForceCanvases = sOption.find(
"c") != std::string::npos;
133 bool bCmpExact = sOption.find(
"e") != std::string::npos;
134 bool bCmpChi2 = sOption.find(
"s") != std::string::npos;
135 bool bCmpRatio = sOption.find(
"u") != std::string::npos;
136 bool bDumpResult = sOption.find(
"o") != std::string::npos;
138 if (iObj != 0 && iObj % 500 == 0) {
140 LOG(info) <<
"FileHandler: object " << iObj <<
" / " << nObjects;
143 std::unique_ptr<ObjectHandler> pObjHandler =
nullptr;
145 if (
dynamic_cast<TProfile*
>(vpObjects[0])) {
148 else if (
dynamic_cast<TH2*
>(vpObjects[0])) {
151 else if (
dynamic_cast<TH1*
>(vpObjects[0])) {
155 LOG(warn) <<
"FileHandler: Object " << objName <<
" has a type \"" << vpObjects[0]->ClassName()
156 <<
"\", which is unknown to the checker framework, it will be skipped";
168 fpObjDB->SetRatioRange(params.ratioMin, params.ratioMax);
169 fpObjDB->SetPvalThreshold(params.pvalThreshold);
170 pObjHandler->SetObjectDB(
fpObjDB);
172 pObjHandler->AddObjects(vpObjects);
173 auto cmpResultObject = pObjHandler->CompareWithDefault();
176 for (
int iVer = 0; iVer < nVersions; ++iVer) {
177 bCmpResult[iVer].SetCmpInference(
178 std::max(cmpResultObject[iVer].GetCmpInference(), bCmpResult[iVer].GetCmpInference()));
182 if (!bSuppressCanvases
183 && (bForceCanvases || std::any_of(cmpResultObject.begin(), cmpResultObject.end(), [](
auto i) {
184 return i.GetCmpInference() != ECmpInference::StronglyEqual;
186 pObjHandler->CreateCanvases(sOption.c_str());
188 pObjHandler->Write();
192 for (
int iVer = 0; iVer < nVersions; ++iVer) {
193 std::string name =
"result_" +
fpObjDB->GetVersionLabel(iVer);
194 cmpResultObject[iVer].Write(name.c_str());
202 for (
auto*& pObj : vpObjects) {
209 LOG(info) <<
"FileHandler: processing objects: done";