33 #include "HistoManager.hh"
37 #include "AIDA/AIDA.h"
42 :fAF(0),fTree(0), fNtuple1(0), fNtuple2(0)
46 fAF = AIDA_createAnalysisFactory();
48 G4cout <<
" HistoManager::HistoManager :"
49 <<
" problem creating the AIDA analysis factory."
79 fileName = fileName +
"." + fileType;
82 AIDA::ITreeFactory* tf =
fAF->createTreeFactory();
83 fTree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
86 G4cout <<
" HistoManager::book :"
87 <<
" problem creating the AIDA tree with "
88 <<
" storeName = " << fileName
89 <<
" storeType = " << fileType
90 <<
" readOnly = " << readOnly
91 <<
" createNew = " << createNew
92 <<
" options = " << fileOption
99 AIDA::IHistogramFactory*
hf =
fAF->createHistogramFactory(*
fTree);
103 fTree->mkdir(
"histograms");
104 fTree->cd(
"histograms");
107 fHisto[0] = hf->createHistogram1D(
"EAbs",
"EAbs: Edep in absorber", 100, 0., 800*
MeV);
109 fHisto[1] = hf->createHistogram1D(
"EGap",
"EGap: Edep in gap", 100, 0., 100*
MeV);
111 fHisto[2] = hf->createHistogram1D(
"LAbs",
"LAbs: trackL in absorber", 100, 0., 1*
m);
113 fHisto[3] = hf->createHistogram1D(
"LGap",
"LGap: trackL in gap", 100, 0., 50*
cm);
124 AIDA::ITupleFactory* ntf =
fAF->createTupleFactory(*
fTree);
128 fTree->mkdir(
"tuples");
131 fNtuple1 = ntf->create(
"Ntuple1",
"Edep",
"double Eabs, Egap");
132 fNtuple2 = ntf->create(
"Ntuple2",
"TrackL",
"double Labs, Lgap");
137 G4cout <<
"\n----> Output file is open in " << fileName <<
G4endl;
148 G4cout <<
"\n----> Histograms and ntuples are saved\n" <<
G4endl;
158 if (ih >= kMaxHisto) {
159 G4cout <<
"---> warning from HistoManager::FillHisto() : histo " << ih
160 <<
" does not exist. (xbin=" << xbin <<
" weight=" << weight <<
")"
172 if (ih >= kMaxHisto) {
173 G4cout <<
"---> warning from HistoManager::Normalize() : histo " << ih
174 <<
" does not exist. (fac=" << fac <<
")" <<
G4endl;
200 G4cout <<
"\n ----> print histograms statistic \n" <<
G4endl;
209 if (name[0] ==
'E' ) unitCategory =
"Energy";
210 if (name[0] ==
'L' ) unitCategory =
"Length";
213 <<
": mean = " <<
G4BestUnit(h1->mean(), unitCategory)
214 <<
" rms = " <<
G4BestUnit(h1->rms(), unitCategory )