34 #include "HistoManager.hh"
38 #include "AIDA/AIDA.h"
43 :fAF(0),fTree(0), fNtuple1(0), fNtuple2(0)
47 fAF = AIDA_createAnalysisFactory();
49 G4cout <<
" HistoManager::HistoManager :"
50 <<
" problem creating the AIDA analysis factory."
80 fileName = fileName +
"." + fileType;
83 AIDA::ITreeFactory* tf =
fAF->createTreeFactory();
84 fTree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
87 G4cout <<
" HistoManager::book :"
88 <<
" problem creating the AIDA tree with "
89 <<
" storeName = " << fileName
90 <<
" storeType = " << fileType
91 <<
" readOnly = " << readOnly
92 <<
" createNew = " << createNew
93 <<
" options = " << fileOption
100 AIDA::IHistogramFactory* hf =
fAF->createHistogramFactory(*
fTree);
104 fTree->mkdir(
"histograms");
105 fTree->cd(
"histograms");
108 fHisto[0] = hf->createHistogram1D(
"EAbs",
"EAbs: Edep in absorber", 100, 0., 800*
MeV);
110 fHisto[1] = hf->createHistogram1D(
"EGap",
"EGap: Edep in gap", 100, 0., 100*
MeV);
112 fHisto[2] = hf->createHistogram1D(
"LAbs",
"LAbs: trackL in absorber", 100, 0., 1*
m);
114 fHisto[3] = hf->createHistogram1D(
"LGap",
"LGap: trackL in gap", 100, 0., 50*
cm);
125 AIDA::ITupleFactory* ntf =
fAF->createTupleFactory(*
fTree);
129 fTree->mkdir(
"tuples");
132 fNtuple1 = ntf->create(
"Ntuple1",
"Edep",
"double Eabs, Egap");
133 fNtuple2 = ntf->create(
"Ntuple2",
"TrackL",
"double Labs, Lgap");
138 G4cout <<
"\n----> Output file is open in " << fileName <<
G4endl;
149 G4cout <<
"\n----> Histograms and ntuples are saved\n" <<
G4endl;
159 if (ih >= kMaxHisto) {
160 G4cout <<
"---> warning from HistoManager::FillHisto() : histo " << ih
161 <<
" does not exist. (xbin=" << xbin <<
" weight=" << weight <<
")"
173 if (ih >= kMaxHisto) {
174 G4cout <<
"---> warning from HistoManager::Normalize() : histo " << ih
175 <<
" does not exist. (fac=" << fac <<
")" <<
G4endl;
201 G4cout <<
"\n ----> print histograms statistic \n" <<
G4endl;
210 if (name[0] ==
'E' ) unitCategory =
"Energy";
211 if (name[0] ==
'L' ) unitCategory =
"Length";
214 <<
": mean = " <<
G4BestUnit(h1->mean(), unitCategory)
215 <<
" rms = " <<
G4BestUnit(h1->rms(), unitCategory )
static constexpr double MeV
void Normalize(G4int id, G4double fac)
void FillNtuple(G4double EnergyAbs, G4double EnergyGap, G4double TrackLAbs, G4double TrackLGap)
void FillHisto(G4int id, G4double e, G4double weight=1.0)
static constexpr double m
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static const G4double fac
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
AIDA::IAnalysisFactory * fAF