ATLAS Offline Software
Loading...
Searching...
No Matches
TFCSBinnedShowerONNX Class Reference

#include <TFCSBinnedShowerONNX.h>

Inheritance diagram for TFCSBinnedShowerONNX:
Collaboration diagram for TFCSBinnedShowerONNX:

Classes

struct  layer_bins_t

Public Types

typedef std::vector< layer_bins_tevent_bins_t
enum  FCSEnergyInitializationStatusBits { kOnlyScaleEnergy = }
 Status bit for energy initialization. More...
enum  FCSStatusBits { kMatchAllPDGID }
 Status bit for FCS needs. More...
typedef std::map< TFCSParametrizationBase *, Duplicate_tFindDuplicates_t
typedef std::map< std::string, FindDuplicates_tFindDuplicateClasses_t

Public Member Functions

 TFCSBinnedShowerONNX (const char *name=nullptr, const char *title=nullptr)
virtual ~TFCSBinnedShowerONNX ()
virtual bool is_match_Ekin_bin (int) const override
void enable_upscaling ()
void disable_upscaling ()
void set_default_hit_energy (float energy)
float get_default_hit_energy () const
void set_max_hits_per_voxel (int max_hits)
int get_max_hits_per_voxel () const
void load_simulator (std::string &filename)
void load_meta_data (const std::string &filename, std::vector< long unsigned int > &layers)
void load_sub_bin_distribution (const std::string &filename)
void set_bin_boundaries (long unsigned int layer_index, const std::vector< float > &R_lower, const std::vector< float > &R_size, const std::vector< float > &alpha_lower, const std::vector< float > &alpha_size)
const event_bins_tget_coordinates ()
void set_coordinates (const event_bins_t &coordinates)
const std::vector< std::vector< std::vector< std::vector< float > > > > & get_sub_bin_distribution () const
const std::vector< float > & get_upscaling_energies () const
void set_sub_bin_distribution_and_energies (const std::vector< std::vector< std::vector< std::vector< float > > > > &sub_bin_distribution, const std::vector< float > &upscaling_energies)
bool OnlyScaleEnergy () const
void set_OnlyScaleEnergy ()
void reset_OnlyScaleEnergy ()
virtual FCSReturnCode simulate (TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
 Method in all derived classes to do some simulation.
virtual FCSReturnCode simulate_hit (Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
 simulated one hit position with some energy.
ICaloGeometryget_geometry ()
virtual void set_geometry (ICaloGeometry *geo) override
 Method to set the geometry access pointer.
virtual int get_number_of_hits (TFCSSimulationState &simulstate, const TFCSTruthState *, const TFCSExtrapolationState *) const override
 Call get_number_of_hits() only once per shower simulation, as it could be calculated with random numbers and give different results each time.
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 generated hits.
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 getMinWeight () const
 Get minimum and maximum value of weight for hit energy reweighting.
virtual float getMaxWeight () const
bool is_match_calosample (int calosample) const override
virtual bool is_match_all_Ekin_bin () const override
virtual bool is_match_all_calosample () const override
int Ekin_bin () const
void set_Ekin_bin (int bin)
int calosample () const
void set_calosample (int cs)
virtual void set_pdgid_Ekin_eta_Ekin_bin_calosample (const TFCSLateralShapeParametrization &ref)
void Print (Option_t *option="") const override
void clear ()
virtual bool is_match_pdgid (int id) const override
virtual bool is_match_Ekin (float Ekin) const override
virtual bool is_match_eta (float eta) const override
virtual bool is_match_all_Ekin () const override
virtual bool is_match_all_eta () const override
const std::set< int > & pdgid () const override
double Ekin_nominal () const override
double Ekin_min () const override
double Ekin_max () const override
double eta_nominal () const override
double eta_min () const override
double eta_max () const override
virtual void set_pdgid (int id)
virtual void set_pdgid (const std::set< int > &ids)
virtual void add_pdgid (int id)
virtual void clear_pdgid ()
virtual void set_Ekin_nominal (double min)
virtual void set_Ekin_min (double min)
virtual void set_Ekin_max (double max)
virtual void set_eta_nominal (double min)
virtual void set_eta_min (double min)
virtual void set_eta_max (double max)
virtual void set_Ekin (const TFCSParametrizationBase &ref)
virtual void set_eta (const TFCSParametrizationBase &ref)
virtual void set_Ekin_eta (const TFCSParametrizationBase &ref)
virtual void set_pdgid_Ekin_eta (const TFCSParametrizationBase &ref)
virtual bool is_match_all_pdgid () const
virtual void set_match_all_pdgid ()
virtual void reset_match_all_pdgid ()
virtual unsigned int size () const
 Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operator[] methods give general access to these daughters.
virtual const TFCSParametrizationBaseoperator[] (unsigned int) const
 Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operator[] methods give general access to these daughters.
virtual TFCSParametrizationBaseoperator[] (unsigned int)
 Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operator[] methods give general access to these daughters.
virtual void set_daughter (unsigned int, TFCSParametrizationBase *)
 Some derived classes have daughter instances of TFCSParametrizationBase objects The set_daughter method allows to change these daughters - expert use only!
virtual bool operator== (const TFCSParametrizationBase &ref) const
 The == operator compares the content of instances.
virtual void CleanAuxInfo (TFCSSimulationState &) const
 Method in all derived classes to delete objects stored in the simulstate AuxInfo.
void FindDuplicates (FindDuplicateClasses_t &dup)
void RemoveDuplicates ()
void RemoveNameTitle ()
bool msgLvl (const MSG::Level lvl) const
 Check whether the logging system is active at the provided verbosity level.
MsgStream & msg () const
 Return a stream for sending messages directly (no decoration).
MsgStream & msg (const MSG::Level lvl) const
 Return a decorated starting stream for sending messages.
MSG::Level level () const
 Retrieve output level.
virtual void setLevel (MSG::Level lvl)
 Update outputlevel.

Static Public Member Functions

static std::string startMsg (MSG::Level lvl, const std::string &file, int line)
 Make a message to decorate the start of logging.

Protected Member Functions

virtual void get_event (TFCSSimulationState &simulstate, float eta_center, float phi_center, float e_init, long unsigned int reference_layer_index) const override
 do not persistify
virtual long unsigned int get_n_hits (TFCSSimulationState &simulstate, long unsigned int layer_index) const override
virtual void compute_n_hits_and_elayer (TFCSSimulationState &simulstate) const
virtual float get_layer_energy (TFCSSimulationState &simulstate, long unsigned int layer_index) const override
virtual std::tuple< float, float, float > get_hit_position_and_energy (TFCSSimulationState &simulstate, long unsigned int layer_index, long unsigned int hit_index) const override
virtual void delete_event (TFCSSimulationState &simulstate) const override
bool compare (const TFCSParametrizationBase &ref) const

Protected Attributes

ICaloGeometrym_geo {}

Static Protected Attributes

static constexpr double init_Ekin_nominal = 0
static constexpr double init_Ekin_min = 0
 Do not persistify!
static constexpr double init_Ekin_max = 14000000
 Do not persistify!
static constexpr double init_eta_nominal = 0
 Do not persistify!
static constexpr double init_eta_min = -100
 Do not persistify!
static constexpr double init_eta_max = 100
 Do not persistify!

Private Member Functions

std::tuple< float, float > get_coordinates (TFCSSimulationState &simulstate, long unsigned int layer_index, int bin_index) const
void upscale (TFCSSimulationState &simulstate, float &R_min, float &R_max, float &alpha_min, float &alpha_max, long unsigned int layer_index, int bin_index) const
long unsigned int get_energy_index (TFCSSimulationState &simulstate, long unsigned int layer_index, long unsigned int hit_index) const
std::tuple< std::vector< float >, std::vector< hsize_t >, bool > load_hdf5_dataset (const std::string &filename, const std::string &datasetname)
void load_bin_boundaries (const std::string &filename, long unsigned int layer_index)
void load_upscaling_distribution (const std::string &filename, long unsigned int layer_index)

Private Attributes

const long unsigned int m_n_layers
float m_default_hit_energy = 4.
int m_max_hits_per_voxel = 100
event_bins_t m_coordinates
bool m_use_upscaling = false
std::vector< std::vector< std::vector< std::vector< float > > > > m_sub_bin_distribution
std::vector< float > m_upscaling_energies
TFCSMLCalorimeterSimulatorm_ai_simulator = nullptr
int m_Ekin_bin
int m_calosample
std::set< int > m_pdgid
double m_Ekin_nominal
double m_Ekin_min
double m_Ekin_max
double m_eta_nominal
double m_eta_min
double m_eta_max
std::string m_nm
 Message source name.

Static Private Attributes

static boost::thread_specific_ptr< MsgStream > m_msg_tls ATLAS_THREAD_SAFE
 Do not persistify!

Detailed Description

Definition at line 25 of file TFCSBinnedShowerONNX.h.

Member Typedef Documentation

◆ event_bins_t

Definition at line 35 of file TFCSBinnedShowerONNX.h.

◆ FindDuplicateClasses_t

typedef std::map<std::string, FindDuplicates_t> TFCSParametrizationBase::FindDuplicateClasses_t
inherited

Definition at line 142 of file TFCSParametrizationBase.h.

◆ FindDuplicates_t

Member Enumeration Documentation

◆ FCSEnergyInitializationStatusBits

Status bit for energy initialization.

Enumerator
kOnlyScaleEnergy 

Set this bit in the TObject bit field the simulated energy.

should only be scaled by the GAN

Definition at line 24 of file TFCSBinnedShowerBase.h.

24 {
26 BIT(18)
28 };
@ kOnlyScaleEnergy
Set this bit in the TObject bit field the simulated energy.

◆ FCSStatusBits

Status bit for FCS needs.

Enumerator
kMatchAllPDGID 

Set this bit in the TObject bit field if valid for all PDGID.

Definition at line 52 of file TFCSParametrizationBase.h.

52 {
53 kMatchAllPDGID = BIT(
54 14)
55 };
@ kMatchAllPDGID
Set this bit in the TObject bit field if valid for all PDGID.

Constructor & Destructor Documentation

◆ TFCSBinnedShowerONNX()

TFCSBinnedShowerONNX::TFCSBinnedShowerONNX ( const char * name = nullptr,
const char * title = nullptr )

Definition at line 49 of file TFCSBinnedShowerONNX.cxx.

50 : TFCSBinnedShowerBase(name, title) {}
TFCSBinnedShowerBase(const char *name=nullptr, const char *title=nullptr)

◆ ~TFCSBinnedShowerONNX()

TFCSBinnedShowerONNX::~TFCSBinnedShowerONNX ( )
virtual

Definition at line 52 of file TFCSBinnedShowerONNX.cxx.

52 {
53 // Delete the AI simulator
54 if (m_ai_simulator) {
55 delete m_ai_simulator;
56 m_ai_simulator = nullptr;
57 }
58}
TFCSMLCalorimeterSimulator * m_ai_simulator

Member Function Documentation

◆ add_pdgid()

void TFCSParametrization::add_pdgid ( int id)
virtualinherited

Reimplemented in TFCSEnergyBinParametrization.

Definition at line 35 of file TFCSParametrization.cxx.

35{ m_pdgid.insert(id); }

◆ calosample()

int TFCSLateralShapeParametrization::calosample ( ) const
inlineinherited

◆ CleanAuxInfo()

virtual void TFCSParametrizationBase::CleanAuxInfo ( TFCSSimulationState & ) const
inlinevirtualinherited

Method in all derived classes to delete objects stored in the simulstate AuxInfo.

Definition at line 130 of file TFCSParametrizationBase.h.

130{};

◆ clear()

void TFCSParametrization::clear ( )
inherited

Definition at line 18 of file TFCSParametrization.cxx.

18 {
19 m_pdgid.clear();
26}
static constexpr double init_Ekin_nominal
static constexpr double init_eta_max
Do not persistify!
static constexpr double init_Ekin_max
Do not persistify!
static constexpr double init_eta_nominal
Do not persistify!
static constexpr double init_eta_min
Do not persistify!
static constexpr double init_Ekin_min
Do not persistify!

◆ clear_pdgid()

void TFCSParametrization::clear_pdgid ( )
virtualinherited

Reimplemented in TFCSEnergyBinParametrization.

Definition at line 37 of file TFCSParametrization.cxx.

37{ m_pdgid.clear(); }

◆ compare()

bool TFCSLateralShapeParametrization::compare ( const TFCSParametrizationBase & ref) const
protectedinherited

Definition at line 32 of file TFCSLateralShapeParametrization.cxx.

33 {
34 if (IsA() != ref.IsA()) {
35 ATH_MSG_DEBUG("compare(): different class types "
36 << IsA()->GetName() << " != " << ref.IsA()->GetName());
37 return false;
38 }
39 const TFCSLateralShapeParametrization &ref_typed =
40 static_cast<const TFCSLateralShapeParametrization &>(ref);
41 if (Ekin_bin() != ref_typed.Ekin_bin()) {
42 ATH_MSG_DEBUG("compare(): different Ekin bin");
43 return false;
44 }
45 if (calosample() != ref_typed.calosample()) {
46 ATH_MSG_DEBUG("compare(): different calosample");
47 return false;
48 }
49
50 return true;
51}
const std::regex ref(r_ef)
#define ATH_MSG_DEBUG(x)
TFCSLateralShapeParametrization(const char *name=nullptr, const char *title=nullptr)
#define IsA
Declare the TObject style functions.

◆ compute_n_hits_and_elayer()

void TFCSBinnedShowerONNX::compute_n_hits_and_elayer ( TFCSSimulationState & simulstate) const
protectedvirtual

Definition at line 207 of file TFCSBinnedShowerONNX.cxx.

208 {
209
210 TFCSMLCalorimeterSimulator::event_t *event =
211 static_cast<TFCSMLCalorimeterSimulator::event_t *>(
212 simulstate.getAuxInfo<void *>("BSEventData"_FCShash));
213 float e_init = simulstate.getAuxInfo<float>("BSEinit"_FCShash);
214
215 // Loop over all layers
216 long unsigned int n_layers = event->event_data.size();
217 std::vector<std::vector<long unsigned int>> hits_per_layer;
218 std::vector<float> elayer;
219 hits_per_layer.resize(n_layers);
220 elayer.resize(n_layers, 0.0f);
221
222 for (long unsigned int layer_index = 0; layer_index < n_layers;
223 ++layer_index) {
224
225 TFCSMLCalorimeterSimulator::layer_t &layer = event->event_data.at(layer_index);
226
227 // Loop over all voxels in the layer
228 long unsigned int n_hits = 0;
229 for (float e_voxel : layer.E_vector) {
230 long unsigned int hits_per_bin;
231 if (e_voxel > std::numeric_limits<float>::epsilon()) {
232 hits_per_bin =
233 std::min(std::max(int(e_voxel * e_init / m_default_hit_energy), 1),
235 elayer.at(layer_index) += e_voxel * e_init;
236
237 } else {
238 hits_per_bin = 0;
239 }
240 n_hits += hits_per_bin;
241 hits_per_layer.at(layer_index).push_back(n_hits);
242 }
243 }
244 // Store the hits per layer vector
245 std::vector<std::vector<long unsigned int>> *hits_per_layer_ptr =
246 new std::vector<std::vector<long unsigned int>>(std::move(hits_per_layer));
247 simulstate.setAuxInfo<void *>("BSNHits"_FCShash, hits_per_layer_ptr);
248
249 // Store the energy per layer
250 std::vector<float> *elayer_ptr = new std::vector<float>(std::move(elayer));
251 simulstate.setAuxInfo<void *>("BSELayer"_FCShash, elayer_ptr);
252}
const T getAuxInfo(std::uint32_t index) const
void setAuxInfo(std::uint32_t index, const T &val)
@ layer
Definition HitInfo.h:79

◆ delete_event()

void TFCSBinnedShowerONNX::delete_event ( TFCSSimulationState & simulstate) const
overrideprotectedvirtual

Implements TFCSBinnedShowerBase.

Definition at line 497 of file TFCSBinnedShowerONNX.cxx.

497 {
498 // Delete the event data
499 void *event_ptr = simulstate.getAuxInfo<void *>("BSEventData"_FCShash);
500 if (event_ptr) {
501 delete static_cast<TFCSMLCalorimeterSimulator::event_t *>(event_ptr);
502 simulstate.setAuxInfo<void *>("BSEventData"_FCShash, nullptr);
503 } else {
504 ATH_MSG_ERROR("No event data found to delete.");
505 }
506
507 void *n_hits_ptr = simulstate.getAuxInfo<void *>("BSNHits"_FCShash);
508 if (n_hits_ptr) {
509 delete static_cast<std::vector<std::vector<long unsigned int>> *>(
510 n_hits_ptr);
511 simulstate.setAuxInfo<void *>("BSNHits"_FCShash, nullptr);
512 } else {
513 ATH_MSG_ERROR("No event hits data found to delete.");
514 }
515
516 void *elayer_ptr = simulstate.getAuxInfo<void *>("BSELayer"_FCShash);
517 if (elayer_ptr) {
518 delete static_cast<std::vector<float> *>(elayer_ptr);
519 simulstate.setAuxInfo<void *>("BSELayer"_FCShash, nullptr);
520 } else {
521 ATH_MSG_ERROR("No event layer energy data found to delete.");
522 }
523
524 return;
525}
#define ATH_MSG_ERROR(x)

◆ disable_upscaling()

void TFCSBinnedShowerONNX::disable_upscaling ( )
inline

Definition at line 46 of file TFCSBinnedShowerONNX.h.

◆ Ekin_bin()

int TFCSLateralShapeParametrization::Ekin_bin ( ) const
inlineinherited

◆ Ekin_max()

double TFCSParametrization::Ekin_max ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 37 of file TFCSParametrization.h.

37{ return m_Ekin_max; };

◆ Ekin_min()

double TFCSParametrization::Ekin_min ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 36 of file TFCSParametrization.h.

36{ return m_Ekin_min; };

◆ Ekin_nominal()

double TFCSParametrization::Ekin_nominal ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 35 of file TFCSParametrization.h.

35{ return m_Ekin_nominal; };

◆ enable_upscaling()

void TFCSBinnedShowerONNX::enable_upscaling ( )
inline

Definition at line 45 of file TFCSBinnedShowerONNX.h.

45{ m_use_upscaling = true; };

◆ eta_max()

double TFCSParametrization::eta_max ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 40 of file TFCSParametrization.h.

40{ return m_eta_max; };

◆ eta_min()

double TFCSParametrization::eta_min ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 39 of file TFCSParametrization.h.

39{ return m_eta_min; };

◆ eta_nominal()

double TFCSParametrization::eta_nominal ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 38 of file TFCSParametrization.h.

38{ return m_eta_nominal; };

◆ FindDuplicates()

void TFCSParametrizationBase::FindDuplicates ( FindDuplicateClasses_t & dup)
inherited

Definition at line 90 of file TFCSParametrizationBase.cxx.

91 {
92
93 for (unsigned int i = 0; i < size(); ++i)
94 if ((*this)[i]) {
95 TFCSParametrizationBase *param = (*this)[i];
96 FindDuplicates_t &dup = dupclasses[param->GetName()];
97 // If param is already in the duplication list, skip over
98 auto checkexist = dup.find(param);
99 if (checkexist != dup.end()) {
100 ATH_MSG_WARNING(" [TFCSParametrizationBase::FindDuplicates] "
101 "DUPLICATE POINTER DETECTED");
102
103 ATH_MSG_WARNING(" - Pointer : " << param);
104 ATH_MSG_WARNING(" - Name : " << param->GetName());
105 ATH_MSG_WARNING(" - Class : " << param->ClassName());
106 ATH_MSG_WARNING(" - Occurs in parent : " << this
107 << " (" << this->ClassName() << ")"
108 << " index=" << i);
109
110 if (checkexist->second.replace) {
111 TFCSParametrizationBase *refparam = checkexist->second.replace;
112 ATH_MSG_DEBUG("Found duplicate pointer: "
113 << refparam << "=" << refparam->GetName()
114 << ", duplicate is " << param << "=" << param->GetName()
115 << " index " << i << " of " << this);
116 dup[refparam].mother.push_back(this);
117 dup[refparam].index.push_back(i);
118 }
119 continue;
120 }
121 // Add param to duplication list
122 dup[param] = Duplicate_t();
123 for (auto &ref : dup) {
124 TFCSParametrizationBase *refparam = ref.first;
125 // skip itself, as this just added above
126 if (param == refparam)
127 continue;
128 // skip nullptr reference
129 if (refparam == nullptr)
130 continue;
131 // skip reference that is itself going to get replaced
132 if (ref.second.replace)
133 continue;
134 // Check for objects with identical content
135 if (*param == *refparam) {
136 ATH_MSG_DEBUG("Found duplicate: "
137 << refparam << "=" << refparam->GetName()
138 << ", duplicate is " << param << "=" << param->GetName()
139 << " index " << i << " of " << this);
140
141 dup[param].replace = refparam;
142 dup[refparam].mother.push_back(this);
143 dup[refparam].index.push_back(i);
144 break;
145 }
146 }
147 // Continue for child objects in param
148 param->FindDuplicates(dupclasses);
149 }
150}
#define ATH_MSG_WARNING(x)
void FindDuplicates(FindDuplicateClasses_t &dup)
std::map< TFCSParametrizationBase *, Duplicate_t > FindDuplicates_t
virtual unsigned int size() const
Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operat...
TFCSParametrizationBase(const char *name=nullptr, const char *title=nullptr)
ClassName()
Default constructor.

◆ get_coordinates() [1/2]

const event_bins_t & TFCSBinnedShowerONNX::get_coordinates ( )
inline

Definition at line 75 of file TFCSBinnedShowerONNX.h.

75{ return m_coordinates; }

◆ get_coordinates() [2/2]

std::tuple< float, float > TFCSBinnedShowerONNX::get_coordinates ( TFCSSimulationState & simulstate,
long unsigned int layer_index,
int bin_index ) const
private

Definition at line 324 of file TFCSBinnedShowerONNX.cxx.

326 {
327 float R_min = m_coordinates.at(layer_index).R_lower.at(bin_index);
328 float R_max = m_coordinates.at(layer_index).R_size.at(bin_index) +
329 m_coordinates.at(layer_index).R_lower.at(bin_index);
330
331 float alpha_min = m_coordinates.at(layer_index).alpha_lower.at(bin_index);
332 float alpha_max = m_coordinates.at(layer_index).alpha_size.at(bin_index) +
333 m_coordinates.at(layer_index).alpha_lower.at(bin_index);
334
335 if (m_use_upscaling) {
336 upscale(simulstate, R_min, R_max, alpha_min, alpha_max, layer_index,
337 bin_index);
338 }
339
340 float R = CLHEP::RandFlat::shoot(simulstate.randomEngine(), R_min, R_max);
341 float alpha =
342 CLHEP::RandFlat::shoot(simulstate.randomEngine(), alpha_min, alpha_max);
343
344 return std::make_tuple(R, alpha);
345}
void upscale(TFCSSimulationState &simulstate, float &R_min, float &R_max, float &alpha_min, float &alpha_max, long unsigned int layer_index, int bin_index) const
CLHEP::HepRandomEngine * randomEngine()
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)

◆ get_default_hit_energy()

float TFCSBinnedShowerONNX::get_default_hit_energy ( ) const
inline

Definition at line 49 of file TFCSBinnedShowerONNX.h.

49{ return m_default_hit_energy; }

◆ get_E_hit()

float TFCSLateralShapeParametrizationHitBase::get_E_hit ( TFCSSimulationState & simulstate,
const TFCSTruthState * truth,
const TFCSExtrapolationState * extrapol ) const
virtualinherited

Get hit energy from layer energy and number of hits.

Definition at line 31 of file TFCSLateralShapeParametrizationHitBase.cxx.

33 {
34 const int nhits = get_number_of_hits(simulstate, truth, extrapol);
35 const int sample = calosample();
36 if (nhits <= 0 || sample < 0)
37 return -1.;
38 else
39 return simulstate.E(sample) / nhits;
40}
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...

◆ get_energy_index()

long unsigned int TFCSBinnedShowerONNX::get_energy_index ( TFCSSimulationState & simulstate,
long unsigned int layer_index,
long unsigned int hit_index ) const
private

Definition at line 287 of file TFCSBinnedShowerONNX.cxx.

289 {
290 std::vector<std::vector<long unsigned int>> *hits_per_layer_ptr =
291 static_cast<std::vector<std::vector<long unsigned int>> *>(
292 simulstate.getAuxInfo<void *>("BSNHits"_FCShash));
293 if (!hits_per_layer_ptr) {
294 ATH_MSG_ERROR("Invalid hits per layer information");
295 return 0;
296 }
297
298 if (layer_index >= hits_per_layer_ptr->size()) {
299 ATH_MSG_ERROR("Layer index out of bounds: " << layer_index << " >= "
300 << hits_per_layer_ptr->size());
301 return 0;
302 }
303
304 // Find the hit index in the hit vector for the given layer
305 const std::vector<long unsigned int> &hits =
306 hits_per_layer_ptr->at(layer_index);
307 auto it = std::upper_bound(hits.begin(), hits.end(), hit_index);
308 long unsigned int energy_index = std::distance(hits.begin(), it);
309
310 if (energy_index >= hits.size()) {
311 ATH_MSG_ERROR("Energy index out of bounds: " << energy_index
312 << " >= " << hits.size());
313 // Print full hits for debugging
314 ATH_MSG_ERROR("Hits per layer: ");
315 for (const auto &hit : hits) {
316 ATH_MSG_ERROR("Hit: " << hit);
317 }
318 return 0;
319 }
320
321 return energy_index;
322}

◆ get_event()

void TFCSBinnedShowerONNX::get_event ( TFCSSimulationState & simulstate,
float eta_center,
float phi_center,
float e_init,
long unsigned int reference_layer_index ) const
overrideprotectedvirtual

do not persistify

Implements TFCSBinnedShowerBase.

Definition at line 60 of file TFCSBinnedShowerONNX.cxx.

62 {
63
64 (void)reference_layer_index; // Unused parameter
65 (void)phi_center; // Unused parameter
66
67 const TFCSMLCalorimeterSimulator::event_t &event =
68 m_ai_simulator->getEvent(simulstate, eta_center, e_init);
69
70 // Store a pointer to the event
71 TFCSMLCalorimeterSimulator::event_t *event_ptr =
72 new TFCSMLCalorimeterSimulator::event_t(event);
73 simulstate.setAuxInfo<void *>("BSEventData"_FCShash, event_ptr);
74 simulstate.setAuxInfo<float>("BSEinit"_FCShash, e_init);
75
76 compute_n_hits_and_elayer(simulstate);
77}
virtual void compute_n_hits_and_elayer(TFCSSimulationState &simulstate) const

◆ get_geometry()

ICaloGeometry * TFCSBinnedShowerBase::get_geometry ( )
inlineinherited

Definition at line 46 of file TFCSBinnedShowerBase.h.

46{ return m_geo; };

◆ get_hit_position_and_energy()

std::tuple< float, float, float > TFCSBinnedShowerONNX::get_hit_position_and_energy ( TFCSSimulationState & simulstate,
long unsigned int layer_index,
long unsigned int hit_index ) const
overrideprotectedvirtual

Implements TFCSBinnedShowerBase.

Definition at line 454 of file TFCSBinnedShowerONNX.cxx.

456 {
457
458 TFCSMLCalorimeterSimulator::event_t *event =
459 static_cast<TFCSMLCalorimeterSimulator::event_t *>(
460 simulstate.getAuxInfo<void *>("BSEventData"_FCShash));
461
462 float e_init = simulstate.getAuxInfo<float>("BSEinit"_FCShash);
463
464 if (layer_index >= event->event_data.size()) {
465 ATH_MSG_ERROR("Layer index out of bounds: " << layer_index << " >= "
466 << event->event_data.size());
467 return std::make_tuple(0.0f, 0.0f, 0.0f);
468 }
469
470 long unsigned int energy_index = get_energy_index(
471 simulstate, layer_index, hit_index); // Get the bin index for the hit
472
473 std::vector<std::vector<long unsigned int>> *hits_per_layer_ptr =
474 static_cast<std::vector<std::vector<long unsigned int>> *>(
475 simulstate.getAuxInfo<void *>("BSNHits"_FCShash));
476
477 long unsigned int hits_per_bin;
478 if (energy_index == 0) {
479 hits_per_bin = hits_per_layer_ptr->at(layer_index).at(energy_index);
480 } else {
481 hits_per_bin = hits_per_layer_ptr->at(layer_index).at(energy_index) -
482 hits_per_layer_ptr->at(layer_index).at(energy_index - 1);
483 }
484
485 float r, alpha;
486
487 TFCSMLCalorimeterSimulator::layer_t &layer = event->event_data.at(layer_index);
488
489 std::tie(r, alpha) = get_coordinates(simulstate, layer_index,
490 layer.bin_index_vector.at(energy_index));
491
492 float E = layer.E_vector.at(energy_index) * e_init / hits_per_bin;
493
494 return std::make_tuple(r, alpha, E);
495}
long unsigned int get_energy_index(TFCSSimulationState &simulstate, long unsigned int layer_index, long unsigned int hit_index) const
const event_bins_t & get_coordinates()
int r
Definition globals.cxx:22

◆ get_layer_energy()

float TFCSBinnedShowerONNX::get_layer_energy ( TFCSSimulationState & simulstate,
long unsigned int layer_index ) const
overrideprotectedvirtual

Implements TFCSBinnedShowerBase.

Definition at line 269 of file TFCSBinnedShowerONNX.cxx.

270 {
271 std::vector<float> *elayer_ptr = static_cast<std::vector<float> *>(
272 simulstate.getAuxInfo<void *>("BSELayer"_FCShash));
273 if (!elayer_ptr) {
274 ATH_MSG_ERROR("Invalid layer energy information");
275 return 0.0f;
276 }
277 if (layer_index >= elayer_ptr->size()) {
278 return 0.0f;
279 }
280
281 ATH_MSG_DEBUG("returning energy for layer " << layer_index
282 << ": " << elayer_ptr->at(layer_index));
283
284 return elayer_ptr->at(layer_index);
285}

◆ get_max_hits_per_voxel()

int TFCSBinnedShowerONNX::get_max_hits_per_voxel ( ) const
inline

Definition at line 51 of file TFCSBinnedShowerONNX.h.

51{ return m_max_hits_per_voxel; }

◆ get_n_hits()

long unsigned int TFCSBinnedShowerONNX::get_n_hits ( TFCSSimulationState & simulstate,
long unsigned int layer_index ) const
overrideprotectedvirtual

Implements TFCSBinnedShowerBase.

Definition at line 254 of file TFCSBinnedShowerONNX.cxx.

255 {
256
257 std::vector<std::vector<long unsigned int>> *hits_per_layer_ptr =
258 static_cast<std::vector<std::vector<long unsigned int>> *>(
259 simulstate.getAuxInfo<void *>("BSNHits"_FCShash));
260
261 if (!hits_per_layer_ptr) {
262 ATH_MSG_ERROR("Invalid hits per layer information");
263 return 0;
264 }
265
266 return hits_per_layer_ptr->at(layer_index).back();
267}

◆ get_number_of_hits()

virtual int TFCSBinnedShowerBase::get_number_of_hits ( TFCSSimulationState & simulstate,
const TFCSTruthState * truth,
const TFCSExtrapolationState * extrapol ) const
inlineoverridevirtualinherited

Call get_number_of_hits() only once per shower simulation, as it could be calculated with random numbers and give different results each time.

Return a value of -1 if this instance can't determine

Reimplemented from TFCSLateralShapeParametrizationHitBase.

Definition at line 53 of file TFCSBinnedShowerBase.h.

55 {
56 long unsigned int nhits = get_n_hits(simulstate, calosample());
57 if (nhits == 0)
58 return -1;
59 return static_cast<int>(nhits);
60 }
virtual long unsigned int get_n_hits(TFCSSimulationState &simulstate, long unsigned int layer_index) const =0

◆ get_sigma2_fluctuation()

double TFCSLateralShapeParametrizationHitBase::get_sigma2_fluctuation ( TFCSSimulationState & simulstate,
const TFCSTruthState * truth,
const TFCSExtrapolationState * extrapol ) const
virtualinherited

Give the effective size sigma^2 of the fluctuations that should be generated by the amount of generated hits.

Return a value <0 if this instance can't determine

Reimplemented in TFCS2DFunctionLateralShapeParametrization, TFCSHistoLateralShapeParametrization, and TFCSLateralShapeParametrizationHitNumberFromE.

Definition at line 19 of file TFCSLateralShapeParametrizationHitBase.cxx.

21 {
22 return -1;
23}

◆ get_sub_bin_distribution()

const std::vector< std::vector< std::vector< std::vector< float > > > > & TFCSBinnedShowerONNX::get_sub_bin_distribution ( ) const
inline

Definition at line 82 of file TFCSBinnedShowerONNX.h.

82 {
84 }
std::vector< std::vector< std::vector< std::vector< float > > > > m_sub_bin_distribution

◆ get_upscaling_energies()

const std::vector< float > & TFCSBinnedShowerONNX::get_upscaling_energies ( ) const
inline

Definition at line 86 of file TFCSBinnedShowerONNX.h.

86 {
88 }
std::vector< float > m_upscaling_energies

◆ getMaxWeight()

float TFCSLateralShapeParametrizationHitBase::getMaxWeight ( ) const
virtualinherited

Reimplemented in TFCSHistoLateralShapeWeight.

Definition at line 46 of file TFCSLateralShapeParametrizationHitBase.cxx.

46 {
47 return -1.;
48}

◆ getMinWeight()

float TFCSLateralShapeParametrizationHitBase::getMinWeight ( ) const
virtualinherited

Get minimum and maximum value of weight for hit energy reweighting.

Reimplemented in TFCSHistoLateralShapeWeight.

Definition at line 42 of file TFCSLateralShapeParametrizationHitBase.cxx.

42 {
43 return -1.;
44}

◆ is_match_all_calosample()

virtual bool TFCSLateralShapeParametrization::is_match_all_calosample ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrization.

Definition at line 29 of file TFCSLateralShapeParametrization.h.

29{ return false; };

◆ is_match_all_Ekin()

virtual bool TFCSParametrization::is_match_all_Ekin ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 25 of file TFCSParametrization.h.

25 {
26 return Ekin_min() == init_Ekin_min && Ekin_max() == init_Ekin_max;
27 };
double Ekin_min() const override
double Ekin_max() const override

◆ is_match_all_Ekin_bin()

virtual bool TFCSLateralShapeParametrization::is_match_all_Ekin_bin ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrization.

Definition at line 24 of file TFCSLateralShapeParametrization.h.

24 {
25 if (Ekin_bin() == -1)
26 return true;
27 return false;
28 };

◆ is_match_all_eta()

virtual bool TFCSParametrization::is_match_all_eta ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 28 of file TFCSParametrization.h.

28 {
29 return eta_min() == init_eta_min && eta_max() == init_eta_max;
30 };
double eta_max() const override
double eta_min() const override

◆ is_match_all_pdgid()

virtual bool TFCSParametrizationBase::is_match_all_pdgid ( ) const
inlinevirtualinherited

Definition at line 66 of file TFCSParametrizationBase.h.

66{ return TestBit(kMatchAllPDGID); };

◆ is_match_calosample()

bool TFCSLateralShapeParametrization::is_match_calosample ( int calosample) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 20 of file TFCSLateralShapeParametrization.h.

20 {
21 return calosample == m_calosample;
22 };

◆ is_match_Ekin()

virtual bool TFCSParametrization::is_match_Ekin ( float Ekin) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 18 of file TFCSParametrization.h.

18 {
19 return (Ekin >= m_Ekin_min) && (Ekin < m_Ekin_max);
20 };

◆ is_match_Ekin_bin()

virtual bool TFCSBinnedShowerONNX::is_match_Ekin_bin ( int ) const
inlineoverridevirtual

Reimplemented from TFCSParametrizationBase.

Definition at line 41 of file TFCSBinnedShowerONNX.h.

41 {
42 return true;
43 };

◆ is_match_eta()

virtual bool TFCSParametrization::is_match_eta ( float eta) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 21 of file TFCSParametrization.h.

21 {
22 return (eta >= m_eta_min) && (eta < m_eta_max);
23 };
Scalar eta() const
pseudorapidity method

◆ is_match_pdgid()

virtual bool TFCSParametrization::is_match_pdgid ( int id) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 15 of file TFCSParametrization.h.

15 {
16 return TestBit(kMatchAllPDGID) || m_pdgid.find(id) != m_pdgid.end();
17 };

◆ level()

MSG::Level ISF_FCS::MLogging::level ( ) const
inlineinherited

Retrieve output level.

Definition at line 201 of file MLogging.h.

201{ return msg().level(); }
MsgStream & msg() const
Return a stream for sending messages directly (no decoration).
Definition MLogging.h:231

◆ load_bin_boundaries()

void TFCSBinnedShowerONNX::load_bin_boundaries ( const std::string & filename,
long unsigned int layer_index )
private

Definition at line 135 of file TFCSBinnedShowerONNX.cxx.

136 {
137
138 // Assert that the layer index is valid
139 if (layer_index >= m_coordinates.size()) {
140 m_coordinates.resize(layer_index + 1);
141 }
142
143 std::vector<std::string> datasetnames = {
144 "binstart_radius_layer_", "binsize_radius_layer_",
145 "binstart_alpha_layer_", "binsize_alpha_layer_"};
146
147 for (long unsigned int i = 0; i < datasetnames.size(); i++) {
148 std::string datasetname = datasetnames.at(i) + std::to_string(layer_index);
149 std::vector<float> data;
150 std::vector<hsize_t> dims;
151 bool success;
152 std::tie(data, dims, success) = load_hdf5_dataset(filename, datasetname);
153 if (!success) {
154 ATH_MSG_ERROR("Error while extracting the bin boundaries for layer "
155 << layer_index << " from " << filename << "."
156 << "Specifically, the key " << datasetname
157 << " could not be loaded.");
158 return;
159 }
160
161 // Fill the corresponding vector in the layer_bins_t structure
162 auto &event_bins = m_coordinates.at(layer_index);
163 switch (i) {
164 case 0:
165 event_bins.R_lower = std::move(data);
166 break;
167 case 1:
168 event_bins.R_size = std::move(data);
169 break;
170 case 2:
171 event_bins.alpha_lower = std::move(data);
172 break;
173 case 3:
174 event_bins.alpha_size = std::move(data);
175 break;
176 }
177 }
178}
std::tuple< std::vector< float >, std::vector< hsize_t >, bool > load_hdf5_dataset(const std::string &filename, const std::string &datasetname)

◆ load_hdf5_dataset()

std::tuple< std::vector< float >, std::vector< hsize_t >, bool > TFCSBinnedShowerONNX::load_hdf5_dataset ( const std::string & filename,
const std::string & datasetname )
private

Definition at line 101 of file TFCSBinnedShowerONNX.cxx.

102 {
103
104 // Open the HDF5 file and dataset
105 H5::H5File file(filename, H5F_ACC_RDONLY);
106
107 // check if the dataset exists
108 if (!file.exists(datasetname)) {
109 return std::make_tuple(std::vector<float>{}, std::vector<hsize_t>{}, false);
110 }
111
112 H5::DataSet dataset = file.openDataSet(datasetname);
113
114 // Get the dataspace of the dataset
115 H5::DataSpace dataspace = dataset.getSpace();
116
117 // Get the number of dimensions and the size of each dimension
118 int rank = dataspace.getSimpleExtentNdims();
119 std::vector<hsize_t> dims_out(rank);
120 dataspace.getSimpleExtentDims(dims_out.data(), NULL);
121
122 // Calculate the total number of elements
123 hsize_t totalSize = 1;
124 for (const auto &dim : dims_out) {
125 totalSize *= dim;
126 }
127
128 // Read the dataset into a buffer
129 std::vector<float> data(totalSize);
130 dataset.read(data.data(), H5::PredType::NATIVE_FLOAT);
131 file.close();
132 return std::make_tuple(data, dims_out, true);
133}
static unsigned int totalSize(const MultiDimArray< T, N > &ht)
TFile * file

◆ load_meta_data()

void TFCSBinnedShowerONNX::load_meta_data ( const std::string & filename,
std::vector< long unsigned int > & layers )

Definition at line 79 of file TFCSBinnedShowerONNX.cxx.

80 {
81
82 m_coordinates.clear();
83
84 if (m_use_upscaling) {
86 }
87
88 // layer dependent variables
89 for (long unsigned int layer_index : layers) {
90
91 ATH_MSG_INFO("Loading layer " << layer_index << " from file: " << filename);
92
93 // Load the bin boundaries for this layer
94 load_bin_boundaries(filename, layer_index);
95 }
96
97 return;
98}
#define ATH_MSG_INFO(x)
void load_bin_boundaries(const std::string &filename, long unsigned int layer_index)

◆ load_simulator()

void TFCSBinnedShowerONNX::load_simulator ( std::string & filename)
inline

Definition at line 54 of file TFCSBinnedShowerONNX.h.

54 {
55 // TODO: Do I have to delete it again?
56 m_ai_simulator = new TFCSMLCalorimeterSimulator();
57 m_ai_simulator->loadSimulator(filename);
58 }

◆ load_sub_bin_distribution()

void TFCSBinnedShowerONNX::load_sub_bin_distribution ( const std::string & filename)

Definition at line 527 of file TFCSBinnedShowerONNX.cxx.

528 {
529 m_use_upscaling = true;
530 TFile *file = TFile::Open(filename.c_str(), "READ");
531 if (!file || file->IsZombie()) {
532 ATH_MSG_ERROR("Failed to open file: " << filename);
533 delete file;
534 return;
535 }
536
537 std::regex pattern(R"(probabilities_layer_(\d+)_energy_([0-9.]+))");
538 std::map<float, std::map<int, std::vector<std::vector<float>>>> temp_storage;
539
540 TIter next(file->GetListOfKeys());
541 TKey *key;
542
543 while ((key = (TKey *)next())) {
544 std::string keyname = key->GetName();
545 std::smatch match;
546 if (std::regex_match(keyname, match, pattern)) {
547 int layer = std::stoi(match[1].str());
548 float energy = std::stod(match[2].str());
549
550 TMatrixD *matrix = dynamic_cast<TMatrixD *>(file->Get(keyname.c_str()));
551 if (matrix) {
552 std::vector<std::vector<float>> mat_vec(
553 matrix->GetNrows(), std::vector<float>(matrix->GetNcols()));
554 for (int i = 0; i < matrix->GetNrows(); ++i) {
555 for (int j = 0; j < matrix->GetNcols(); ++j) {
556 mat_vec[i][j] = static_cast<float>((*matrix)(i, j));
557 }
558 }
559 temp_storage[energy][layer] = std::move(mat_vec);
560 }
561 }
562 }
563
564 file->Close();
565 delete file;
566
567 // Output containers
568 std::vector<float> energies;
569 std::vector<std::vector<std::vector<std::vector<float>>>>
570 data; // [energy][layer][row][col]
571
572 for (const auto &[energy, layer_map] : temp_storage) {
573 energies.push_back(energy);
574 int max_layer = 0;
575 for (const auto &[l, _] : layer_map)
576 max_layer = std::max(max_layer, l);
577
578 std::vector<std::vector<std::vector<float>>> layer_vec(max_layer + 1);
579 for (const auto &[layer_idx, mat] : layer_map) {
580 layer_vec[layer_idx] = mat;
581 }
582 data.push_back(std::move(layer_vec));
583 }
584
585 // Example output
586 for (size_t i = 0; i < energies.size(); ++i) {
587 std::cout << "Energy index " << i << ": " << energies[i] << " GeV\n";
588 for (size_t j = 0; j < data[i].size(); ++j) {
589 if (!data[i][j].empty()) {
590 std::cout << " Layer " << j << " Shape: (" << data[i][j].size() << ", "
591 << data[i][j][0].size() << ")\n";
592 }
593 }
594 }
595
596 m_upscaling_energies = std::move(energies);
597 m_sub_bin_distribution = std::move(data);
598}
static const Attributes_t empty
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:359
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ load_upscaling_distribution()

void TFCSBinnedShowerONNX::load_upscaling_distribution ( const std::string & filename,
long unsigned int layer_index )
private

◆ msg() [1/2]

MsgStream & ISF_FCS::MLogging::msg ( ) const
inlineinherited

Return a stream for sending messages directly (no decoration).

Definition at line 231 of file MLogging.h.

231 {
232 MsgStream *ms = m_msg_tls.get();
233 if (!ms) {
234 ms = new MsgStream(Athena::getMessageSvc(), m_nm);
235 m_msg_tls.reset(ms);
236 }
237 return *ms;
238}
std::string m_nm
Message source name.
Definition MLogging.h:211
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [2/2]

MsgStream & ISF_FCS::MLogging::msg ( const MSG::Level lvl) const
inlineinherited

Return a decorated starting stream for sending messages.

Definition at line 240 of file MLogging.h.

240 {
241 return msg() << lvl;
242}

◆ msgLvl()

bool ISF_FCS::MLogging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Check whether the logging system is active at the provided verbosity level.

Definition at line 222 of file MLogging.h.

222 {
223 if (msg().level() <= lvl) {
224 msg() << lvl;
225 return true;
226 } else {
227 return false;
228 }
229}
MSG::Level level() const
Retrieve output level.
Definition MLogging.h:201

◆ OnlyScaleEnergy()

bool TFCSBinnedShowerBase::OnlyScaleEnergy ( ) const
inlineinherited

Definition at line 30 of file TFCSBinnedShowerBase.h.

30{ return TestBit(kOnlyScaleEnergy); };

◆ operator==()

virtual bool TFCSParametrizationBase::operator== ( const TFCSParametrizationBase & ref) const
inlinevirtualinherited

The == operator compares the content of instances.

The implementation in the base class only returns true for a comparison with itself

Reimplemented in TFCSHitCellMapping, TFCSHitCellMappingWiggle, TFCSLateralShapeParametrizationHitNumberFromE, and TFCSPredictExtrapWeights.

Definition at line 119 of file TFCSParametrizationBase.h.

119 {
120 return compare(ref);
121 };
bool compare(const TFCSParametrizationBase &ref) const
Do not persistify!

◆ operator[]() [1/2]

virtual TFCSParametrizationBase * TFCSParametrizationBase::operator[] ( unsigned int )
inlinevirtualinherited

Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operator[] methods give general access to these daughters.

Reimplemented in TFCSLateralShapeParametrizationHitChain, and TFCSParametrizationChain.

Definition at line 106 of file TFCSParametrizationBase.h.

106 {
107 return nullptr;
108 };

◆ operator[]() [2/2]

virtual const TFCSParametrizationBase * TFCSParametrizationBase::operator[] ( unsigned int ) const
inlinevirtualinherited

Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operator[] methods give general access to these daughters.

Reimplemented in TFCSLateralShapeParametrizationHitChain, and TFCSParametrizationChain.

Definition at line 99 of file TFCSParametrizationBase.h.

99 {
100 return nullptr;
101 };

◆ pdgid()

const std::set< int > & TFCSParametrization::pdgid ( ) const
inlineoverridevirtualinherited

Reimplemented from TFCSParametrizationBase.

Definition at line 34 of file TFCSParametrization.h.

34{ return m_pdgid; };

◆ Print()

void TFCSLateralShapeParametrization::Print ( Option_t * option = "") const
overrideinherited

Definition at line 53 of file TFCSLateralShapeParametrization.cxx.

53 {
54 TString opt(option);
55 bool shortprint = opt.Index("short") >= 0;
56 bool longprint = msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint);
57 TString optprint = opt;
58 optprint.ReplaceAll("short", "");
60 if (longprint) {
61 if (Ekin_bin() == -1)
62 ATH_MSG_INFO(optprint << " Ekin_bin=all ; calosample=" << calosample());
63 else
64 ATH_MSG_INFO(optprint << " Ekin_bin=" << Ekin_bin()
65 << " ; calosample=" << calosample());
66 }
67}
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
Definition MLogging.h:222
void Print(Option_t *option="") const
Print object information.

◆ RemoveDuplicates()

void TFCSParametrizationBase::RemoveDuplicates ( )
inherited

Definition at line 152 of file TFCSParametrizationBase.cxx.

152 {
153 FindDuplicateClasses_t dupclasses;
154 FindDuplicates(dupclasses);
155
156 std::set<TFCSParametrizationBase *> dellist;
157 for (auto &dupiter : dupclasses) {
158 FindDuplicates_t &dup = dupiter.second;
159 for (auto onedup : dup) {
160 if (onedup.second.mother.empty())
161 continue;
162 TFCSParametrizationBase *ref = onedup.first;
163 ATH_MSG_DEBUG("Main object " << ref << "=" << ref->GetName());
164 for (unsigned int i = 0; i < onedup.second.mother.size(); ++i) {
165 int index = onedup.second.index[i];
166 TFCSParametrizationBase *mother = onedup.second.mother[i];
167 TFCSParametrizationBase *delparam = mother->operator[](index);
168 unsigned int delcount = dup[delparam].mother.size();
169 if (delcount == 0) {
170 ATH_MSG_DEBUG(" - Delete object "
171 << delparam << "=" << delparam->GetName() << " index "
172 << index << " of " << mother << ", has " << delcount
173 << " other replacements attached. Deleting");
174 mother->set_daughter(index, ref);
175 dellist.insert(delparam);
176 } else {
177 ATH_MSG_WARNING(" - Delete object "
178 << delparam << "=" << delparam->GetName() << " index "
179 << index << " of " << mother << ", has " << delcount
180 << " other replacements attached. Skipping");
181 }
182 }
183 }
184 }
185
186 ATH_MSG_INFO("RERUNNING DUPLICATE FINDING");
187 FindDuplicateClasses_t dupclasses2;
188 FindDuplicates(dupclasses2);
189
190 std::map<std::string, int> ndel;
191 for (auto *delparam : dellist) {
192 FindDuplicates_t &dup2 = dupclasses2[delparam->GetName()];
193 bool present = dup2.find(delparam) != dup2.end();
194 if (present) {
195 ATH_MSG_WARNING("- Delete object " << delparam << "="
196 << delparam->GetName()
197 << " still referenced somewhere!");
198 } else {
199 ATH_MSG_DEBUG("- Delete object " << delparam << "="
200 << delparam->GetName());
201 ++ndel[delparam->ClassName()];
202 delete delparam;
203 }
204 }
205 for (auto &del : ndel)
206 ATH_MSG_INFO("Deleted " << del.second << " duplicate objects of class "
207 << del.first);
208}
virtual void set_daughter(unsigned int, TFCSParametrizationBase *)
Some derived classes have daughter instances of TFCSParametrizationBase objects The set_daughter meth...
std::map< std::string, FindDuplicates_t > FindDuplicateClasses_t
str index
Definition DeMoScan.py:362

◆ RemoveNameTitle()

void TFCSParametrizationBase::RemoveNameTitle ( )
inherited

Definition at line 210 of file TFCSParametrizationBase.cxx.

210 {
211 for (unsigned int i = 0; i < size(); ++i)
212 if ((*this)[i]) {
213 TFCSParametrizationBase *param = (*this)[i];
214 param->SetName("");
215 param->SetTitle("");
216
217 // Continue for child objects in param
218 param->RemoveNameTitle();
219 }
220}

◆ reset_match_all_pdgid()

virtual void TFCSParametrizationBase::reset_match_all_pdgid ( )
inlinevirtualinherited

Definition at line 84 of file TFCSParametrizationBase.h.

84{ ResetBit(kMatchAllPDGID); };

◆ reset_OnlyScaleEnergy()

void TFCSBinnedShowerBase::reset_OnlyScaleEnergy ( )
inlineinherited

Definition at line 34 of file TFCSBinnedShowerBase.h.

34{ ResetBit(kOnlyScaleEnergy); };

◆ set_bin_boundaries()

void TFCSBinnedShowerONNX::set_bin_boundaries ( long unsigned int layer_index,
const std::vector< float > & R_lower,
const std::vector< float > & R_size,
const std::vector< float > & alpha_lower,
const std::vector< float > & alpha_size )

Definition at line 193 of file TFCSBinnedShowerONNX.cxx.

197 {
198 if (layer_index >= m_coordinates.size()) {
199 m_coordinates.resize(layer_index + 1);
200 }
201 m_coordinates.at(layer_index).R_lower = R_lower;
202 m_coordinates.at(layer_index).R_size = R_size;
203 m_coordinates.at(layer_index).alpha_lower = alpha_lower;
204 m_coordinates.at(layer_index).alpha_size = alpha_size;
205}

◆ set_calosample()

void TFCSLateralShapeParametrization::set_calosample ( int cs)
inherited

Definition at line 21 of file TFCSLateralShapeParametrization.cxx.

21 {
22 m_calosample = cs;
23}

◆ set_coordinates()

void TFCSBinnedShowerONNX::set_coordinates ( const event_bins_t & coordinates)
inline

Definition at line 77 of file TFCSBinnedShowerONNX.h.

77 {
78 m_coordinates = coordinates;
79 }

◆ set_daughter()

virtual void TFCSParametrizationBase::set_daughter ( unsigned int ,
TFCSParametrizationBase *  )
inlinevirtualinherited

Some derived classes have daughter instances of TFCSParametrizationBase objects The set_daughter method allows to change these daughters - expert use only!

The original element at this position is not deleted

Reimplemented in TFCSLateralShapeParametrizationHitChain, and TFCSParametrizationChain.

Definition at line 113 of file TFCSParametrizationBase.h.

114 {};

◆ set_default_hit_energy()

void TFCSBinnedShowerONNX::set_default_hit_energy ( float energy)
inline

Definition at line 48 of file TFCSBinnedShowerONNX.h.

◆ set_Ekin()

void TFCSParametrization::set_Ekin ( const TFCSParametrizationBase & ref)
virtualinherited

Definition at line 55 of file TFCSParametrization.cxx.

55 {
56 set_Ekin_nominal(ref.Ekin_nominal());
57 set_Ekin_min(ref.Ekin_min());
58 set_Ekin_max(ref.Ekin_max());
59}
virtual void set_Ekin_max(double max)
virtual void set_Ekin_min(double min)
virtual void set_Ekin_nominal(double min)

◆ set_Ekin_bin()

void TFCSLateralShapeParametrization::set_Ekin_bin ( int bin)
inherited

Definition at line 17 of file TFCSLateralShapeParametrization.cxx.

◆ set_Ekin_eta()

void TFCSParametrization::set_Ekin_eta ( const TFCSParametrizationBase & ref)
virtualinherited

Definition at line 67 of file TFCSParametrization.cxx.

67 {
69 set_eta(ref);
70}
virtual void set_eta(const TFCSParametrizationBase &ref)
virtual void set_Ekin(const TFCSParametrizationBase &ref)

◆ set_Ekin_max()

void TFCSParametrization::set_Ekin_max ( double max)
virtualinherited

Definition at line 45 of file TFCSParametrization.cxx.

45{ m_Ekin_max = max; }
#define max(a, b)
Definition cfImp.cxx:41

◆ set_Ekin_min()

void TFCSParametrization::set_Ekin_min ( double min)
virtualinherited

Definition at line 43 of file TFCSParametrization.cxx.

43{ m_Ekin_min = min; }
#define min(a, b)
Definition cfImp.cxx:40

◆ set_Ekin_nominal()

void TFCSParametrization::set_Ekin_nominal ( double min)
virtualinherited

Definition at line 39 of file TFCSParametrization.cxx.

39 {
40 m_Ekin_nominal = nominal;
41}

◆ set_eta()

void TFCSParametrization::set_eta ( const TFCSParametrizationBase & ref)
virtualinherited

Definition at line 61 of file TFCSParametrization.cxx.

61 {
62 set_eta_nominal(ref.eta_nominal());
63 set_eta_min(ref.eta_min());
64 set_eta_max(ref.eta_max());
65}
virtual void set_eta_max(double max)
virtual void set_eta_nominal(double min)
virtual void set_eta_min(double min)

◆ set_eta_max()

void TFCSParametrization::set_eta_max ( double max)
virtualinherited

Definition at line 53 of file TFCSParametrization.cxx.

53{ m_eta_max = max; }

◆ set_eta_min()

void TFCSParametrization::set_eta_min ( double min)
virtualinherited

Definition at line 51 of file TFCSParametrization.cxx.

51{ m_eta_min = min; }

◆ set_eta_nominal()

void TFCSParametrization::set_eta_nominal ( double min)
virtualinherited

Definition at line 47 of file TFCSParametrization.cxx.

47 {
48 m_eta_nominal = nominal;
49}

◆ set_geometry()

virtual void TFCSBinnedShowerBase::set_geometry ( ICaloGeometry * geo)
inlineoverridevirtualinherited

Method to set the geometry access pointer.

Loops over daughter objects if present

Reimplemented from TFCSParametrizationBase.

Definition at line 48 of file TFCSBinnedShowerBase.h.

48 {
49 m_geo = geo;
51 };
virtual void set_geometry(ICaloGeometry *geo)
Method to set the geometry access pointer.

◆ set_match_all_pdgid()

virtual void TFCSParametrizationBase::set_match_all_pdgid ( )
inlinevirtualinherited

Definition at line 83 of file TFCSParametrizationBase.h.

83{ SetBit(kMatchAllPDGID); };

◆ set_max_hits_per_voxel()

void TFCSBinnedShowerONNX::set_max_hits_per_voxel ( int max_hits)
inline

Definition at line 50 of file TFCSBinnedShowerONNX.h.

50{ m_max_hits_per_voxel = max_hits; }

◆ set_OnlyScaleEnergy()

void TFCSBinnedShowerBase::set_OnlyScaleEnergy ( )
inlineinherited

Definition at line 32 of file TFCSBinnedShowerBase.h.

32{ SetBit(kOnlyScaleEnergy); };

◆ set_pdgid() [1/2]

void TFCSParametrization::set_pdgid ( const std::set< int > & ids)
virtualinherited

Reimplemented in TFCSEnergyBinParametrization.

Definition at line 33 of file TFCSParametrization.cxx.

◆ set_pdgid() [2/2]

void TFCSParametrization::set_pdgid ( int id)
virtualinherited

Reimplemented in TFCSEnergyBinParametrization.

Definition at line 28 of file TFCSParametrization.cxx.

28 {
29 m_pdgid.clear();
30 m_pdgid.insert(id);
31}

◆ set_pdgid_Ekin_eta()

void TFCSParametrization::set_pdgid_Ekin_eta ( const TFCSParametrizationBase & ref)
virtualinherited

Definition at line 72 of file TFCSParametrization.cxx.

73 {
75 set_pdgid(ref.pdgid());
76}
virtual void set_Ekin_eta(const TFCSParametrizationBase &ref)
virtual void set_pdgid(int id)

◆ set_pdgid_Ekin_eta_Ekin_bin_calosample()

void TFCSLateralShapeParametrization::set_pdgid_Ekin_eta_Ekin_bin_calosample ( const TFCSLateralShapeParametrization & ref)
virtualinherited

Definition at line 25 of file TFCSLateralShapeParametrization.cxx.

26 {
27 set_calosample(ref.calosample());
28 set_Ekin_bin(ref.Ekin_bin());
30}
virtual void set_pdgid_Ekin_eta(const TFCSParametrizationBase &ref)

◆ set_sub_bin_distribution_and_energies()

void TFCSBinnedShowerONNX::set_sub_bin_distribution_and_energies ( const std::vector< std::vector< std::vector< std::vector< float > > > > & sub_bin_distribution,
const std::vector< float > & upscaling_energies )
inline

Definition at line 90 of file TFCSBinnedShowerONNX.h.

93 {
94 m_sub_bin_distribution = sub_bin_distribution;
95 m_upscaling_energies = upscaling_energies;
96 m_use_upscaling = true;
97 }

◆ setLevel()

void ISF_FCS::MLogging::setLevel ( MSG::Level lvl)
virtualinherited

Update outputlevel.

Definition at line 105 of file MLogging.cxx.

105 {
106 lvl = (lvl >= MSG::NUM_LEVELS) ? MSG::ALWAYS
107 : (lvl < MSG::NIL) ? MSG::NIL
108 : lvl;
109 msg().setLevel(lvl);
110}

◆ simulate()

FCSReturnCode TFCSBinnedShowerBase::simulate ( TFCSSimulationState & simulstate,
const TFCSTruthState * truth,
const TFCSExtrapolationState * extrapol ) const
overridevirtualinherited

Method in all derived classes to do some simulation.

Result should be returned in simulstate.

Simulate all energies in calo layers for energy parametrizations. Simulate cells for shape simulation.

Reimplemented from TFCSParametrizationBase.

Definition at line 29 of file TFCSBinnedShowerBase.cxx.

31 {
32
33 // select a random event from the library
34 float eta_center, phi_center;
35 long unsigned int reference_layer_index = CaloCell_ID_FCS::CaloSample_FCS::EMB2;
36 eta_center =
37 extrapol->eta(reference_layer_index, TFCSExtrapolationState::SUBPOS_MID);
38 if (eta_center > 1.4) { // Endcap becomes more relevant
39 reference_layer_index = CaloCell_ID_FCS::CaloSample_FCS::EME2;
40 }
41 // TODO: What about the endcap?
42 eta_center =
43 extrapol->eta(reference_layer_index, TFCSExtrapolationState::SUBPOS_MID);
44 phi_center =
45 extrapol->phi(reference_layer_index, TFCSExtrapolationState::SUBPOS_MID);
46
47 // Fill the total energy and layer energies into simulstate
48 float Einit;
49 const float Ekin = truth->Ekin();
50
51 if (OnlyScaleEnergy())
52 Einit = simulstate.E();
53 else
54 Einit = Ekin;
55
56 // Reset the total energy
57 simulstate.set_E(0);
58
59 get_event(simulstate, eta_center, phi_center, Einit, reference_layer_index);
60
61 for (long unsigned int layer_index = 0;
62 layer_index < CaloCell_ID_FCS::MaxSample; ++layer_index) {
63
64 float layer_energy = get_layer_energy(simulstate, layer_index);
65
66 // Reset and set the layer energy
67 simulstate.set_E(layer_index, 0);
68 simulstate.add_E(layer_index, layer_energy);
69 }
70
71 if (simulstate.E() > std::numeric_limits<double>::epsilon()) {
72 for (int ilayer = 0; ilayer < CaloCell_ID_FCS::MaxSample; ++ilayer) {
73 simulstate.set_Efrac(ilayer, simulstate.E(ilayer) / simulstate.E());
74 }
75 }
76 return FCSSuccess;
77}
virtual float get_layer_energy(TFCSSimulationState &simulstate, long unsigned int layer_index) const =0
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
double phi(int layer, int subpos) const
double eta(int layer, int subpos) const
void set_E(int sample, double Esample)
void add_E(int sample, double Esample)
void set_Efrac(int sample, double Efracsample)
double Ekin() const

◆ simulate_hit()

FCSReturnCode TFCSBinnedShowerBase::simulate_hit ( Hit & hit,
TFCSSimulationState & simulstate,
const TFCSTruthState * truth,
const TFCSExtrapolationState * extrapol )
overridevirtualinherited

simulated one hit position with some energy.

As last step in TFCSLateralShapeParametrizationHitChain::simulate, the hit should be mapped into a cell and this cell recorded in simulstate. All hits/cells should be resacled such that their final sum is simulstate->E(sample)

Reimplemented from TFCSLateralShapeParametrizationHitBase.

Definition at line 79 of file TFCSBinnedShowerBase.cxx.

81 {
82
83 const int pdgId = truth->pdgid();
84 const float charge = MC::charge(pdgId);
85 long unsigned int layer_index = calosample();
86
87 const double center_eta = hit.center_eta();
88 const double center_phi = hit.center_phi();
89 const double center_r = hit.center_r();
90 const double center_z = hit.center_z();
91
92 ATH_MSG_VERBOSE(" Layer " << layer_index << " Extrap eta " << center_eta
93 << " phi " << center_phi << " R " << center_r);
94
95 //next MR: change to std::abs, std::sqrt functions
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)));
99
100 long unsigned int hit_index = hit.idx();
101
102 // Get necessary the hit information
103 float r, alpha, E;
104 std::tie(r, alpha, E) =
105 get_hit_position_and_energy(simulstate, layer_index, hit_index);
106
107 hit.reset();
108 hit.E() = E;
109
110 if (layer_index <= CaloCell_ID_FCS::CaloSample_FCS::FCAL0) {
111 float delta_eta_mm = r * std::cos(alpha);
112 float delta_phi_mm = r * std::sin(alpha);
113
114 // Particles with negative eta are expected to have the same shape
115 // as those with positive eta after transformation: delta_eta -->
116 // -delta_eta
117 if (center_eta < 0.) {
118 delta_eta_mm = -delta_eta_mm;
119 }
120
121 // We derive the shower shapes for electrons and positively charged
122 // hadrons. Particle with the opposite charge are expected to have the
123 // same shower shape after the transformation: delta_phi -->
124 // -delta_phi
125 if ((charge < 0. && pdgId != 11) || pdgId == -11)
126 delta_phi_mm = -delta_phi_mm;
127
128 const float delta_eta = delta_eta_mm / eta_jakobi / dist000;
129 const float delta_phi = delta_phi_mm / center_r;
130
131 hit.eta() = center_eta + delta_eta;
132 hit.phi() = TVector2::Phi_mpi_pi(center_phi + delta_phi);
133
134 ATH_MSG_VERBOSE(" Hit eta " << hit.eta() << " phi " << hit.phi()
135 << " layer " << layer_index);
136
137 } else { // FCAL is in (x,y,z)
138 const float hit_r = r * std::cos(alpha) + center_r;
139 float delta_phi = r * std::sin(alpha) / center_r;
140 // We derive the shower shapes for electrons and positively charged
141 // hadrons. Particle with the opposite charge are expected to have the
142 // same shower shape after the transformation: delta_phi -->
143 // -delta_phi
144 if ((charge < 0. && pdgId != 11) || pdgId == -11)
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);
149 hit.z() = center_z;
150 ATH_MSG_VERBOSE(" Hit x " << hit.x() << " y " << hit.y() << " layer "
151 << layer_index);
152 }
153
154 return FCSSuccess;
155}
#define ATH_MSG_VERBOSE(x)
double charge(const T &p)
Definition AtlasPID.h:997
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
int pdgid() const
double charge(const T &p)
delta_phi(phi1, phi2)
Definition eFEXNTuple.py:14

