ATLAS Offline Software
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 
17 #include "L1TopoEvent/GenericTOB.h"
19 
20 #include <vector>
21 #include <string>
22 #include <memory>
23 
24 class TH1;
25 class TH2;
26 class IL1TopoHistSvc;
27 
28 namespace 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 
128  class ConfigurableAlgImpl;
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 
147 std::ostream & operator<<(std::ostream &, const TCS::ConfigurableAlg &);
148 
149 } // end of namespace TCS
150 
151 #endif /* defined(__TopoCore__TopoAlg__) */
ParameterSpace.h
TCS::ConfigurableAlg::SORT
@ SORT
Definition: ConfigurableAlg.h:32
TCS::ConfigurableAlg::isDecisionAlg
bool isDecisionAlg() const
Definition: ConfigurableAlg.h:62
TCS::ConfigurableAlg::className
const std::string & className() const
Definition: ConfigurableAlg.h:49
TCS::Parameter
Definition: Parameter.h:24
ymin
double ymin
Definition: listroot.cxx:63
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
IL1TopoHistSvc
Definition: IL1TopoHistSvc.h:12
TCS::ConfigurableAlg::m_name
std::string m_name
Definition: ConfigurableAlg.h:134
TCS::parType_t
uint32_t parType_t
Definition: Parameter.h:22
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
TCS::ConfigurableAlg::ConfigurableAlgImpl
The implementation class.
Definition: ConfigurableAlg.cxx:29
TCS::ConfigurableAlg::parameters
const ParameterSpace & parameters() const
Definition: ConfigurableAlg.h:87
TCS::ConfigurableAlg::initialize
virtual StatusCode initialize()
Definition: ConfigurableAlg.h:56
TCS::ConfigurableAlg::m_impl
std::unique_ptr< ConfigurableAlgImpl > m_impl
Definition: ConfigurableAlg.h:128
TCS::ConfigurableAlg::setAlgoId
void setAlgoId(unsigned int algoId)
Definition: ConfigurableAlg.h:93
TCS::ConfigurableAlg::calcTMass
unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:186
TCS::ConfigurableAlg::ToString
std::string ToString(const int val)
Definition: ConfigurableAlg.cxx:475
TCS::ConfigurableAlg::isLegacyTopo
bool isLegacyTopo() const
Definition: ConfigurableAlg.h:66
TCS::ConfigurableAlg::fillHist2D
void fillHist2D(const std::string &histName, double x, double y)
Definition: ConfigurableAlg.cxx:471
TCS::ConfigurableAlg::calcDeltaEtaBW
unsigned int calcDeltaEtaBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:128
athena.value
value
Definition: athena.py:124
x
#define x
L1Threshold.h
TCS::ConfigurableAlg::parameter
const Parameter & parameter(const std::string &parameterName) const
Definition: ConfigurableAlg.cxx:243
TCS::ParameterSpace
Definition: ParameterSpace.h:18
TCS::ConfigurableAlg::AlgType
AlgType
Definition: ConfigurableAlg.h:32
TCS::ConfigurableAlg::isCountingAlg
bool isCountingAlg() const
Definition: ConfigurableAlg.h:64
TCS::ConfigurableAlg::m_isLegacyTopo
bool m_isLegacyTopo
Definition: ConfigurableAlg.h:144
AlgFactory.h
TCS::ConfigurableAlg::doReset
virtual StatusCode doReset()=0
TCS::ConfigurableAlg::name
const std::string & name() const
Definition: ConfigurableAlg.h:48
TCS::ConfigurableAlg::m_algType
AlgType m_algType
Definition: ConfigurableAlg.h:142
xmin
double xmin
Definition: listroot.cxx:60
TCS::ConfigurableAlg::~ConfigurableAlg
virtual ~ConfigurableAlg()
Definition: ConfigurableAlg.cxx:115
TCS::ConfigurableAlg::NONE
@ NONE
Definition: ConfigurableAlg.h:32
StatusCode.h
TCS::ConfigurableAlg::setLegacyMode
void setLegacyMode(bool isLegacyTopo)
Definition: ConfigurableAlg.h:45
TCS::ConfigurableAlg::defineParameter
void defineParameter(const std::string &name, TCS::parType_t value)
Definition: ConfigurableAlg.cxx:201
covarianceTool.title
title
Definition: covarianceTool.py:542
TCS::ConfigurableAlg::isocut
bool isocut(const std::string &threshold, const unsigned int bit) const
Definition: ConfigurableAlg.cxx:484
TCS::ConfigurableAlg::fullname
std::string fullname() const
Definition: ConfigurableAlg.h:50
TCS::ConfigurableAlg::calcDeltaEta
unsigned int calcDeltaEta(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:173
TCS::ConfigurableAlg::calcDeltaR2
unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:191
TCS::ConfigurableAlg::ConfigurableAlg
ConfigurableAlg(const std::string &name, AlgType algType)
Definition: ConfigurableAlg.cxx:105
TCS::ConfigurableAlg::reset
StatusCode reset()
Definition: ConfigurableAlg.h:58
TCS::ConfigurableAlg::calcInvMassBW
unsigned int calcInvMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:136
TCS::ConfigurableAlg::registerHist
void registerHist(TH1 *)
Definition: ConfigurableAlg.cxx:262
TCS::ConfigurableAlg::isSortingAlg
bool isSortingAlg() const
Definition: ConfigurableAlg.h:60
TCS::GenericTOB
Definition: GenericTOB.h:35
TCS::ConfigurableAlg::setL1TopoHistSvc
void setL1TopoHistSvc(std::shared_ptr< IL1TopoHistSvc >)
sets the external hist service
Definition: ConfigurableAlg.cxx:258
Parameter.h
TCS::ConfigurableAlg::m_algoId
unsigned int m_algoId
Definition: ConfigurableAlg.h:138
TCS::ConfigurableAlg
Definition: ConfigurableAlg.h:30
selection
const std::string selection
Definition: fbtTestBasics.cxx:74
threshold
Definition: chainparser.cxx:74
TCS::ConfigurableAlg::m_className
std::string m_className
Definition: ConfigurableAlg.h:135
TrigConf::TrigConfMessaging
Class to provide easy access to TrigConf::MsgStream for TrigConf classes.
Definition: TrigConfMessaging.h:28
TCS::ConfigurableAlg::bookHist
void bookHist(std::vector< std::string > &regName, const std::string &name, const std::string &title, const int binx, const int xmin, const int xmax)
Definition: ConfigurableAlg.cxx:270
TCS::ConfigurableAlg::calcDeltaR2BW
unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:152
GenericTOB.h
TCS::ConfigurableAlg::bookHistMult
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)
Definition: ConfigurableAlg.cxx:338
TCS::ConfigurableAlg::COUNT
@ COUNT
Definition: ConfigurableAlg.h:32
y
#define y
TCS::ConfigurableAlg::calcDeltaPhi
unsigned int calcDeltaPhi(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:165
TCS::ConfigurableAlg::setClassName
void setClassName(const std::string &className)
Definition: ConfigurableAlg.h:43
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
plotting.yearwise_efficiency.xtitle
string xtitle
Definition: yearwise_efficiency.py:32
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TCS::ConfigurableAlg::calcInvMass
unsigned int calcInvMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:181
xmax
double xmax
Definition: listroot.cxx:61
TCS::ConfigurableAlg::setParameters
void setParameters(const ParameterSpace &)
Definition: ConfigurableAlg.cxx:222
TrigConfMessaging.h
Messaging base class for TrigConf code shared with Lvl1 ( AthMessaging)
TCS::ConfigurableAlg::quadraticSumBW
unsigned long quadraticSumBW(int i1, int i2)
Definition: ConfigurableAlg.cxx:160
TCS::ConfigurableAlg::fillHist1D
void fillHist1D(const std::string &histName, double x)
Definition: ConfigurableAlg.cxx:467
TCS::operator<<
std::ostream & operator<<(std::ostream &, const TCS::CountingConnector &)
Definition: CountingConnector.cxx:93
TCS::ConfigurableAlg::DECISION
@ DECISION
Definition: ConfigurableAlg.h:32
TCS::ConfigurableAlg::calcTMassBW
unsigned int calcTMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:144
TCS::ConfigurableAlg::m_parameters
ParameterSpace m_parameters
Definition: ConfigurableAlg.h:140
TCS::ConfigurableAlg::calcDeltaPhiBW
unsigned int calcDeltaPhiBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition: ConfigurableAlg.cxx:120
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
ymax
double ymax
Definition: listroot.cxx:64
TCS::ConfigurableAlg::algoId
unsigned int algoId() const
Definition: ConfigurableAlg.h:53