70 m_beamTime = m_G4Svc->GetBeamTime() *
ns;
73 G4DigiManager* digiManager = G4DigiManager::GetDMpointer();
75 G4int THCID = digiManager->GetHitsCollectionID(
"BesTofHitsCollection" );
81 G4int partId, scinNb, nHits;
93 for ( G4int j = 0; j < nHits; j++ )
104 if ( ( partId == 1 && temp0 > 0 && temp1 > 0 ) || ( ( partId != 1 ) && temp0 > 0 ) )
138 G4double cvelScint = c_light / m_refIndexEc;
140 G4ThreeVector pos = hit->
GetPos();
143 G4double edep = hit->
GetEdep();
146 G4double timeFlight = hit->
GetTime() - m_beamTime;
154 G4double nx = pDirection.x();
155 G4double ny = pDirection.y();
156 G4double nz = pDirection.z();
163 NphStep = G4int( edep * m_phNConstEc * m_Cpe2pmtEc * 0.66 * m_QEEc * m_CEEc * m_peCorFacEc );
168 for ( G4int i = 0; i < NphStep; i++ )
171 ddS = stepL * G4UniformRand();
172 ddT = deltaT * G4UniformRand();
173 G4ThreeVector emtPos;
174 emtPos.setX( pos.x() + nx * ddS );
175 emtPos.setY( pos.y() + ny * ddS );
176 emtPos.setZ( pos.z() + nz * ddS );
182 DirectPh( partId, emtPos, pathL, forb );
185 G4double ran = G4UniformRand();
186 if ( pathL > 0 &&
exp( -pathL / m_attenEc ) > ran )
189 G4double scinSwim = pathL / cvelScint;
197 G4double endTime = timeFlight + ddT + scinSwim + scinTime + transitTime;
203 if ( m_t1st[forb] > endTime ) m_t1st[forb] = endTime;
204 if ( m_tLast[forb] < endTime ) m_tLast[forb] = endTime;
215 G4double cos_spanEc = 1;
218 ran = G4UniformRand();
220 G4double dcosEc = cos_spanEc * ( ran * 2.0 - 1.0 );
221 G4double r2 = sqrt( emtPos.x() * emtPos.x() + emtPos.y() * emtPos.y() );
222 if ( dcosEc > 0.0 && dcosEc != 1 )
225 pathL = ( r2 - m_ecR1 ) / ( 1.0 - dcosEc );
227 else if ( dcosEc < 0 && dcosEc != -1 )
230 pathL = ( 2 * 838 - r2 - m_ecR1 ) / ( 1.0 + dcosEc );
235 G4double tmp_tauRatio, tmp_tau1, tmp_tau2, tmp_tau3;
236 tmp_tauRatio = m_tauRatioEc;
241 G4double UniformR = tmp_tauRatio / ( 1 + tmp_tauRatio );
242 G4double EmissionTime;
243 if ( G4UniformRand() > UniformR )
247 EmissionTime = -tmp_tau2 * log( G4UniformRand() );
248 if ( G4UniformRand() -
exp( EmissionTime / tmp_tau2 - EmissionTime / tmp_tau1 ) > 1.E-8 )
252 else EmissionTime = -tmp_tau3 * log( G4UniformRand() );
302 static G4int istore_snpe = -1;
306 G4double tau = m_riseTimeEc;
307 G4double norma_const = sqrt(
M_PI ) * tau * tau * tau / 4.0;
308 G4double echarge = 1.6e-7;
317 if ( istore_snpe < 0 )
322 t = ( i + 1 ) * m_timeBinSize;
323 snpe[i] = m_PMTgainEc * m_CeEc *
t *
t *
exp( -(
t / tau ) * (
t / tau ) ) / norma_const;
329 for ( G4int j = 0; j < 2; j++ )
334 for ( G4int j = 0; j < fb; j++ )
336 if ( m_totalPhot[j] > 0 )
338 n1 = G4int( m_t1st[j] / m_timeBinSize );
339 n2 = G4int( m_tLast[j] / m_timeBinSize );
345 for ( G4int i =
n1; i <
n2; i++ )
347 phtn = m_nPhot[i][j];
361 if ( profPmt[i][j] > 0 )
363 m_preGainEc * profPmt[i][j] + G4RandGauss::shoot( 0, m_noiseSigmaEc );
370 if ( profPmt[i][j] >
max )
max = profPmt[i][j];
373 G4double tmp_HLthresh, tmp_LLthresh;
376 tmp_HLthresh = m_HLthreshEc;
377 tmp_LLthresh = m_LLthreshEc;
381 tmp_HLthresh = m_HLthreshEc;
382 tmp_LLthresh = m_LLthreshEc;
386 if (
max >= tmp_HLthresh )
390 if ( profPmt[i][j] >= tmp_LLthresh )
392 m_TDC[j] = i * m_timeBinSize;
393 m_ADC[j] = m_preGainEc * m_totalPhot[j] * echarge * m_PMTgainEc;