◆ size()

virtual unsigned int TFCSParametrizationBase::size ( ) const
inlinevirtualinherited

Some derived classes have daughter instances of TFCSParametrizationBase objects The size() and operator[] methods give general access to these daughters.

Reimplemented in TFCSLateralShapeParametrizationHitChain, and TFCSParametrizationChain.

Definition at line 93 of file TFCSParametrizationBase.h.

93{ return 0; };

◆ startMsg()

std::string ISF_FCS::MLogging::startMsg ( MSG::Level lvl,
const std::string & file,
int line )
staticinherited

Make a message to decorate the start of logging.

Print a message for the start of logging.

Definition at line 116 of file MLogging.cxx.

116 {
117 int col1_len = 20;
118 int col2_len = 5;
119 int col3_len = 10;
120 auto last_slash = file.find_last_of('/');
121 int path_len = last_slash == std::string::npos ? 0 : last_slash;
122 int trim_point = path_len;
123 int total_len = file.length();
124 if (total_len - path_len > col1_len)
125 trim_point = total_len - col1_len;
126 std::string trimmed_name = file.substr(trim_point);
127 const char *LevelNames[MSG::NUM_LEVELS] = {
128 "NIL", "VERBOSE", "DEBUG", "INFO", "WARNING", "ERROR", "FATAL", "ALWAYS"};
129 std::string level = LevelNames[lvl];
130 std::string level_string = std::string("(") + level + ") ";
131 std::stringstream output;
132 output << std::setw(col1_len) << std::right << trimmed_name << ":"
133 << std::setw(col2_len) << std::left << line << std::setw(col3_len)
134 << std::right << level_string;
135 return output.str();
136}
output
Definition merge.py:16

