ATLAS Offline Software
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 
17 #include "L1TopoCommon/Exception.h"
18 #include "L1TopoInterfaces/Count.h"
19 #include "L1TopoEvent/TOBArray.h"
24 #include <cmath>
25 
26 
27 REGISTER_ALG_TCS(EnergyThreshold)
28 
29 using 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 
41  m_threshold = getThreshold();
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 
50  return StatusCode::SUCCESS;
51 
52 }
53 
55  Count & count){
56  return process(input, count);
57 }
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 }
TCS::gTETOBArray
Definition: gTETOBArray.h:14
TrigConf::L1Threshold_gTE
Definition: L1Threshold.h:380
TrigConf::L1Threshold_jTE
Definition: L1Threshold.h:350
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
jXETOBArray.h
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
TCS::DataArrayImpl< jXETOB >::const_iterator
data_t::const_iterator const_iterator
Definition: DataArrayImpl.h:18
TCS::gXETOBArray
Definition: gXETOBArray.h:14
TrigConf::L1Threshold_gXE
Definition: L1Threshold.h:365
TrigConf::L1Threshold_jXE
Definition: L1Threshold.h:335
TCS::EnergyThreshold::process
virtual StatusCode process(const TCS::InputTOBArray &input, Count &count) override final
Definition: EnergyThreshold.cxx:60
gXETOBArray.h
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
TCS::DataArrayImpl::end
iterator end()
Definition: DataArrayImpl.h:43
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
TCS::CountingAlg::setNumberOutputBits
void setNumberOutputBits(unsigned int numberOutputBits)
Definition: CountingAlg.h:41
TCS::EnergyThreshold::EnergyThreshold
EnergyThreshold(const std::string &name)
Definition: EnergyThreshold.cxx:31
TCS::jTETOBArray
Definition: jTETOBArray.h:14
gTETOBArray.h
Count.h
TCS::InputTOBArray
Definition: InputTOBArray.h:15
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TCS::jXETOBArray
Definition: L1Topo/L1TopoEvent/L1TopoEvent/jXETOBArray.h:14
TCS::EnergyThreshold::processBitCorrect
virtual StatusCode processBitCorrect(const TCS::InputTOBArray &input, Count &count) override final
Definition: EnergyThreshold.cxx:54
TOBArray.h
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition: AlgFactory.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TCS::DataArrayImpl::begin
iterator begin()
Definition: DataArrayImpl.h:40
TCS::Count
Definition: L1Topo/L1TopoInterfaces/L1TopoInterfaces/Count.h:20
EnergyThreshold.h
TCS::EnergyThreshold::initialize
virtual StatusCode initialize() override
Definition: EnergyThreshold.cxx:38
getThreshold
CP::CorrectionCode getThreshold(Int_t &threshold, const std::string &trigger)
Definition: MuonTriggerSFRootCoreTest.cxx:48
jTETOBArray.h
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
Exception.h
TCS::CountingAlg
Definition: CountingAlg.h:25
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15