15#include "TDirectory.h"
49 LOG_IF(fatal, !
fpObjDB) <<
"ObjectHandler: object database was not defined";
50 LOG_IF(fatal, !
fpOutDir) <<
"ObjectHandler: output directory was not defined";
51 LOG_IF(fatal, (
int) vpObj.size() !=
fpObjDB->GetNofVersions())
52 <<
"ObjectHandler: Attempt to add vector with object pointers of different to the one of version labels";
54 TDirectory* pCurrDir = gDirectory;
56 for (
int iVer = 0; iVer <
fpObjDB->GetNofVersions(); ++iVer) {
61 LOG_IF(fatal, strcmp(
fsBaseName.c_str(), vpObj[iVer]->GetName()))
62 <<
"Hist1DHandler: attempt to add object of different name " <<
fsBaseName <<
" vs. " << vpObj[iVer]->GetName();
64 const char* cloneName = Form(
"%s_orig_%s",
fsBaseName.data(),
fpObjDB->GetVersionLabel(iVer).data());
65 fvpObjects.push_back((TNamed*) vpObj[iVer]->Clone(cloneName));
67 gDirectory = pCurrDir;
76 int iDef =
fpObjDB->GetDefaultID();
77 for (
int iV = 0; iV < (int)
fvpObjects.size(); ++iV) {
90 LOG_IF(fatal, !pDir) <<
"ObjectHandler: attempt to pass nullptr as a folder";
103 auto WriteCanvas = [](
auto canvas) ->
void {
104 if (canvas.get()) canvas->Write();
Base handler class (implementation)
ObjectHandler(int iObject, int iFile, int iDataset, const char *objType="")
Default constructor.
Base abstract class for object handler.
std::string fsObjType
Base type of the object to be handled.
std::string fsBaseName
Base names of the object.
std::shared_ptr< TCanvas > fpCanvasCmp
Comparison canvas: plots together.
std::vector< Result > CompareWithDefault()
Compares different versions with default.
std::shared_ptr< TCanvas > fpCanvasDiff
Comparison canvas: difference with default.
int fDatasetID
Index of dataset.
std::shared_ptr< ObjectDB > fpObjDB
Pointer to object database.
void Write()
Writes objects to file.
int fObjectID
Index of object.
std::shared_ptr< TCanvas > fpCanvasRat
Comparison canvas: ratios to default.
std::vector< TNamed * > fvpObjects
Vector of objects.
virtual ~ObjectHandler()
Destructor.
TDirectory * fpOutDir
Pointer to directory.
int fFileID
Index of file.
void AddObjects(const std::vector< TNamed * > &vpObj)
Adds vector of pointer to objects.
void SetOutputDirectory(TDirectory *pDir)
Sets folder to store output.
virtual Result Compare(int iVersion) const =0
Compares objects to default.
A storable result of the QA-checker comparison routine.
ECmpInference
The object comparison inference.
@ StronglyEqual
All the comparison methods gave equality.