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 IOBitwise::IeEmNbhoodTOB *) const
 

Private Attributes

Gaudi::Property< bool > m_enableDump
 
SG::WriteHandleKey< IOBitwise::IeEmEg1BDTTOBContainerm_BDTResultKey
 
SG::ReadHandleKey< IOBitwise::IeEmNbhoodTOBContainerm_nbhdTOBContainerReadKey
 

Static Private Attributes

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

Detailed Description

Definition at line 31 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 16 of file Egamma1BDTAlgTool.cxx.

18  :
19  base_class(type, name, parent){
20  }

◆ ~Egamma1BDTAlgTool()

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

Member Function Documentation

◆ combine_phi()

std::vector< double > GlobalSim::Egamma1BDTAlgTool::combine_phi ( const IOBitwise::IeEmNbhoodTOB nbhdTOB) const
private

Definition at line 86 of file Egamma1BDTAlgTool.cxx.

86  {
87  auto result = std::vector<double>();
88 
89  const auto& phi_low = nbhdTOB->Neighbourhood().phi_low();
90  if (phi_low.size() != s_required_phi_len) {return result;}
91 
92  const auto& phi_center = nbhdTOB->Neighbourhood().phi_center();
93  if (phi_center.size() != s_required_phi_len) {return result;}
94 
95 
96  const auto& phi_high = nbhdTOB->Neighbourhood().phi_high();
97  if (phi_high.size() != s_required_phi_len) {return result;}
98 
99  result.resize(s_combination_len);
100 
101  constexpr int c{8};
102 
103  result.at(0) = phi_center.at(c).m_e;
104 
105  result.at(1) = std::max(phi_low.at(c).m_e, phi_high.at(c).m_e);
106 
107  int ri{2};
108  for (int diff = 1; diff != 9; ++diff) {
109  result.at(ri) =
110  std::max({phi_center.at(c-diff).m_e,
111  phi_center.at(c+diff).m_e});
112 
113  result.at(ri+1) =
114  std::max({phi_low.at(c-diff).m_e,
115  phi_low.at(c+diff).m_e,
116  phi_high.at(c-diff).m_e,
117  phi_high.at(c+diff).m_e});
118 
119  ri += 2;
120  }
121 
122  return result;
123  }

◆ initialize()

StatusCode GlobalSim::Egamma1BDTAlgTool::initialize ( )
override

Definition at line 22 of file Egamma1BDTAlgTool.cxx.

22  {
23 
24  CHECK(m_nbhdTOBContainerReadKey.initialize());
25  CHECK(m_BDTResultKey.initialize());
26 
27  return StatusCode::SUCCESS;
28  }

◆ run()

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

Definition at line 31 of file Egamma1BDTAlgTool.cxx.

31  {
32  ATH_MSG_DEBUG("run()");
33 
34 
35  // read in LArStrip neighborhood TOBs from the event store
36  auto in =
38  ctx);
39  CHECK(in.isValid());
40 
41  ATH_MSG_DEBUG("read in " << (*in).size() << " neighborhoods");
42 
44  CHECK(h_BDTResult.record(std::make_unique<IOBitwise::IeEmEg1BDTTOBContainer>()));
45 
46  for (const auto nbhdTOB : *in) {
47  auto c_phi = combine_phi(nbhdTOB);
48  if (c_phi.empty()) {continue;} // corner case: not all phi have len 17
49  auto input = digitizer::digitize10(c_phi);
50 
51  assert(input.size() == n_features);
52  ap_int<10>* c_input = &input[0]; // vector->array
53 
54  score_t scores[GlobalSim::BDT::fn_classes(n_classes)];
55 
56  // the bdt variable is already set up
57  bdt.decision_function(c_input, scores);
58  if (msgLevel() <= MSG::DEBUG) {
59  std::stringstream ss;
60  ss << "BDT input: ";
61  for (const auto& i : input) {ss << i << ' ';}
62  ATH_MSG_DEBUG(ss.str());
63  }
64 
65  if (msgLevel() <= MSG::DEBUG) {
66  std::stringstream ss;
67  ss << "C BDT output: ";
68  for (const auto& i : scores) {ss << i << ' ';}
69  ATH_MSG_DEBUG(ss.str());
70  }
71 
72  //Extract the bits (one by one) from the ap_fixed<10,5> object -> Bitset<10>
73  std::bitset<IOBitwise::IeEmEg1BDTTOB::s_eGamma1BDT_width> result;
74  for (int i=0;i<scores[0].length();i++){
75  result[i] = scores[0][0];
76  }
77 
78  h_BDTResult->push_back(std::make_unique<IOBitwise::eEmEg1BDTTOB>(*nbhdTOB, result));
79 
80  }
81  return StatusCode::SUCCESS;
82  }

◆ toString()

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

Definition at line 125 of file Egamma1BDTAlgTool.cxx.

125  {
126 
127  std::stringstream ss;
128  ss << "Egamma1BDTAlgTool. name: " << name() << '\n'
129  << m_nbhdTOBContainerReadKey << '\n'
130  << '\n';
131  return ss.str();
132  }

Member Data Documentation

◆ m_BDTResultKey

SG::WriteHandleKey<IOBitwise::IeEmEg1BDTTOBContainer> GlobalSim::Egamma1BDTAlgTool::m_BDTResultKey
private
Initial value:
{
this,
"BDTResultKey",
"BDTResult"}

Definition at line 56 of file Egamma1BDTAlgTool.h.

◆ m_enableDump

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

Definition at line 50 of file Egamma1BDTAlgTool.h.

◆ m_nbhdTOBContainerReadKey

SG::ReadHandleKey<IOBitwise::IeEmNbhoodTOBContainer> GlobalSim::Egamma1BDTAlgTool::m_nbhdTOBContainerReadKey
private
Initial value:
{
this,
"LArNeighborhoodTOBContainerReadKey",
"stripNeighborhoodTOBContainer",
"key to read inLArNeighborhoodTOBsReadKeys"}

Definition at line 63 of file Egamma1BDTAlgTool.h.

◆ s_combination_len

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

Definition at line 78 of file Egamma1BDTAlgTool.h.

◆ s_required_phi_len

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

Definition at line 74 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
GlobalSim::Egamma1BDTAlgTool::m_BDTResultKey
SG::WriteHandleKey< IOBitwise::IeEmEg1BDTTOBContainer > m_BDTResultKey
Definition: Egamma1BDTAlgTool.h:56
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
GlobalSim::Egamma1BDTAlgTool::combine_phi
std::vector< double > combine_phi(const IOBitwise::IeEmNbhoodTOB *) const
Definition: Egamma1BDTAlgTool.cxx:86
GlobalSim::digitizer::digitize10
static std::vector< ap_int< 10 > > digitize10(const std::vector< double > &v)
Definition: Digitizer.h:28
GlobalSim::Egamma1BDTAlgTool::s_combination_len
static constexpr int s_combination_len
Definition: Egamma1BDTAlgTool.h:78
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
GlobalSim::Egamma1BDTAlgTool::s_required_phi_len
static constexpr int s_required_phi_len
Definition: Egamma1BDTAlgTool.h:74
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
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:240
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
DEBUG
#define DEBUG
Definition: page_access.h:11
GlobalSim::Egamma1BDTAlgTool::m_nbhdTOBContainerReadKey
SG::ReadHandleKey< IOBitwise::IeEmNbhoodTOBContainer > m_nbhdTOBContainerReadKey
Definition: Egamma1BDTAlgTool.h:63
python.compressB64.c
def c
Definition: compressB64.py:93