62 ThisNearlineMinorVersion(0),
63 ThisNearlineMajorVersion(0)
72 TTree *Header = (TTree*) fp->Get(headerTreeName.c_str());
74 std::cout <<
"NearlineSummariser: ERROR: " << fp->GetName() <<
" doesn't contain header tree: " << headerTreeName <<
std::endl;
78 Header->SetBranchAddress(
"Run",&Run);
79 Header->SetBranchAddress(
"Subrun",&Subrun);
80 Header->SetBranchAddress(
"FirstEvent",&FirstEvent);
81 Header->SetBranchAddress(
"LastEvent",&LastEvent);
82 Header->SetBranchAddress(
"Nevents",&Nevents);
83 Header->SetBranchAddress(
"StartYear",&StartYear);
84 Header->SetBranchAddress(
"StartMonth",&StartMonth);
85 Header->SetBranchAddress(
"StartDay",&StartDay);
86 Header->SetBranchAddress(
"StartHour",&StartHour);
87 Header->SetBranchAddress(
"EndYear",&EndYear);
88 Header->SetBranchAddress(
"EndMonth",&EndMonth);
89 Header->SetBranchAddress(
"EndDay",&EndDay);
90 Header->SetBranchAddress(
"EndHour",&EndHour);
100 TH1*
hist = (TH1*) fp->Get(versionHistName.c_str());
103 std::cout <<
"NearlineSummariser: ERROR: " << fp->GetName() <<
" doesn't contain version number hist: " << versionHistName <<
std::endl;
107 ThisNearlineMinorVersion = hist->GetBinContent(1);
108 ThisNearlineMajorVersion = hist->GetBinContent(2);
113 os <<
"Run " << rhs.
Run 141 if(dirName==
"") histFullName = histName;
142 else histFullName = dirName +
"/" + histName;
143 std::shared_ptr<TH1> thisHisto(
getHistogram(File, histFullName, newHistName));
144 MapNameHists.insert(std::pair<
std::string,std::shared_ptr<TH1>>(histName, thisHisto));
155 std::vector<std::string> vecFileNames;
156 for(
int i=1;i<argc;i++){
158 vecFileNames.push_back(thisFileName);
161 std::vector<NearlineRunPlotSet> VecRunPlotSet;
162 std::vector<std::string> VecPlotNames;
163 VecPlotNames.push_back(
"hped_per_event_chan_0");
164 VecPlotNames.push_back(
"hped_per_event_chan_128");
165 VecPlotNames.push_back(
"hped_per_event_chan_256");
166 VecPlotNames.push_back(
"hped_per_event_chan_384");
167 VecPlotNames.push_back(
"hped_per_event_chan_512");
168 VecPlotNames.push_back(
"hped_per_event_chan_640");
169 VecPlotNames.push_back(
"hped_per_event_chan_768");
170 VecPlotNames.push_back(
"hped_per_event_chan_896");
171 VecPlotNames.push_back(
"hped_per_event_chan_1024");
172 VecPlotNames.push_back(
"hped_per_event_chan_1152");
173 VecPlotNames.push_back(
"hped_per_event_chan_1280");
174 VecPlotNames.push_back(
"hped_per_event_chan_1408");
175 VecPlotNames.push_back(
"hped_per_event_chan_1536");
176 VecPlotNames.push_back(
"hped_per_event_chan_1664");
177 VecPlotNames.push_back(
"hped_per_event_chan_1792");
178 VecPlotNames.push_back(
"hped_per_event_chan_1920");
182 for(
auto thisFileName: vecFileNames){
183 TFile *
fp = TFile::Open(thisFileName.c_str());
191 std::cout <<
"NearlineSummariser: INFO: " 200 std::cout <<
"NearlineSummariser: INFO: ThisNearlineVersion: " 203 <<
" NearlineVersion (Summariser): " 208 for(
auto thisPlotName: VecPlotNames){
229 VecRunPlotSet.push_back(thisRunPlotSet);
236 for(
auto thisRunPlotSet: VecRunPlotSet){
237 std::cout <<
"NearlineSummariser: INFO: " << thisRunPlotSet.FileInfo <<
std::endl;
262 TList* listOfKeys = fp->GetListOfKeys();
263 TIter next(listOfKeys);
265 while(( key = (TKey*)next() )){
267 if(thisKeyName == dirName){
272 std::cout <<
"NearlineSummariser: ERROR: " << fp->GetName() <<
" doesn't contain a dir: " << dirName <<
std::endl;
286 fp->GetObject(histName.c_str(),
hist);
289 std::cout <<
"NearlineSummariser: ERROR: Failed to get histogram: " << histName <<
"\n";
295 outhist = (TH1*) hist->Clone(newHistName.c_str());
296 outhist->SetDirectory(0);
int ThisNearlineMinorVersion
std::map< std::string, std::shared_ptr< TH1 > > MapNameHists
unsigned long long int EndTime
const int NearlineMajorVersion
const int NearlineMinorVersion
friend std::ostream & operator<<(std::ostream &os, NearlineFileInfo &rhs)
int main(int argc, char **argv)
unsigned long long int StartTime
void getHeaderInfo(TFile *fp, std::string headerTreeName)
NearlineFileInfo(TFile *fp, std::string headerTreeName=NearlineInstanceLabel+"/Header", std::string versionHistName=NearlineInstanceLabel+"/hist_nearline_version")
bool checkFileHasDir(TFile *fp, std::string dirName)
const std::string NearlineInstanceLabel
TH1 * getHistogram(TFile *fp, std::string histName, std::string newHistName)
void getNearlineVersion(TFile *fp, std::string versionHistName)
NearlineFileInfo FileInfo
void loadHistogram(std::string dirName, std::string histName)
std::string to_string(ModuleType const mt)
QTextStream & endl(QTextStream &s)
int ThisNearlineMajorVersion
NearlineRunPlotSet(TFile *fp)