◆ upscale()

void TFCSBinnedShowerONNX::upscale ( TFCSSimulationState & simulstate,
float & R_min,
float & R_max,
float & alpha_min,
float & alpha_max,
long unsigned int layer_index,
int bin_index ) const
private

Definition at line 347 of file TFCSBinnedShowerONNX.cxx.

351 {
352
353 float p = CLHEP::RandFlat::shoot(simulstate.randomEngine(), 0, 1);
354
355 float e_init = simulstate.getAuxInfo<float>("BSEinit"_FCShash);
356 std::vector<float> available_energies = m_upscaling_energies;
357
358 unsigned int e_index = 0;
359
360 std::vector<float> probabilities = {0.25f, 0.5f, 0.75f};
361
362 if (available_energies.size() > 1) {
363 // find closest energy index using binary search
364 auto it = std::upper_bound(available_energies.begin(),
365 available_energies.end(), e_init);
366 if (it != available_energies.end()) {
367 e_index = std::distance(available_energies.begin(), it);
368 } else {
369 e_index = available_energies.size() - 1;
370 }
371
372 float e_high = available_energies.at(e_index);
373 if (e_high < e_init || e_index == 0) {
374 if (m_sub_bin_distribution.at(e_index).size() > layer_index) {
375 probabilities =
376 m_sub_bin_distribution.at(e_index).at(layer_index).at(bin_index);
377 }
378 } else {
379 if (m_sub_bin_distribution.at(e_index).size() > layer_index &&
380 m_sub_bin_distribution.at(e_index - 1).size() > layer_index) {
381 float e_low = available_energies.at(e_index - 1);
382 float f_low = std::log(e_high / e_init) / (std::log(e_high / e_low));
383 float f_high = 1 - f_low;
384 for (unsigned int i = 0; i < 3; ++i) {
385 float p_low = m_sub_bin_distribution.at(e_index - 1)
386 .at(layer_index)
387 .at(bin_index)
388 .at(i);
389 float p_high = m_sub_bin_distribution.at(e_index)
390 .at(layer_index)
391 .at(bin_index)
392 .at(i);
393 probabilities[i] = f_low * p_low + f_high * p_high;
394 }
395 }
396 }
397 }
398
399 else if (available_energies.size() == 1) {
400 probabilities = m_sub_bin_distribution.at(0).at(layer_index).at(bin_index);
401 }
402
403float p_alpha_low = probabilities[2] - probabilities[1] + probabilities[0];
404 float p_r;
405
406 if (p < p_alpha_low) {
407 alpha_max = (alpha_min + alpha_max) / 2.;
408 p_r = probabilities[0] / (p_alpha_low);
409 } else {
410 alpha_min = (alpha_min + alpha_max) / 2.;
411 p_r = (probabilities[1] - probabilities[0]) / (1 - p_alpha_low);
412 }
413
414 p = CLHEP::RandFlat::shoot(simulstate.randomEngine(), 0, 1);
415 if (layer_index != 2){
416 // if ((layer_index != 2) && (layer_index != 0)) {
417 if (p > p_r) {
418 R_min = (R_min + R_max) / 2.;
419 return;
420 } else {
421 R_max = (R_min + R_max) / 2.;
422 return;
423 }
424 }
425
426
427 // Use linear interpolation for layer 2
428 // It works better than uniform sampling for the second layer...
429 if (p_r < 0.25) {
430 p_r = 0.25; // Values below 0.25 are not allowed for linear pdf
431 } else if (p_r > 0.75) {
432 p_r = 0.75; // Values above 0.75 are not allowed for linear pdf
433 } else if (TMath::Abs(p_r - 0.5) < std::numeric_limits<float>::epsilon()) {
434 return; // Best upscaling is uniform sampling. Nothing to do here.
435 }
436
437 // Inverse CDF for linear pdf
438 float r = (1. - 4. * p_r) / (2. - 4. * p_r) -
439 TMath::Sqrt(((1. - 4. * p_r) / (2. - 4. * p_r)) *
440 ((1. - 4. * p_r) / (2. - 4. * p_r)) +
441 p / ((1. / 2.) - p_r));
442 if (r < 0) {
443 r = (1. - 4. * p_r) / (2. - 4. * p_r) +
444 TMath::Sqrt(((1. - 4. * p_r) / (2. - 4. * p_r)) *
445 ((1. - 4. * p_r) / (2. - 4. * p_r)) +
446 p / ((1. / 2.) - p_r));
447 }
448
449 R_min = R_min + r / 2 * (R_max - R_min);
450 R_max = R_min;
451}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

