43 #include "G4HCofThisEvent.hh"
60 isInitialized(false),SDnames(0),numberOfSD(0) {
62 primaryGenerator =
pg;
68 instanciateSteppingAction();
72 G4cout <<
"end of instantiation of EndofEventAction" <<
G4endl;
86 void CCalEndOfEventAction::initialize() {
91 G4cout <<
"CCalEndOfEventAction look for " << numberOfSD
92 <<
" calorimeter-like SD" <<
G4endl;
99 for (
int i=0; i<numberOfSD; i++) {
102 G4cout <<
"CCalEndOfEventAction: found SD " << i <<
" name "
117 G4cout << G4endl <<
"=== Begin of EndOfEventAction === " <<
G4endl;
120 if (!isInitialized) initialize();
122 theSteppingAction->endOfEvent();
130 G4cout <<
"CCalEndOfEventAction: No Hit Collection in this event"
141 float hcalE[28], ecalE[49], fullE=0., edec=0, edhc=0;
143 for (i = 0; i < 28; i++) {hcalE[i]=0.;}
144 for (i = 0; i < 49; i++) {ecalE[i]=0.;}
146 float*
edep =
new float[numberOfSD];
148 for (i = 0; i < numberOfSD; i++){
164 G4cout <<
" There are " << nentries <<
" hits in " << SDnames[i]
179 if (unitID > 0 && unitID < 29) {
183 int i0 = unitID/4096;
184 int i1 = (unitID/64)%64;
186 if (i0 == 1 && i1 < 8 && i2 < 8) {
192 G4cout <<
" with Energy = " << En/
MeV <<
" MeV in Unit " << unitID
200 G4cout <<
" ===> Total Energy Deposit in this Calorimeter = "
201 << edep[i]*1000.0 <<
" MeV " <<
G4endl;
206 if (SDnames[i] ==
"HadronCalorimeter") {
208 }
else if (SDnames[i] ==
"CrystalMatrix") {
215 #ifdef G4ANALYSIS_USE
218 float x = pos.
x()/
mm;
219 float y = pos.
y()/
mm;
220 float z = pos.
z()/
mm;
222 CCalAnalysis* analysis = CCalAnalysis::getInstance();
223 analysis->InsertEnergy(fullE);
224 analysis->InsertEnergyHcal(hcalE);
225 analysis->InsertEnergyEcal(ecalE);
226 analysis->setNtuple(hcalE, ecalE, ener, x, y, z, fullE, edec, edhc);
227 analysis->EndOfEvent(nhit);
228 for (i = 0; i < numberOfSD; i++){
249 void CCalEndOfEventAction::instanciateSteppingAction(){
255 G4cout <<
" CCalEndOfEventAction::instanciateSteppingAction creates"
256 <<
" CCalSteppingAction" <<
G4endl;