ATLAS Offline Software
TFCSMLCalorimeterSimulator.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_TFCSMLCALORIMETERSIMULATOR_H
6 #define ISF_TFCSMLCALORIMETERSIMULATOR_H
7 
8 // ISF includes
9 #include <map>
10 #include <vector>
11 #include <string>
12 #include <fstream>
13 
16 
17 // generic network class
19 
20 
21 
22 
24 public:
27 
28  typedef struct {
29  std::vector<unsigned int> bin_index_vector;
30  std::vector<float> E_vector;
31  } layer_t;
32 
33  typedef struct {
34  std::vector<layer_t> event_data;
35  } event_t;
36 
37  bool loadSimulator(std::string& filename);
38 
39  void Print() const;
40 
42  event_t getEvent(TFCSSimulationState &simulstate, float eta, float energy) const;
44 
45  void setInputShapes(std::vector<long unsigned int>& layer_boundaries, std::vector<long unsigned int>& used_layers) {
46  m_layer_boundaries = layer_boundaries;
47  m_used_layers = used_layers;
48  m_nVoxels = layer_boundaries.back();
49  m_nLayers = used_layers.size();
50  };
51 
52 private:
53 
54  std::unique_ptr<VNetworkBase> m_onnx_model = nullptr;
55 
56  int m_nEvents = 1; // Currently no batching supported from ONNX handler
57 
58  // Default shapes for the photon barrel-CFM
59  // Should be set using setInputShapes for other models
60  std::vector<long unsigned int> m_layer_boundaries = {0, 36, 200, 310, 346, 382};
61  std::vector<long unsigned int> m_used_layers = {0, 1, 2, 3, 12};
62  long unsigned int m_nVoxels = 382;
63  long unsigned int m_nLayers= 5;
64 
65 
66  ClassDef(TFCSMLCalorimeterSimulator, 1) // TFCSMLCalorimeterSimulator
67 };
68 
69 #endif //> !ISF_TFCSMLCALORIMETERSIMULATOR_H
TFCSMLCalorimeterSimulator::event_t::event_data
std::vector< layer_t > event_data
Definition: TFCSMLCalorimeterSimulator.h:34
VNetworkBase::NetworkOutputs
std::map< std::string, double > NetworkOutputs
Format for network outputs.
Definition: VNetworkBase.h:100
VNetworkBase.h
TFCSMLCalorimeterSimulator::setInputShapes
void setInputShapes(std::vector< long unsigned int > &layer_boundaries, std::vector< long unsigned int > &used_layers)
Definition: TFCSMLCalorimeterSimulator.h:45
ISF_FCS::MLogging
Cut down AthMessaging.
Definition: MLogging.h:176
TFCSMLCalorimeterSimulator::m_onnx_model
std::unique_ptr< VNetworkBase > m_onnx_model
Definition: TFCSMLCalorimeterSimulator.h:54
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TFCSMLCalorimeterSimulator::TFCSMLCalorimeterSimulator
TFCSMLCalorimeterSimulator()
Definition: TFCSMLCalorimeterSimulator.cxx:12
TFCSMLCalorimeterSimulator::layer_t
Definition: TFCSMLCalorimeterSimulator.h:28
TFCSMLCalorimeterSimulator::getEvent
event_t getEvent(TFCSSimulationState &simulstate, float eta, float energy) const
Definition: TFCSMLCalorimeterSimulator.cxx:85
TFCSMLCalorimeterSimulator
Definition: TFCSMLCalorimeterSimulator.h:23
TFCSMLCalorimeterSimulator::loadSimulator
bool loadSimulator(std::string &filename)
Definition: TFCSMLCalorimeterSimulator.cxx:16
TFCSMLCalorimeterSimulator::layer_t::bin_index_vector
std::vector< unsigned int > bin_index_vector
Definition: TFCSMLCalorimeterSimulator.h:29
TFCSMLCalorimeterSimulator::m_nVoxels
long unsigned int m_nVoxels
Definition: TFCSMLCalorimeterSimulator.h:62
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
TFCSMLCalorimeterSimulator::event_t
Definition: TFCSMLCalorimeterSimulator.h:33
TFCSMLCalorimeterSimulator::~TFCSMLCalorimeterSimulator
virtual ~TFCSMLCalorimeterSimulator()
Definition: TFCSMLCalorimeterSimulator.cxx:14
TFCSMLCalorimeterSimulator::m_nLayers
long unsigned int m_nLayers
Definition: TFCSMLCalorimeterSimulator.h:63
TFCSMLCalorimeterSimulator::m_used_layers
std::vector< long unsigned int > m_used_layers
Definition: TFCSMLCalorimeterSimulator.h:61
TFCSMLCalorimeterSimulator::m_nEvents
int m_nEvents
Definition: TFCSMLCalorimeterSimulator.h:56
TFCSMLCalorimeterSimulator::layer_t::E_vector
std::vector< float > E_vector
Definition: TFCSMLCalorimeterSimulator.h:30
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:23
TFCSMLCalorimeterSimulator::Print
void Print() const
Definition: TFCSMLCalorimeterSimulator.cxx:202
TFCSMLCalorimeterSimulator::predictVoxels
VNetworkBase::NetworkOutputs predictVoxels() const
Definition: TFCSMLCalorimeterSimulator.cxx:147
TFCSSimulationState.h
TFCSMLCalorimeterSimulator::m_layer_boundaries
std::vector< long unsigned int > m_layer_boundaries
Definition: TFCSMLCalorimeterSimulator.h:60
MLogging.h
TFCSSimulationState
Definition: TFCSSimulationState.h:32