Warning, file /geant4/examples/advanced/underground_physics/src/DMXRunAction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #include "DMXRunActionMessenger.hh"
0047 #include "DMXRunAction.hh"
0048
0049 #include "G4Run.hh"
0050 #include "G4ios.hh"
0051 #include "G4AnalysisManager.hh"
0052
0053 #include <fstream>
0054
0055
0056
0057 DMXRunAction::DMXRunAction()
0058 {
0059 runMessenger = new DMXRunActionMessenger(this);
0060 savehitsFile = "hits.out";
0061 savepmtFile = "pmt.out";
0062 savehistFile = "dmx";
0063 }
0064
0065
0066
0067 DMXRunAction::~DMXRunAction()
0068 {
0069 delete runMessenger;
0070 runMessenger = 0;
0071
0072 }
0073
0074
0075
0076 void DMXRunAction::BeginOfRunAction(const G4Run* aRun)
0077 {
0078
0079 if (IsMaster())
0080 G4cout << "### Run " << aRun->GetRunID() << " starts (master)." << G4endl;
0081 else
0082 G4cout << "### Run " << aRun->GetRunID() << " starts (worker)." << G4endl;
0083
0084
0085 Book();
0086
0087 }
0088
0089
0090
0091 void DMXRunAction::EndOfRunAction(const G4Run*)
0092 {;}
0093
0094
0095
0096 void DMXRunAction::Book()
0097 {
0098
0099 G4AnalysisManager* man = G4AnalysisManager::Instance();
0100 man->SetDefaultFileType("root");
0101
0102 man->SetNtupleMerging(true);
0103
0104
0105 man->OpenFile(savehistFile);
0106 man->SetFirstHistoId(1);
0107 man->SetFirstNtupleId(1);
0108
0109
0110
0111
0112 man->CreateNtuple("tree1", "Particle Source Energy");
0113 man->CreateNtupleDColumn("energy");
0114 man->FinishNtuple();
0115
0116
0117
0118 man->CreateNtuple("tree2", "Scintillation Hits Info");
0119 man->CreateNtupleDColumn("Event");
0120 man->CreateNtupleDColumn("e_prim");
0121 man->CreateNtupleDColumn("tot_e");
0122 man->CreateNtupleDColumn("s_hits");
0123 man->CreateNtupleDColumn("xe_time");
0124 man->CreateNtupleDColumn("num_ph");
0125 man->CreateNtupleDColumn("avphtime");
0126 man->CreateNtupleDColumn("firstpart");
0127 man->CreateNtupleDColumn("firstparte");
0128 man->CreateNtupleDColumn("gamma");
0129 man->CreateNtupleDColumn("neutron");
0130 man->CreateNtupleDColumn("posi");
0131 man->CreateNtupleDColumn("elec");
0132 man->CreateNtupleDColumn("other");
0133 man->CreateNtupleDColumn("seed1");
0134 man->CreateNtupleDColumn("seed2");
0135 man->FinishNtuple();
0136
0137
0138
0139 man->CreateNtuple("tree3", "PMT Hits Info");
0140 man->CreateNtupleDColumn("event");
0141 man->CreateNtupleDColumn("hits");
0142 man->CreateNtupleDColumn("xpos");
0143 man->CreateNtupleDColumn("ypos");
0144 man->CreateNtupleDColumn("zpos");
0145 man->FinishNtuple();
0146
0147
0148 man->CreateH1("h1","Source Energy /keV", 1000,0.,10000.);
0149 man->CreateH1("h2","Energy Deposit /keV", 1000,0.,1000.);
0150 man->CreateH1("h3","Nuclear Recoil Edep /keV", 100,0.,100.);
0151 man->CreateH1("h4","Number of Photons - LowE", 200,0.,200.);
0152 man->CreateH1("h5","Number of Photons - HighE", 100,0.,10000.);
0153 man->CreateH1("h6","Average Photon Arrival/ns", 200,0.,200.);
0154 man->CreateH1("h7","1st event Photon Arrival", 200,0.,200.);
0155 man->CreateH1("h8","Gamma Energy Deposit/keV", 1000,0.,1000.);
0156 man->CreateH1("h9","Neutron Ener Deposit/keV", 1000,0.,1000.);
0157 man->CreateH1("h10","Electron Ener Deposit/keV",1000,0.,1000.);
0158 man->CreateH1("h11","Positron Ener Deposit/keV",1000,0.,1000.);
0159 man->CreateH1("h12","Other Ener Deposit/keV", 1000,0.,1000.);
0160
0161
0162 man->CreateH2("hh1","PMT Hit Pattern",
0163 300 ,-30.,30.,300,-30.,30.);
0164 man->CreateH2("hh2","1st event PMT Hit Pattern",
0165 300 ,-30.,30.,300,-30.,30.);
0166
0167 return;
0168
0169 }
0170
0171