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 if(adc2e<=1e-5)
167 {
168 m_energy = 0;
169 }
170 else
171 {
172 m_energy /= adc2e;
173
174 }
175 }
176
177
179 {
180 m_partId = partId;
181 m_nTheta = nTheta;
183 m_eDep = eDigi;
184 m_nHits = nHits;
185 m_adc = m_energy;
187 m_tupleEmc1->write();
188 }
189
193 m_besEmcDigitsCollection->insert(digi);
194 }
195 }
196
197
201 ;
202
203
204
206 {
207 m_eTot = eTot;
208 m_nDigi = size;
209 m_tupleEmc2->write();
210 }
211
212 StoreDigiCollection(m_besEmcDigitsCollection);
213
214 for(size_t i=0;i<m_crystalGroup->size();i++)
215 {
216 delete (*m_crystalGroup)[i];
217 }
218 m_crystalGroup->clear();
219 delete m_crystalGroup;
220 }
221}
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