Skip to content

Commit

Permalink
attempt to fix pipeline (backwards compatibility)
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed May 12, 2024
1 parent 7258f5b commit e573ceb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/TRestDetectorElectronDiffusionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,15 @@ TRestEvent* TRestDetectorElectronDiffusionProcess::ProcessEvent(TRestEvent* inpu
Double_t driftDistance = plane->GetDistanceTo({x, y, z});

double numberOfElectrons = energy * REST_Units::eV / wValue;
if (fUseFanoFactor && fFanoFactor > 0) {
const double sigma = TMath::Sqrt(fFanoFactor * numberOfElectrons);
if (fUseFanoFactor) {
if (fFanoFactor <= 0) {
throw runtime_error("Fano factor not valid");
}
const auto sigma = TMath::Sqrt(fFanoFactor * numberOfElectrons);
numberOfElectrons = fRandom->Gaus(numberOfElectrons, sigma);
} else if (fPoissonElectronExcitation) {
// this is probably a bad idea, we only keep it for backwards compatibility
numberOfElectrons = fRandom->Poisson(energy * REST_Units::eV / fWorkFunction);
}

if (wValue != fWorkFunction) {
Expand Down Expand Up @@ -293,7 +299,7 @@ void TRestDetectorElectronDiffusionProcess::InitFromConfigFile() {
fGasPressure = GetDblParameterWithUnits("gasPressure", -1.);
fElectricField = GetDblParameterWithUnits("electricField", -1.);
fWorkFunction = GetDblParameterWithUnits("WValue", 0.0) * REST_Units::eV;
fFanoFactor = GetDblParameterWithUnits("fanoFactor", 0.0);
fFanoFactor = GetDblParameterWithUnits("FanoFactor", 0.0);
fAttachment = StringToDouble(GetParameter("attachment", "0"));
fLongitudinalDiffusionCoefficient =
StringToDouble(GetParameter("longitudinalDiffusionCoefficient", "-1"));
Expand All @@ -314,6 +320,7 @@ void TRestDetectorElectronDiffusionProcess::InitFromConfigFile() {
}
fMaxHits = StringToInteger(GetParameter("maxHits", "1000"));
fSeed = static_cast<UInt_t>(StringToInteger(GetParameter("seed", "0")));
fPoissonElectronExcitation = StringToBool(GetParameter("poissonElectronExcitation", "false"));
fUnitElectronEnergy = StringToBool(GetParameter("unitElectronEnergy", "false"));
fCheckIsInside = StringToBool(GetParameter("checkIsInside", "false"));
fUseFanoFactor = StringToBool(GetParameter("useFano", "false"));
Expand Down

0 comments on commit e573ceb

Please sign in to comment.