Import Geant4 10.5.0.beta source tree
This commit is contained in:
@@ -39,9 +39,11 @@
|
||||
#include "CCalAnalysis.hh"
|
||||
|
||||
|
||||
void CCalRunAction::BeginOfRunAction(const G4Run* aRun) {
|
||||
void CCalRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
numberOfTimeSlices = 200;
|
||||
|
||||
// A.R. Added for visualization of events.
|
||||
if ( G4VVisManager::GetConcreteInstance() ) {
|
||||
@@ -49,24 +51,99 @@ void CCalRunAction::BeginOfRunAction(const G4Run* aRun) {
|
||||
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
|
||||
CCalAnalysis* analysis = CCalAnalysis::getInstance();
|
||||
analysis->BeginOfRun(aRun->GetRunID());
|
||||
if (aRun->GetRunID() == 0) //first run
|
||||
Book();
|
||||
|
||||
|
||||
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
|
||||
//cleanup
|
||||
G4int timeHist = analysis->GetH1Id("h300");
|
||||
for (int i=0; i<numberOfTimeSlices; i++)
|
||||
analysis->GetH1(timeHist+i)->reset();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCalRunAction::EndOfRunAction(const G4Run* aRun) {
|
||||
|
||||
void CCalRunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " end." << G4endl;
|
||||
|
||||
// A.R. Added for visualization of events.
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
|
||||
CCalAnalysis* analysis = CCalAnalysis::getInstance();
|
||||
analysis->EndOfRun(aRun->GetRunID());
|
||||
|
||||
}
|
||||
|
||||
void CCalRunAction::Book()
|
||||
{
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetFirstHistoId(1);
|
||||
analysisManager->SetFirstNtupleId(1);
|
||||
|
||||
// Open an output file
|
||||
analysisManager->OpenFile("ccal");
|
||||
G4cout << "********************************************" << G4endl
|
||||
<< "* o/p file ccal" << G4endl
|
||||
<< "********************************************" << G4endl
|
||||
<< G4endl;
|
||||
|
||||
|
||||
// Create a tuple :
|
||||
// Create ntuple
|
||||
analysisManager->CreateNtuple("ntuple1", "Event info");
|
||||
for (int i=0;i<28;i++) {
|
||||
G4String tupleidString = "hcal" + std::to_string( i );
|
||||
analysisManager->CreateNtupleFColumn( tupleidString.c_str() );
|
||||
}
|
||||
for (int i=0; i<49; i++) {
|
||||
G4String tupleidString = "ecal" + std::to_string( i );
|
||||
analysisManager->CreateNtupleFColumn( tupleidString.c_str() );
|
||||
}
|
||||
analysisManager->CreateNtupleFColumn("ELAB");
|
||||
analysisManager->CreateNtupleFColumn("XPOS");
|
||||
analysisManager->CreateNtupleFColumn("YPOS");
|
||||
analysisManager->CreateNtupleFColumn("ZPOS");
|
||||
analysisManager->CreateNtupleFColumn("EDEP");
|
||||
analysisManager->CreateNtupleFColumn("EDEC");
|
||||
analysisManager->CreateNtupleFColumn("EHDC");
|
||||
analysisManager->FinishNtuple();
|
||||
|
||||
//
|
||||
//Create histograms. Save the ID of the first histogram in each block
|
||||
//
|
||||
//Energy deposit in Hcal layers
|
||||
for (int i = 0; i<28; i++) {
|
||||
G4String idString = "h" + std::to_string( i+100 );
|
||||
G4String ntupletagString = "Energy Deposit in Hcal Layer" + std::to_string( i ) + " in GeV";
|
||||
analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 1.0 );
|
||||
}
|
||||
// Energy deposits in Ecal towers
|
||||
for (int i = 0; i<49; i++) {
|
||||
G4String idString = "h" + std::to_string( i+200 );
|
||||
G4String ntupletagString = "Energy Deposit in Ecal Tower" + std::to_string( i ) + " in GeV";
|
||||
analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 1.0 );
|
||||
}
|
||||
// Total energy deposit
|
||||
analysisManager->CreateH1( "h4000", "Total energy deposited in GeV", 100, 0., 100.0 );
|
||||
|
||||
// Time slices
|
||||
for (int i=0; i<numberOfTimeSlices; i++){
|
||||
G4String idString = "h" + std::to_string( i+300 );
|
||||
G4String ntupletagString = "Time slice " + std::to_string( i ) + " nsec energy profile in GeV";
|
||||
analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 100.0 );
|
||||
}
|
||||
|
||||
// Profile of lateral energy deposit in Hcal
|
||||
for (int i = 0; i<70; i++) {
|
||||
G4String idString = "h" + std::to_string( i+500 );
|
||||
G4String ntupletagString = "Lateral energy profile at " + std::to_string( i ) + " cm in GeV";
|
||||
analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 10.0 );
|
||||
}
|
||||
|
||||
// Time profile
|
||||
analysisManager->CreateH1( "h901", "Time Profile in Sensitive Detector", 200, 0., 200. );
|
||||
analysisManager->CreateH1( "h902", "Time Profile in Sensitive+Passive", 200, 0., 200. );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user