ATLAS Offline Software
TFCSBinnedShowerBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_FASTCALOSIMEVENT_TFCSBinnedShowerBase_h
6 #define ISF_FASTCALOSIMEVENT_TFCSBinnedShowerBase_h
7 
8 // local includes
11 
12 // External includes
13 #include <RtypesCore.h>
14 #include <TMath.h>
15 
16 #include <fstream>
17 #include <tuple>
18 #include <vector>
19 
20 class ICaloGeometry;
21 
23  public:
24  TFCSBinnedShowerBase(const char *name = nullptr, const char *title = nullptr);
25 
26  virtual ~TFCSBinnedShowerBase();
27 
31  BIT(18)
32  };
34 
35  bool OnlyScaleEnergy() const { return TestBit(kOnlyScaleEnergy); };
36 
38 
39  void reset_OnlyScaleEnergy() { ResetBit(kOnlyScaleEnergy); };
40 
41  // Fill layer energies
42  virtual FCSReturnCode simulate(
43  TFCSSimulationState &simulstate, const TFCSTruthState *truth,
44  const TFCSExtrapolationState *extrapol) const override;
45 
46  // Do hit simulation
48  Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth,
49  const TFCSExtrapolationState *extrapol) override;
50 
52 
53  virtual void set_geometry(ICaloGeometry *geo) override {
54  m_geo = geo;
56  };
57 
58  virtual int get_number_of_hits(
59  TFCSSimulationState &simulstate, const TFCSTruthState * /*truth*/,
60  const TFCSExtrapolationState * /*extrapol*/) const override {
61  long unsigned int nhits = get_n_hits(simulstate, calosample());
62  if (nhits == 0)
63  return -1;
64  return static_cast<int>(nhits);
65  }
66 
67  protected:
69 
70  // Called at the beginning of the simulation to store and or generate the
71  // needed shower data for the current event
72  virtual void get_event(TFCSSimulationState &simulstate, float eta_center,
73  float phi_center, float e_init,
74  long unsigned int reference_layer_index) const = 0;
75 
76  // Returns the number of bins that are used in the given layer
77  virtual long unsigned int get_n_hits(TFCSSimulationState &simulstate,
78  long unsigned int layer_index) const = 0;
79 
80  // Returns the position and energy of the corresponding hit in the given
81  // event, layer and bin
82  virtual float get_layer_energy(TFCSSimulationState &simulstate,
83  long unsigned int layer_index) const = 0;
84 
85  // Returns the position and energy of the corresponding hit in the given
86  // event, layer and bin
87  virtual std::tuple<float, float, float> get_hit_position_and_energy(
88  TFCSSimulationState &simulstate, long unsigned int layer_index,
89  long unsigned int hit_index) const = 0;
90 
91  // Delete all pointers that were created in get_event()
92  virtual void delete_event(TFCSSimulationState &simulstate) const = 0;
93 
94  private:
95  const long unsigned int m_n_layers =
97  ClassDefOverride(TFCSBinnedShowerBase, 1) // TFCSBinnedShowerBase
98 };
99 
100 #endif
TFCSBinnedShowerBase::m_geo
ICaloGeometry * m_geo
Definition: TFCSBinnedShowerBase.h:68
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
TFCSBinnedShowerBase::delete_event
virtual void delete_event(TFCSSimulationState &simulstate) const =0
TFCSBinnedShowerBase::~TFCSBinnedShowerBase
virtual ~TFCSBinnedShowerBase()
Definition: TFCSBinnedShowerBase.cxx:43
TFCSBinnedShowerBase::get_layer_energy
virtual float get_layer_energy(TFCSSimulationState &simulstate, long unsigned int layer_index) const =0
TFCSBinnedShowerBase::set_OnlyScaleEnergy
void set_OnlyScaleEnergy()
Definition: TFCSBinnedShowerBase.h:37
TFCSBinnedShowerBase::kOnlyScaleEnergy
@ kOnlyScaleEnergy
Set this bit in the TObject bit field the simulated energy should only be scaled by the GAN.
Definition: TFCSBinnedShowerBase.h:30
TFCSBinnedShowerBase::get_geometry
ICaloGeometry * get_geometry()
Definition: TFCSBinnedShowerBase.h:51
TFCSBinnedShowerBase::OnlyScaleEnergy
bool OnlyScaleEnergy() const
Definition: TFCSBinnedShowerBase.h:35
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
RunActsMaterialValidation.extrapol
extrapol
Definition: RunActsMaterialValidation.py:91
TFCSBinnedShowerBase::get_n_hits
virtual long unsigned int get_n_hits(TFCSSimulationState &simulstate, long unsigned int layer_index) const =0
TFCSLateralShapeParametrizationHitBase
Definition: TFCSLateralShapeParametrizationHitBase.h:13
Hit
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloGpu/ISF_FastCaloGpu/Hit.h:16
TFCSLateralShapeParametrizationHitBase.h
LArNewCalib_PedestalAutoCorr.MaxSample
int MaxSample
Definition: LArNewCalib_PedestalAutoCorr.py:15
TFCSBinnedShowerBase::get_number_of_hits
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 numb...
Definition: TFCSBinnedShowerBase.h:58
ICaloGeometry
Definition: ICaloGeometry.h:14
covarianceTool.title
title
Definition: covarianceTool.py:542
TFCSParametrizationBase::set_geometry
virtual void set_geometry(ICaloGeometry *geo)
Method to set the geometry access pointer.
Definition: TFCSParametrizationBase.cxx:24
TFCSBinnedShowerBase::TFCSBinnedShowerBase
TFCSBinnedShowerBase(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSBinnedShowerBase.cxx:38
TFCSBinnedShowerBase
Definition: TFCSBinnedShowerBase.h:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TFCSBinnedShowerBase::simulate_hit
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
simulated one hit position with some energy.
Definition: TFCSBinnedShowerBase.cxx:95
TFCSLateralShapeParametrization::calosample
int calosample() const
Definition: TFCSLateralShapeParametrization.h:34
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
TFCSBinnedShowerBase::get_event
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
TFCSBinnedShowerBase::set_geometry
virtual void set_geometry(ICaloGeometry *geo) override
Method to set the geometry access pointer.
Definition: TFCSBinnedShowerBase.h:53
TFCSBinnedShowerBase::m_n_layers
const long unsigned int m_n_layers
Definition: TFCSBinnedShowerBase.h:95
TFCSBinnedShowerBase::get_hit_position_and_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
TFCSSimulationState.h
TFCSBinnedShowerBase::reset_OnlyScaleEnergy
void reset_OnlyScaleEnergy()
Definition: TFCSBinnedShowerBase.h:39
TFCSTruthState
Definition: TFCSTruthState.h:13
TFCSSimulationState
Definition: TFCSSimulationState.h:32
TFCSBinnedShowerBase::FCSEnergyInitializationStatusBits
FCSEnergyInitializationStatusBits
Status bit for energy initialization.
Definition: TFCSBinnedShowerBase.h:29
TFCSBinnedShowerBase::simulate
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
Definition: TFCSBinnedShowerBase.cxx:45