boost::thread_specific_ptr<MsgStream> m_msg_tls ISF_FCS::MLogging::ATLAS_THREAD_SAFE
inlinestaticprivateinherited

Do not persistify!

MsgStream instance (a std::cout like with print-out levels)

Definition at line 215 of file MLogging.h.

◆ init_Ekin_max

double TFCSParametrizationBase::init_Ekin_max = 14000000
staticconstexprprotectedinherited

Do not persistify!

Definition at line 155 of file TFCSParametrizationBase.h.

◆ init_Ekin_min

double TFCSParametrizationBase::init_Ekin_min = 0
staticconstexprprotectedinherited

Do not persistify!

Definition at line 154 of file TFCSParametrizationBase.h.

◆ init_Ekin_nominal

double TFCSParametrizationBase::init_Ekin_nominal = 0
staticconstexprprotectedinherited

Definition at line 153 of file TFCSParametrizationBase.h.

◆ init_eta_max

double TFCSParametrizationBase::init_eta_max = 100
staticconstexprprotectedinherited

Do not persistify!

Definition at line 158 of file TFCSParametrizationBase.h.

◆ init_eta_min

double TFCSParametrizationBase::init_eta_min = -100
staticconstexprprotectedinherited

Do not persistify!

Definition at line 157 of file TFCSParametrizationBase.h.

