ATLAS Offline Software
Loading...
Searching...
No Matches
ConfigurableAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 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 <memory>
23
24class TH1;
25class TH2;
26class IL1TopoHistSvc;
27
28namespace TCS {
29
31 protected:
33
34 public:
35
36 // constructor
37 ConfigurableAlg(const std::string & name, AlgType algType);
38
39 // destructor
40 virtual ~ConfigurableAlg();
41
42 // setting the class name
43 void setClassName(const std::string & className) { m_className = className; }
44
46
47 // accessors
48 const std::string & name() const { return m_name; }
49 const std::string & className() const { return m_className; }
50 std::string fullname() const { return m_className + "/" + m_name; }
51
52 // the index of the algorithm in the hardware
53 unsigned int algoId() const { return m_algoId; }
54
55 // reset
57
58 StatusCode reset() { return doReset(); }
59
60 bool isSortingAlg() const { return m_algType == SORT; }
61
62 bool isDecisionAlg() const { return m_algType == DECISION; }
63
64 bool isCountingAlg() const { return m_algType == COUNT; }
65
66 bool isLegacyTopo() const { return m_isLegacyTopo; }
67
68 // Kinematic calculation
69 unsigned int calcDeltaPhiBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
70 unsigned int calcDeltaEtaBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
71 unsigned int calcInvMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
72 unsigned int calcTMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
73 unsigned int calcDeltaR2BW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
74 unsigned long quadraticSumBW(int i1, int i2);
75 unsigned int calcDeltaPhi(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
76 unsigned int calcDeltaEta(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
77 unsigned int calcInvMass(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
78 unsigned int calcTMass(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
79 unsigned int calcDeltaR2(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
80
81
82 // const access to parameter
83 const Parameter & parameter(const std::string & parameterName) const;
84
85 const Parameter & parameter(const std::string & parameterName, unsigned int selection) const;
86
87 const ParameterSpace & parameters() const { return m_parameters; }
88
89 // set parameters from configuration
90 void setParameters(const ParameterSpace &);
91
92 // setters
93 void setAlgoId(unsigned int algoId) { m_algoId = algoId; }
94
98 void setL1TopoHistSvc(std::shared_ptr<IL1TopoHistSvc>);
99
100 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);
101 void bookHist(std::vector<std::string> &regName, const std::string& name, const std::string& title, const int binx, const int xmin, const int xmax);
102 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);
103 void bookHist(std::vector<std::string> &regName, const std::string& name, const std::string& title, const int binx, const int xmin, const int xmax, const int biny, const int ymin, const int ymax);
104
105
106 protected:
107
108 // define parameters by developer
109 void defineParameter(const std::string & name, TCS::parType_t value);
110
111 void defineParameter(const std::string & name, TCS::parType_t value, unsigned int selection);
112
113 virtual StatusCode doReset() = 0;
114
115 void registerHist(TH1 *);
116
117 void registerHist(TH2 *);
118
119 void fillHist1D(const std::string & histName, double x);
120
121 void fillHist2D(const std::string & histName, double x, double y);
122
123 bool isocut(const std::string& threshold, const unsigned int bit) const;
124
125 bool isocut(const unsigned int threshold, const unsigned int bit) const;
126 private:
127
129 std::unique_ptr<ConfigurableAlgImpl> m_impl;
130
131 void defineParameter(const Parameter &);
132 std::string ToString(const int val);
133
134 std::string m_name {""};
135 std::string m_className {""};
136
137 // just for the hardware
138 unsigned int m_algoId {0};
139
141
142 AlgType m_algType; // stores type of alg (Sorting or Decision)
143
145 };
146
147std::ostream & operator<<(std::ostream &, const TCS::ConfigurableAlg &);
148
149} // end of namespace TCS
150
151#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)
const Parameter & parameter(const std::string &parameterName) const
unsigned int algoId() const
bool isLegacyTopo() const
unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
const std::string & name() const
bool isocut(const std::string &threshold, const unsigned int bit) const
void bookHist(std::vector< std::string > &regName, const std::string &name, const std::string &title, const int binx, const int xmin, const int xmax)
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(const std::string &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:22