112 aParticleChange.Initialize(aTrack);
115 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
117 if( aTrack.GetParentID() == 0 && aTrack.GetCurrentStepNumber() == 1 ) {
124 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
125 G4ParticleDefinition *pDef = aParticle->GetDefinition();
126 G4String particleName = pDef->GetParticleName();
127 const G4Material* aMaterial = aStep.GetPreStepPoint()->GetMaterial();
128 const G4Material* bMaterial = aStep.GetPostStepPoint()->GetMaterial();
130 if((particleName ==
"neutron" || particleName ==
"antineutron") &&
131 aStep.GetTotalEnergyDeposit() <= 0)
132 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
139 G4Element *ElementA = NULL, *ElementB = NULL;
140 if (aMaterial && aMaterial->GetMaterialPropertiesTable()) {
141 const G4ElementVector* theElementVector1 =
142 aMaterial->GetElementVector();
143 ElementA = (*theElementVector1)[0];
145 if (bMaterial && bMaterial->GetMaterialPropertiesTable()) {
146 const G4ElementVector* theElementVector2 =
147 bMaterial->GetElementVector();
148 ElementB = (*theElementVector2)[0];
150 G4int z1,z2,j=1; G4bool NobleNow=
false,NobleLater=
false;
151 if (ElementA) z1 = (G4int)(ElementA->GetZ());
else z1 = -1;
152 if (ElementB) z2 = (G4int)(ElementB->GetZ());
else z2 = -1;
153 if ( z1==2 || z1==10 || z1==18 || z1==36 || z1==54 ) {
155 j = (G4int)aMaterial->GetMaterialPropertiesTable()->
156 GetConstProperty(
"TOTALNUM_INT_SITES");
162 if ( z2==2 || z2==10 || z2==18 || z2==36 || z2==54 ) {
164 j = (G4int)bMaterial->GetMaterialPropertiesTable()->
165 GetConstProperty(
"TOTALNUM_INT_SITES");
172 if ( !NobleNow && !NobleLater )
173 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
177 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
178 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
179 G4ThreeVector
x1 = pPostStepPoint->GetPosition();
180 G4ThreeVector x0 = pPreStepPoint->GetPosition();
181 G4double evtStrt = pPreStepPoint->GetGlobalTime();
182 G4double
t0 = pPreStepPoint->GetLocalTime();
183 G4double
t1 = pPostStepPoint->GetLocalTime();
189 G4bool outside =
false, inside =
false, InsAndOuts =
false;
190 G4MaterialPropertiesTable* aMaterialPropertiesTable =
191 aMaterial->GetMaterialPropertiesTable();
192 if ( NobleNow && !NobleLater ) outside =
true;
193 if ( !NobleNow && NobleLater ) {
194 aMaterial = bMaterial; inside =
true; z1 = z2;
196 aMaterialPropertiesTable = bMaterial->GetMaterialPropertiesTable();
198 if ( NobleNow && NobleLater &&
199 aMaterial->GetDensity() != bMaterial->GetDensity() )
207 G4double nDensity = Density*
AVO;
208 G4int Phase = aMaterial->GetState();
209 G4double ElectricField, FieldSign;
210 G4bool GlobalFields =
false;
212 ElectricField = aMaterialPropertiesTable->
213 GetConstProperty(
"ELECTRICFIELD"); GlobalFields =
true; }
215 if ( x1[2] <
WIN && x1[2] >
TOP && Phase == kStateGas )
216 ElectricField = aMaterialPropertiesTable->
217 GetConstProperty(
"ELECTRICFIELDWINDOW");
218 else if ( x1[2] <
TOP && x1[2] >
ANE && Phase == kStateGas )
219 ElectricField = aMaterialPropertiesTable->
220 GetConstProperty(
"ELECTRICFIELDTOP");
221 else if ( x1[2] <
ANE && x1[2] >
SRF && Phase == kStateGas )
222 ElectricField = aMaterialPropertiesTable->
223 GetConstProperty(
"ELECTRICFIELDANODE");
224 else if ( x1[2] <
SRF && x1[2] >
GAT && Phase == kStateLiquid )
225 ElectricField = aMaterialPropertiesTable->
226 GetConstProperty(
"ELECTRICFIELDSURFACE");
227 else if ( x1[2] <
GAT && x1[2] >
CTH && Phase == kStateLiquid )
228 ElectricField = aMaterialPropertiesTable->
229 GetConstProperty(
"ELECTRICFIELDGATE");
230 else if ( x1[2] <
CTH && x1[2] >
BOT && Phase == kStateLiquid )
231 ElectricField = aMaterialPropertiesTable->
232 GetConstProperty(
"ELECTRICFIELDCATHODE");
233 else if ( x1[2] <
BOT && x1[2] >
PMT && Phase == kStateLiquid )
234 ElectricField = aMaterialPropertiesTable->
235 GetConstProperty(
"ELECTRICFIELDBOTTOM");
237 ElectricField = aMaterialPropertiesTable->
238 GetConstProperty(
"ELECTRICFIELD");
240 if ( ElectricField >= 0 ) FieldSign = 1;
else FieldSign = -1;
242 G4double Temperature = aMaterial->GetTemperature();
243 G4double ScintillationYield, ResolutionScale, R0 = 1.0*
CLHEP::um,
244 DokeBirks[3], ThomasImel = 0.00, delta = 1*
CLHEP::mm;
245 DokeBirks[0] = 0.00; DokeBirks[2] = 1.00;
250 ScintillationYield = 1 / (41.3*
CLHEP::eV);
252 ResolutionScale = 0.2;
259 ScintillationYield = 1 / (29.2*
CLHEP::eV);
261 ResolutionScale = 0.13;
264 tau3 = G4RandGauss::shoot(15.4e3*
CLHEP::ns,200*CLHEP::ns);
267 ScintillationYield = 1 / (19.5*
CLHEP::eV);
269 ResolutionScale = 0.107;
272 ThomasImel = 0.156977*
pow(ElectricField,-0.1);
273 DokeBirks[0] = 0.07*
pow((ElectricField/1.0e3),-0.85);
278 DokeBirks[0] = 0.0003;
280 } nDensity /= 39.948;
287 if ( Phase == kStateGas ) ScintillationYield = 1 / (30.0*
CLHEP::eV);
288 else ScintillationYield = 1 / (15.0*
CLHEP::eV);
290 ResolutionScale = 0.05;
297 default: nDensity /= 131.293;
298 ScintillationYield = 48.814+0.80877*Density+2.6721*
pow(Density,2.);
303 ResolutionScale = 1.00 *
304 (0.12724-0.032152*Density-0.0013492*
pow(Density,2.));
306 if ( Phase == kStateLiquid ) {
307 ResolutionScale *= 1.5;
313 DokeBirks[0]= 19.171*
pow(ElectricField+25.552,-0.83057)+0.026772;
332 else if ( Phase == kStateGas ) {
335 ScintillationYield = 1 / (12.98*
CLHEP::eV); }
337 G4double Townsend = (ElectricField/nDensity)*1e17;
338 DokeBirks[0] = 0.0000;
339 DokeBirks[2] = 0.1933*
pow(Density,2.6199)+0.29754 -
340 (0.045439*
pow(Density,2.4689)+0.066034)*log10(ElectricField);
341 if ( ElectricField>6990 ) DokeBirks[2]=0.0;
342 if ( ElectricField<1000 ) DokeBirks[2]=0.2;
343 if ( ElectricField<100. ) { DokeBirks[0]=0.18; DokeBirks[2]=0.58; }
344 if( Density < 0.061 ) ThomasImel = 0.041973*
pow(Density,1.8105);
345 else if( Density >= 0.061 && Density <= 0.167 )
346 ThomasImel=5.9583e-5+0.0048523*Density-0.023109*
pow(Density,2.);
347 else ThomasImel = 6.2552e-6*
pow(Density,-1.9963);
348 if(ElectricField)ThomasImel=1.2733e-5*
pow(Townsend/Density,-0.68426);
360 G4double anExcitationEnergy = ((
const G4Ions*)(pDef))->
361 GetExcitationEnergy();
362 G4double TotalEnergyDeposit =
363 aMaterialPropertiesTable->GetConstProperty(
"ENERGY_DEPOSIT_TOT" );
364 G4bool
convert =
false, annihil =
false;
366 if(pPreStepPoint->GetKineticEnergy()>=(2*CLHEP::electron_mass_c2) &&
367 !pPostStepPoint->GetKineticEnergy() &&
368 !aStep.GetTotalEnergyDeposit() && aParticle->GetPDGcode()==22) {
369 convert =
true; TotalEnergyDeposit = CLHEP::electron_mass_c2;
371 if(pPreStepPoint->GetKineticEnergy() &&
372 !pPostStepPoint->GetKineticEnergy() &&
373 aParticle->GetPDGcode()==-11) {
374 annihil =
true; TotalEnergyDeposit += aStep.GetTotalEnergyDeposit();
376 G4bool either =
false;
377 if(inside || outside || convert || annihil || InsAndOuts) either=
true;
381 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
383 if ( !annihil ) TotalEnergyDeposit += aStep.GetTotalEnergyDeposit();
384 if ( !convert ) aMaterialPropertiesTable->
385 AddConstProperty(
"ENERGY_DEPOSIT_TOT", TotalEnergyDeposit );
387 TotalEnergyDeposit = aStep.GetTotalEnergyDeposit();
392 G4double InitialKinetEnergy = aMaterialPropertiesTable->
393 GetConstProperty(
"ENERGY_DEPOSIT_GOL" );
395 if ( InitialKinetEnergy == 0 ) {
396 G4double tE = pPreStepPoint->GetKineticEnergy()+anExcitationEnergy;
399 Phase == kStateLiquid && z1 == 54 ) tE = 9.4*
CLHEP::keV;
400 if (
fKr83m && ElectricField != 0 )
402 aMaterialPropertiesTable->
403 AddConstProperty (
"ENERGY_DEPOSIT_GOL", tE );
411 if(outside){ aMaterialPropertiesTable->
412 AddConstProperty(
"ENERGY_DEPOSIT_GOL",
413 InitialKinetEnergy-pPostStepPoint->GetKineticEnergy());
414 if(aMaterialPropertiesTable->
415 GetConstProperty(
"ENERGY_DEPOSIT_GOL")<0)
416 aMaterialPropertiesTable->AddConstProperty(
"ENERGY_DEPOSIT_GOL",0);
420 if(inside) { aMaterialPropertiesTable->
421 AddConstProperty(
"ENERGY_DEPOSIT_GOL",
422 InitialKinetEnergy+pPreStepPoint->GetKineticEnergy());
423 if ( TotalEnergyDeposit > 0 && InitialKinetEnergy == 0 ) {
424 aMaterialPropertiesTable->AddConstProperty(
"ENERGY_DEPOSIT_GOL",0);
425 TotalEnergyDeposit = .000000;
431 aMaterialPropertiesTable->
432 AddConstProperty(
"ENERGY_DEPOSIT_GOL",(-0.1*
CLHEP::keV)+
433 InitialKinetEnergy-pPostStepPoint->GetKineticEnergy());
434 InitialKinetEnergy = bMaterial->GetMaterialPropertiesTable()->
435 GetConstProperty(
"ENERGY_DEPOSIT_GOL");
436 bMaterial->GetMaterialPropertiesTable()->
437 AddConstProperty(
"ENERGY_DEPOSIT_GOL",(-0.1*
CLHEP::keV)+
438 InitialKinetEnergy+pPreStepPoint->GetKineticEnergy());
439 if(aMaterialPropertiesTable->
440 GetConstProperty(
"ENERGY_DEPOSIT_GOL")<0)
441 aMaterialPropertiesTable->AddConstProperty(
"ENERGY_DEPOSIT_GOL",0);
442 if ( bMaterial->GetMaterialPropertiesTable()->
443 GetConstProperty(
"ENERGY_DEPOSIT_GOL") < 0 )
444 bMaterial->GetMaterialPropertiesTable()->
445 AddConstProperty (
"ENERGY_DEPOSIT_GOL", 0 );
447 InitialKinetEnergy = aMaterialPropertiesTable->
448 GetConstProperty(
"ENERGY_DEPOSIT_GOL");
450 InitialKinetEnergy += 2*CLHEP::electron_mass_c2;
455 InitialKinetEnergy -= 2*CLHEP::electron_mass_c2;
458 aMaterialPropertiesTable->
459 AddConstProperty(
"ENERGY_DEPOSIT_GOL",InitialKinetEnergy);
460 if (anExcitationEnergy < 1
e-100 && aStep.GetTotalEnergyDeposit()==0 &&
461 aMaterialPropertiesTable->GetConstProperty(
"ENERGY_DEPOSIT_GOL")==0 &&
462 aMaterialPropertiesTable->GetConstProperty(
"ENERGY_DEPOSIT_TOT")==0)
463 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
466 if ( aTrack.GetCreatorProcess() )
467 procName = aTrack.GetCreatorProcess()->GetProcessName();
482 char xCoord[80];
char yCoord[80];
char zCoord[80];
486 sprintf(xCoord,
"POS_X_%d",i); sprintf(yCoord,
"POS_Y_%d",i);
487 sprintf(zCoord,
"POS_Z_%d",i);
488 pos[0] = aMaterialPropertiesTable->GetConstProperty(xCoord);
489 pos[1] = aMaterialPropertiesTable->GetConstProperty(yCoord);
490 pos[2] = aMaterialPropertiesTable->GetConstProperty(zCoord);
491 if ( sqrt(
pow(x1[0]-pos[0],2.)+
pow(x1[1]-pos[1],2.)+
492 pow(x1[2]-pos[2],2.)) < delta ) {
493 exists =
true;
break;
496 if(!exists && TotalEnergyDeposit) {
498 sprintf(xCoord,
"POS_X_%i",j); sprintf(yCoord,
"POS_Y_%i",j);
499 sprintf(zCoord,
"POS_Z_%i",j);
501 aMaterialPropertiesTable->AddConstProperty( xCoord, x1[0] );
502 aMaterialPropertiesTable->AddConstProperty( yCoord, x1[1] );
503 aMaterialPropertiesTable->AddConstProperty( zCoord, x1[2] );
505 aMaterialPropertiesTable->
506 AddConstProperty(
"TOTALNUM_INT_SITES", j );
514 G4double
a1 = ElementA->GetA();
515 z2 = pDef->GetAtomicNumber();
516 G4double
a2 = (G4double)(pDef->GetAtomicMass());
517 if ( particleName ==
"alpha" || (z2 == 2 && a2 == 4) )
519 if (
fAlpha ||
abs(aParticle->GetPDGcode()) == 2112 )
521 G4double epsilon = 11.5*(TotalEnergyDeposit/
CLHEP::keV)*
pow(z1,(-7./3.));
522 G4double
gamma = 3.*
pow(epsilon,0.15)+0.7*
pow(epsilon,0.6)+epsilon;
523 G4double kappa = 0.133*
pow(z1,(2./3.))*
pow(a2,(-1./2.))*(2./3.);
525 if ( (z1 == z2 && pDef->GetParticleType() ==
"nucleus") ||
526 particleName ==
"neutron" || particleName ==
"antineutron" ) {
528 if ( z1 == 18 && Phase == kStateLiquid )
533 if ( ElectricField == 0 && Phase == kStateLiquid ) {
534 if ( z1 == 54 ) ThomasImel = 0.19;
535 if ( z1 == 18 ) ThomasImel = 0.25;
538 0.3065*exp(-0.008806*
pow(ElectricField,0.76313));
543 G4double MeanNumberOfQuanta =
544 ScintillationYield*TotalEnergyDeposit;
547 G4double sigma = sqrt(ResolutionScale*MeanNumberOfQuanta);
549 G4int(floor(G4RandGauss::shoot(MeanNumberOfQuanta,sigma)+0.5));
551 if (LeffVar > 1) LeffVar = 1.00000;
552 if (LeffVar < 0) LeffVar = 0;
556 if(TotalEnergyDeposit < 1/ScintillationYield || NumQuanta < 0)
562 G4int NumIons = NumQuanta - NumExcitons;
568 G4double dE, dx=0, LET=0, recombProb;
570 if ( particleName !=
"e-" && particleName !=
"e+" && z1 != z2 &&
571 particleName !=
"mu-" && particleName !=
"mu+" ) {
577 if(LET) dx = dE/(Density*LET);
578 if(
abs(aParticle->GetPDGcode())==2112) dx=0;
582 if(dx) LET = (dE/dx)*(1/Density);
583 if ( LET > 0 && dE > 0 && dx > 0 ) {
586 particleName ==
"e-" ) {
589 DokeBirks[1] = DokeBirks[0]/(1-DokeBirks[2]);
591 recombProb = (DokeBirks[0]*LET)/(1+DokeBirks[1]*LET)+DokeBirks[2];
592 if ( Phase == kStateLiquid ) {
593 if ( z1 == 54 ) recombProb *= (Density/
Density_LXe);
594 if ( z1 == 18 ) recombProb *= (Density/
Density_LAr);
597 if(recombProb<0) recombProb=0;
598 if(recombProb>1) recombProb=1;
602 G4int NumPhotons = NumExcitons +
BinomFluct(NumIons,recombProb);
603 G4int NumElectrons = NumQuanta - NumPhotons;
613 G4double nonIonizingEnergy = TotalEnergyDeposit;
614 nonIonizingEnergy *= 1.0*NumPhotons/NumQuanta;
615 aParticleChange.ProposeNonIonizingEnergyDeposit(nonIonizingEnergy);
616 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
624 char numExc[80];
char numIon[80];
char numPho[80];
char numEle[80];
625 sprintf(numExc,
"N_EXC_%i",counter); sprintf(numIon,
"N_ION_%i",counter);
626 NumExcitons += (G4int)aMaterialPropertiesTable->
627 GetConstProperty( numExc );
628 NumIons += (G4int)aMaterialPropertiesTable->
629 GetConstProperty( numIon );
630 aMaterialPropertiesTable->AddConstProperty( numExc, NumExcitons );
631 aMaterialPropertiesTable->AddConstProperty( numIon, NumIons );
632 sprintf(numPho,
"N_PHO_%i",counter); sprintf(numEle,
"N_ELE_%i",counter);
633 NumPhotons +=(G4int)aMaterialPropertiesTable->
634 GetConstProperty( numPho );
635 NumElectrons +=(G4int)aMaterialPropertiesTable->
636 GetConstProperty( numEle );
637 aMaterialPropertiesTable->AddConstProperty( numPho, NumPhotons );
638 aMaterialPropertiesTable->AddConstProperty( numEle, NumElectrons );
642 char trackL[80];
char time00[80];
char time01[80];
char energy[80];
643 sprintf(trackL,
"TRACK_%i",counter); sprintf(energy,
"ENRGY_%i",counter);
644 sprintf(time00,
"TIME0_%i",counter); sprintf(time01,
"TIME1_%i",counter);
645 delta = aMaterialPropertiesTable->GetConstProperty( trackL );
646 G4double energ = aMaterialPropertiesTable->GetConstProperty( energy );
648 aMaterialPropertiesTable->AddConstProperty( trackL, delta );
649 aMaterialPropertiesTable->AddConstProperty( energy, energ );
650 if ( TotalEnergyDeposit > 0 ) {
651 G4double deltaTime = aMaterialPropertiesTable->
652 GetConstProperty( time00 );
655 if (aParticle->GetCharge() != 0) {
657 aMaterialPropertiesTable->AddConstProperty( time00, t0 );
661 aMaterialPropertiesTable->AddConstProperty( time00, t1 );
663 deltaTime = aMaterialPropertiesTable->GetConstProperty( time01 );
666 aMaterialPropertiesTable->AddConstProperty( time01, t1 );
670 TotalEnergyDeposit=aMaterialPropertiesTable->
671 GetConstProperty(
"ENERGY_DEPOSIT_TOT");
672 InitialKinetEnergy=aMaterialPropertiesTable->
673 GetConstProperty(
"ENERGY_DEPOSIT_GOL");
674 if(InitialKinetEnergy >
HIENLIM &&
681 if( !anExcitationEnergy && pDef->GetParticleType() ==
"nucleus" &&
682 aTrack.GetTrackStatus() != fAlive && !
fAlpha )
683 InitialKinetEnergy = TotalEnergyDeposit;
684 if ( particleName ==
"neutron" || particleName ==
"antineutron" )
685 InitialKinetEnergy = TotalEnergyDeposit;
690 if( fabs(TotalEnergyDeposit-InitialKinetEnergy)<safety ||
691 TotalEnergyDeposit>=InitialKinetEnergy ){
695 NumPhotons = 0; NumElectrons = 0;
697 sprintf(numPho,
"N_PHO_%d",i); sprintf(numEle,
"N_ELE_%d",i);
698 NumPhotons +=(G4int)aMaterialPropertiesTable->
699 GetConstProperty( numPho );
700 NumElectrons+=(G4int)aMaterialPropertiesTable->
701 GetConstProperty( numEle );
702 sprintf(trackL,
"TRACK_%d",i); sprintf(energy,
"ENRGY_%d",i);
704 dx += aMaterialPropertiesTable->GetConstProperty(trackL);
705 dE += aMaterialPropertiesTable->GetConstProperty(energy);
708 aParticleChange.SetNumberOfSecondaries(
709 buffer*(NumPhotons+NumElectrons));
711 if (aTrack.GetTrackStatus() == fAlive )
712 aParticleChange.ProposeTrackStatus(fSuspend);
719 sprintf(xCoord,
"POS_X_%d",i); sprintf(yCoord,
"POS_Y_%d",i);
720 sprintf(zCoord,
"POS_Z_%d",i);
721 sprintf(numExc,
"N_EXC_%d",i); sprintf(numIon,
"N_ION_%d",i);
722 sprintf(numPho,
"N_PHO_%d",i); sprintf(numEle,
"N_ELE_%d",i);
723 NumExcitons = (G4int)aMaterialPropertiesTable->
724 GetConstProperty( numExc );
725 NumIons = (G4int)aMaterialPropertiesTable->
726 GetConstProperty( numIon );
727 sprintf(trackL,
"TRACK_%d",i); sprintf(energy,
"ENRGY_%d",i);
728 sprintf(time00,
"TIME0_%d",i); sprintf(time01,
"TIME1_%d",i);
729 delta = aMaterialPropertiesTable->GetConstProperty( trackL );
730 energ = aMaterialPropertiesTable->GetConstProperty( energy );
731 t0 = aMaterialPropertiesTable->GetConstProperty( time00 );
732 t1 = aMaterialPropertiesTable->GetConstProperty( time01 );
739 if( z1 == 54 && ElectricField &&
740 Phase == kStateLiquid ) {
741 if (
abs ( z1 - z2 ) &&
742 abs ( aParticle->GetPDGcode() ) != 2112 ) {
743 ThomasImel = 0.056776*
pow(ElectricField,-0.11844);
745 ThomasImel=0.057675*
pow(ElectricField,-0.49362);
751 -0.15169*
pow((ElectricField+215.25),0.01811)+0.20952;
754 if (ThomasImel > 0.19) ThomasImel = 0.19;
755 if (ThomasImel < 0.00) ThomasImel = 0.00;
757 if ( Phase == kStateLiquid ) {
758 if ( z1 == 54 ) ThomasImel *=
pow((Density/2.84),0.3);
766 xi = (G4double(NumIons)/4.)*ThomasImel;
769 (0.17163+162.32/(ElectricField+191.39));
770 if ( NumIonsEff > 1e6 ) NumIonsEff = 1e6;
771 xi = (G4double(NumIonsEff)/4.)*ThomasImel;
773 if (
fKr83m && ElectricField==0 )
774 xi = (G4double(1.3*NumIons)/4.)*ThomasImel;
775 recombProb = 1-log(1+xi)/xi;
776 if(recombProb<0) recombProb=0;
777 if(recombProb>1) recombProb=1;
780 NumPhotons = NumExcitons +
BinomFluct(NumIons,recombProb);
781 NumElectrons = (NumExcitons + NumIons) - NumPhotons;
783 aMaterialPropertiesTable->
784 AddConstProperty( numPho, NumPhotons );
785 aMaterialPropertiesTable->
786 AddConstProperty( numEle, NumElectrons );
791 NumPhotons = (G4int)aMaterialPropertiesTable->
792 GetConstProperty( numPho );
793 NumElectrons =(G4int)aMaterialPropertiesTable->
794 GetConstProperty( numEle );
797 G4double FanoFactor =0;
800 2575.9*
pow((ElectricField+15.154),-0.64064)-1.4707;
802 if ( (dE/
CLHEP::keV) <= 100 && ElectricField >= 0 ) {
803 G4double keVee = (TotalEnergyDeposit/(100.*
CLHEP::keV));
805 FanoFactor *= -0.00075+0.4625*keVee+34.375*
pow(keVee,2.);
807 FanoFactor *= 0.069554+1.7322*keVee-.80215*
pow(keVee,2.);
810 if ( Phase == kStateGas && Density>0.5 ) FanoFactor =
811 0.42857-4.7857*Density+7.8571*
pow(Density,2.);
813 NumQuanta = NumPhotons + NumElectrons;
814 if(z1==54 && FanoFactor) NumElectrons = G4int(
815 floor(G4RandGauss::shoot(NumElectrons,
816 sqrt(FanoFactor*NumElectrons))+0.5));
817 NumPhotons = NumQuanta - NumElectrons;
818 if ( NumElectrons <= 0 ) NumElectrons = 0;
819 if ( NumPhotons <= 0 ) NumPhotons = 0;
824 } NumElectrons = G4int(floor(NumElectrons*
phe_per_e+0.5));
834 aMaterialPropertiesTable->AddConstProperty( numExc, 0 );
835 aMaterialPropertiesTable->AddConstProperty( numIon, 0 );
836 aMaterialPropertiesTable->AddConstProperty( numPho, 0 );
837 aMaterialPropertiesTable->AddConstProperty( numEle, 0 );
840 if( InitialKinetEnergy < MAX_ENE && InitialKinetEnergy >
MIN_ENE &&
842 NumQuanta = NumPhotons + NumElectrons;
844 for(k = 0; k < NumQuanta; k++) {
845 G4double sampledEnergy;
846 G4DynamicParticle* aQuantum;
849 G4double cost = 1. - 2.*G4UniformRand();
850 G4double sint = std::sqrt((1.-cost)*(1.+cost));
852 G4double sinp = std::sin(phi); G4double cosp = std::cos(phi);
853 G4double
px = sint*cosp; G4double
py = sint*sinp;
857 G4ParticleMomentum photonMomentum(px, py, pz);
860 if (k < NumPhotons) {
862 G4double sx = cost*cosp;
863 G4double sy = cost*sinp;
865 G4ThreeVector photonPolarization(sx, sy, sz);
866 G4ThreeVector perp = photonMomentum.cross(photonPolarization);
868 sinp = std::sin(phi);
869 cosp = std::cos(phi);
870 photonPolarization = cosp * photonPolarization + sinp * perp;
871 photonPolarization = photonPolarization.unit();
874 sampledEnergy = G4RandGauss::shoot(PhotMean,PhotWidth);
876 new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(),
878 aQuantum->SetPolarization(photonPolarization.x(),
879 photonPolarization.y(),
880 photonPolarization.z());
886 G4ParticleMomentum electronMomentum(0, 0, -FieldSign);
890 if ( Phase == kStateGas ) {
909 aQuantum->SetKineticEnergy(sampledEnergy);
911 G4cout <<
"sampledEnergy = " << sampledEnergy << G4endl;
920 G4double aSecondaryTime = t0+G4UniformRand()*(t1-
t0)+evtStrt;
924 if ( aQuantum->GetDefinition()->
925 GetParticleName()==
"opticalphoton" ) {
927 abs(aParticle->GetPDGcode()) != 2112 ) {
934 if ( Phase == kStateLiquid && z1 == 54 )
935 tauR = 3.5*((1+0.41*LET)/(0.18*LET))*
CLHEP::ns 936 *exp(-0.00900*ElectricField);
943 SingTripRatioX = G4RandGauss::shoot(0.17,0.05);
944 SingTripRatioR = G4RandGauss::shoot(0.8,0.2);
946 SingTripRatioR = 0.2701+0.003379*LET-4.7338e-5*
pow(LET,2.)
947 +8.1449e-6*
pow(LET,3.); SingTripRatioX = SingTripRatioR;
949 SingTripRatioX = G4RandGauss::shoot(0.36,0.06);
950 SingTripRatioR = G4RandGauss::shoot(0.5,0.2); }
954 SingTripRatioR = G4RandGauss::shoot(2.3,0.51);
957 if (z1==18) SingTripRatioR = (-0.065492+1.9996
958 *exp(-dE/CLHEP::MeV))/(1+0.082154/
pow(dE/CLHEP::MeV,2.)) + 2.1811;
959 SingTripRatioX = SingTripRatioR;
964 SingTripRatioR = G4RandGauss::shoot(7.8,1.5);
965 if (z1==18) SingTripRatioR = 0.22218*
pow(energ/
CLHEP::keV,0.48211);
966 SingTripRatioX = SingTripRatioR;
971 if ( k > NumExcitons ) {
974 aSecondaryTime += tauR*(1./G4UniformRand()-1);
975 if(G4UniformRand()<SingTripRatioR/(1+SingTripRatioR))
976 aSecondaryTime -= tau1*log(G4UniformRand());
977 else aSecondaryTime -= tau3*log(G4UniformRand());
980 if(G4UniformRand()<SingTripRatioX/(1+SingTripRatioX))
981 aSecondaryTime -= tau1*log(G4UniformRand());
982 else aSecondaryTime -= tau3*log(G4UniformRand());
986 G4double gainField = 12;
987 G4double tauTrap = 884.83-62.069*gainField;
988 if ( Phase == kStateLiquid )
989 aSecondaryTime -= tauTrap*
CLHEP::ns*log(G4UniformRand());
998 x0[0] = aMaterialPropertiesTable->GetConstProperty( xCoord );
999 x0[1] = aMaterialPropertiesTable->GetConstProperty( yCoord );
1000 x0[2] = aMaterialPropertiesTable->GetConstProperty( zCoord );
1001 G4double radius = sqrt(
pow(x0[0],2.)+
pow(x0[1],2.));
1004 if ( radius >=
R_TOL ) {
1007 radius -=
R_TOL; phi = atan ( x0[1] / x0[0] );
1008 x0[0] = fabs(radius*cos(phi))*((fabs(x0[0]))/(x0[0]));
1009 x0[1] = fabs(radius*sin(phi))*((fabs(x0[1]))/(x0[1]));
1012 G4ThreeVector aSecondaryPosition = x0;
1013 if ( k >= NumPhotons &&
diffusion && ElectricField > 0 ) {
1014 G4double D_T = 64*
pow(1
e-3*ElectricField,-.17);
1016 G4double D_L = 13.859*
pow(1
e-3*ElectricField,-0.58559);
1018 if ( Phase == kStateLiquid && z1 == 18 ) {
1019 D_T = 93.342*
pow(ElectricField/nDensity,0.041322);
1021 if ( Phase == kStateGas && z1 == 54 ) {
1022 D_L=4.265+19097/ElectricField-1.7397e6/
pow(ElectricField,2.)+
1023 1.2477e8/
pow(ElectricField,3.); D_T *= 0.01;
1027 if (ElectricField<100 && Phase == kStateLiquid) {
1030 G4double vDrift = sqrt((2*sampledEnergy)/(
EMASS));
1031 if (
BORDER == 0 ) x0[2] = 0;
1032 G4double sigmaDT = sqrt(2*D_T*fabs(
BORDER-x0[2])/vDrift);
1033 G4double sigmaDL = sqrt(2*D_L*fabs(
BORDER-x0[2])/vDrift);
1034 G4double dr = fabs(G4RandGauss::shoot(0.,sigmaDT));
1036 aSecondaryPosition[0] += cos(phi) * dr;
1037 aSecondaryPosition[1] += sin(phi) * dr;
1038 aSecondaryPosition[2] += G4RandGauss::shoot(0.,sigmaDL);
1039 radius = sqrt(
pow(aSecondaryPosition[0],2.)+
1040 pow(aSecondaryPosition[1],2.));
1041 if(aSecondaryPosition[2] >=
BORDER && Phase == kStateLiquid) {
1043 if(aSecondaryPosition[2] <=
PMT && !GlobalFields)
1044 aSecondaryPosition[2] =
PMT +
R_TOL;
1048 if ( aSecondaryTime < 0 ) aSecondaryTime = 0;
1049 G4Track * aSecondaryTrack =
1050 new G4Track(aQuantum,aSecondaryTime,aSecondaryPosition);
1051 if ( k < NumPhotons || radius <
R_MAX )
1052 aParticleChange.AddSecondary(aSecondaryTrack);
1056 aMaterialPropertiesTable->AddConstProperty( xCoord, 999*
CLHEP::km );
1057 aMaterialPropertiesTable->AddConstProperty( yCoord, 999*
CLHEP::km );
1058 aMaterialPropertiesTable->AddConstProperty( zCoord, 999*
CLHEP::km );
1059 aMaterialPropertiesTable->AddConstProperty( trackL, 0*
CLHEP::um );
1060 aMaterialPropertiesTable->AddConstProperty( energy, 0*
CLHEP::eV );
1061 aMaterialPropertiesTable->AddConstProperty( time00, DBL_MAX );
1062 aMaterialPropertiesTable->AddConstProperty( time01, -1*
CLHEP::ns );
1064 if (verboseLevel>0) {
1065 G4cout <<
"\n Exiting from G4S1Light::DoIt -- " 1066 <<
"NumberOfSecondaries = " 1067 << aParticleChange.GetNumberOfSecondaries() << G4endl;
1072 aMaterialPropertiesTable->
1073 AddConstProperty(
"TOTALNUM_INT_SITES", 0 );
1074 aMaterialPropertiesTable->
1075 AddConstProperty(
"ENERGY_DEPOSIT_TOT", 0*
CLHEP::keV );
1076 aMaterialPropertiesTable->
1077 AddConstProperty(
"ENERGY_DEPOSIT_GOL", 0*CLHEP::MeV );
1084 aParticleChange.SetNumberOfSecondaries(0);
1085 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
1089 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
static constexpr double cm
G4double GetGasElectronDriftSpeed(G4double efieldinput, G4double density)
code to link reconstructed objects back to the MC truth information
static constexpr double keV
static constexpr double g
static constexpr double cm3
G4bool fTrackSecondariesFirst
static constexpr double MeV
static constexpr double km
kilovolt_as<> kilovolt
Type of potential stored in kilovolt, in double precision.
void InitMatPropValues(G4MaterialPropertiesTable *nobleElementMat)
bool exists(std::string path)
static G4ThermalElectron * ThermalElectron()
static constexpr double eV
static constexpr double cm2
G4int BinomFluct(G4int N0, G4double prob)
def convert(inputfile, outputfile="wire-cell-garfield-fine-response.json.bz2", average=False, shaped=False)
G4double CalculateElectronLET(G4double E, G4int Z)
double gamma(double KE, const simb::MCParticle *part)
static constexpr double mm
G4bool fMultipleScattering
G4double GetLiquidElectronDriftSpeed(double T, double F, G4bool M, G4int Z)