◆ init_eta_nominal

double TFCSParametrizationBase::init_eta_nominal = 0
staticconstexprprotectedinherited

Do not persistify!

Definition at line 156 of file TFCSParametrizationBase.h.

◆ m_ai_simulator

TFCSMLCalorimeterSimulator* TFCSBinnedShowerONNX::m_ai_simulator = nullptr
private

Definition at line 173 of file TFCSBinnedShowerONNX.h.

◆ m_calosample

int TFCSLateralShapeParametrization::m_calosample
privateinherited

Definition at line 47 of file TFCSLateralShapeParametrization.h.

◆ m_coordinates

event_bins_t TFCSBinnedShowerONNX::m_coordinates
private

Definition at line 139 of file TFCSBinnedShowerONNX.h.

◆ m_default_hit_energy

float TFCSBinnedShowerONNX::m_default_hit_energy = 4.
private

Definition at line 134 of file TFCSBinnedShowerONNX.h.

◆ m_Ekin_bin

int TFCSLateralShapeParametrization::m_Ekin_bin
privateinherited

Definition at line 46 of file TFCSLateralShapeParametrization.h.

◆ m_Ekin_max

double TFCSParametrization::m_Ekin_max
privateinherited

Definition at line 64 of file TFCSParametrization.h.

◆ m_Ekin_min

