ATLAS Offline Software
Loading...
Searching...
No Matches
EnergyThreshold.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4/*********************************
5 * EnergyThreshold.cpp
6 * Created by Jack Harrison on 16/12/21.
7 *
8 * @brief algorithm that computes the multiplicity for a specified list and ET threshold
9 * line 1: 0 or 1, line 1 and 2 : 2 or more, uses 2 bits
10 *
11 * @param NumberLeading MinET
12
13**********************************/
14
15
24#include <cmath>
25
26
27REGISTER_ALG_TCS(EnergyThreshold)
28
29using namespace std;
30
32
33 setNumberOutputBits(12); //To-Do: Make this flexible to adapt to the menu. Each counting requires more than one bit
34
35}
36
37
39
40
42
43 // book histograms
44 std::string hname_accept = "EnergyThreshold_accept_EtaPt_"+m_threshold->name();
45 bookHistMult(m_histAccept, hname_accept, "Mult_"+ m_threshold->name(), "E_{t} [GeV]", 200, 0, 1000);
46
47 hname_accept = "EnergyThreshold_accept_counts_"+m_threshold->name();
48 bookHistMult(m_histAccept, hname_accept, "Mult_"+m_threshold->name(), "counts", 15, 0, 15);
49
51
52}
53
58
59
61 Count & count )
62{
63
64
65 if (m_threshold->type() == "jXE") {
66
67 // Grab the threshold and cast it into the right type
68 const auto& jXEThr = dynamic_cast<const TrigConf::L1Threshold_jXE &>(*m_threshold);
69 // Grab inputs
70 const jXETOBArray & jXEArray = dynamic_cast<const jXETOBArray&>(input);
71
72 int counting = 0;
73
74 // Loop over input TOBs
75 for(jXETOBArray::const_iterator jxe = jXEArray.begin();
76 jxe != jXEArray.end();
77 ++jxe ) {
78
79 bool passed = (*jxe)->Et2() > std::pow(jXEThr.thrValue100MeV(), 2);
80 if (passed) {
81 counting++;
82 fillHist1D(m_histAccept[0], ((*jxe)->EtDouble()));
83 }
84 }
85
86 fillHist1D( m_histAccept[1], counting);
87
88 // Pass counting to TCS::Count object - output bits are composed there
89 count.setSizeCount(counting);
90
91 }
92
93 else if (m_threshold->type() == "jTE") {
94
95 // Grab the threshold and cast it into the right type
96 const auto& jTEThr = dynamic_cast<const TrigConf::L1Threshold_jTE &>(*m_threshold);
97 // Grab inputs
98 const jTETOBArray & jTEArray = dynamic_cast<const jTETOBArray&>(input);
99
100 int counting = 0;
101
102 // Loop over input TOBs
103 for(jTETOBArray::const_iterator jte = jTEArray.begin();
104 jte != jTEArray.end();
105 ++jte ) {
106
107 bool passed = (*jte)->sumEt() > jTEThr.thrValue100MeV();
108 if (passed) {
109 counting++;
110 fillHist1D(m_histAccept[0], ((*jte)->sumEtDouble()));
111 }
112 }
113
114 fillHist1D( m_histAccept[1], counting);
115
116 // Pass counting to TCS::Count object - output bits are composed there
117 count.setSizeCount(counting);
118
119 }
120
121 else if (m_threshold->type() == "gXE") {
122
123 // Grab the threshold and cast it into the right type
124 const auto& gXEThr = dynamic_cast<const TrigConf::L1Threshold_gXE &>(*m_threshold);
125 // Grab inputs
126 const gXETOBArray & gXEArray = dynamic_cast<const gXETOBArray&>(input);
127
128 int counting = 0;
129
130 // Loop over input TOBs
131 for(gXETOBArray::const_iterator gxe = gXEArray.begin();
132 gxe != gXEArray.end();
133 ++gxe ) {
134
135 bool passed = (*gxe)->Et2() > std::pow(gXEThr.thrValue100MeV(), 2);
136 if (passed) {
137 counting++;
138 fillHist1D(m_histAccept[0], ((*gxe)->EtDouble()));
139 }
140 }
141
142 fillHist1D( m_histAccept[1], counting);
143
144 // Pass counting to TCS::Count object - output bits are composed there
145 count.setSizeCount(counting);
146
147 }
148
149 else if (m_threshold->type() == "gTE") {
150
151 // Grab the threshold and cast it into the right type
152 const auto& gTEThr = dynamic_cast<const TrigConf::L1Threshold_gTE &>(*m_threshold);
153 // Grab inputs
154 const gTETOBArray & gTEArray = dynamic_cast<const gTETOBArray&>(input);
155
156 int counting = 0;
157
158 // Loop over input TOBs
159 for(gTETOBArray::const_iterator gte = gTEArray.begin();
160 gte != gTEArray.end();
161 ++gte ) {
162
163 bool passed = (*gte)->sumEt() > gTEThr.thrValue100MeV();
164 if (passed) {
165 counting++;
166 fillHist1D(m_histAccept[0], ((*gte)->sumEtDouble()));
167 }
168 }
169
170 fillHist1D( m_histAccept[1], counting);
171
172 // Pass counting to TCS::Count object - output bits are composed there
173 count.setSizeCount(counting);
174
175 }
176
177 else { std::cout << "WARNING: threshold type " << m_threshold->type() << " not included in EnergyThreshold algorithm. Skipping." << std::endl; }
178
180}
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
CP::CorrectionCode getThreshold(Int_t &threshold, const std::string &trigger)
const std::string & name() const
void fillHist1D(const std::string &histName, double x)
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)
std::vector< std::string > m_histAccept
Definition CountingAlg.h:51
CountingAlg(const std::string &name)
Definition CountingAlg.h:28
void setNumberOutputBits(unsigned int numberOutputBits)
Definition CountingAlg.h:41
data_t::const_iterator const_iterator
virtual StatusCode process(const TCS::InputTOBArray &input, Count &count) override final
virtual StatusCode processBitCorrect(const TCS::InputTOBArray &input, Count &count) override final
TrigConf::L1Threshold const * m_threshold
virtual StatusCode initialize() override
EnergyThreshold(const std::string &name)
const std::string process
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
STL namespace.