34 #include "HistoManager.hh"
35 #include "HistoMessenger.hh"
39 #include "AIDA/AIDA.h"
46 :af(0),
tree(0),factoryOn(
false)
51 af = AIDA_createAnalysisFactory();
53 G4cout <<
" HistoManager::HistoManager() :"
54 <<
" problem creating the AIDA analysis factory."
59 fileName[0] =
"Pol01.aida";
77 delete histoMessenger;
92 if (fileName[0].find(
".")==G4String::npos) {
93 fileName[1] = fileName[0] +
"." + fileType;
96 fileName[1] = fileName[0];
101 AIDA::ITreeFactory* tf = af->createTreeFactory();
102 tree = tf->create(fileName[1], fileType, readOnly, createNew, fileOption);
105 G4cout <<
"HistoManager::book() :"
106 <<
" problem creating the AIDA tree with "
107 <<
" storeName = " << fileName[1]
108 <<
" storeType = " << fileType
109 <<
" readOnly = " << readOnly
110 <<
" createNew = " << createNew
111 <<
" options = " << fileOption
117 AIDA::IHistogramFactory*
hf = af->createHistogramFactory(*
tree);
122 histo[k] = hf->createHistogram1D( Label[k], Title[k],
123 Nbins[k], Vmin[k], Vmax[k]);
129 G4cout <<
"\n----> Histogram Tree is opened " << fileName[1] <<
G4endl;
137 #ifdef G4ANALYSIS_USE
141 G4cout <<
"\n----> Histogram Tree is saved in " << fileName[1] <<
G4endl;
158 if (particleName==
"gamma")
id=1;
159 else if (particleName==
"e-")
id=5;
160 else if (particleName==
"e+")
id=9;
163 if (costheta>=1.) costheta=.99999999;
164 if (costheta<-1.) costheta=-1.;
168 FillHisto(
id+3,longitudinalPolarization);
174 G4cout <<
"---> warning from HistoManager::FillHisto() : histo " << ih
175 <<
"does not exist; e= " << e <<
" w= " << weight <<
G4endl;
178 #ifdef G4ANALYSIS_USE
179 if(exist[ih]) histo[ih]->fill(e/Unit[ih], weight);
189 G4cout <<
"---> warning from HistoManager::SetHisto() : histo " << ih
190 <<
"does not exist" <<
G4endl;
194 const G4String id[] = {
"0",
"1",
"2",
"3",
"4",
"5",
195 "6",
"7",
"8",
"9",
"10",
"11",
"12"};
198 "Gamma Energy distribution",
199 "Gamma Cos(Theta) distribution",
200 "Gamma Phi angular distribution",
201 "Gamma longitudinal Polarization",
202 "Electron Energy distribution",
203 "Electron Cos(Theta) distribution",
204 "Electron Phi angular distribution",
205 "Electron longitudinal Polarization",
206 "Positron Energy distribution",
207 "Positron Cos(Theta) distribution",
208 "Positron Phi angular distribution",
209 "Positron longitudinal Polarization"
214 G4double vmin = valmin, vmax = valmax;
217 if (unit !=
"none") {
218 titl = title[ih] +
" (" + unit +
")";
220 vmin = valmin/Unit[ih]; vmax = valmax/Unit[ih];
229 Width[ih] = (valmax-valmin)/nbins;
231 G4cout <<
"----> SetHisto " << ih <<
": " << titl <<
"; "
232 << nbins <<
" bins from "
233 << vmin <<
" " << unit <<
" to " << vmax <<
" " << unit <<
G4endl;
242 G4cout <<
"---> warning from HistoManager::RemoveHisto() : histo " << ih
243 <<
"does not exist" <<
G4endl;
247 histo[ih] = 0; exist[ih] =
false;
void FillHisto(G4int id, G4double bin, G4double weight=1.0)
void FillHistos(const G4String &particleName, G4double kinEnergy, G4double costheta, G4double phi, G4double longitudinalPolarization)
static G4double GetValueOf(const G4String &)
G4GLOB_DLL std::ostream G4cout
void SetHisto(G4int, G4int, G4double, G4double, const G4String &unit="none")
subroutine title(NA, NB, NCA, NCB)