13 #include <sys/types.h>
19 ThresholdConfig::ThresholdConfig() :
36 const vector<TriggerThreshold*>&
38 thrVecMap_t::const_iterator
res = m_thresholdVectors.find(
type);
39 if(
res == m_thresholdVectors.end()) {
41 throw std::runtime_error(
"Unknown triggertype in ThresholdConfig::getThresholdVector encountered" );
46 const std::vector<TrigConf::TriggerThreshold*>&
48 return getThresholdVector(
type);
57 if(
pos >= thrVec.size()) thrVec.resize(
pos+1, 0);
59 if(thrVec[
pos] != 0) {
60 cerr <<
"ThresholdConfig::insertInPosition: position " <<
pos
61 <<
" already filled for type " << thr->
type() <<
" [" << thr->
ttype() <<
"]" <<
", abort!!" << endl;
62 cerr << endl <<
"Existing threshold" << endl;
63 thrVec[
pos]->print(
"",5);
64 cerr << endl <<
"New threshold" << endl;
66 throw runtime_error(
"ThresholdConfig::insertInPosition position already filled" );
78 m_TriggerThresholdVector.push_back(thr);
83 const auto&
res = m_thresholdVectors.find(ttype);
84 if(
res == m_thresholdVectors.end()) {
85 cerr <<
"Unknown triggertype '" <<
L1DataDef::typeAsString(ttype) <<
"' in ThresholdConfig::getThresholdVector encountered" << endl;
86 throw runtime_error(
"Unknown triggertype in ThresholdConfig::getThresholdVector encountered" );
88 vector<TriggerThreshold*>& thrVec =
res->second;
93 cerr <<
"ThresholdConfig::addTriggerThreshold: threshold mapping " << thr->
mapping()
94 <<
" exceeds maximum for type '" << thr->
type() <<
"' , abort!" << endl;
95 throw runtime_error(
"ThresholdConfig::addTriggerThreshold: threshold mapping exceeds limit" );
99 insertInPosition(thrVec, thr, thr->
mapping() );
114 insertInPosition( m_ClusterThresholdVector, thr, thr->
mapping() );
118 unsigned int max_tau = 0;
119 unsigned int pos = max_em + max_tau - thr->
mapping() - 1;
120 insertInPosition( m_ClusterThresholdVector, thr,
pos );
131 return thr?thr->
type():
"EM";
140 (getThresholdVector(
L1DataDef::EM)[thresholdnumber]->triggerThresholdValue(eta,phi));
146 (getThresholdVector(
L1DataDef::EM)[thresholdnumber]->triggerThresholdValue(eta,phi));
152 (getThresholdVector(
L1DataDef::EM)[thresholdnumber]->triggerThresholdValue(eta,phi));
161 return getThresholdVector(
type)[thresholdnumber]->triggerThresholdValue(eta,phi)->window();
182 return getThresholdVector(
type)[thresholdnumber]->triggerThresholdValue(eta,phi)->ptcut();
249 if (
p->mapping()>=8 )
250 p->setThresholdNumber(max_em - 1 - (
p->mapping()-8) );
256 p->setThresholdNumber(
p->mapping() + 8);
266 if(thr->id()==
id)
return thr;
273 cout <<
indent <<
"=========================================" << endl
274 <<
indent <<
" The " <<
name <<
": " <<
vec.size() <<
" elements" << endl
275 <<
indent <<
"=========================================" << endl;
278 else cout <<
indent <<
" " << 0 << endl;
284 cout <<
indent <<
"Threshold configuration: " << getThresholdVector().size() <<
" thresholds" << endl;
287 << getThresholdVector(
tt).size() <<
" thresholds" << endl;
289 cout <<
"Threshold configuration: " << getThresholdVector().size() <<
" thresholds" << endl;
292 cout <<
indent <<
"=========================================" << endl
293 <<
indent <<
"== ThresholdConfig for MT_id = " << lvl1MasterTableId() << endl
294 <<
indent <<
"=========================================" << endl;
319 cout <<
"#=========================================" << endl
320 <<
"# " <<
name <<
":" << endl
321 <<
"#=========================================" << endl;
327 printTtvSummary(getThresholdVector(
L1DataDef::EM),
"EM threshold values");
328 printTtvSummary(getThresholdVector(
L1DataDef::TAU),
"Tau threshold values");
329 printTtvSummary(m_ClusterThresholdVector,
"Cluster threshold values (EM + Tau)");
330 printTtvSummary(getThresholdVector(
L1DataDef::JET),
"JetThreshold values");
331 printTtvSummary(getThresholdVector(
L1DataDef::FJET),
"FJetThreshold values");
332 printTtvSummary(getThresholdVector(
L1DataDef::TE),
"TotEt values");
333 printTtvSummary(getThresholdVector(
L1DataDef::JE),
"JetEt values");
334 printTtvSummary(getThresholdVector(
L1DataDef::XE),
"MissEt values");
335 printTtvSummary(getThresholdVector(
L1DataDef::MUON),
"MuonThreshold values");
336 printTtvSummary(getThresholdVector(
L1DataDef::NIM),
"NimThreshold values");
343 cout <<
"#---------------------------------------------------------" << endl
344 <<
"# TTV(type,name) eta phi : pt window emIsol hadIsol hadVeto" << endl
346 <<
"#---------------------------------------------------------" << endl;
347 for (
int ieta = -49; ieta <= 49; ++ieta) {
348 for (
int iphi = 0; iphi < 64; ++iphi) {
350 float emiso(-1), hadiso(-1), hadveto(-1);
357 sprintf(
line,
"TTV(%-4s,%-10s) eta[%2d] phi[%2d]: %3f %6u %6f %6f %6f",
358 thr->
type().c_str(), thr->
name().c_str(), ieta, iphi,
359 ttv->
ptcut(), ttv->
window(), emiso, hadiso, hadveto);
360 cout <<
line << endl;
366 vector<TrigConf::TriggerThreshold*>
368 vector<TriggerThreshold*>
v;
370 if ( thr->type() ==
type )
v.push_back(thr);
378 m_TriggerThresholdVector.clear();
380 for(thrVecMap_t::value_type &
p: m_thresholdVectors)