7#include "HepPDT/ParticleData.hh"
34 float eta_center, phi_center;
38 if (eta_center > 1.4) {
49 const float Ekin = truth->
Ekin();
52 Einit = simulstate.
E();
59 get_event(simulstate, eta_center, phi_center, Einit, reference_layer_index);
61 for (
long unsigned int layer_index = 0;
67 simulstate.
set_E(layer_index, 0);
68 simulstate.
add_E(layer_index, layer_energy);
71 if (simulstate.
E() > std::numeric_limits<double>::epsilon()) {
73 simulstate.
set_Efrac(ilayer, simulstate.
E(ilayer) / simulstate.
E());
83 const int pdgId = truth->
pdgid();
84 const float charge = HepPDT::ParticleID(pdgId).charge();
89 const double center_r = hit.
center_r();
90 const double center_z = hit.
center_z();
92 ATH_MSG_VERBOSE(
" Layer " << layer_index <<
" Extrap eta " << center_eta
93 <<
" phi " << center_phi <<
" R " << center_r);
96 const float dist000 = TMath::Sqrt(center_r * center_r + center_z * center_z);
97 const float eta_jakobi = TMath::Abs(2.0 * TMath::Exp(-center_eta) /
98 (1.0 + TMath::Exp(-2 * center_eta)));
100 long unsigned int hit_index = hit.
idx();
104 std::tie(
r, alpha, E) =
111 float delta_eta_mm =
r * std::cos(alpha);
112 float delta_phi_mm =
r * std::sin(alpha);
117 if (center_eta < 0.) {
118 delta_eta_mm = -delta_eta_mm;
125 if ((
charge < 0. && pdgId != 11) || pdgId == -11)
126 delta_phi_mm = -delta_phi_mm;
128 const float delta_eta = delta_eta_mm / eta_jakobi / dist000;
129 const float delta_phi = delta_phi_mm / center_r;
131 hit.
eta() = center_eta + delta_eta;
132 hit.
phi() = TVector2::Phi_mpi_pi(center_phi + delta_phi);
135 <<
" layer " << layer_index);
138 const float hit_r =
r * std::cos(alpha) + center_r;
139 float delta_phi =
r * std::sin(alpha) / center_r;
144 if ((
charge < 0. && pdgId != 11) || pdgId == -11)
145 delta_phi = -delta_phi;
146 const float hit_phi = TVector2::Phi_mpi_pi(center_phi + delta_phi);
147 hit.
x() = hit_r * std::cos(hit_phi);
148 hit.
y() = hit_r * std::sin(hit_phi);
#define ATH_MSG_VERBOSE(x)
double charge(const T &p)
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
void reset_OnlyScaleEnergy()
TFCSBinnedShowerBase(const char *name=nullptr, const char *title=nullptr)
virtual float get_layer_energy(TFCSSimulationState &simulstate, long unsigned int layer_index) const =0
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
simulated one hit position with some energy.
virtual std::tuple< float, float, float > get_hit_position_and_energy(TFCSSimulationState &simulstate, long unsigned int layer_index, long unsigned int hit_index) const =0
bool OnlyScaleEnergy() const
virtual void get_event(TFCSSimulationState &simulstate, float eta_center, float phi_center, float e_init, long unsigned int reference_layer_index) const =0
do not persistify
virtual ~TFCSBinnedShowerBase()
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
long unsigned int & idx()
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
void set_E(int sample, double Esample)
void add_E(int sample, double Esample)
void set_Efrac(int sample, double Efracsample)