14#include "G4EventManager.hh"
15#include "G4HCofThisEvent.hh"
16#include "G4VHitsCollection.hh"
17#include "G4SDManager.hh"
19#include "G4UnitsTable.hh"
23 :calorimeterCollID(-1),fNHits(0),fTotECrystal(0),fTotLCrystal(0),
27 {
for(
int j=0;j<150;j++)
28 fSingleECrystal[i][j]=0;
30 G4SDManager * SDman = G4SDManager::GetSDMpointer();
31 calorimeterCollID= SDman->GetCollectionID(
"CalCollection");
36 delete[]fEnergySignal;
37 delete[]fNThetaSignal;
43 G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
54 fNHits = CHC->entries();
56 for (i=0;i<fNHits;i++)
58 fTotECrystal += (*CHC)[i]->GetEdepCrystal();
59 fTotLCrystal += (*CHC)[i]->GetTrakCrystal();
60 G4int nTheta=45-(*CHC)[i]->GetNumThetaCrystal();
61 G4int
nPhi =(*CHC)[i]->GetNumPhiCrystal();
62 if(nTheta>0&&nTheta<50&&nPhi>0&&
nPhi<150)
64 fSingleECrystal[nTheta][
nPhi]+=(*CHC)[i]->GetEdepCrystal();
70 G4cout <<
"EMC Hit out range:"
71 << nTheta <<
','<<
nPhi << G4endl;
81 if(fSingleECrystal[i][j]>ecut)
87 if((fEnergySignal=
new G4double[fNCrystalSignal+1])==
NULL||
88 (fNThetaSignal=
new G4int[fNCrystalSignal+1])==
NULL||
89 (fNPhiSignal=
new G4int[fNCrystalSignal+1])==
NULL)
92 G4cout<<
"BesEmcDigitization:can't allocate memory for Signal"<<G4endl;
99 if(fSingleECrystal[i][j]>ecut)
102 fEnergySignal[
n]=fSingleECrystal[i][j];
103 fNThetaSignal[
n]=45-i;
114 if(nTheta>0&&nTheta<50&&nPhi>0&&
nPhi<150)
115 return fSingleECrystal[nTheta][
nPhi];
123 <<
" Absorber: total energy: "
124 << fTotECrystal/GeV <<
" GeV" << G4endl
125 <<
" total track length: "
126 << fTotLCrystal/cm <<
" cm" << G4endl;
128 G4cout <<
"\n " << fNHits
129 <<
" hits are stored in BesEmcHitsCollection." << G4endl;
G4THitsCollection< BesEmcHit > BesEmcHitsCollection
G4double GetEmcSignal(G4int, G4int)
G4bool Digitize(const G4Event *, G4double)