Skip to content

Commit

Permalink
simplify if
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed May 10, 2024
1 parent 79bdadd commit d562dd5
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/TRestDetectorElectronDiffusionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,28 +198,24 @@ TRestEvent* TRestDetectorElectronDiffusionProcess::ProcessEvent(TRestEvent* inpu
Double_t driftDistance = plane->GetDistanceTo({x, y, z});

unsigned int numberOfElectrons;
Double_t fanofactor = fFano;
Double_t fanoFactor = fFano;
if (fPoissonElectronExcitation) {
if (fUseFanoFactor) {
std::cout << "using fano factor " << fanofactor << std::endl;
numberOfElectrons = fRandom->Poisson(energy * fanofactor * REST_Units::eV / fWValue);
if (wValue != fWValue) {
// reduce the number of electrons to improve speed
numberOfElectrons = static_cast<unsigned int>(numberOfElectrons * fWValue / wValue);
}
RESTInfo << "using fano factor " << fanoFactor << RESTendl;
numberOfElectrons = fRandom->Poisson(energy * fanoFactor * REST_Units::eV / fWValue);
} else {
std::cout << "not using fano factor " << std::endl;
RESTInfo << "not using fano factor " << RESTendl;
numberOfElectrons = fRandom->Poisson(energy * REST_Units::eV / fWValue);
if (wValue != fWValue) {
// reduce the number of electrons to improve speed
numberOfElectrons = static_cast<unsigned int>(numberOfElectrons * fWValue / wValue);
}
}

} else {
numberOfElectrons = static_cast<unsigned int>(energy * REST_Units::eV / wValue);
}

if (wValue != fWValue) {
// reduce the number of electrons to improve speed
numberOfElectrons = static_cast<unsigned int>(numberOfElectrons * fWValue / wValue);
}

if (numberOfElectrons <= 0) {
numberOfElectrons = 1;
}
Expand Down

0 comments on commit d562dd5

Please sign in to comment.