4 #include "TDirectory.h" 15 _file(file), _runnumber(run), _module(mod), _path(path), _prefix(prefix) { }
46 TObject*
obj =
nullptr;
50 bool ok =
_file->cd(fullpath.c_str());
51 if(ok && gDirectory) {
52 obj = gDirectory->Get(name);
64 if(!strstr(obj->GetTitle(),
"run")) {
67 obj->SetTitle(htitle);
88 std::vector<unsigned int>
runlist;
89 char searchstring[100];
90 char decodestring[100];
91 sprintf(searchstring,
"%s_",what);
92 sprintf(decodestring,
"%s_%%u",what);
96 bool ok =
_file->cd(fullpath.c_str());
97 if(ok && gDirectory) {
98 TList*
keys = gDirectory->GetListOfKeys();
101 while((key=(TKey*)it.Next())) {
102 std::cout << key->GetName() << std::endl;
103 TClass
cl(key->GetClassName());
104 if (
cl.InheritsFrom(
"TDirectory") && strstr(key->GetName(),searchstring) !=
nullptr ) {
106 sscanf(key->GetName(),decodestring,&
run);
107 runlist.push_back(run);
120 TH1F* den = (TH1F*)denom.
getObject(name);
122 TH1F*
ratio =
nullptr;
124 if(den!=
nullptr && num!=
nullptr) {
129 denreb = (TH1F*)den->Rebin(rebin,
"denrebinned");
130 numreb = (TH1F*)num->Rebin(rebin,
"numrebinned");
133 ratio =
new TH1F(*numreb);
134 ratio->SetDirectory(
nullptr);
137 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