CbmRoot
CbmStudyReport.cxx
Go to the documentation of this file.
1 
6 #include "CbmStudyReport.h"
7 
8 #include "CbmHistManager.h" // for CbmHistManager
9 
10 #include <TFile.h> // for TFile
11 
12 #include <cassert> // for assert
13 #include <fstream> // for string, ofstream, stringstream
14 #include <string> // for basic_string
15 #include <vector> // for vector
16 
17 using std::ofstream;
18 using std::string;
19 using std::stringstream;
20 using std::vector;
21 
22 CbmStudyReport::CbmStudyReport() : CbmReport(), fHM(), fStudyNames() {}
23 
25 
26 void CbmStudyReport::Create(const vector<CbmHistManager*>& histManagers,
27  const vector<string>& studyNames,
28  const string& outputDir) {
29  assert(histManagers.size() == studyNames.size());
30  fHM = histManagers;
31  fStudyNames = studyNames;
32  SetOutputDir(outputDir);
33  CreateReports();
34 }
35 
36 void CbmStudyReport::Create(const vector<string>& fileNames,
37  const vector<string>& studyNames,
38  const string& outputDir) {
39  assert(fileNames.size() == studyNames.size());
40  Int_t nofStudies = fileNames.size();
41  vector<TFile*> files(nofStudies);
42  fHM.resize(nofStudies);
43  for (Int_t i = 0; i < nofStudies; i++) {
44  fHM[i] = new CbmHistManager();
45  files[i] = new TFile(fileNames[i].c_str());
46  fHM[i]->ReadFromFile(files[i]);
47  }
48  fStudyNames = studyNames;
49  SetOutputDir(outputDir);
50 
51  CreateReports();
52 
53  // Do not delete histogram managers and files.
54  // Otherwise histograms disappear from canvases
55  // and are not saved to file.
56  // for (Int_t i = 0; i < nofStudies; i++) {
57  // delete fHM[i];
58  // delete files[i];
59  // }
60  // fHM.clear();
61  // files.clear();
62 }
63 
CbmStudyReport::CbmStudyReport
CbmStudyReport()
Constructor.
Definition: CbmStudyReport.cxx:22
CbmStudyReport
Base class for study reports.
Definition: CbmStudyReport.h:26
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmStudyReport::fHM
std::vector< CbmHistManager * > fHM
Definition: CbmStudyReport.h:82
CbmStudyReport::Create
virtual void Create()=0
Inherited from CbmReport. Pure abstract function which is called from public Create() function.
CbmHistManager.h
Histogram manager.
CbmHistManager
Histogram manager.
Definition: CbmHistManager.h:41
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmStudyReport::fStudyNames
std::vector< std::string > fStudyNames
Definition: CbmStudyReport.h:83
CbmStudyReport::~CbmStudyReport
virtual ~CbmStudyReport()
Destructor.
Definition: CbmStudyReport.cxx:24
CbmReport
Base class for reports.
Definition: CbmReport.h:35
CbmStudyReport.h
Base class for study reports.
CbmReport::CreateReports
void CreateReports()
Create all available report types.
Definition: CbmReport.cxx:60
CbmReport::SetOutputDir
void SetOutputDir(const std::string &outputDir)
Definition: CbmReport.h:61