ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
GlobalSim::Egamma1BDTAlgTool Class Reference

#include <Egamma1BDTAlgTool.h>

Inheritance diagram for GlobalSim::Egamma1BDTAlgTool:
Collaboration diagram for GlobalSim::Egamma1BDTAlgTool:

Public Member Functions

 Egamma1BDTAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~Egamma1BDTAlgTool ()=default
 
StatusCode initialize () override
 
virtual StatusCode run (const EventContext &ctx) const override
 
virtual std::string toString () const override
 

Private Member Functions

std::vector< double > combine_phi (const LArStripNeighborhood *) const
 
std::vector< ap_int< 10 > > digitize (const std::vector< double > &) const
 

Private Attributes

Gaudi::Property< bool > m_enableDump
 
SG::ReadHandleKey< LArStripNeighborhoodContainerm_nbhdContainerReadKey
 

Static Private Attributes

static constexpr int s_required_phi_len = 17
 
static constexpr int s_combination_len = 18
 

Detailed Description

Definition at line 26 of file Egamma1BDTAlgTool.h.

Constructor & Destructor Documentation

◆ Egamma1BDTAlgTool()

GlobalSim::Egamma1BDTAlgTool::Egamma1BDTAlgTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 14 of file Egamma1BDTAlgTool.cxx.

16  :
17  base_class(type, name, parent){
18  }

◆ ~Egamma1BDTAlgTool()

virtual GlobalSim::Egamma1BDTAlgTool::~Egamma1BDTAlgTool ( )
virtualdefault

Member Function Documentation

◆ combine_phi()

std::vector< double > GlobalSim::Egamma1BDTAlgTool::combine_phi ( const LArStripNeighborhood nbhd) const
private

Definition at line 76 of file Egamma1BDTAlgTool.cxx.

76  {
77  auto result = std::vector<double>();
78 
79  const auto& phi_low = nbhd->phi_low();
80  if (phi_low.size() != s_required_phi_len) {return result;}
81 
82  const auto& phi_center = nbhd->phi_center();
83  if (phi_center.size() != s_required_phi_len) {return result;}
84 
85 
86  const auto& phi_high = nbhd->phi_high();
87  if (phi_high.size() != s_required_phi_len) {return result;}
88 
89  result.resize(s_combination_len);
90 
91  constexpr int c{8};
92 
93  result.at(0) = phi_center.at(c).m_e;
94 
95  result.at(1) = std::max(phi_low.at(c).m_e, phi_high.at(c).m_e);
96 
97  int ri{2};
98  for (int diff = 1; diff != 9; ++diff) {
99  result.at(ri) =
100  std::max({phi_center.at(c-diff).m_e,
101  phi_center.at(c+diff).m_e});
102 
103  result.at(ri+1) =
104  std::max({phi_low.at(c-diff).m_e,
105  phi_low.at(c+diff).m_e,
106  phi_high.at(c-diff).m_e,
107  phi_high.at(c+diff).m_e});
108 
109  ri += 2;
110  }
111 
112  return result;
113  }

◆ digitize()

std::vector< ap_int< 10 > > GlobalSim::Egamma1BDTAlgTool::digitize ( const std::vector< double > &  v) const
private

Definition at line 117 of file Egamma1BDTAlgTool.cxx.

117  {
118  auto sf = [](double v) {
119  if (v < 0) {return 0.;}
120  if (v < 8000) {return v / 31.25;}
121  if (v < 40000) {return 192. + v / 125;}
122  if (v < 168000) {return 432. + v / 500;}
123  if (v < 678000) {return 686. + v / 2000;}
124  return 1023.;
125  };
126 
127  auto result = std::vector<ap_int<10>>();
128  result.reserve(s_combination_len);
129 
130  std::transform(std::cbegin(v),
131  std::cend(v),
132  std::back_inserter(result),
133  sf);
134 
135  return result;
136  }

◆ initialize()

StatusCode GlobalSim::Egamma1BDTAlgTool::initialize ( )
override

Definition at line 20 of file Egamma1BDTAlgTool.cxx.

20  {
21 
22  CHECK(m_nbhdContainerReadKey.initialize());
23 
24  return StatusCode::SUCCESS;
25  }

◆ run()

StatusCode GlobalSim::Egamma1BDTAlgTool::run ( const EventContext &  ctx) const
overridevirtual

Definition at line 28 of file Egamma1BDTAlgTool.cxx.

