70{
71 Initialize();
72
73
75 ("BesEmcDigitizer","BesEmcDigitsCollection");
76 G4DigiManager* DigiMan = G4DigiManager::GetDMpointer();
77
78
79
80 G4int EHCID;
81 EHCID = DigiMan->GetHitsCollectionID("BesEmcHitsCollection");
82
83
86
87 if (EHC)
88 {
89
90 m_crystalGroup = new vector<CrystalSingle*>;
92 G4int size=m_crystalGroup->size();
94 G4int partId, nTheta,
nPhi, nHits;
95 G4double eTot=0, eDigi;
97
99
100 for(G4int i=0;i<size;i++)
101 {
102 cryst = (*m_crystalGroup)[i];
108 eTot += eDigi;
109
113
114 const int indexSize = 200;
115 G4double e[indexSize];
116 for(G4int i=0;i<indexSize;i++)
117 e[i]=0;
118 G4int index=0;
120
121 for(G4int j=0;j<nHits;j++)
122 {
126 if(index<indexSize&&index>=0)
128 else
129 G4cout<<"Track index overload!"<<G4endl;
130 }
131
132 G4double maxi=e[0];
133 for(G4int i=1;i<indexSize;i++)
134 {
135 if(e[i]>maxi)
136 {
137 maxi = e[i];
138 index = i;
139 }
140 }
141
142 if(eDigi>0)
143 {
150
154
155
156 m_energy = wave->
max(
bin);
157
158 m_energy -= 0.46*MeV;
161
163 {
164 G4int index = m_emcCalibConstSvc->
getIndex(partId,nTheta,
nPhi);
166
167
170
171 if (emaxData>0) {
172
173 adc2e=emaxData/2.5;
174 }
175 }
176
177 if(adc2e<=1e-5)
178 {
179 m_energy = 0;
180 }
181 else
182 {
183
184 m_energy /= adc2e;
185
186
187
188 }
189 }
190
191
193 {
194 m_partId = partId;
195 m_nTheta = nTheta;
197 m_eDep = eDigi;
198 m_nHits = nHits;
199 m_adc = m_energy;
201 m_tupleEmc1->write();
202 }
203
207 m_besEmcDigitsCollection->insert(digi);
208 }
209 }
210
211
215 ;
216
217
218
220 {
221 m_eTot = eTot;
222 m_nDigi = size;
223 m_tupleEmc2->write();
224 }
225
226 StoreDigiCollection(m_besEmcDigitsCollection);
227
228 for(size_t i=0;i<m_crystalGroup->size();i++)
229 {
230 delete (*m_crystalGroup)[i];
231 }
232 m_crystalGroup->clear();
233 delete m_crystalGroup;
234 }
235}
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
G4THitsCollection< BesEmcHit > BesEmcHitsCollection
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
virtual void AddNoise5x5(G4double coherentNoise)
virtual void GroupHits(BesEmcHitsCollection *)
G4double GetEdepCrystal()
vector< G4int > * GetHitIndexes()
double EmcCoherentNoise()
virtual double getDigiCalibConst(int No) const =0
virtual int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const =0
virtual double getCrystalEmaxData(int Index) const =0