35 #include "HistoManager.hh"
58 analysisManager->SetVerboseLevel(1);
59 analysisManager->SetNtupleMerging(
true);
62 analysisManager->SetHistoDirectoryName(
"histo");
63 analysisManager->SetNtupleDirectoryName(
"ntuple");
67 G4bool fileOpen = analysisManager->OpenFile(
"AnaEx01");
69 G4cerr <<
"\n---> HistoManager::Book(): cannot open "
70 << analysisManager->GetFileName() <<
G4endl;
80 analysisManager->CreateH1(
"EAbs",
"Edep in absorber (MeV)", 100, 0., 800*
MeV);
82 analysisManager->CreateH1(
"EGap",
"Edep in gap (MeV)", 100, 0., 100*
MeV);
84 analysisManager->CreateH1(
"LAbs",
"trackL in absorber (mm)", 100, 0., 1*
m);
86 analysisManager->CreateH1(
"LGap",
"trackL in gap (mm)", 100, 0., 50*
cm);
94 analysisManager->CreateNtuple(
"Ntuple1",
"Edep");
95 analysisManager->CreateNtupleDColumn(
"Eabs");
96 analysisManager->CreateNtupleDColumn(
"Egap");
97 analysisManager->FinishNtuple();
101 analysisManager->CreateNtuple(
"Ntuple2",
"TrackL");
102 analysisManager->CreateNtupleDColumn(
"Labs");
103 analysisManager->CreateNtupleDColumn(
"Lgap");
104 analysisManager->FinishNtuple();
108 G4cout <<
"\n----> Output file is open in "
109 << analysisManager->GetFileName() <<
"."
110 << analysisManager->GetFileType() <<
G4endl;
120 analysisManager->Write();
121 analysisManager->CloseFile();
123 G4cout <<
"\n----> Histograms and ntuples are saved\n" <<
G4endl;
125 delete G4AnalysisManager::Instance();
134 analysisManager->FillH1(ih, xbin, weight);
142 G4H1*
h1 = analysisManager->GetH1(ih);
143 if (h1) h1->scale(fac);
153 analysisManager->FillNtupleDColumn(0, 0, energyAbs);
154 analysisManager->FillNtupleDColumn(0, 1, energyGap);
155 analysisManager->AddNtupleRow(0);
157 analysisManager->FillNtupleDColumn(1, 0, trackLAbs);
158 analysisManager->FillNtupleDColumn(1, 1, trackLGap);
159 analysisManager->AddNtupleRow(1);
170 G4cout <<
"\n ----> print histograms statistic \n" <<
G4endl;
171 for (
G4int i=0; i<analysisManager->GetNofH1s(); ++i ) {
173 G4H1*
h1 = analysisManager->GetH1(i);
176 if (name[0U] ==
'E' ) unitCategory =
"Energy";
177 if (name[0U] ==
'L' ) unitCategory =
"Length";
182 <<
": mean = " <<
G4BestUnit(h1->mean(), unitCategory)
183 <<
" 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
G4CsvAnalysisManager G4AnalysisManager
G4GLOB_DLL std::ostream G4cerr
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static const G4double fac
G4GLOB_DLL std::ostream G4cout
static constexpr double cm