151 G4double cvelScint=c_light/m_refIndexEc;
153 G4ThreeVector pos=hit->
GetPos();
159 G4double timeFlight=hit->
GetTime()-m_beamTime;
167 G4double nx=pDirection.x();
168 G4double ny=pDirection.y();
169 G4double nz=pDirection.z();
176 NphStep=G4int(edep*m_phNConstEc*m_Cpe2pmtEc*0.66*m_QEEc*m_CEEc*m_peCorFacEc);
181 for (G4int i=0;i<NphStep;i++)
184 ddS=stepL*G4UniformRand();
185 ddT=deltaT*G4UniformRand();
186 G4ThreeVector emtPos;
187 emtPos.setX(pos.x() + nx*ddS);
188 emtPos.setY(pos.y() + ny*ddS);
189 emtPos.setZ(pos.z() + nz*ddS);
195 DirectPh(partId, emtPos, pathL, forb);
198 G4double ran=G4UniformRand();
199 if (pathL>0 &&
exp(-pathL/m_attenEc) > ran)
202 G4double scinSwim=pathL/cvelScint;
210 G4double endTime= timeFlight + ddT + scinSwim + scinTime + transitTime;
216 if (m_t1st[forb]>endTime) m_t1st[forb] = endTime;
217 if (m_tLast[forb]<endTime) m_tLast[forb]= endTime;
229 G4double cos_spanEc = 1;
234 G4double dcosEc = cos_spanEc*(ran*2.0-1.0);
235 G4double r2=sqrt(emtPos.x()*emtPos.x()+emtPos.y()*emtPos.y());
236 if (dcosEc > 0.0 && dcosEc != 1)
239 pathL = (r2-m_ecR1)/(1.0-dcosEc);
241 else if (dcosEc < 0 && dcosEc != -1)
244 pathL=(2*838-r2-m_ecR1)/(1.0+dcosEc);
250 G4double tmp_tauRatio,tmp_tau1,tmp_tau2,tmp_tau3;
251 tmp_tauRatio = m_tauRatioEc;
256 G4double UniformR = tmp_tauRatio/(1+tmp_tauRatio);
257 G4double EmissionTime;
258 if (G4UniformRand()>UniformR) {
260 EmissionTime = -tmp_tau2*log( G4UniformRand() );
261 if (G4UniformRand()-
exp(EmissionTime/tmp_tau2-EmissionTime/tmp_tau1)>1.E-8)
265 else EmissionTime = -tmp_tau3*log( G4UniformRand() );
318 static G4int istore_snpe=-1;
322 G4double tau = m_riseTimeEc;
323 G4double norma_const=sqrt(
M_PI)*tau*tau*tau/4.0;
324 G4double echarge=1.6e-7;
338 t=(i+1)*m_timeBinSize;
339 snpe[i]=m_PMTgainEc*m_CeEc*
t*
t*
exp(- (
t/tau) * (
t/tau) )/norma_const;
345 for (G4int j=0;j<2;j++)
350 for (G4int j=0; j<fb; j++)
352 if (m_totalPhot[j] > 0)
354 n1=G4int(m_t1st[j]/m_timeBinSize);
355 n2=G4int(m_tLast[j]/m_timeBinSize);
362 for (G4int i=
n1;i<
n2;i++)
371 profPmt[ii][j] += phtn*snpe[ihst];
380 profPmt[i][j] = m_preGainEc*profPmt[i][j]+G4RandGauss::shoot(0,m_noiseSigmaEc);
387 if (profPmt[i][j]>
max)
391 G4double tmp_HLthresh, tmp_LLthresh;
393 tmp_HLthresh = m_HLthreshEc;
394 tmp_LLthresh = m_LLthreshEc;
397 tmp_HLthresh = m_HLthreshEc;
398 tmp_LLthresh = m_LLthreshEc;
402 if (
max>=tmp_HLthresh)
406 if ( profPmt[i][j] >= tmp_LLthresh )
408 m_TDC[j] = i*m_timeBinSize;
409 m_ADC[j] = m_preGainEc*m_totalPhot[j]*echarge*m_PMTgainEc;