34 #include "HistoManager.hh"
39 #include "AIDA/AIDA.h"
50 af = AIDA_createAnalysisFactory();
52 G4cout <<
" HistoManager::HistoManager :"
53 <<
" problem creating the AIDA analysis factory."
90 fileName = fileName +
"." + fileType;
93 AIDA::ITreeFactory* tf = af->createTreeFactory();
94 tree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
97 G4cout <<
" HistoManager::book :"
98 <<
" problem creating the AIDA tree with "
99 <<
" storeName = " << fileName
100 <<
" storeType = " << fileType
101 <<
" readOnly = " << readOnly
102 <<
" createNew = " << createNew
103 <<
" options = " << fileOption
110 AIDA::IHistogramFactory*
hf = af->createHistogramFactory(*tree);
114 tree->mkdir(
"histograms");
115 tree->cd(
"histograms");
117 histo[1] = hf->createHistogram1D(
"1",
"Edep in absorber", 100, 0., 800*
MeV);
118 if (!histo[1])
G4cout <<
"\n can't create histo 1" <<
G4endl;
119 histo[2] = hf->createHistogram1D(
"2",
"Edep in gap", 100, 0., 100*
MeV);
120 if (!histo[2])
G4cout <<
"\n can't create histo 2" <<
G4endl;
121 histo[3] = hf->createHistogram1D(
"3",
"trackL in absorber", 100, 0., 1*
m);
122 if (!histo[3])
G4cout <<
"\n can't create histo 3" <<
G4endl;
123 histo[4] = hf->createHistogram1D(
"4",
"trackL in gap", 100, 0., 50*
cm);
124 if (!histo[4])
G4cout <<
"\n can't create histo 4" <<
G4endl;
131 AIDA::ITupleFactory* ntf = af->createTupleFactory(*tree);
135 tree->mkdir(
"tuples");
138 ntupl = ntf->create(
"101",
"Edep and TrackL",
"double Eabs, Egap, Labs, Lgap");
143 G4cout <<
"\n----> Histogram Tree is opened in " << fileName <<
G4endl;
151 #ifdef G4ANALYSIS_USE
155 G4cout <<
"\n----> Histogram Tree is saved \n" <<
G4endl;
168 G4cout <<
"---> warning from HistoManager::FillHisto() : histo " << ih
169 <<
" does not exist. (xbin=" << xbin <<
" weight=" << weight <<
")"
173 #ifdef G4ANALYSIS_USE
174 if (histo[ih]) histo[ih]->fill(xbin, weight);
183 G4cout <<
"---> warning from HistoManager::Normalize() : histo " << ih
184 <<
" does not exist. (fac=" << fac <<
")" <<
G4endl;
187 #ifdef G4ANALYSIS_USE
188 if (histo[ih]) histo[ih]->scale(fac);
194 #ifdef G4ANALYSIS_USE
199 ntupl->fill(0, energyAbs);
200 ntupl->fill(1, energyGap);
201 ntupl->fill(2, trackLAbs);
202 ntupl->fill(3, trackLGap);
215 #ifdef G4ANALYSIS_USE
217 G4cout <<
"\n ----> print histograms statistic \n" <<
G4endl;
220 <<
" EAbs : mean = " <<
G4BestUnit(histo[1]->mean(),
"Energy")
223 <<
" EGap : mean = " <<
G4BestUnit(histo[2]->mean(),
"Energy")
226 <<
" LAbs : mean = " <<
G4BestUnit(histo[3]->mean(),
"Length")
229 <<
" LGap : mean = " <<
G4BestUnit(histo[4]->mean(),
"Length")