40 #include "HistoManager.hh"
47 fNtuple1(0), fNtuple2(0),
48 fEabs(0), fEgap(0) ,fLabs(0), fLgap(0)
63 if ( fRootFile )
delete fRootFile;
74 fRootFile =
new TFile(fileName,
"RECREATE");
76 G4cout <<
" HistoManager::book :"
77 <<
" problem creating the ROOT TFile "
82 fHisto[1] =
new TH1D(
"1",
"Edep in absorber", 100, 0., 800*CLHEP::MeV);
83 if (!fHisto[1])
G4cout <<
"\n can't create histo 1" <<
G4endl;
84 fHisto[2] =
new TH1D(
"2",
"Edep in gap", 100, 0., 100*CLHEP::MeV);
85 if (!fHisto[2])
G4cout <<
"\n can't create histo 2" <<
G4endl;
86 fHisto[3] =
new TH1D(
"3",
"trackL in absorber", 100, 0., 1*CLHEP::m);
87 if (!fHisto[3])
G4cout <<
"\n can't create histo 3" <<
G4endl;
88 fHisto[4] =
new TH1D(
"4",
"trackL in gap", 100, 0., 50*CLHEP::cm);
89 if (!fHisto[4])
G4cout <<
"\n can't create histo 4" <<
G4endl;
93 fNtuple1 =
new TTree(
"101",
"Edep");
94 fNtuple1->Branch(
"Eabs", &fEabs,
"Eabs/D");
95 fNtuple1->Branch(
"Egap", &fEgap,
"Egap/D");
99 fNtuple2 =
new TTree(
"102",
"TrackL");
100 fNtuple2->Branch(
"Labs", &fLabs,
"Labs/D");
101 fNtuple2->Branch(
"Lgap", &fLgap,
"Lgap/D");
104 G4cout <<
"\n----> Histogram file is opened in " << fileName <<
G4endl;
114 G4cout <<
"\n----> Histogram Tree is saved \n" <<
G4endl;
123 G4cout <<
"---> warning from HistoManager::FillHisto() : histo " << ih
124 <<
" does not exist. (xbin=" << xbin <<
" weight=" << weight <<
")"
128 if (fHisto[ih]) { fHisto[ih]->Fill(xbin, weight); }
136 G4cout <<
"---> warning from HistoManager::Normalize() : histo " << ih
137 <<
" does not exist. (fac=" << fac <<
")" <<
G4endl;
140 if (fHisto[ih]) fHisto[ih]->Scale(fac);
153 if (fNtuple1) fNtuple1->Fill();
154 if (fNtuple2) fNtuple2->Fill();
162 G4cout <<
"\n ----> print histograms statistic \n" <<
G4endl;
165 <<
" EAbs : mean = " <<
G4BestUnit(fHisto[1]->GetMean(),
"Energy")
168 <<
" EGap : mean = " <<
G4BestUnit(fHisto[2]->GetMean(),
"Energy")
171 <<
" LAbs : mean = " <<
G4BestUnit(fHisto[3]->GetMean(),
"Length")
174 <<
" LGap : mean = " <<
G4BestUnit(fHisto[4]->GetMean(),
"Length")
void FillNtuple(G4int id, G4int column, G4double value)
void FillHisto(G4int id, G4double bin, G4double weight=1.0)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void Normalize(G4int id, G4double fac)
G4GLOB_DLL std::ostream G4cout