Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -54,15 +54,20 @@ void HistoManager::Book()
|
||||
// The choice of analysis technology is done via selection of a namespace
|
||||
// in HistoManager.hh
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
// Only merge in MT mode to avoid warning when running in Sequential mode
|
||||
#ifdef G4MULTITHREADED
|
||||
analysisManager->SetNtupleMerging(true);
|
||||
#endif
|
||||
|
||||
// Create directories
|
||||
analysisManager->SetHistoDirectoryName("histo");
|
||||
analysisManager->SetNtupleDirectoryName("ntuple");
|
||||
if ( ! fFactoryOn ) {
|
||||
//
|
||||
analysisManager->SetDefaultFileType("root");
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
// Only merge in MT mode to avoid warning when running in Sequential mode
|
||||
#ifdef G4MULTITHREADED
|
||||
analysisManager->SetNtupleMerging(true);
|
||||
#endif
|
||||
|
||||
// Create directories
|
||||
analysisManager->SetHistoDirectoryName("histo");
|
||||
analysisManager->SetNtupleDirectoryName("ntuple");
|
||||
}
|
||||
|
||||
// Open an output file
|
||||
//
|
||||
@@ -73,39 +78,41 @@ void HistoManager::Book()
|
||||
return;
|
||||
}
|
||||
|
||||
// Create histograms.
|
||||
// Histogram ids are generated automatically starting from 0.
|
||||
// The start value can be changed by:
|
||||
// analysisManager->SetFirstHistoId(1);
|
||||
if ( ! fFactoryOn ) {
|
||||
// Create histograms.
|
||||
// Histogram ids are generated automatically starting from 0.
|
||||
// The start value can be changed by:
|
||||
// analysisManager->SetFirstHistoId(1);
|
||||
|
||||
// id = 0
|
||||
analysisManager->CreateH1("EAbs","Edep in absorber (MeV)", 100, 0., 800*MeV);
|
||||
// id = 1
|
||||
analysisManager->CreateH1("EGap","Edep in gap (MeV)", 100, 0., 100*MeV);
|
||||
// id = 2
|
||||
analysisManager->CreateH1("LAbs","trackL in absorber (mm)", 100, 0., 1*m);
|
||||
// id = 3
|
||||
analysisManager->CreateH1("LGap","trackL in gap (mm)", 100, 0., 50*cm);
|
||||
// id = 0
|
||||
analysisManager->CreateH1("EAbs","Edep in absorber (MeV)", 100, 0., 800*MeV);
|
||||
// id = 1
|
||||
analysisManager->CreateH1("EGap","Edep in gap (MeV)", 100, 0., 100*MeV);
|
||||
// id = 2
|
||||
analysisManager->CreateH1("LAbs","trackL in absorber (mm)", 100, 0., 1*m);
|
||||
// id = 3
|
||||
analysisManager->CreateH1("LGap","trackL in gap (mm)", 100, 0., 50*cm);
|
||||
|
||||
// Create ntuples.
|
||||
// Ntuples ids are generated automatically starting from 0.
|
||||
// The start value can be changed by:
|
||||
// analysisManager->SetFirstMtupleId(1);
|
||||
// Create ntuples.
|
||||
// Ntuples ids are generated automatically starting from 0.
|
||||
// The start value can be changed by:
|
||||
// analysisManager->SetFirstMtupleId(1);
|
||||
|
||||
// Create 1st ntuple (id = 0)
|
||||
analysisManager->CreateNtuple("Ntuple1", "Edep");
|
||||
analysisManager->CreateNtupleDColumn("Eabs"); // column Id = 0
|
||||
analysisManager->CreateNtupleDColumn("Egap"); // column Id = 1
|
||||
analysisManager->FinishNtuple();
|
||||
// Create 1st ntuple (id = 0)
|
||||
analysisManager->CreateNtuple("Ntuple1", "Edep");
|
||||
analysisManager->CreateNtupleDColumn("Eabs"); // column Id = 0
|
||||
analysisManager->CreateNtupleDColumn("Egap"); // column Id = 1
|
||||
analysisManager->FinishNtuple();
|
||||
|
||||
// Create 2nd ntuple (id = 1)
|
||||
//
|
||||
analysisManager->CreateNtuple("Ntuple2", "TrackL");
|
||||
analysisManager->CreateNtupleDColumn("Labs"); // column Id = 0
|
||||
analysisManager->CreateNtupleDColumn("Lgap"); // column Id = 1
|
||||
analysisManager->FinishNtuple();
|
||||
// Create 2nd ntuple (id = 1)
|
||||
//
|
||||
analysisManager->CreateNtuple("Ntuple2", "TrackL");
|
||||
analysisManager->CreateNtupleDColumn("Labs"); // column Id = 0
|
||||
analysisManager->CreateNtupleDColumn("Lgap"); // column Id = 1
|
||||
analysisManager->FinishNtuple();
|
||||
|
||||
fFactoryOn = true;
|
||||
fFactoryOn = true;
|
||||
}
|
||||
|
||||
G4cout << "\n----> Output file is open in "
|
||||
<< analysisManager->GetFileName() << "."
|
||||
@@ -123,9 +130,6 @@ void HistoManager::Save()
|
||||
analysisManager->CloseFile();
|
||||
|
||||
G4cout << "\n----> Histograms and ntuples are saved\n" << G4endl;
|
||||
|
||||
delete G4AnalysisManager::Instance();
|
||||
fFactoryOn = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -141,7 +145,7 @@ void HistoManager::FillHisto(G4int ih, G4double xbin, G4double weight)
|
||||
void HistoManager::Normalize(G4int ih, G4double fac)
|
||||
{
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
G4H1* h1 = analysisManager->GetH1(ih);
|
||||
auto h1 = analysisManager->GetH1(ih);
|
||||
if (h1) h1->scale(fac);
|
||||
}
|
||||
|
||||
@@ -172,7 +176,7 @@ void HistoManager::PrintStatistic()
|
||||
G4cout << "\n ----> print histograms statistic \n" << G4endl;
|
||||
for ( G4int i=0; i<analysisManager->GetNofH1s(); ++i ) {
|
||||
G4String name = analysisManager->GetH1Name(i);
|
||||
G4H1* h1 = analysisManager->GetH1(i);
|
||||
auto h1 = analysisManager->GetH1(i);
|
||||
|
||||
G4String unitCategory;
|
||||
if (name[0U] == 'E' ) unitCategory = "Energy";
|
||||
|
||||
Reference in New Issue
Block a user