double TFCSParametrization::m_Ekin_min
privateinherited

Definition at line 64 of file TFCSParametrization.h.

◆ m_Ekin_nominal

double TFCSParametrization::m_Ekin_nominal
privateinherited

Definition at line 64 of file TFCSParametrization.h.

◆ m_eta_max

double TFCSParametrization::m_eta_max
privateinherited

Definition at line 65 of file TFCSParametrization.h.

◆ m_eta_min

double TFCSParametrization::m_eta_min
privateinherited

Definition at line 65 of file TFCSParametrization.h.

◆ m_eta_nominal

double TFCSParametrization::m_eta_nominal
privateinherited

Definition at line 65 of file TFCSParametrization.h.

◆ m_geo

ICaloGeometry* TFCSBinnedShowerBase::m_geo {}
protectedinherited

Definition at line 63 of file TFCSBinnedShowerBase.h.

63{};

◆ m_max_hits_per_voxel

int TFCSBinnedShowerONNX::m_max_hits_per_voxel = 100
private

Definition at line 136 of file TFCSBinnedShowerONNX.h.

◆ m_n_layers

const long unsigned int TFCSBinnedShowerONNX::m_n_layers
private
Initial value:

Definition at line 130 of file TFCSBinnedShowerONNX.h.

◆ m_nm

std::string ISF_FCS::MLogging::m_nm
privateinherited

Message source name.

Definition at line 211 of file MLogging.h.

◆ m_pdgid

std::set<int> TFCSParametrization::m_pdgid
privateinherited

Definition at line 63 of file TFCSParametrization.h.

◆ m_sub_bin_distribution

std::vector<std::vector<std::vector<std::vector<float> > > > TFCSBinnedShowerONNX::m_sub_bin_distribution
private

Definition at line 151 of file TFCSBinnedShowerONNX.h.

◆ m_upscaling_energies

std::vector<float> TFCSBinnedShowerONNX::m_upscaling_energies
private

Definition at line 152 of file TFCSBinnedShowerONNX.h.

◆ m_use_upscaling

bool TFCSBinnedShowerONNX::m_use_upscaling = false
private

Definition at line 146 of file TFCSBinnedShowerONNX.h.


The documentation for this class was generated from the following files: