ATLAS Offline Software
Loading...
Searching...
No Matches
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
19class 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
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
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
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
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
virtual void set_geometry(ICaloGeometry *geo)
Method to set the geometry access pointer.
double eta_max() const override
double eta_min() const override
void load_phi_modulation(std::string filename, long unsigned int layer_index, float eta_min, float eta_max, float energy_shift=1.0)
const std::vector< std::vector< std::vector< float > > > & get_phi_modulation() const
const std::vector< std::vector< std::vector< float > > > & get_min_phi() const
std::vector< std::vector< std::vector< float > > > m_modulation
const std::vector< std::vector< float > > & get_min_eta() const
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
simulated one hit position with some energy.
const std::vector< std::vector< float > > & get_energy_shift() const
TFCSPhiModulationCorrection(const char *name=nullptr, const char *title=nullptr)
void set_phi_modulation_scale(float phi_modulation_scale)
static float get_phi_cell_size(long unsigned int layer, float eta)
std::vector< std::vector< float > > m_energy_shift
std::tuple< int, long unsigned int, long unsigned int > get_eta_and_phi_index(float phi, float eta, long unsigned int layer_index) const
std::vector< std::vector< std::vector< float > > > m_min_phi
std::vector< std::vector< float > > m_min_eta
void set_geometry(ICaloGeometry *geo) override
Method to set the geometry access pointer.