40 , fDatasetID(iDataset)
46 for (
int iVer = 0; iVer <
fpObjDB->GetNofVersions(); ++iVer) {
48 auto* pInFile =
new ((*fpInputFiles)[iVer]) TFile(filename.data(),
"READONLY");
49 LOG(info) <<
"File: " << pInFile->GetName();
50 LOG_IF(fatal, !pInFile->IsOpen()) <<
"FileHandler: file " << filename <<
" cannot be opened";
54 LOG_IF(fatal, !
fpObjDB.get()) <<
"FileHandler: attempt to register a null pointer for the object database";
55 LOG_IF(fatal, !
fpOutDir) <<
"FileHandler: attempt to register a null pointer for the output directory";
56 LOG_IF(fatal,
fDatasetID < 0) <<
"FileHandler: attempt to register undefined dataset index";
57 LOG_IF(fatal,
fFileID < 0) <<
"FileHandler: attempt to register undefined file index";
83 std::vector<ECmpInference> bCmpResult;
85 int nVersions =
fpObjDB->GetNofVersions();
90 LOG(warn) <<
"FileHandler: No objects were passed to file \"" << nObjects <<
". Skipping file";
95 std::string sOption = opt;
96 for (
auto& ch : sOption) {
97 ch = std::tolower(ch);
99 bool bSuppressCanvases = sOption.find(
"b") != std::string::npos;
100 bool bForceCanvases = sOption.find(
"c") != std::string::npos;
101 bool bCmpExact = sOption.find(
"e") != std::string::npos;
102 bool bCmpChi2 = sOption.find(
"s") != std::string::npos;
103 bool bCmpRatio = sOption.find(
"u") != std::string::npos;
105 LOG(info) <<
"FileHandler: processing objects: ...";
106 std::vector<TNamed*> vpObjects(nVersions,
nullptr);
107 for (
int iObj = 0; iObj < nObjects; ++iObj) {
108 bool skipObj =
false;
109 for (
int iVer = 0; iVer < nVersions; ++iVer) {
110 auto* pInputFile =
static_cast<TFile*
>(
fpInputFiles->At(iVer));
111 vpObjects[iVer] = pInputFile->Get<TNamed>(
fpObjDB->GetObject(
fFileID, iObj).c_str());
112 if (!vpObjects[iVer]) {
123 if (iObj != 0 && nObjects % 500 == 0) {
125 LOG(info) <<
"FileHandler: object " << iObj <<
" / " << nObjects;
129 std::unique_ptr<ObjectHandler> pObjHandler =
nullptr;
131 if (
dynamic_cast<TProfile*
>(vpObjects[0])) {
134 else if (
dynamic_cast<TH2*
>(vpObjects[0])) {
137 else if (
dynamic_cast<TH1*
>(vpObjects[0])) {
141 LOG(warn) <<
"FileHandler: Object " <<
fpObjDB->GetObject(
fFileID, iObj) <<
" has a type \""
142 << vpObjects[0]->ClassName()
143 <<
"\", which is unknown to the cbm::qa::checker framework, it will be skipped";
155 pObjHandler->SetObjectDB(
fpObjDB);
157 pObjHandler->AddObjects(vpObjects);
158 auto cmpResultObject = pObjHandler->CompareWithDefault();
159 for (
int iVer = 0; iVer < nVersions; ++iVer) {
160 bCmpResult[iVer] = std::max(cmpResultObject[iVer], bCmpResult[iVer]);
163 if (!bSuppressCanvases
164 && (bForceCanvases || std::any_of(cmpResultObject.begin(), cmpResultObject.end(), [](
auto i) {
165 return i != ECmpInference::StronglyEqual;
167 pObjHandler->CreateCanvases(opt);
169 pObjHandler->Write();
173 for (
auto* pObj : vpObjects) {
180 LOG(info) <<
"FileHandler: processing objects: done";