28  {
29  ATH_MSG_DEBUG("run()");
30 
31 
32  // read in LArStrip neighborhoods from the event store
33  // there is one neighborhood per EFex RoI
34  auto in =
36  ctx);
37  CHECK(in.isValid());
38 
39  ATH_MSG_DEBUG("read in " << (*in).size() << " neighborhoods");
40 
41 
42  for (const auto& nbhd : *in) {
43  auto c_phi = combine_phi(nbhd);
44  if (c_phi.empty()) {continue;} // corner case: not all phi have len 17
45  auto input = digitize(c_phi);
46 
47  assert(input.size() == n_features);
48  ap_int<10>* c_input = &input[0]; // vector->array
49 
50  score_t scores[GlobalSim::BDT::fn_classes(n_classes)];
51 
52  // the bdt variable is already set up
53  bdt.decision_function(c_input, scores);
54  {
55  std::stringstream ss;
56  ss << "BDT input: ";
57  for (const auto& i : input) {ss << i << ' ';}
58  ATH_MSG_DEBUG(ss.str());
59  }
60 
61  {
62  std::stringstream ss;
63  ss << "C BDT output: ";
64  for (const auto& i : scores) {ss << i << ' ';}
65  ATH_MSG_DEBUG(ss.str());
66  }
67 
68  }
69 
70 
71  return StatusCode::SUCCESS;
72  }

◆ toString()

std::string GlobalSim::Egamma1BDTAlgTool::toString ( ) const
overridevirtual

Definition at line 139 of file Egamma1BDTAlgTool.cxx.

139  {
140 
141  std::stringstream ss;
142  ss << "Egamma1BDTAlgTool. name: " << name() << '\n'
143  << m_nbhdContainerReadKey << '\n'
144  << '\n';
145  return ss.str();
146  }

Member Data Documentation

◆ m_enableDump

Gaudi::Property<bool> GlobalSim::Egamma1BDTAlgTool::m_enableDump
private
Initial value:
{this,
"enableDump",
{false},
"flag to enable dumps"}

Definition at line 45 of file Egamma1BDTAlgTool.h.

◆ m_nbhdContainerReadKey

SG::ReadHandleKey<LArStripNeighborhoodContainer> GlobalSim::Egamma1BDTAlgTool::m_nbhdContainerReadKey
private
Initial value:
{
this,
"LArNeighborhoodContainerReadKey",
"stripNeighborhoodContainer",
"key to read inLArNeighborhoodReadKeys"}

Definition at line 52 of file Egamma1BDTAlgTool.h.

◆ s_combination_len

constexpr int GlobalSim::Egamma1BDTAlgTool::s_combination_len = 18
inlinestaticconstexprprivate

Definition at line 68 of file Egamma1BDTAlgTool.h.

◆ s_required_phi_len

constexpr int GlobalSim::Egamma1BDTAlgTool::s_required_phi_len = 17
inlinestaticconstexprprivate

Definition at line 64 of file Egamma1BDTAlgTool.h.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
GlobalSim::Egamma1BDTAlgTool::digitize
std::vector< ap_int< 10 > > digitize(const std::vector< double > &) const
Definition: Egamma1BDTAlgTool.cxx:117
GlobalSim::Egamma1BDTAlgTool::s_combination_len
static constexpr int s_combination_len
Definition: Egamma1BDTAlgTool.h:68
GlobalSim::Egamma1BDTAlgTool::combine_phi
std::vector< double > combine_phi(const LArStripNeighborhood *) const
Definition: Egamma1BDTAlgTool.cxx:76
GlobalSim::Egamma1BDTAlgTool::s_required_phi_len
static constexpr int s_required_phi_len
Definition: Egamma1BDTAlgTool.h:64
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
GlobalSim::BDT::fn_classes
constexpr int fn_classes(int n_classes)
Definition: Trigger/TrigT1/Global/GlobalSimulation/src/GlobalAlgs/Egamma1BDT/BDT.h:44
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
GlobalSim::score_t
ap_fixed< 10, 5 > score_t
Definition: parameters.h:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
GlobalSim::Egamma1BDTAlgTool::m_nbhdContainerReadKey
SG::ReadHandleKey< LArStripNeighborhoodContainer > m_nbhdContainerReadKey
Definition: Egamma1BDTAlgTool.h:52
python.PyAthena.v
v
Definition: PyAthena.py:154
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.compressB64.c
def c
Definition: compressB64.py:93