68 {
69 Initialize();
70
71 m_besEmcDigitsCollection =
73 G4DigiManager* DigiMan = G4DigiManager::GetDMpointer();
74
75
76 G4int EHCID;
77 EHCID = DigiMan->GetHitsCollectionID( "BesEmcHitsCollection" );
78
79
82
83 if ( EHC )
84 {
85
86 m_crystalGroup = new vector<CrystalSingle*>;
88 G4int size = m_crystalGroup->size();
89 CrystalSingle* cryst;
90 G4int partId, nTheta,
nPhi, nHits;
91 G4double eTot = 0, eDigi;
92 BesEmcHit* hit;
93
94 G4double coherentNoise = RandGauss::shoot() * m_G4Svc->EmcCoherentNoise();
95
96 for ( G4int i = 0; i < size; i++ )
97 {
98 cryst = ( *m_crystalGroup )[i];
104 eTot += eDigi;
105
106 BesEmcDigi* digi = new BesEmcDigi;
109
110 const int indexSize = 200;
111 G4double e[indexSize];
112 for ( G4int i = 0; i < indexSize; i++ ) e[i] = 0;
113 G4int index = 0;
115
116 for ( G4int j = 0; j < nHits; j++ )
117 {
121 if ( index < indexSize && index >= 0 ) e[index] +=
energy;
122 else G4cout << "Track index overload!" << G4endl;
123 }
124
125 G4double maxi = e[0];
126 for ( G4int i = 1; i < indexSize; i++ )
127 {
128 if ( e[i] > maxi )
129 {
130 maxi = e[i];
131 index = i;
132 }
133 }
134
135 if ( eDigi > 0 )
136 {
141 digi->
SetTime( m_G4Svc->EmcTime() );
143
145 if ( m_G4Svc->EmcNoiseLevel() > 0 )
146 wave->
addElecNoise( m_G4Svc->EmcIncoherentNoise(), coherentNoise );
147
148
149 m_energy = wave->
max(
bin );
150
151 m_energy -= 0.46 * MeV;
154
155 if ( m_G4Svc->EmcLightOutput() )
156 {
157 G4int index = m_emcCalibConstSvc->getIndex( partId, nTheta,
nPhi );
158 G4double adc2e = m_emcCalibConstSvc->getDigiCalibConst( index );
159
160 G4double CrystalDeadEcut = m_emcCalibConstSvc->getCrystalDeadEcut( index );
161
162 if ( m_G4Svc->EmcElecSaturation() == 1 )
163 {
164 G4double emaxData = m_emcCalibConstSvc->getCrystalEmaxData( index );
165
166 if ( emaxData > 0 ) { adc2e = emaxData / 2.5; }
167 }
168
169 if ( adc2e <= 1e-5 )
170 { m_energy = 0; }
171 else if ( m_G4Svc->EmcElecSatuDead() == 1 && CrystalDeadEcut > 0 &&
172 m_energy / 1000.0 > CrystalDeadEcut )
173
174 {
175
176
177 m_energy = 0;
178 }
179 else
180 {
181
182 m_energy /= adc2e;
183
184
185 }
186 }
187
188
189 if ( m_G4Svc->EmcRootFlag() )
190 {
191 m_partId = partId;
192 m_nTheta = nTheta;
194 m_eDep = eDigi;
195 m_nHits = nHits;
196 m_adc = m_energy;
198 m_tupleEmc1->write();
199 }
200
204 m_besEmcDigitsCollection->insert( digi );
205 }
206 }
207
208
209 if ( m_G4Svc->EmcNoiseLevel() == 2 )
AddNoise5x5( coherentNoise );
210 else if ( m_G4Svc->EmcNoiseLevel() == 3 )
211 ;
212
213
214
215 if ( m_G4Svc->EmcRootFlag() )
216 {
217 m_eTot = eTot;
218 m_nDigi = size;
219 m_tupleEmc2->write();
220 }
221
222 StoreDigiCollection( m_besEmcDigitsCollection );
223
224 for ( size_t i = 0; i < m_crystalGroup->size(); i++ ) { delete ( *m_crystalGroup )[i]; }
225 m_crystalGroup->clear();
226 delete m_crystalGroup;
227 }
228}
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
G4THitsCollection< BesEmcHit > BesEmcHitsCollection
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP 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()