252 G4double cvelScint=c_light/m_refIndex/1.07;
254 G4ThreeVector pos=hit->
GetPos();
260 G4double timeFlight=hit->
GetTime()-m_beamTime;
269 G4double nx=pDirection.x();
270 G4double ny=pDirection.y();
271 G4double nz=pDirection.z();
283 G4double thetaProb=1-
cos( asin(1.43/m_refIndex));
287 G4double nMean, nPhoton;
290 G4int runId = m_RealizationSvc->
getRunId();
291 if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-1000000 && runId<=-23463 ) ) {
298 G4double resolutionScale=1.;
299 G4double
sigma=resolutionScale*sqrt(nMean);
300 nPhoton=G4int(G4RandGauss::shoot(nMean,
sigma)+0.5);
303 nPhoton=G4int(G4Poisson(nMean));
308 NphStep=G4int(nPhoton*thetaProb*m_rAngle*m_QE*m_CE*m_peCorFac);
324 for (G4int i=0;i<NphStep;i++)
327 ddS=stepL*G4UniformRand();
328 ddT=deltaT*G4UniformRand();
329 G4ThreeVector emtPos;
330 emtPos.setX(pos.x() + nx*ddS);
331 emtPos.setY(pos.y() + ny*ddS);
332 emtPos.setZ(pos.z() + nz*ddS);
338 DirectPh(partId, emtPos, pathL, forb);
343 G4double ran = G4UniformRand();
347 attenL = 10.*attenL/0.75;
349 if (pathL>0 &&
exp(-pathL/attenL) > ran)
352 G4double scinSwim=pathL/cvelScint;
360 G4double endTime= timeFlight + ddT + scinSwim + scinTime + transitTime;
378 if (m_t1st[forb]>endTime) m_t1st[forb] = endTime;
379 if (m_tLast[forb]<endTime) m_tLast[forb]= endTime;
418 G4double I1,I2,I3,rp1,rs1,rp2,rs2,Rp1,Rs1,Rp2,Rs2,Rp,Rs;
431 I3=asin(
sin(I1)*(
n1/n3));
436 Rp=(Rp1+Rp2-2*Rp1*Rp2)/(1-Rp1*Rp2);
437 Rs=(Rs1+Rs2-2*Rs1*Rs2)/(1-Rs1*Rs2);
466 const static G4double silicon_oil_index = 1.43;
467 const static G4double glass_index = 1.532;
470 G4double cos_span=1-
cos( asin(silicon_oil_index/m_refIndex) );
475 dcos=cos_span*(ran*2.0-1.0);
477 G4double r2=sqrt(emtPos.x()*emtPos.x()+emtPos.y()*emtPos.y());
480 G4double theta,thetaR;
484 thetaR=asin(1/m_refIndex);
487 G4double ratio1Mean=(CLHEP::pi)*25.5*25.5/(57.1+60.7)/25.0;
488 G4double ratio2Mean=(19.5/25.5)*(19.5/25.5);
489 G4double ratio1=G4RandGauss::shoot(ratio1Mean,0.015);
490 G4double ratio2=G4RandGauss::shoot(ratio2Mean,0.015);
491 G4double ratio3Mean=0.945*ratio1Mean*ratio2Mean;
492 G4double ratio3=G4RandGauss::shoot(ratio3Mean,0.015);
494 G4double R2=1-
Reflectivity(m_refIndex,silicon_oil_index, glass_index, theta);
495 if (dcos > 0 && dcos != 1)
499 if (G4UniformRand()<ratio1)
501 if (G4UniformRand()<R2)
503 if (G4UniformRand()<ratio2)
506 pathL=(m_scinLength/2-emtPos.z())/
costheta;
511 if (G4UniformRand()<ratio3)
514 pathL=(1.5*m_scinLength-emtPos.z())/
costheta;
520 if (G4UniformRand()<R1)
522 G4double tempran=G4UniformRand();
526 pathL=(1.5*m_scinLength-emtPos.z())/
costheta;
528 else if (tempran>ratio1&&G4UniformRand()<R1&&G4UniformRand()<ratio3)
531 pathL=(2.5*m_scinLength-emtPos.z())/
costheta;
538 if (G4UniformRand()<ratio1)
540 if (G4UniformRand()<R2)
542 if (G4UniformRand()<ratio2)
545 pathL=(m_scinLength/2-emtPos.z())/
costheta;
550 if (G4UniformRand()<ratio3)
553 pathL=(1.5*m_scinLength-emtPos.z())/
costheta;
559 G4double tempran=G4UniformRand();
563 pathL=(1.5*m_scinLength-emtPos.z())/
costheta;
565 else if (tempran>ratio1 && G4UniformRand()<ratio3)
568 pathL=(2.5*m_scinLength-emtPos.z())/
costheta;
573 else if (dcos < 0 && dcos != -1)
577 if (G4UniformRand()<ratio1)
579 if (G4UniformRand()<R2)
581 if (G4UniformRand()<ratio2)
584 pathL=(m_scinLength/2+emtPos.z())/
costheta;
589 if (G4UniformRand()<ratio3)
592 pathL=(1.5*m_scinLength+emtPos.z())/
costheta;
598 if (G4UniformRand()<R1)
600 G4double tempran=G4UniformRand();
604 pathL=(1.5*m_scinLength+emtPos.z())/
costheta;
606 else if (tempran>ratio1&&G4UniformRand()<R1&&G4UniformRand()<ratio3)
609 pathL=(2.5*m_scinLength+emtPos.z())/
costheta;
616 if (G4UniformRand()<ratio1)
618 if (G4UniformRand()<R2)
620 if (G4UniformRand()<ratio2)
623 pathL=(m_scinLength/2+emtPos.z())/
costheta;
628 if (G4UniformRand()<ratio3)
631 pathL=(1.5*m_scinLength+emtPos.z())/
costheta;
637 G4double tempran=G4UniformRand();
641 pathL=(1.5*m_scinLength+emtPos.z())/
costheta;
643 else if (tempran>ratio1 && G4UniformRand()<ratio3)
646 pathL=(2.5*m_scinLength+emtPos.z())/
costheta;
652 G4double convFactor=180./3.1415926;
653 if (theta>asin(1)-thetaR)
655 G4double
alpha = G4UniformRand()*asin(1.);
656 G4int nRef1 = pathL*sintheta*
cos(
alpha)/50.0+0.5;
657 G4int nRef2 = pathL*sintheta*
sin(
alpha)/58.9+0.5;
658 G4double beta1=acos(sintheta*
cos(
alpha));
659 G4double beta2=acos(sintheta*
sin(
alpha));
660 beta2 -= 3.75/convFactor;
664 for (G4int i=0;i<nRef1;i++)
666 if (G4UniformRand()<(1-R21) && G4UniformRand()<0.15)
669 for (G4int i=0;i<nRef2;i++)
671 if (G4UniformRand()<(1-R22) && G4UniformRand()<0.15)
701 G4double tmp_tauRatio,tmp_tau1,tmp_tau2,tmp_tau3;
702 tmp_tauRatio = m_tauRatio;
706 G4double UniformR = tmp_tauRatio/(1+tmp_tauRatio);
707 G4double EmissionTime;
708 if (G4UniformRand()>UniformR) {
710 EmissionTime = -tmp_tau2*log( G4UniformRand() );
711 if (G4UniformRand()-
exp(EmissionTime/tmp_tau2-EmissionTime/tmp_tau1)>1.E-8)
715 else EmissionTime = -tmp_tau3*log( G4UniformRand() );
774 G4double norma_const;
775 G4double echarge=1.6e-7;
788 norma_const = sqrt(CLHEP::pi)*tau*tau*tau/4.0;
789 t = (i+1)*m_timeBinSize;
790 snpe[i][0] = m_Ce*
t*
t*
exp(- (
t/tau) * (
t/tau) )/norma_const;
796 norma_const = sqrt(CLHEP::pi)*tau*tau*tau/4.0;
797 t = (i+1)*m_timeBinSize;
798 snpe[i][1] = m_Ce*
t*
t*
exp(- (
t/tau) * (
t/tau) )/norma_const;
803 G4double pmtGain0,pmtGain,relativeGain,smearPMTgain;
804 G4double smearADC[2] = {0.,0.};
805 G4int runId = m_RealizationSvc->
getRunId();
821 G4double timeSmear = G4RandGauss::shoot(0,0.020);
822 if (runId>=-22913 && runId<=-20448) {
823 timeSmear = G4RandGauss::shoot(0,0.040);
825 else if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-1000000 && runId<=-23463 ) ) {
826 timeSmear = G4RandGauss::shoot(0,0.025);
829 for (G4int j=0; j<fb; j++)
831 if (m_totalPhot[j] > 0)
833 n1=G4int(m_t1st[j]/m_timeBinSize);
834 n2=G4int(m_tLast[j]/m_timeBinSize);
842 for (G4int i=
n1;i<
n2;i++)
848 Npoisson = G4Poisson(10.0);
849 if(Npoisson>0.)
break;
855 pmtGain = pmtGain0*relativeGain;
856 smearPMTgain = G4RandGauss::shoot(pmtGain,pmtGain/sqrt(Npoisson));
858 if(smearPMTgain>0)
break;
860 smearADC[j] += phtn*smearPMTgain;
866 profPmt[ii][j] += smearPMTgain*phtn*snpe[ihst][j];
877 profPmt[i][j] = m_preGain*profPmt[i][j]+G4RandGauss::shoot(0,m_noiseSigma);
884 if (profPmt[i][j]>
max)
893 G4double tmp_HLthresh, tmp_LLthresh, adcFactor;
896 if(runId>=-1000000 && runId<=-9484)
900 tmp_HLthresh = m_HLthresh;
901 tmp_LLthresh = m_LLthresh;
925 if (
max>=tmp_HLthresh)
929 if ( profPmt[i][j] >= tmp_LLthresh )
931 m_TDC[j] = i*m_timeBinSize + timeSmear +G4RandGauss::shoot(0,0.025);
933 if( ( runId>=-11396 && runId<=-8093 ) || ( runId>-1000000 && runId<=-23463 ) ) {
935 m_TDC[j] = i*m_timeBinSize + timeSmear +G4RandGauss::shoot(0,0.055);
938 m_TDC[j] = i*m_timeBinSize + timeSmear +G4RandGauss::shoot(0,0.062);
945 double x = m_preGain*smearADC[j]*echarge*ratio;
956 m_ADC[j] = m_preGain*smearADC[j]*echarge*adcFactor;