34 #include "HistoManager.hh"
35 #include "HistoMessenger.hh"
39 #include "AIDA/AIDA.h"
45 :af(0),
tree(0),factoryOn(false)
49 af = AIDA_createAnalysisFactory();
51 G4cout <<
" HistoManager::HistoManager() :"
52 <<
" problem creating the AIDA analysis factory."
57 fileName[0] =
"Pol01.aida";
75 delete histoMessenger;
90 if (fileName[0].find(
".")==G4String::npos) {
91 fileName[1] = fileName[0] +
"." + fileType;
94 fileName[1] = fileName[0];
99 AIDA::ITreeFactory* tf = af->createTreeFactory();
100 tree = tf->create(fileName[1], fileType, readOnly, createNew, fileOption);
103 G4cout <<
"HistoManager::book() :"
104 <<
" problem creating the AIDA tree with "
105 <<
" storeName = " << fileName[1]
106 <<
" storeType = " << fileType
107 <<
" readOnly = " << readOnly
108 <<
" createNew = " << createNew
109 <<
" options = " << fileOption
115 AIDA::IHistogramFactory*
hf = af->createHistogramFactory(*tree);
120 histo[k] = hf->createHistogram1D( Label[k], Title[k],
121 Nbins[k], Vmin[k], Vmax[k]);
127 G4cout <<
"\n----> Histogram Tree is opened " << fileName[1] <<
G4endl;
135 #ifdef G4ANALYSIS_USE
139 G4cout <<
"\n----> Histogram Tree is saved in " << fileName[1] <<
G4endl;
156 if (particleName==
"gamma")
id=1;
157 else if (particleName==
"e-")
id=5;
158 else if (particleName==
"e+")
id=9;
161 if (costheta>=1.) costheta=.99999999;
162 if (costheta<-1.) costheta=-1.;
166 FillHisto(
id+3,longitudinalPolarization);
172 G4cout <<
"---> warning from HistoManager::FillHisto() : histo " << ih
173 <<
"does not exist; e= " << e <<
" w= " << weight <<
G4endl;
176 #ifdef G4ANALYSIS_USE
177 if(exist[ih]) histo[ih]->fill(e/Unit[ih], weight);
187 G4cout <<
"---> warning from HistoManager::SetHisto() : histo " << ih
188 <<
"does not exist" <<
G4endl;
192 const G4String id[] = {
"0",
"1",
"2",
"3",
"4",
"5",
193 "6",
"7",
"8",
"9",
"10",
"11",
"12"};
196 "Gamma Energy distribution",
197 "Gamma Cos(Theta) distribution",
198 "Gamma Phi angular distribution",
199 "Gamma longitudinal Polarization",
200 "Electron Energy distribution",
201 "Electron Cos(Theta) distribution",
202 "Electron Phi angular distribution",
203 "Electron longitudinal Polarization",
204 "Positron Energy distribution",
205 "Positron Cos(Theta) distribution",
206 "Positron Phi angular distribution",
207 "Positron longitudinal Polarization"
212 G4double vmin = valmin, vmax = valmax;
215 if (unit !=
"none") {
216 titl = title[ih] +
" (" + unit +
")";
218 vmin = valmin/Unit[ih]; vmax = valmax/Unit[ih];
227 Width[ih] = (valmax-valmin)/nbins;
229 G4cout <<
"----> SetHisto " << ih <<
": " << titl <<
"; "
230 << nbins <<
" bins from "
231 << vmin <<
" " << unit <<
" to " << vmax <<
" " << unit <<
G4endl;
240 G4cout <<
"---> warning from HistoManager::RemoveHisto() : histo " << ih
241 <<
"does not exist" <<
G4endl;
245 histo[ih] = 0; exist[ih] =
false;