EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmStudyReport.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmStudyReport.cxx
1 
6 #include "CbmStudyReport.h"
7 #include "CbmReportElement.h"
8 #include "CbmHistManager.h"
9 #include <cassert>
10 #include <iostream>
11 #include <fstream>
12 #include <vector>
13 #include <sstream>
14 #include "TFile.h"
15 
16 using std::ofstream;
17 using std::vector;
18 using std::stringstream;
19 
21  : CbmReport(),
22  fHM(),
23  fStudyNames()
24 {
25 
26 }
27 
29 {
30 
31 }
32 
34  const vector<CbmHistManager*>& histManagers,
35  const vector<string>& studyNames,
36  const string& outputDir)
37 {
38  assert(histManagers.size() == studyNames.size());
39  fHM = histManagers;
40  fStudyNames = studyNames;
41  SetOutputDir(outputDir);
42  CreateReports();
43 }
44 
46  const vector<string>& fileNames,
47  const vector<string>& studyNames,
48  const string& outputDir)
49 {
50  assert(fileNames.size() == studyNames.size());
51  Int_t nofStudies = fileNames.size();
52  vector<TFile*> files(nofStudies);
53  fHM.resize(nofStudies);
54  for (Int_t i = 0; i < nofStudies; i++) {
55  fHM[i] = new CbmHistManager();
56  files[i] = new TFile(fileNames[i].c_str());
57  fHM[i]->ReadFromFile(files[i]);
58  }
59  fStudyNames = studyNames;
60  SetOutputDir(outputDir);
61 
62  CreateReports();
63 
64  // Do not delete histogram managers and files.
65  // Otherwise histograms disappear from canvases
66  // and are not saved to file.
67 // for (Int_t i = 0; i < nofStudies; i++) {
68 // delete fHM[i];
69 // delete files[i];
70 // }
71 // fHM.clear();
72 // files.clear();
73 }
74