ATLAS Offline Software
Loading...
Searching...
No Matches
ConfigurableAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4// BaseTOBoAlg.h
5// TopoCore
6// Created by Joerg Stelzer on 11/10/12.
7
8#ifndef TCS_ConfigurableAlg
9#define TCS_ConfigurableAlg
10
12
19
20#include <vector>
21#include <string>
22#include <string_view>
23#include <memory>
24
25class TH1;
26class TH2;
27class IL1TopoHistSvc;
28
29namespace TCS {
30
32 protected:
34
35 public:
36
37 // constructor
38 ConfigurableAlg(const std::string & name, AlgType algType);
39
40 // destructor
41 virtual ~ConfigurableAlg();
42
43 // setting the class name
44 void setClassName(const std::string & className) { m_className = className; }
45
47
48 // accessors
49 const std::string & name() const { return m_name; }
50 const std::string & className() const { return m_className; }
51 std::string fullname() const { return m_className + "/" + m_name; }
52
53 // the index of the algorithm in the hardware
54 unsigned int algoId() const { return m_algoId; }
55
56 // reset
58
59 StatusCode reset() { return doReset(); }
60
61 bool isSortingAlg() const { return m_algType == SORT; }
62
63 bool isDecisionAlg() const { return m_algType == DECISION; }
64
65 bool isCountingAlg() const { return m_algType == COUNT; }
66
67 bool isLegacyTopo() const { return m_isLegacyTopo; }
68
69 // Kinematic calculation
70 unsigned int calcDeltaPhiBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
71 unsigned int calcDeltaEtaBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
72 unsigned int calcInvMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
73 unsigned int calcTMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
74 unsigned int calcDeltaR2BW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
75 unsigned long quadraticSumBW(int i1, int i2);
76 unsigned int calcDeltaPhi(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
77 unsigned int calcDeltaEta(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
78 unsigned int calcInvMass(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
79 unsigned int calcTMass(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
80 unsigned int calcDeltaR2(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
81
82
83 // const access to parameter
84 const Parameter & parameter(std::string_view parameterName) const;
85
86 const Parameter & parameter(std::string_view parameterName, unsigned int selection) const;
87
88 const ParameterSpace & parameters() const { return m_parameters; }
89
90 // set parameters from configuration
91 void setParameters(const ParameterSpace &);
92
93 // setters
94 void setAlgoId(unsigned int algoId) { m_algoId = algoId; }
95
99 void setL1TopoHistSvc(std::shared_ptr<IL1TopoHistSvc>);
100
101 void bookHistMult(std::vector<std::string> &regName, const std::string& name, const std::string& title, const std::string& xtitle, const int binx, const int xmin, const int xmax);
102 void bookHist(std::vector<std::string> &regName, std::string_view name, std::string_view title, const int binx, const int xmin, const int xmax);
103 void bookHistMult(std::vector<std::string> &regName, const std::string& name, const std::string& title, const std::string& xtitle, const std::string& ytitle, const int binx, const int xmin, const int xmax, const int biny, const int ymin, const int ymax);
104 void bookHist(std::vector<std::string> &regName, std::string_view name, std::string_view title, const int binx, const int xmin, const int xmax, const int biny, const int ymin, const int ymax);
105
106
107 protected:
108
109 // define parameters by developer
110 void defineParameter(std::string_view name, TCS::parType_t value);
111
112 void defineParameter(std::string_view name, TCS::parType_t value, unsigned int selection);
113
114 virtual StatusCode doReset() = 0;
115
116 void registerHist(TH1 *);
117
118 void registerHist(TH2 *);
119
120 void fillHist1D(const std::string & histName, double x);
121
122 void fillHist2D(const std::string & histName, double x, double y);
123
124 bool isocut(const std::string& threshold, const unsigned int bit) const;
125
126 bool isocut(const unsigned int threshold, const unsigned int bit) const;
127 private:
128
130 std::unique_ptr<ConfigurableAlgImpl> m_impl;
131
132 void defineParameter(const Parameter &);
133 std::string ToString(const int val);
134
135 std::string m_name {""};
136 std::string m_className {""};
137
138 // just for the hardware
139 unsigned int m_algoId {0};
140
142
143 AlgType m_algType; // stores type of alg (Sorting or Decision)
144
146 };
147
148std::ostream & operator<<(std::ostream &, const TCS::ConfigurableAlg &);
149
150} // end of namespace TCS
151
152#endif /* defined(__TopoCore__TopoAlg__) */
Messaging base class for TrigConf code shared with Lvl1 ( AthMessaging).
#define y
#define x
const ParameterSpace & parameters() const
ConfigurableAlg(const std::string &name, AlgType algType)
unsigned int algoId() const
bool isLegacyTopo() const
unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
const std::string & name() const
void bookHist(std::vector< std::string > &regName, std::string_view name, std::string_view title, const int binx, const int xmin, const int xmax)
const Parameter & parameter(std::string_view parameterName) const
bool isocut(const std::string &threshold, const unsigned int bit) const
void fillHist1D(const std::string &histName, double x)
unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcDeltaPhiBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void setL1TopoHistSvc(std::shared_ptr< IL1TopoHistSvc >)
sets the external hist service
const std::string & className() const
unsigned int calcInvMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned long quadraticSumBW(int i1, int i2)
unsigned int calcDeltaEta(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void setAlgoId(unsigned int algoId)
std::string ToString(const int val)
void setParameters(const ParameterSpace &)
void setClassName(const std::string &className)
bool isCountingAlg() const
std::unique_ptr< ConfigurableAlgImpl > m_impl
virtual StatusCode doReset()=0
void bookHistMult(std::vector< std::string > &regName, const std::string &name, const std::string &title, const std::string &xtitle, const int binx, const int xmin, const int xmax)
ParameterSpace m_parameters
unsigned int calcDeltaEtaBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void defineParameter(std::string_view name, TCS::parType_t value)
bool isDecisionAlg() const
unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcTMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void setLegacyMode(bool isLegacyTopo)
std::string fullname() const
unsigned int calcDeltaPhi(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcInvMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
virtual StatusCode initialize()
void fillHist2D(const std::string &histName, double x, double y)
bool isSortingAlg() const
Class to provide easy access to TrigConf::MsgStream for TrigConf classes.
const std::string selection
double xmax
Definition listroot.cxx:61
double ymin
Definition listroot.cxx:63
double xmin
Definition listroot.cxx:60
double ymax
Definition listroot.cxx:64
std::ostream & operator<<(std::ostream &os, const TCS::Bin &bin)
uint32_t parType_t
Definition Parameter.h:23