ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimEvent
ISF_FastCaloSimEvent
TFCSPredictExtrapWeights.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_TFCSPREDICTEXTRAPWEIGHTS_h
6
#define ISF_FASTCALOSIMEVENT_TFCSPREDICTEXTRAPWEIGHTS_h
7
8
#include "
ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h
"
9
#include "
ISF_FastCaloSimEvent/TFCSSimulationState.h
"
10
#include <string>
11
#include "TH2D.h"
12
13
// forward declare lwtnn dependencies
14
namespace
lwt
{
15
class
LightweightNeuralNetwork;
16
}
17
18
class
TFCSPredictExtrapWeights
:
public
TFCSLateralShapeParametrizationHitBase
{
19
public
:
20
TFCSPredictExtrapWeights
(
const
char
*name =
nullptr
,
21
const
char
*title =
nullptr
);
22
virtual
~TFCSPredictExtrapWeights
();
23
24
virtual
bool
operator==
(
const
TFCSParametrizationBase
&
ref
)
const override
;
25
26
// Used to decorate simulstate with extrapolation weights
27
virtual
FCSReturnCode
28
simulate
(
TFCSSimulationState
&simulstate,
const
TFCSTruthState
*truth,
29
const
TFCSExtrapolationState
*extrapol)
const override
;
30
31
// Used to decorate Hit with extrapolated center positions
32
virtual
FCSReturnCode
33
simulate_hit
(
Hit
&
hit
,
TFCSSimulationState
&simulstate,
34
const
TFCSTruthState
*truth,
35
const
TFCSExtrapolationState
*extrapol)
override
;
36
37
// Status bit for chain persistency
38
enum
FCSfreemem
{
39
kfreemem
= BIT(17)
41
};
42
bool
freemem
()
const
{
return
TestBit(
kfreemem
); };
43
void
set_freemem
() { SetBit(
kfreemem
); };
44
45
// Initialize Neural Network
46
bool
initializeNetwork
(
int
pid,
const
std::string &etaBin,
47
const
std::string &FastCaloNNInputFolderName);
48
49
// Get inputs needed to normalize data
50
bool
getNormInputs
(
const
std::string &etaBin,
51
const
std::string &FastCaloTXTInputFolderName);
52
53
// Test function
54
static
void
test_path
(std::string &net_path, std::string
const
&norm_path,
55
TFCSSimulationState
*simulstate =
nullptr
,
56
const
TFCSTruthState
*truth =
nullptr
,
57
const
TFCSExtrapolationState
*extrapol =
nullptr
);
58
static
void
unit_test
(
TFCSSimulationState
*simulstate =
nullptr
,
59
const
TFCSTruthState
*truth =
nullptr
,
60
const
TFCSExtrapolationState
*extrapol =
nullptr
);
61
62
// Prepare inputs to the Neural Network
63
std::map<std::string, double>
prepareInputs
(
TFCSSimulationState
&simulstate,
64
const
float
truthE)
const
;
65
66
// Print()
67
void
Print
(Option_t *option =
""
)
const override
;
68
69
// Use extrapWeight=0.5 or r and z when constructing a hit?
70
enum
TFCSPredictExtrapWeightsStatusBits
{
kUseHardcodedWeight
= BIT(15) };
71
bool
UseHardcodedWeight
()
const
{
return
TestBit(
kUseHardcodedWeight
); };
72
void
set_UseHardcodedWeight
() { SetBit(
kUseHardcodedWeight
); };
73
void
reset_UseHardcodedWeight
() { ResetBit(
kUseHardcodedWeight
); };
74
75
private
:
76
// Persistify configuration in string m_input. A custom Streamer(...) builds
77
// m_nn on the fly when reading from file.
78
// Inside Athena, if freemem() is true, the content of m_input is deleted
79
// after reading in order to free memory
80
std::string *
m_input
=
nullptr
;
81
std::vector<int> *
m_relevantLayers
=
nullptr
;
82
lwt::LightweightNeuralNetwork *
m_nn
=
nullptr
;
83
std::vector<int> *
m_normLayers
=
84
nullptr
;
// vector of index layers (-1 corresponds to truth energy)
85
std::vector<float> *
m_normMeans
=
86
nullptr
;
// vector of mean values for normalizing energy fraction per
87
// layer, last index is for total energy
88
std::vector<float> *
m_normStdDevs
=
89
nullptr
;
// vector of std dev values for normalizing energy fraction per
90
// layer, last index is for total energy
91
92
ClassDefOverride(
TFCSPredictExtrapWeights
, 1)
// TFCSPredictExtrapWeights
93
};
94
95
#endif
ref
const std::regex ref(r_ef)
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
TFCSLateralShapeParametrizationHitBase.h
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition
TFCSParametrizationBase.h:41
TFCSSimulationState.h
TFCSExtrapolationState
Definition
TFCSExtrapolationState.h:13
TFCSLateralShapeParametrizationHitBase::Hit
Definition
TFCSLateralShapeParametrizationHitBase.h:42
TFCSLateralShapeParametrizationHitBase::TFCSLateralShapeParametrizationHitBase
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
Definition
TFCSLateralShapeParametrizationHitBase.cxx:15
TFCSParametrizationBase
Definition
TFCSParametrizationBase.h:46
TFCSPredictExtrapWeights::set_freemem
void set_freemem()
Definition
TFCSPredictExtrapWeights.h:43
TFCSPredictExtrapWeights::~TFCSPredictExtrapWeights
virtual ~TFCSPredictExtrapWeights()
Definition
TFCSPredictExtrapWeights.cxx:44
TFCSPredictExtrapWeights::simulate
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override
Method in all derived classes to do some simulation.
Definition
TFCSPredictExtrapWeights.cxx:183
TFCSPredictExtrapWeights::getNormInputs
bool getNormInputs(const std::string &etaBin, const std::string &FastCaloTXTInputFolderName)
Definition
TFCSPredictExtrapWeights.cxx:87
TFCSPredictExtrapWeights::UseHardcodedWeight
bool UseHardcodedWeight() const
Definition
TFCSPredictExtrapWeights.h:71
TFCSPredictExtrapWeights::set_UseHardcodedWeight
void set_UseHardcodedWeight()
Definition
TFCSPredictExtrapWeights.h:72
TFCSPredictExtrapWeights::m_normMeans
std::vector< float > * m_normMeans
Definition
TFCSPredictExtrapWeights.h:85
TFCSPredictExtrapWeights::reset_UseHardcodedWeight
void reset_UseHardcodedWeight()
Definition
TFCSPredictExtrapWeights.h:73
TFCSPredictExtrapWeights::m_nn
lwt::LightweightNeuralNetwork * m_nn
Definition
TFCSPredictExtrapWeights.h:82
TFCSPredictExtrapWeights::operator==
virtual bool operator==(const TFCSParametrizationBase &ref) const override
The == operator compares the content of instances.
Definition
TFCSPredictExtrapWeights.cxx:65
TFCSPredictExtrapWeights::TFCSPredictExtrapWeights
TFCSPredictExtrapWeights(const char *name=nullptr, const char *title=nullptr)
Definition
TFCSPredictExtrapWeights.cxx:36
TFCSPredictExtrapWeights::m_normStdDevs
std::vector< float > * m_normStdDevs
Definition
TFCSPredictExtrapWeights.h:88
TFCSPredictExtrapWeights::m_relevantLayers
std::vector< int > * m_relevantLayers
Definition
TFCSPredictExtrapWeights.h:81
TFCSPredictExtrapWeights::freemem
bool freemem() const
Definition
TFCSPredictExtrapWeights.h:42
TFCSPredictExtrapWeights::FCSfreemem
FCSfreemem
Definition
TFCSPredictExtrapWeights.h:38
TFCSPredictExtrapWeights::kfreemem
@ kfreemem
Set this bit in the TObject bit if the memory for m_input should be freed after reading in athena.
Definition
TFCSPredictExtrapWeights.h:39
TFCSPredictExtrapWeights::Print
void Print(Option_t *option="") const override
Definition
TFCSPredictExtrapWeights.cxx:500
TFCSPredictExtrapWeights::m_normLayers
std::vector< int > * m_normLayers
Do not persistify.
Definition
TFCSPredictExtrapWeights.h:83
TFCSPredictExtrapWeights::prepareInputs
std::map< std::string, double > prepareInputs(TFCSSimulationState &simulstate, const float truthE) const
Definition
TFCSPredictExtrapWeights.cxx:147
TFCSPredictExtrapWeights::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
TFCSPredictExtrapWeights.cxx:217
TFCSPredictExtrapWeights::test_path
static void test_path(std::string &net_path, std::string const &norm_path, TFCSSimulationState *simulstate=nullptr, const TFCSTruthState *truth=nullptr, const TFCSExtrapolationState *extrapol=nullptr)
Definition
TFCSPredictExtrapWeights.cxx:379
TFCSPredictExtrapWeights::TFCSPredictExtrapWeightsStatusBits
TFCSPredictExtrapWeightsStatusBits
Definition
TFCSPredictExtrapWeights.h:70
TFCSPredictExtrapWeights::kUseHardcodedWeight
@ kUseHardcodedWeight
Definition
TFCSPredictExtrapWeights.h:70
TFCSPredictExtrapWeights::unit_test
static void unit_test(TFCSSimulationState *simulstate=nullptr, const TFCSTruthState *truth=nullptr, const TFCSExtrapolationState *extrapol=nullptr)
Definition
TFCSPredictExtrapWeights.cxx:363
TFCSPredictExtrapWeights::initializeNetwork
bool initializeNetwork(int pid, const std::string &etaBin, const std::string &FastCaloNNInputFolderName)
Definition
TFCSPredictExtrapWeights.cxx:287
TFCSPredictExtrapWeights::m_input
std::string * m_input
Definition
TFCSPredictExtrapWeights.h:80
TFCSSimulationState
Definition
TFCSSimulationState.h:32
TFCSTruthState
Definition
TFCSTruthState.h:13
lwt
Definition
NnClusterizationFactory.h:51
Generated on
for ATLAS Offline Software by
1.17.0