4 #include "TDirectory.h" 15 : _file(file), _runnumber(run), _module(mod), _path(path), _prefix(prefix) {}
43 TObject*
obj =
nullptr;
47 bool ok =
_file->cd(fullpath.c_str());
48 if (ok && gDirectory) {
49 obj = gDirectory->Get(name);
59 if (!strstr(obj->GetTitle(),
"run")) {
61 sprintf(htitle,
"%s %s run %s", obj->GetTitle(),
suffix,
_runnumber.c_str());
62 obj->SetTitle(htitle);
73 std::vector<unsigned int> runlist;
74 char searchstring[100];
75 char decodestring[100];
76 sprintf(searchstring,
"%s_", what);
77 sprintf(decodestring,
"%s_%%u", what);
81 bool ok =
_file->cd(fullpath.c_str());
82 if (ok && gDirectory) {
83 TList*
keys = gDirectory->GetListOfKeys();
86 while ((key = (TKey*)it.Next())) {
88 TClass
cl(key->GetClassName());
89 if (
cl.InheritsFrom(
"TDirectory") && strstr(key->GetName(), searchstring) !=
nullptr) {
91 sscanf(key->GetName(), decodestring, &
run);
92 runlist.push_back(run);
102 TH1F* den = (TH1F*)denom.
getObject(name);
104 TH1F*
ratio =
nullptr;
106 if (den !=
nullptr && num !=
nullptr) {
110 denreb = (TH1F*)den->Rebin(rebin,
"denrebinned");
111 numreb = (TH1F*)num->Rebin(rebin,
"numrebinned");
114 ratio =
new TH1F(*numreb);
115 ratio->SetDirectory(
nullptr);
118 ratio->Divide(numreb, denreb, 1, 1,
"B");
TH1F * getBinomialRatio(const CommonAnalyzer &denom, const char *name, const int rebin=-1) const
const std::string & getRunNumber() const
TNamed * getObjectWithSuffix(const char *name, const char *suffix="") const
void setRunNumber(const char *run)
TObject * getObject(const char *name) const
const std::string & getPath() const
void setModule(const char *mod)
const std::string & getPrefix() const
CommonAnalyzer & operator=(const CommonAnalyzer &dtca)
const std::vector< unsigned int > getList(const char *what) const
void setPath(const char *path)
CommonAnalyzer(TFile *file, const char *run, const char *mod, const char *path="", const char *prefix="")
const std::vector< unsigned int > getRunList() const
const std::string & getModule() const
void setFile(TFile *file)
void setPrefix(const char *prefix)
T mod(const T &a, const T &b)
const std::vector< unsigned int > getFillList() const