File indexing completed on 2025-02-23 09:19:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "CCalRunAction.hh"
0031
0032 #include "globals.hh"
0033 #include "G4Run.hh"
0034
0035 #include "G4ios.hh"
0036
0037 #include "G4AnalysisManager.hh"
0038 #include "G4Threading.hh"
0039
0040
0041 CCalRunAction::CCalRunAction()
0042 {
0043 numberOfTimeSlices = 200;
0044 Book();
0045 }
0046
0047
0048 CCalRunAction::~CCalRunAction()
0049 {
0050 }
0051
0052
0053 void CCalRunAction::BeginOfRunAction(const G4Run* aRun)
0054 {
0055 G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
0056
0057 G4AnalysisManager* analysis = G4AnalysisManager::Instance();
0058 analysis->SetDefaultFileType("root");
0059
0060
0061 G4int timeHist = analysis->GetH1Id("h300");
0062 for (G4int i=0; i<numberOfTimeSlices; ++i) {
0063 analysis->GetH1(timeHist+i)->reset();
0064 }
0065
0066
0067 analysis->OpenFile("ccal");
0068 G4cout << "********************************************" << G4endl
0069 << "* o/p file ccal" << G4endl
0070 << "********************************************" << G4endl
0071 << G4endl;
0072 }
0073
0074
0075 void CCalRunAction::EndOfRunAction(const G4Run* aRun)
0076 {
0077 G4cout << "### Run " << aRun->GetRunID() << " end." << G4endl;
0078
0079
0080 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0081 analysisManager->Write();
0082 analysisManager->CloseFile();
0083 }
0084
0085
0086 void CCalRunAction::Book()
0087 {
0088 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0089 analysisManager->SetVerboseLevel(1);
0090 analysisManager->SetFirstHistoId(1);
0091 analysisManager->SetFirstNtupleId(1);
0092
0093
0094 if ( G4Threading::IsMultithreadedApplication() ) analysisManager->SetNtupleMerging(true);
0095
0096
0097 analysisManager->CreateNtuple("ntuple1", "Event info");
0098 for (G4int i=0;i<28;++i) {
0099 G4String tupleidString = "hcal" + std::to_string( i );
0100 analysisManager->CreateNtupleFColumn( tupleidString.c_str() );
0101 }
0102 for (G4int i=0; i<49; ++i) {
0103 G4String tupleidString = "ecal" + std::to_string( i );
0104 analysisManager->CreateNtupleFColumn( tupleidString.c_str() );
0105 }
0106 analysisManager->CreateNtupleFColumn("ELAB");
0107 analysisManager->CreateNtupleFColumn("XPOS");
0108 analysisManager->CreateNtupleFColumn("YPOS");
0109 analysisManager->CreateNtupleFColumn("ZPOS");
0110 analysisManager->CreateNtupleFColumn("EDEP");
0111 analysisManager->CreateNtupleFColumn("EDEC");
0112 analysisManager->CreateNtupleFColumn("EHDC");
0113 analysisManager->FinishNtuple();
0114
0115
0116
0117
0118
0119 for (G4int i = 0; i<28; ++i) {
0120 G4String idString = "h" + std::to_string( i+100 );
0121 G4String ntupletagString = "Energy Deposit in Hcal Layer" + std::to_string( i ) + " in GeV";
0122 analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 1.0 );
0123 }
0124
0125 for (G4int i = 0; i<49; ++i) {
0126 G4String idString = "h" + std::to_string( i+200 );
0127 G4String ntupletagString = "Energy Deposit in Ecal Tower" + std::to_string( i ) + " in GeV";
0128 analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 1.0 );
0129 }
0130
0131 analysisManager->CreateH1( "h4000", "Total energy deposited in GeV", 100, 0., 100.0 );
0132
0133
0134 for (G4int i=0; i<numberOfTimeSlices; ++i){
0135 G4String idString = "h" + std::to_string( i+300 );
0136 G4String ntupletagString = "Time slice " + std::to_string( i ) + " nsec energy profile in GeV";
0137 analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 100.0 );
0138 }
0139
0140
0141 for (G4int i = 0; i<70; ++i) {
0142 G4String idString = "h" + std::to_string( i+500 );
0143 G4String ntupletagString = "Lateral energy profile at " + std::to_string( i ) + " cm in GeV";
0144 analysisManager->CreateH1( idString.c_str(), ntupletagString.c_str(), 100, 0., 10.0 );
0145 }
0146
0147
0148 analysisManager->CreateH1( "h901", "Time Profile in Sensitive Detector", 200, 0., 200. );
0149 analysisManager->CreateH1( "h902", "Time Profile in Sensitive+Passive", 200, 0., 200. );
0150
0151 return;
0152 }