ATLAS Offline Software
TFCSPhiModulationCorrection.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_TFCSPhiModulationCorrection_h
6 #define ISF_FASTCALOSIMEVENT_TFCSPhiModulationCorrection_h
7 
8 // Local includes
10 
11 // External includes
12 #include <RtypesCore.h>
13 #include <TMath.h>
14 
15 #include <fstream>
16 #include <tuple>
17 #include <vector>
18 
19 class ICaloGeometry;
20 
23  public:
24  TFCSPhiModulationCorrection(const char *name = nullptr,
25  const char *title = nullptr);
26 
28 
29  void load_phi_modulation(std::string filename, long unsigned int layer_index,
30  float eta_min, float eta_max,
31  float energy_shift = 1.0);
32 
33  void clear() {
34  m_modulation.clear();
35  m_min_phi.clear();
36  m_min_eta.clear();
37  m_energy_shift.clear();
38  };
39 
40  const std::vector<std::vector<std::vector<float>>>& get_phi_modulation() const {
41  return m_modulation;
42  };
43  const std::vector<std::vector<float>>& get_min_eta() const { return m_min_eta; };
44  const std::vector<std::vector<float>>& get_energy_shift() const {
45  return m_energy_shift;
46  };
47  const std::vector<std::vector<std::vector<float>>>& get_min_phi() const {
48  return m_min_phi;
49  };
50 
51  void set_phi_modulation_scale(float phi_modulation_scale) {
52  m_modulation_scale = phi_modulation_scale;
53  };
54 
55  float get_phi_modulation_scale() const { return m_modulation_scale; };
56 
57  static float get_phi_cell_size(long unsigned int layer, float eta) {
58  if (layer <= 3) {
59  return 2 * TMath::Pi() / 1024;
60  } else if (eta < 2.5) {
61  return 2 * TMath::Pi() / 768;
62  } else {
63  return 2 * TMath::Pi() / 256;
64  }
65  }
66 
67  // Adds adds the phi-modulation in the energy to the given hit
68  float add_phi_modulation(Hit &hit) const;
69 
70  // Adds adds the phi-modulation in the energy to the given hit
71  float add_phi_modulation(Hit &hit, long unsigned int layer_index) const;
72 
73  // Adds adds the phi-modulation in the energy to the given hit
74  float add_phi_modulation(float energy, float phi, float eta,
75  long unsigned int layer_index) const;
76 
77  // Removes the phi-modulation in the energy from the given hit
78  float remove_phi_modulation(Hit &hit) const;
79 
80  // Removes the phi-modulation in the energy from the given hit
81  float remove_phi_modulation(Hit &hit, long unsigned int layer_index) const;
82 
83  // Removes the phi-modulation in the energy from the given hit
84  float remove_phi_modulation(float energy, float phi, float eta,
85  long unsigned int layer_index) const;
86 
87  // Returns the correct eta and phi index for the position of the hit.
88  // Used to extract the correct modulation factor from the stored modulation
89  // curves.
90  std::tuple<int, long unsigned int, long unsigned int> get_eta_and_phi_index(
91  float phi, float eta, long unsigned int layer_index) const;
92 
93  void set_geometry(ICaloGeometry *geo) override {
94  m_geo = geo;
96  };
97 
98  ICaloGeometry *get_geometry() const { return m_geo; };
99 
100  virtual FCSReturnCode simulate_hit(
101  Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth,
102  const TFCSExtrapolationState *extrapol) override;
103 
104  protected:
106 
107  private:
108  // Needed to reapply the phi modulation
109  float m_modulation_scale = 1.0;
110  std::vector<std::vector<std::vector<float>>> m_modulation;
111  std::vector<std::vector<std::vector<float>>> m_min_phi;
112  std::vector<std::vector<float>> m_min_eta;
113  std::vector<std::vector<float>> m_energy_shift;
114 
115  ClassDefOverride(TFCSPhiModulationCorrection,
116  1) // TFCSPhiModulationCorrection
117 };
118 
119 #endif
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TFCSPhiModulationCorrection::get_phi_modulation
const std::vector< std::vector< std::vector< float > > > & get_phi_modulation() const
Definition: TFCSPhiModulationCorrection.h:40
TFCSPhiModulationCorrection::clear
void clear()
Definition: TFCSPhiModulationCorrection.h:33
TFCSPhiModulationCorrection::get_eta_and_phi_index
std::tuple< int, long unsigned int, long unsigned int > get_eta_and_phi_index(float phi, float eta, long unsigned int layer_index) const
Definition: TFCSPhiModulationCorrection.cxx:144
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
RunActsMaterialValidation.extrapol
extrapol
Definition: RunActsMaterialValidation.py:91
TFCSPhiModulationCorrection
Definition: TFCSPhiModulationCorrection.h:22
TFCSPhiModulationCorrection::get_phi_modulation_scale
float get_phi_modulation_scale() const
Definition: TFCSPhiModulationCorrection.h:55
TFCSLateralShapeParametrizationHitBase
Definition: TFCSLateralShapeParametrizationHitBase.h:13
TFCSPhiModulationCorrection::m_modulation
std::vector< std::vector< std::vector< float > > > m_modulation
Definition: TFCSPhiModulationCorrection.h:110
Hit
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloGpu/ISF_FastCaloGpu/Hit.h:16
TFCSPhiModulationCorrection::TFCSPhiModulationCorrection
TFCSPhiModulationCorrection(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSPhiModulationCorrection.cxx:29
TFCSLateralShapeParametrizationHitBase.h
TFCSPhiModulationCorrection::m_energy_shift
std::vector< std::vector< float > > m_energy_shift
Definition: TFCSPhiModulationCorrection.h:113
TFCSPhiModulationCorrection::remove_phi_modulation
float remove_phi_modulation(Hit &hit) const
Definition: TFCSPhiModulationCorrection.cxx:293
TFCSPhiModulationCorrection::add_phi_modulation
float add_phi_modulation(Hit &hit) const
Definition: TFCSPhiModulationCorrection.cxx:228
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
TFCSPhiModulationCorrection::m_min_eta
std::vector< std::vector< float > > m_min_eta
Definition: TFCSPhiModulationCorrection.h:112
TFCSPhiModulationCorrection::set_phi_modulation_scale
void set_phi_modulation_scale(float phi_modulation_scale)
Definition: TFCSPhiModulationCorrection.h:51
ICaloGeometry
Definition: ICaloGeometry.h:14
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
covarianceTool.title
title
Definition: covarianceTool.py:542
TFCSPhiModulationCorrection::get_min_eta
const std::vector< std::vector< float > > & get_min_eta() const
Definition: TFCSPhiModulationCorrection.h:43
TFCSParametrizationBase::set_geometry
virtual void set_geometry(ICaloGeometry *geo)
Method to set the geometry access pointer.
Definition: TFCSParametrizationBase.cxx:24
TFCSPhiModulationCorrection::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: TFCSPhiModulationCorrection.cxx:358
TFCSPhiModulationCorrection::get_min_phi
const std::vector< std::vector< std::vector< float > > > & get_min_phi() const
Definition: TFCSPhiModulationCorrection.h:47
TFCSParametrization::eta_max
double eta_max() const override
Definition: TFCSParametrization.h:40
TFCSPhiModulationCorrection::set_geometry
void set_geometry(ICaloGeometry *geo) override
Method to set the geometry access pointer.
Definition: TFCSPhiModulationCorrection.h:93
TFCSPhiModulationCorrection::get_phi_cell_size
static float get_phi_cell_size(long unsigned int layer, float eta)
Definition: TFCSPhiModulationCorrection.h:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TFCSParametrization::eta_min
double eta_min() const override
Definition: TFCSParametrization.h:39
TFCSPhiModulationCorrection::load_phi_modulation
void load_phi_modulation(std::string filename, long unsigned int layer_index, float eta_min, float eta_max, float energy_shift=1.0)
Definition: TFCSPhiModulationCorrection.cxx:35
TFCSPhiModulationCorrection::m_min_phi
std::vector< std::vector< std::vector< float > > > m_min_phi
Definition: TFCSPhiModulationCorrection.h:111
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:23
TFCSPhiModulationCorrection::m_modulation_scale
float m_modulation_scale
do not persistify
Definition: TFCSPhiModulationCorrection.h:109
TFCSPhiModulationCorrection::~TFCSPhiModulationCorrection
virtual ~TFCSPhiModulationCorrection()
Definition: TFCSPhiModulationCorrection.cxx:33
TFCSPhiModulationCorrection::get_energy_shift
const std::vector< std::vector< float > > & get_energy_shift() const
Definition: TFCSPhiModulationCorrection.h:44
TFCSTruthState
Definition: TFCSTruthState.h:13
TFCSSimulationState
Definition: TFCSSimulationState.h:32
TFCSPhiModulationCorrection::get_geometry
ICaloGeometry * get_geometry() const
Definition: TFCSPhiModulationCorrection.h:98
TFCSPhiModulationCorrection::m_geo
ICaloGeometry * m_geo
Definition: TFCSPhiModulationCorrection.h:105