41{
42 G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
44
45 if (HCE)
47 else
48 return false;
49
50 G4int i=0,j=0;
51 if (CHC)
52 {
53 fNHits = CHC->entries();
54 if(fNHits)
55 for (i=0;i<fNHits;i++)
56 {
57 fTotECrystal += (*CHC)[i]->GetEdepCrystal();
58 fTotLCrystal += (*CHC)[i]->GetTrakCrystal();
59 G4int nTheta=45-(*CHC)[i]->GetNumThetaCrystal();
60 G4int
nPhi =(*CHC)[i]->GetNumPhiCrystal();
61 if(nTheta>0&&nTheta<50&&nPhi>0&&
nPhi<150)
62 {
63 fSingleECrystal[nTheta][
nPhi]+=(*CHC)[i]->GetEdepCrystal();
64
65
66 }
67 else
68 {
69 G4cout << "EMC Hit out range:"
70 << nTheta <<
','<<
nPhi << G4endl;
71 }
72 }
73 }
74 else
75 return false;
76
77 for(i=1;i<50;i++)
78 {for(j=1;j<150;j++)
79 {
80 if(fSingleECrystal[i][j]>ecut)
81 {
82 fNCrystalSignal++;
83 }
84 }
85 }
86 if((fEnergySignal=new G4double[fNCrystalSignal+1])==NULL||
87 (fNThetaSignal=new G4int[fNCrystalSignal+1])==NULL||
88 (fNPhiSignal=new G4int[fNCrystalSignal+1])==NULL)
89 {
90 G4Exception("BesEmcDigitization:can't allocate memory for Signal");
91 }
92 G4int n=0;
93 for(i=1;i<50;i++)
94 {for(j=1;j<150;j++)
95 {
96 if(fSingleECrystal[i][j]>ecut)
97 {
98 n++;
99 fEnergySignal[n]=fSingleECrystal[i][j];
100 fNThetaSignal[n]=45-i;
101 fNPhiSignal [n]=j;
102 }
103 }
104 }
105
106 return true;
107}
G4THitsCollection< BesEmcHit > BesEmcHitsCollection