ATLAS Offline Software
TFCSEnergyAndHitGANV2.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_FASTCALOSIMEVENT_TFCSEnergyAndHitGANV2_h
6 #define ISF_FASTCALOSIMEVENT_TFCSEnergyAndHitGANV2_h
7 
12 #include <string>
13 
14 
15 // forward declare lwtnn dependencies
16 namespace lwt {
17 class LightweightGraph;
18 }
19 
21 public:
22  TFCSEnergyAndHitGANV2(const char *name = nullptr,
23  const char *title = nullptr);
24  virtual ~TFCSEnergyAndHitGANV2();
25 
26  virtual bool is_match_Ekin_bin(int /*Ekin_bin*/) const override {
27  return true;
28  };
29  virtual bool is_match_calosample(int calosample) const override;
30  virtual bool is_match_all_Ekin_bin() const override { return true; };
31  virtual bool is_match_all_calosample() const override { return false; };
32 
35  kGANfreemem = BIT(17)
36  };
38 
39  bool GANfreemem() const { return TestBit(kGANfreemem); };
40  void set_GANfreemem() { SetBit(kGANfreemem); };
41  void reset_GANfreemem() { ResetBit(kGANfreemem); };
42 
46  BIT(18)
47  };
49 
50  bool OnlyScaleEnergy() const { return TestBit(kOnlyScaleEnergy); };
52  void reset_OnlyScaleEnergy() { ResetBit(kOnlyScaleEnergy); };
53 
55  virtual int get_bin(TFCSSimulationState &simulstate, const TFCSTruthState *,
56  const TFCSExtrapolationState *) const override {
57  return simulstate.getAuxInfo<int>("GANlayer"_FCShash);
58  };
59  virtual const std::string
61  const TFCSExtrapolationState *) const override;
62 
63  unsigned int get_nr_of_init(unsigned int bin) const;
64  void set_nr_of_init(unsigned int bin, unsigned int ninit);
65 
67  return m_param.GetBinning();
68  };
71  };
72 
73  bool initializeNetwork(int const &pid, int const &etaMin,
74  const std::string &FastCaloGANInputFolderName);
75 
76  bool fillEnergy(TFCSSimulationState &simulstate, const TFCSTruthState *truth,
77  const TFCSExtrapolationState *extrapol) const;
78  virtual FCSReturnCode
79  simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth,
80  const TFCSExtrapolationState *extrapol) const override;
81 
82  virtual void Print(Option_t *option = "") const override;
83 
84  static void test_path(const std::string& path,
85  TFCSSimulationState *simulstate = nullptr,
86  const TFCSTruthState *truth = nullptr,
87  const TFCSExtrapolationState *extrapol = nullptr,
88  const std::string& outputname = "unnamed", int pid = 211);
89 
90  static void unit_test(TFCSSimulationState *simulstate = nullptr,
91  const TFCSTruthState *truth = nullptr,
92  const TFCSExtrapolationState *extrapol = nullptr);
93 
94 protected:
96  std::string FastCaloGANInputFolderName);
97 
98 private:
99  static int GetBinsInFours(double const &bins);
100  int GetAlphaBinsForRBin(const TAxis *x, int ix, int yBinNum) const;
101 
102  std::vector<int> m_bin_ninit;
103 
104  // Persistify configuration in string m_input. A custom Streamer(...) builds
105  // m_graph on the fly when reading from file. Inside Athena, if GANfreemem()
106  // is true, the content of m_input is deleted after reading in order to free
107  // memory
108 
111 
112  ClassDefOverride(TFCSEnergyAndHitGANV2, 2) // TFCSEnergyAndHitGANV2
113 };
114 
115 #endif
TFCSEnergyAndHitGANV2::is_match_all_Ekin_bin
virtual bool is_match_all_Ekin_bin() const override
Definition: TFCSEnergyAndHitGANV2.h:30
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
TFCSSimulationState::getAuxInfo
const T getAuxInfo(std::uint32_t index) const
Definition: TFCSSimulationState.h:161
TFCSEnergyAndHitGANV2::set_GANfreemem
void set_GANfreemem()
Definition: TFCSEnergyAndHitGANV2.h:40
TFCSEnergyAndHitGANV2
Definition: TFCSEnergyAndHitGANV2.h:20
TFCSEnergyAndHitGANV2::is_match_Ekin_bin
virtual bool is_match_Ekin_bin(int) const override
Definition: TFCSEnergyAndHitGANV2.h:26
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
TFCSEnergyAndHitGANV2::get_Binning
const TFCSGANXMLParameters::Binning & get_Binning() const
Definition: TFCSEnergyAndHitGANV2.h:66
TFCSEnergyAndHitGANV2::initializeNetwork
bool initializeNetwork(int const &pid, int const &etaMin, const std::string &FastCaloGANInputFolderName)
Definition: TFCSEnergyAndHitGANV2.cxx:72
python.App.bins
bins
Definition: App.py:410
TFCSEnergyAndHitGANV2::SetRegionAndSliceFromXML
void SetRegionAndSliceFromXML(int pid, int etaMax, std::string FastCaloGANInputFolderName)
TFCSEnergyAndHitGANV2::GetBinsInFours
static int GetBinsInFours(double const &bins)
Definition: TFCSEnergyAndHitGANV2.cxx:681
TFCSEnergyAndHitGANV2::FCSEnergyInitializationStatusBits
FCSEnergyInitializationStatusBits
Status bit for energy initialization.
Definition: TFCSEnergyAndHitGANV2.h:44
bin
Definition: BinsDiffFromStripMedian.h:43
TFCSGANXMLParameters.h
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
TFCSEnergyAndHitGANV2::kGANfreemem
@ kGANfreemem
Set this bit in the TObject bit if the memory for m_input should be freed after reading in athena.
Definition: TFCSEnergyAndHitGANV2.h:35
TFCSGANXMLParameters::Binning
std::map< int, TH2D > Binning
Definition: TFCSGANXMLParameters.h:29
TFCSEnergyAndHitGANV2::OnlyScaleEnergy
bool OnlyScaleEnergy() const
Definition: TFCSEnergyAndHitGANV2.h:50
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
RunActsMaterialValidation.extrapol
extrapol
Definition: RunActsMaterialValidation.py:90
TFCSEnergyAndHitGANV2::set_nr_of_init
void set_nr_of_init(unsigned int bin, unsigned int ninit)
Definition: TFCSEnergyAndHitGANV2.cxx:62
TFCSGANXMLParameters
Definition: TFCSGANXMLParameters.h:27
x
#define x
TFCSParametrizationBinnedChain
Definition: TFCSParametrizationBinnedChain.h:10
TFCSParametrizationBinnedChain.h
TFCSEnergyAndHitGANV2::get_ExtrapolationWeights
const TFCSGANEtaSlice::ExtrapolatorWeights get_ExtrapolationWeights() const
Definition: TFCSEnergyAndHitGANV2.h:69
covarianceTool.title
title
Definition: covarianceTool.py:542
TFCSEnergyAndHitGANV2::m_slice
TFCSGANEtaSlice * m_slice
Definition: TFCSEnergyAndHitGANV2.h:109
TFCSEnergyAndHitGANV2::reset_GANfreemem
void reset_GANfreemem()
Definition: TFCSEnergyAndHitGANV2.h:41
lwt
Definition: NnClusterizationFactory.h:52
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
TFCSEnergyAndHitGANV2::GANfreemem
bool GANfreemem() const
Definition: TFCSEnergyAndHitGANV2.h:39
TFCSEnergyAndHitGANV2::~TFCSEnergyAndHitGANV2
virtual ~TFCSEnergyAndHitGANV2()
Definition: TFCSEnergyAndHitGANV2.cxx:42
TFCSGANEtaSlice
Definition: TFCSGANEtaSlice.h:30
TFCSEnergyAndHitGANV2::GetAlphaBinsForRBin
int GetAlphaBinsForRBin(const TAxis *x, int ix, int yBinNum) const
Definition: TFCSEnergyAndHitGANV2.cxx:692
TFCSGANEtaSlice.h
TFCSGANEtaSlice::GetExtrapolatorWeights
ExtrapolatorWeights GetExtrapolatorWeights()
Definition: TFCSGANEtaSlice.h:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TFCSGANEtaSlice::ExtrapolatorWeights
std::map< int, double > ExtrapolatorWeights
Definition: TFCSGANEtaSlice.h:38
TFCSEnergyAndHitGANV2::unit_test
static void unit_test(TFCSSimulationState *simulstate=nullptr, const TFCSTruthState *truth=nullptr, const TFCSExtrapolationState *extrapol=nullptr)
Definition: TFCSEnergyAndHitGANV2.cxx:574
TFCSEnergyAndHitGANV2::is_match_all_calosample
virtual bool is_match_all_calosample() const override
Definition: TFCSEnergyAndHitGANV2.h:31
TFCSEnergyAndHitGANV2::simulate
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
Definition: TFCSEnergyAndHitGANV2.cxx:518
TFCSEnergyAndHitGANV2::m_bin_ninit
std::vector< int > m_bin_ninit
Definition: TFCSEnergyAndHitGANV2.h:102
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
TFCSEnergyAndHitGANV2::m_param
TFCSGANXMLParameters m_param
Definition: TFCSEnergyAndHitGANV2.h:110
TFCSEnergyAndHitGANV2::is_match_calosample
virtual bool is_match_calosample(int calosample) const override
Definition: TFCSEnergyAndHitGANV2.cxx:48
TFCSEnergyAndHitGANV2::get_bin
virtual int get_bin(TFCSSimulationState &simulstate, const TFCSTruthState *, const TFCSExtrapolationState *) const override
use the layer to be done as binning of the GAN chain
Definition: TFCSEnergyAndHitGANV2.h:55
TFCSEnergyAndHitGANV2::kOnlyScaleEnergy
@ kOnlyScaleEnergy
Set this bit in the TObject bit field the simulated energy should only be scaled by the GAN.
Definition: TFCSEnergyAndHitGANV2.h:45
TFCSSimulationState.h
TFCSEnergyAndHitGANV2::fillEnergy
bool fillEnergy(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const
Definition: TFCSEnergyAndHitGANV2.cxx:115
TFCSEnergyAndHitGANV2::get_nr_of_init
unsigned int get_nr_of_init(unsigned int bin) const
Definition: TFCSEnergyAndHitGANV2.cxx:56
TFCSEnergyAndHitGANV2::FCSGANfreemem
FCSGANfreemem
Status bit for chain persistency.
Definition: TFCSEnergyAndHitGANV2.h:34
TFCSTruthState
Definition: TFCSTruthState.h:13
TFCSEnergyAndHitGANV2::TFCSEnergyAndHitGANV2
TFCSEnergyAndHitGANV2(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSEnergyAndHitGANV2.cxx:36
TFCSEnergyAndHitGANV2::test_path
static void test_path(const std::string &path, TFCSSimulationState *simulstate=nullptr, const TFCSTruthState *truth=nullptr, const TFCSExtrapolationState *extrapol=nullptr, const std::string &outputname="unnamed", int pid=211)
Definition: TFCSEnergyAndHitGANV2.cxx:590
TFCSEnergyAndHitGANV2::Print
virtual void Print(Option_t *option="") const override
Definition: TFCSEnergyAndHitGANV2.cxx:539
TFCSSimulationState
Definition: TFCSSimulationState.h:32
TFCSGANXMLParameters::GetBinning
const Binning & GetBinning() const
Definition: TFCSGANXMLParameters.h:39
TFCSEnergyAndHitGANV2::reset_OnlyScaleEnergy
void reset_OnlyScaleEnergy()
Definition: TFCSEnergyAndHitGANV2.h:52
TFCSEnergyAndHitGANV2::set_OnlyScaleEnergy
void set_OnlyScaleEnergy()
Definition: TFCSEnergyAndHitGANV2.h:51
TFCSEnergyAndHitGANV2::get_variable_text
virtual const std::string get_variable_text(TFCSSimulationState &simulstate, const TFCSTruthState *, const TFCSExtrapolationState *) const override
Definition: TFCSEnergyAndHitGANV2.cxx:108