45 #include "HistoMessenger.hh"
79 if(!(fHistoActive || fNtupleActive)) {
return; }
85 G4String nam = fHistName +
"." + fHistType;
89 G4cout <<
"Histo::Book: ERROR open file <" << nam <<
">" <<
G4endl;
91 fNtupleActive =
false;
94 G4cout <<
"### Histo::Save: Opended file <" << nam <<
"> for "
95 << fNHisto <<
" histograms " <<
G4endl;
98 for(
G4int i=0; i<fNHisto; ++i) {
101 fHisto[i] = fManager->
CreateH1(ss, fTitles[i], fBins[i], fXmin[i], fXmax[i]);
103 G4cout <<
"Created histogram #" << i <<
" id= " << fHisto[i]
104 <<
" " << ss <<
" " << fTitles[i] <<
G4endl;
112 G4int n = fNtupleI.size();
131 if(!(fHistoActive || fNtupleActive)) {
return; }
134 G4String nam = fHistName +
"." + fHistType;
137 if(!fManager->
Write()) {
138 G4cout <<
"Histo::Save: FATAL ERROR writing ROOT file" <<
G4endl;
142 G4cout <<
"### Histo::Save: Histograms and Ntuples are saved" <<
G4endl;
144 if(fManager->
CloseFile() && fVerbose > 0) {
157 G4cout <<
"Histo::Add1D: New histogram will be booked: #" <<
id <<
" <" << name
158 <<
" " << nb <<
" " << x1 <<
" " << x2 <<
" " << u
164 fActive.push_back(fDefaultAct);
170 fTitles.push_back(name);
171 fHisto.push_back(-1);
178 if(i>=0 && i<fNHisto) {
180 G4cout <<
"Histo::SetHisto1D: #" << i
181 <<
" " << nb <<
" " << x1 <<
" " << x2 <<
" " << u
191 G4cout <<
"Histo::SetHisto1D: WARNING! wrong histogram index " << i <<
G4endl;
200 G4cout <<
"Histo::Activate: Histogram: #" << i <<
" "
203 if(i>=0 && i<fNHisto) {
205 if(val) { fHistoActive =
true; }
213 if(!fHistoActive) {
return; }
215 G4cout <<
"Histo::Fill: Histogram: #" << i <<
" at x= " << x
219 if(i>=0 && i<fNHisto) {
220 if(fActive[i]) { fManager->
FillH1(fHisto[i], x/fUnit[i], w); }
222 G4cout <<
"Histo::Fill: WARNING! wrong histogram index " << i <<
G4endl;
230 if(!fHistoActive) {
return; }
232 G4cout <<
"Histo::Scale: Histogram: #" << i <<
" by factor " << x <<
G4endl;
234 if(i>=0 && i<fNHisto) {
235 if(fActive[i]) { fManager->
GetH1(fHisto[i])->scale(x); }
237 G4cout <<
"Histo::Scale: WARNING! wrong histogram index " << i <<
G4endl;
252 fNtupleActive =
true;
253 fNtupleI.push_back(w1);
254 fTupleI.push_back(-1);
261 fNtupleActive =
true;
262 fNtupleF.push_back(w1);
263 fTupleF.push_back(-1);
270 fNtupleActive =
true;
271 fNtupleD.push_back(w1);
272 fTupleD.push_back(-1);
279 if(!fNtupleActive) {
return; }
280 G4int n = fNtupleI.size();
281 if(i >= 0 && i < n) {
283 G4cout <<
"Histo::FillTupleI: i= " << i <<
" id= " << fTupleI[i]
284 <<
" <" << fNtupleI[i] <<
"> = " << x <<
G4endl;
288 G4cout <<
"Histo::FillTupleI: WARNING! wrong ntuple index " << i <<
G4endl;
296 if(!fNtupleActive) {
return; }
297 G4int n = fNtupleF.size();
298 if(i >= 0 && i < n) {
300 G4cout <<
"Histo::FillTupleF: i= " << i <<
" id= " << fTupleF[i]
301 <<
" <" << fNtupleF[i] <<
"> = " << x <<
G4endl;
305 G4cout <<
"Histo::FillTupleF: WARNING! wrong ntuple index " << i <<
G4endl;
313 if(!fNtupleActive) {
return; }
314 G4int n = fNtupleD.size();
315 if(i >= 0 && i < n) {
317 G4cout <<
"Histo::FillTupleD: i= " << i <<
" id= " << fTupleD[i]
318 <<
" <" << fNtupleD[i] <<
"> = " << x <<
G4endl;
322 G4cout <<
"Histo::FillTupleD: WARNING! wrong ntuple index " << i <<
G4endl;
330 if(!fNtupleActive) {
return; }
346 if(nam ==
"root" || nam ==
"ROOT" ) { fHistType =
"root"; }
347 else if(nam ==
"xml" || nam ==
"XML") { fHistType =
"xml"; }
348 else if(nam ==
"ascii" || nam ==
"ASCII" ||
349 nam ==
"Csv" || nam ==
"csv" || nam ==
"CSV") { fHistType =
"ascii"; }