43 #include "G4HCofThisEvent.hh"
60 primaryGenerator =
pg;
66 instanciateSteppingAction();
70 G4cout <<
"end of instantiation of EndofEventAction" <<
G4endl;
84 void CCalEndOfEventAction::initialize() {
89 G4cout <<
"CCalEndOfEventAction look for " << numberOfSD
90 <<
" calorimeter-like SD" <<
G4endl;
97 for (
int i=0; i<numberOfSD; i++) {
100 G4cout <<
"CCalEndOfEventAction: found SD " << i <<
" name "
115 G4cout << G4endl <<
"=== Begin of EndOfEventAction === " <<
G4endl;
118 if (!isInitialized) initialize();
120 theSteppingAction->endOfEvent();
128 G4cout <<
"CCalEndOfEventAction: No Hit Collection in this event"
139 float hcalE[28], ecalE[49], fullE=0., edec=0, edhc=0;
141 for (i = 0; i < 28; i++) {hcalE[i]=0.;}
142 for (i = 0; i < 49; i++) {ecalE[i]=0.;}
144 float* edep =
new float[numberOfSD];
146 for (i = 0; i < numberOfSD; i++){
162 G4cout <<
" There are " << nentries <<
" hits in " << SDnames[i]
169 for (j=0; j<nentries; j++){
177 if (unitID > 0 && unitID < 29) {
181 int i0 = unitID/4096;
182 int i1 = (unitID/64)%64;
184 if (i0 == 1 && i1 < 8 && i2 < 8) {
190 G4cout <<
" with Energy = " << En/
MeV <<
" MeV in Unit " << unitID
198 G4cout <<
" ===> Total Energy Deposit in this Calorimeter = "
199 << edep[i]*1000.0 <<
" MeV " <<
G4endl;
204 if (SDnames[i] ==
"HadronCalorimeter") {
206 }
else if (SDnames[i] ==
"CrystalMatrix") {
215 float x = pos.
x()/
mm;
216 float y = pos.
y()/
mm;
217 float z = pos.
z()/
mm;
223 analysis->
setNtuple(hcalE, ecalE, ener, x, y, z, fullE, edec, edhc);
225 for (i = 0; i < numberOfSD; i++){
233 for (
G4int k=0; k<nentries; k++) {
245 void CCalEndOfEventAction::instanciateSteppingAction(){
251 G4cout <<
" CCalEndOfEventAction::instanciateSteppingAction creates"
252 <<
" CCalSteppingAction" <<
G4endl;
static constexpr double mm
G4VHitsCollection * GetHC(G4int i)
G4int GetCollectionID(G4String colName)
void setNtuple(float *hcalE, float *ecalE, float elab, float x, float y, float z, float edep, float edec, float edhc)
static CCalSDList * getInstance()
virtual void StartOfEventAction(const G4Event *evt)
void InsertEnergyHcal(float *)
double getEnergyDeposit() const
const G4UserSteppingAction * GetUserSteppingAction() const
void InsertEnergyEcal(float *)
virtual void EndOfEventAction(const G4Event *evt)
G4ThreeVector GetParticlePosition()
G4GLOB_DLL std::ostream G4cout
CCalEndOfEventAction(CCalPrimaryGeneratorAction *)
double getTimeSlice() const
void InsertEnergy(float v)
void EndOfEvent(G4int flag)
static G4RunManager * GetRunManager()
Alternative here is a XML file.
static CCalAnalysis * getInstance()
static G4SDManager * GetSDMpointer()
static constexpr double GeV
unsigned int getUnitID() const
static constexpr double MeV
G4HCofThisEvent * GetHCofThisEvent() const
G4double GetParticleEnergy()
void InsertTimeProfile(int, double, double)
static const G4double pos
virtual void SetUserAction(G4UserRunAction *userAction)