|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "CLHEP/Random/RandGaussZiggurat.h"
31 if (sigma2 <= 0 ||
sample < 0)
36 return simulstate.
E(
sample) * sigma2 / maxWeight;
38 return simulstate.
E(
sample) * sigma2;
66 ATH_MSG_ERROR(
"TFCSLateralShapeParametrizationFluctChain::simulate(): "
67 "fluctuation of hits could not be calculated");
79 const float absEavghit_tenth = std::abs(Eavghit / 10);
81 float error2_sumEhit = 0;
87 <<
" sigma2=" << sigma2);
94 int retry_warning = 1;
100 hit.
E() = CLHEP::RandGaussZiggurat::shoot(simulstate.
randomEngine(),
101 Eavghit,
m_RMS * Eavghit);
102 }
while (std::abs(hit.
E()) < absEavghit_tenth);
109 for (
auto hititr = hitloopstart; hititr !=
m_chain.end(); ++hititr) {
126 retry_warning = retry >> 1;
127 if (retry_warning < 1)
134 const float Ehit = hit.
E();
136 float sumEhit2 = sumEhit * sumEhit;
137 error2_sumEhit += Ehit * Ehit;
139 error2 = error2_sumEhit / sumEhit2;
141 if (ifail >= retry) {
142 ATH_MSG_ERROR(
"TFCSLateralShapeParametrizationFluctChain::simulate(): "
143 "simulate_hit call failed after "
144 << ifail <<
"/" << retry
145 <<
"retries, total fails=" << itotalfail);
150 if (ifail >= retry_warning) {
151 ATH_MSG_WARNING(
"TFCSLateralShapeParametrizationFluctChain::simulate():"
152 " retry simulate_hit calls "
153 << ifail <<
"/" << retry
154 <<
", total fails=" << itotalfail);
157 }
while (error2 > sigma2);
162 <<
"+-" << TMath::Sqrt(error2_sumEhit) <<
" ~ "
163 << TMath::Sqrt(error2_sumEhit) / sumEhit * 100
164 <<
"% rel error^2=" << error2 <<
" sigma^2=" << sigma2
165 <<
" ~ " << TMath::Sqrt(sigma2) * 100
166 <<
"% hits=" << ihit <<
" fail=" << itotalfail);
174 bool shortprint =
opt.Index(
"short") >= 0;
176 TString optprint =
opt;
177 optprint.ReplaceAll(
"short",
"");
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol)
simulated one hit position with some energy.
MSG::Level level() const
Retrieve output level.
virtual FCSReturnCode init_hit(TFCSLateralShapeParametrizationHitBase::Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
void Print(Option_t *option) const override
void PropagateMSGLevel(MSG::Level level) const
CLHEP::HepRandomEngine * randomEngine()
#define ATH_MSG_VERBOSE(x)
virtual float getMaxWeight() const
virtual float get_sigma2_fluctuation(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
Give the effective size sigma^2 of the fluctuations that should be generated.
static constexpr float s_max_sigma2_fluctuation
unsigned int get_nr_of_init() const
TFCSLateralShapeParametrizationFluctChain(const char *name=nullptr, const char *title=nullptr, float RMS=1.0)
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
virtual float get_E_hit(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Get hit energy from layer energy and number of hits.
#define ATH_MSG_WARNING(x)
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
void Print(Option_t *option="") const override
Do not persistify!