7#include "CLHEP/Random/RandFlat.h"
8#include "CLHEP/Random/RandGaussZiggurat.h"
43 const double center_r = hit.
center_r();
44 const double center_z = hit.
center_z();
46 const float dist000 = TMath::Sqrt(center_r * center_r + center_z * center_z);
47 const float eta_jakobi = TMath::Abs(2.0 * TMath::Exp(-center_eta) /
48 (1.0 + TMath::Exp(-2 * center_eta)));
50 const float delta_eta = hit.
eta() - center_eta;
51 const float delta_phi = hit.
phi() - center_phi;
52 const float delta_eta_mm = delta_eta * eta_jakobi * dist000;
53 const float delta_phi_mm = delta_phi * center_r;
54 const float delta_r_mm =
55 TMath::Sqrt(delta_eta_mm * delta_eta_mm + delta_phi_mm * delta_phi_mm);
64 float weight =
m_hist->GetBinContent(
bin);
68 CLHEP::RandGaussZiggurat::shoot(simulstate.
randomEngine(), weight, RMS);
73 <<
" weight=" << weight);
82 m_hist = (TH1 *)hist->Clone(TString(
"TFCSHistoLateralShapeWeight_") +
84 m_hist->SetDirectory(
nullptr);
91 bool shortprint = opt.Index(
"short") >= 0;
92 bool longprint =
msgLvl(MSG::DEBUG) || (
msgLvl(MSG::INFO) && !shortprint);
93 TString optprint = opt;
94 optprint.ReplaceAll(
"short",
"");
100 <<
" Histogram: " <<
m_hist->GetNbinsX() <<
" bins ["
101 << std::as_const(
m_hist)->GetXaxis()->GetXmin() <<
","
102 << std::as_const(
m_hist)->GetXaxis()->GetXmax() <<
"]"
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
virtual ~TFCSHistoLateralShapeWeight()
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
weight the energy of one hit in order to generate fluctuations
virtual void Print(Option_t *option="") const override
bool Initialize(TH1 *hist)
Init from histogram.
TFCSHistoLateralShapeWeight(const char *name=nullptr, const char *title=nullptr)
virtual float getMinWeight() const override
Get minimum and maximum value of weight for hit energy reweighting.
TH1 * m_hist
Histogram to be used for the shape simulation The histogram x-axis should be in dR^2=deta^2+dphi^2.
virtual float getMaxWeight() const override
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
void Print(Option_t *option="") const override
CLHEP::HepRandomEngine * randomEngine()