ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerThreshold.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
15
16#include <stdexcept>
17#include <iostream>
18#include <algorithm>
19
20using namespace std;
21
25
49
53
54
55void
60
61void
66
67
68void
70 if(input!="ctpin" && input!="ctpcore")
71 throw runtime_error( "Threshold input must be either 'ctpin' or 'ctpcore' but value was '"+input+"'" );
72 m_Input = input;
73}
74
75
76bool
80
83
85
86 float eta = float(eta_i)+0.5;
87 float phi = float(phi_i)+0.5;
88
90
91 if( thrV->contains(eta, phi) ) {
92
93 if( ttv != 0 && ttv->priority()==thrV->priority() ) {
94 cerr << "TriggerThreshold '" << name() << "' has overlapping values of same priority at eta = "
95 << eta << ", phi = " << phi << endl;
96 throw runtime_error( "Overlapping thresholdValues of the same priority" );
97 }
98 if( ttv==0 || ttv->priority()<thrV->priority() ) {
99 ttv = thrV;
100 }
101 }
102 }
103 if(ttv==0) {
104 cerr << "TriggerThreshold::triggerThresholdValue: did not find threshold value at eta = "
105 << eta << ", phi = " << phi << " for threshold " << name() << endl;
106 throw runtime_error( "Did not find threshold value" );
107 }
108 return ttv;
109}
110
111
112const
113std::vector<TrigConf::TriggerThresholdValue*>&
117
118void
122
123
130
131
134 TriggerThresholdValue* ttv = 0;
136 ttv = new MuonThresholdValue();
139 ttv = new ClusterThresholdValue();
143 ttv = new JetThresholdValue();
147 ttv = new EtThresholdValue();
149 ttv = new XsThresholdValue();
160 ttv = new NimThresholdValue();
161 } else {
162 cout << "TriggerThreshold::createThresholdValue: ERROR Unknown trigger value type: " << type << endl;
163 throw std::runtime_error("TriggerThreshold::createThresholdValue: Unknown trigger value type.");
164 }
165 return ttv;
166}
167
168
174
175void TrigConf::TriggerThreshold::print(const std::string& indent, unsigned int detail) const {
176 if(detail==2) {
177 cout << indent << "TriggerThreshold " << name() << endl;
178 }
179 if(detail>=3) {
180 if(detail>=4)
181 cout << indent << "==================================" << endl;
182 cout << indent << "TriggerThreshold "; printNameIdV(indent);
183 if(detail>=4) {
184 cout << indent << " Type: " << type() << endl;
185 if(ttype()==L1DataDef::ZB) {
186 cout << indent << " seed: " << m_ZBSeedingThresholdName << endl;
187 cout << indent << " seed multi: " << m_ZBSeedingThresholdMulti << endl;
188 cout << indent << " BC delay: " << m_BCDelay << endl;
189 }
190 cout << indent << " active: " << m_Active << endl;
191 cout << indent << " mapping " << m_Mapping << endl;
192 cout << indent << " number of values: " << numberofValues() << endl;
193 cout << indent << " cable name: " << m_CableName << endl;
194 cout << indent << " cable ctpin: " << m_CableCtpin << endl;
195 cout << indent << " cable connector: " << m_CableConnector << endl;
196 cout << indent << " cable start: " << m_CableStart << endl;
197 cout << indent << " cable end: " << m_CableEnd << endl;
198 cout << indent << " threshold number: " << m_ThresholdNumber << endl;
199 for(unsigned int i=0; i < m_TriggerThresholdValueVector.size();i++)
201 }
202 }
203}
204
205
206namespace {
207
208 bool compThrValues(TrigConf::TriggerThresholdValue *x, TrigConf::TriggerThresholdValue *y) { // strict weak ordering: x and y are equivalent if compMon(x,y) and compMon(y,x) are false
209 if(x->priority() != y->priority())
210 return x->priority() < y->priority();
211 if(x->etamin() != y->etamin())
212 return x->etamin() < y->etamin();
213 return x->name() < y->name();
214 }
215
216}
217
218
219void
220TrigConf::TriggerThreshold::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) const {
221 indent(xmlfile, indentLevel, indentWidth)
222 << "<TriggerThreshold active=\"" << m_Active
223 << "\" bitnum=\"" << bitnum()
224 << "\" id=\"" << id()
225 << "\" mapping=\"" << m_Mapping
226 << "\" name=\"" << name()
227 << "\" type=\"" << type()
228 << "\" input=\"" << input();
229
230 if(ttype()==L1DataDef::ZB)
231 xmlfile << "\" seed=\"" << m_ZBSeedingThresholdName
232 << "\" seed_multi=\"" << m_ZBSeedingThresholdMulti
233 << "\" bcdelay=\"" << m_BCDelay;
234
235 xmlfile << "\" version=\"" << version() <<"\">" << endl;
236
237 auto sortedThresholdValues = m_TriggerThresholdValueVector;
238 sort(sortedThresholdValues.begin(),sortedThresholdValues.end(),compThrValues);
239
240 for(TriggerThresholdValue* thrV : sortedThresholdValues)
241 thrV->writeXML(xmlfile, indentLevel+1, indentWidth);
242
243 if(m_CableName!="") {
244 if(input()=="ctpin") {
245 indent(xmlfile, indentLevel+1, indentWidth)
246 << "<Cable connector=\"" << m_CableConnector << "\" input=\"" << m_CableCtpin << "\" name=\"" << m_CableName << "\">" << endl;
247 indent(xmlfile, indentLevel+2, indentWidth)
248 << "<Signal range_begin=\"" << m_CableStart << "\" range_end=\"" << m_CableEnd <<"\"/>" << endl;
249 } else {
250 indent(xmlfile, indentLevel+1, indentWidth)
251 << "<Cable connector=\"" << m_CableConnector << "\" input=\"" << m_CableCtpin << "\" name=\"" << m_CableName << "\">" << endl;
252 indent(xmlfile, indentLevel+2, indentWidth)
253 << "<Signal range_begin=\"" << m_CableStart << "\" range_end=\"" << m_CableEnd <<"\" clock=\"" << m_Clock << "\"/>" << endl;
254 }
255 indent(xmlfile, indentLevel+1, indentWidth) << "</Cable>" << endl;
256 }
257
258 indent(xmlfile, indentLevel, indentWidth)
259 << "</TriggerThreshold>" << endl;
260}
261
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void print(char *figname, TCanvas *c1)
#define y
#define x
static TriggerType stringAsType(const std::string &type)
Definition L1DataDef.h:51
static TriggerTypeConfig & typeConfig(TriggerType tt)
static std::string & typeAsString(TriggerType tt)
Definition L1DataDef.h:53
unsigned int id() const
std::ostream & indent(std::ostream &o, int lvl, int size) const
void printNameIdV(const std::string &indent="") const
unsigned int version() const
void setType(L1DataDef::TriggerType type)
void addThresholdValue(TriggerThresholdValue *value)
static TriggerThresholdValue * createThresholdValue(const std::string &type)
virtual ~TriggerThreshold() override
const std::string & type() const
void setInput(const std::string &input)
virtual void print(const std::string &indent="", unsigned int detail=1) const override
TriggerThresholdValue * triggerThresholdValue(int eta, int phi) const
unsigned int bitnum() const
std::vector< TriggerThresholdValue * > m_TriggerThresholdValueVector
const std::vector< TriggerThresholdValue * > & thresholdValueVector() const
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
L1DataDef::TriggerType m_type
L1DataDef::TriggerType ttype() const
const std::string & input() const
static std::vector< std::string > xmlfile
Definition iLumiCalc.h:29
STL namespace.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.