|
ATLAS Offline Software
|
Go to the documentation of this file.
23 #include "HepPDT/ParticleData.hh"
36 m_number_of_hits_simul(nullptr) {}
41 if (m_number_of_hits_simul)
42 m_number_of_hits_simul->set_geometry(
geo);
50 m_number_of_hits_simul(nullptr) {}
57 TString(
"hit chain for ") +
59 m_number_of_hits_simul(nullptr) {
73 const Chain_t::value_type &
value) {
108 if (param !=
nullptr) {
109 if (!param->InheritsFrom(TFCSLateralShapeParametrizationHitBase::Class())) {
110 ATH_MSG_ERROR(
"Wrong class type " << param->IsA()->GetName());
137 int n = hitsim->get_number_of_hits(simulstate, truth,
extrapol);
146 float weight = hitsim->getMinWeight();
155 float weight = hitsim->getMaxWeight();
171 const float maxWeight =
193 double sigma2 = hitsim->get_sigma2_fluctuation(simulstate, truth,
extrapol);
217 for (
auto hititr =
m_chain.begin(); hititr != initloopend; ++hititr) {
224 ATH_MSG_ERROR(
"TFCSLateralShapeParametrizationHitChain::simulate(): "
225 "simulate_hit init call failed");
251 const float Elayer = simulstate.
E(cs);
257 if (Ehit * Elayer <= 0) {
258 ATH_MSG_ERROR(
"TFCSLateralShapeParametrizationHitChain::simulate(): Ehit "
259 "and Elayer have different sign! Ehit="
260 << Ehit <<
" Elayer=" << Elayer);
266 int nhit = TMath::Nint(Elayer / Ehit);
274 ATH_MSG_DEBUG(
"E(" << cs <<
")=" << simulstate.
E(cs) <<
" #hits~" << nhit);
282 bool our_chainA =
false;
283 if (cs > 0 && cs < 8 && cs != 4)
285 if (nhit >
MIN_GPU_HITS && our_chainA && simulstate.get_geold() !=
nullptr) {
287 "running FastCaloSim in GPU, nhits = " << nhit <<
" ; Ehit = " << Ehit);
306 args.rd4h = simulstate.get_gpu_rand();
310 bool reweight =
false;
320 ->is_phi_symmetric();
326 if (ichn == 2 &&
m_chain.size() == 4) {
333 if ((ichn == 2 &&
m_chain.size() == 3) ||
334 (ichn == 3 &&
m_chain.size() == 4)) {
348 for (
unsigned int ii = 0; ii <
args.ct; ++ii) {
353 m_geo->getDDE(cs, cellele->
eta(), cellele->
phi());
354 sumEhit +=
args.hitcells_E_h[ii].energy;
356 if (std::abs(sumEhit) > std::abs(Elayer))
357 simulstate.
deposit(cell_h,
args.hitcells_E_h[ii].energy);
368 int retry_warning = 1;
381 for (
auto hititr = hitloopstart; hititr !=
m_chain.end(); ++hititr) {
398 retry_warning = retry >> 1;
399 if (retry_warning < 1)
408 if (((ihit == 20 * nhit) || (ihit == 100 * nhit)) && ihit >= 100) {
410 "TFCSLateralShapeParametrizationHitChain::simulate(): Iterated "
411 << ihit <<
" times, expected " << nhit <<
" times. Deposited E("
412 << cs <<
")=" << sumEhit <<
" expected E=" << Elayer);
414 if (ihit >= 1000 * nhit && ihit >= 1000) {
415 ATH_MSG_DEBUG(
"TFCSLateralShapeParametrizationHitChain::simulate():"
416 " Aborting hit chain, iterated "
417 << ihit <<
" times, expected " << nhit
418 <<
" times. Deposited E(" << cs <<
")=" << sumEhit
419 <<
" expected E=" << Elayer <<
", caused by:");
424 if (ifail >= retry) {
425 ATH_MSG_ERROR(
"TFCSLateralShapeParametrizationHitChain::simulate(): "
426 "simulate_hit call failed after "
427 << ifail <<
"/" << retry
428 <<
"retries, total fails=" << itotalfail);
433 if (ifail >= retry_warning) {
435 " retry simulate_hit calls "
436 << ifail <<
"/" << retry
437 <<
", total fails=" << itotalfail);
440 }
while (std::abs(sumEhit) < std::abs(Elayer));
451 bool shortprint =
opt.Index(
"short") >= 0;
453 TString optprint =
opt;
454 optprint.ReplaceAll(
"short",
"");
458 ATH_MSG_INFO(optprint <<
"#:Number of hits simulation:");
464 for (
auto hititr =
m_chain.begin(); hititr != hitloopstart; ++hititr) {
471 for (
auto hititr = hitloopstart; hititr !=
m_chain.end(); ++hititr) {
JetConstituentVector::iterator iterator
GeoGpu * get_geoPtr() const
virtual int get_number_of_hits(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
Call get_number_of_hits() only once, as it could contain a random number.
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.
virtual float getMinWeight() const
Get minimum and maximum value of weight for hit energy reweighting.
virtual void set_pdgid_Ekin_eta_Ekin_bin_calosample(const TFCSLateralShapeParametrization &ref)
MSG::Level level() const
Retrieve output level.
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
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
#define ATH_MSG_VERBOSE(x)
CUDA_HOSTDEV float phi() const
cell phi
virtual double 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 by the amount of generat...
virtual const TFCSParametrizationBase * operator[](unsigned int ind) const override
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
virtual unsigned int size() const override
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
virtual float get_E_hit(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
Get hit energy from layer energy and number of hits.
virtual float getMaxWeight() const
CUDA_HOSTDEV float eta() const
cell eta
void simulate_hits(float, int, Chain0_Args &, bool)
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.
void push_back_init(const Chain_t::value_type &value)
static constexpr float s_max_sigma2_fluctuation
unsigned int get_nr_of_init() const
void deposit(const CaloDetDescrElement *cellele, float E)
virtual void set_geometry(ICaloGeometry *geo)
Method to set the geometry access pointer.
unsigned long get_ncells() const
TFCSLateralShapeParametrizationHitChain(const char *name=nullptr, const char *title=nullptr)
const CaloDetDescrElement_Gpu * index2cell(unsigned long index)
TFCSLateralShapeParametrizationHitBase * m_number_of_hits_simul
virtual void set_daughter(unsigned int ind, TFCSParametrizationBase *param) override
Some derived classes have daughter instances of TFCSParametrizationBase objects The set_daughter meth...
virtual int get_number_of_hits(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
Call get_number_of_hits() only once per shower simulation, as it could be calculated with random numb...
#define ATH_MSG_WARNING(x)
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
const Chain_t & chain() const
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
void Print(Option_t *option="") const override
Do not persistify!