ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::HLTChainList Class Reference

list of all HLT chains in a trigger menu More...

#include <HLTChainList.h>

Inheritance diagram for TrigConf::HLTChainList:
Collaboration diagram for TrigConf::HLTChainList:

Public Member Functions

 HLTChainList ()
 default constructor
 HLTChainList (const std::vector< HLTChain * > &chainList)
 constructor with configuration data
 ~HLTChainList ()
 default destructor
bool addHLTChain (HLTChain *ch)
 adds an HLTChain to the menu
HLTChainchain (const std::string &chainname) const
 access the chain by name returns null-pointer if chain not found
HLTChainchain (unsigned int counter, HLTLevel level) const
 access the chain by level and counter
void print (const std::string &indent="", unsigned int detail=1) const
 accessors to list of chains, for backward compatibility, use HLTChainList directly
DiffStructcompareTo (const HLTChainList *o) const
void applyPrescaleSet (const HLTPrescaleSet *pss)
 set prescales of all chains
HLTPrescaleSetextractPrescaleSet () const
 extract prescales from all chains
void setL2LowerChainCounter (const CTPConfig *ctpcfg)
void setEFLowerChainCounter ()
void clear ()

Friends

std::ostream & operator<< (std::ostream &o, const TrigConf::HLTChainList &c)

Detailed Description

list of all HLT chains in a trigger menu

Definition at line 56 of file HLTChainList.h.

Constructor & Destructor Documentation

◆ HLTChainList() [1/2]

TrigConf::HLTChainList::HLTChainList ( )

default constructor

Definition at line 24 of file HLTChainList.cxx.

25{}

◆ HLTChainList() [2/2]

TrigConf::HLTChainList::HLTChainList ( const std::vector< HLTChain * > & chainList)

constructor with configuration data

Parameters
chainListlist of all HLT chains

Definition at line 28 of file HLTChainList.cxx.

28 {
29 copy(chainList.begin(), chainList.end(), std::inserter(*this, begin()));
30}
bool copy
Definition calibdata.py:26

◆ ~HLTChainList()

TrigConf::HLTChainList::~HLTChainList ( )

default destructor

Definition at line 33 of file HLTChainList.cxx.

33 {
34 clear();
35}

Member Function Documentation

◆ addHLTChain()

bool TrigConf::HLTChainList::addHLTChain ( TrigConf::HLTChain * chain)

adds an HLTChain to the menu

Parameters
chchain to be added

Definition at line 45 of file HLTChainList.cxx.

45 {
46 pair<iterator, bool> ins = insert(chain);
47 if(!ins.second)
48 throw runtime_error("Can't insert chain '" + chain->name() + "', because a uniqueness constraint is violated");
49 return ins.second;
50}
HLTChain * chain(const std::string &chainname) const
access the chain by name returns null-pointer if chain not found
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.

◆ applyPrescaleSet()

void TrigConf::HLTChainList::applyPrescaleSet ( const HLTPrescaleSet * pss)

set prescales of all chains

Definition at line 73 of file HLTChainList.cxx.

73 {
74 for(HLTChain *ch: *this) {
75 if(ch->level_enum() == HLTLevel::HLT ) {
76 // merged menu
77 if (pss->hasPrescale( ch->chain_counter(), HLTLevel::HLT ) ) {
78 // merged prescales (Run 2)
79 const HLTPrescale& sc = pss->getPrescale( ch->chain_counter(), HLTLevel::HLT );
80 ch->set_prescales( sc );
81 } else {
82 // prescale set has not been merged yet (LS 1)
83 if(ch->mergeCounter.l2==0 && ch->mergeCounter.ef==0) {
84 throw runtime_error("Merged HLT chain has no info about L2 or EF counter");
85 } else if(ch->mergeCounter.l2==0) {
86 const HLTPrescale& efps = pss->getPrescale( ch->mergeCounter.ef, HLTLevel::EF );
87 ch->set_prescales( efps );
88 } else if(ch->mergeCounter.ef==0) {
89 const HLTPrescale& l2ps = pss->getPrescale( ch->mergeCounter.ef, HLTLevel::L2 );
90 ch->set_prescales( l2ps );
91 } else {
92 const HLTPrescale& l2ps = pss->getPrescale( ch->mergeCounter.l2, HLTLevel::L2 );
93 const HLTPrescale& efps = pss->getPrescale( ch->mergeCounter.ef, HLTLevel::EF );
94 HLTTEUtils::mergeL2EFPrescales( ch, l2ps, efps);
95 }
96 }
97 } else {
98 // menu not merged
99 const HLTPrescale& sc = pss->getPrescale( ch->chain_counter(), str2lvl(ch->level()) );
100 ch->set_prescales( sc );
101 }
102 }
103}
static Double_t sc
static void mergeL2EFPrescales(TrigConf::HLTChain *hltchain, const TrigConf::HLTPrescale &l2ps, const TrigConf::HLTPrescale &efps)
HLTLevel str2lvl(const std::string &level)
Definition HLTLevel.h:14

◆ chain() [1/2]

TrigConf::HLTChain * TrigConf::HLTChainList::chain ( const std::string & chainname) const

access the chain by name returns null-pointer if chain not found

Definition at line 55 of file HLTChainList.cxx.

55 {
56 const index<name_hash>::type& byname = get<name_hash>();
57 index<name_hash>::type::const_iterator ch = byname.find(name);
58 if(ch == byname.end()) return 0;
59 return *ch;
60}
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132

◆ chain() [2/2]

TrigConf::HLTChain * TrigConf::HLTChainList::chain ( unsigned int counter,
HLTLevel level ) const

access the chain by level and counter

returns null-pointer if chain not found

Definition at line 64 of file HLTChainList.cxx.

64 {
65 const index<counter>::type& bycounter = get<counter>();
66 index<counter>::type::const_iterator ch = bycounter.find(boost::make_tuple(chaincounter,level));
67 if(ch == bycounter.end()) return 0;
68 return *ch;
69}

◆ clear()

void TrigConf::HLTChainList::clear ( )

Definition at line 37 of file HLTChainList.cxx.

37 {
38 for(HLTChain* ch : *this) {
39 delete ch;
40 }
41 HLTChainContainer::clear();
42}

◆ compareTo()

TrigConf::DiffStruct * TrigConf::HLTChainList::compareTo ( const HLTChainList * o) const

Definition at line 157 of file HLTChainList.cxx.

157 {
158 DiffStruct * ds = new DiffStruct("CHAIN_LIST");
159 for(HLTChain* ch : *this) {
160 HLTChain *o_ch = o->chain(ch->name());
161 if(o_ch) {
162 ds->addSub( ch->compareTo(o_ch) );
163 } else {
164 ds->addLeftOnlySub( "CHAIN", ch->name() );
165 }
166 }
167 for(HLTChain* o_ch : *o) {
168 const HLTChain *ch = chain(o_ch->name());
169 if(!ch)
170 ds->addRightOnlySub( "CHAIN", o_ch->name() );
171 }
172 if(ds->empty()) {
173 delete ds; ds=0;
174 }
175 return ds;
176}

◆ extractPrescaleSet()

TrigConf::HLTPrescaleSet * TrigConf::HLTChainList::extractPrescaleSet ( ) const

extract prescales from all chains

Definition at line 107 of file HLTChainList.cxx.

107 {
108 HLTPrescaleSet* pss = new HLTPrescaleSet();
109 for(HLTChain *ch : *this)
110 pss->setPrescale(ch->prescales(), ch->chain_counter(), ch->level_enum());
111 return pss;
112}

◆ print()

void TrigConf::HLTChainList::print ( const std::string & indent = "",
unsigned int detail = 1 ) const

accessors to list of chains, for backward compatibility, use HLTChainList directly

print the chain list

Definition at line 180 of file HLTChainList.cxx.

180 {
181 if(detail>=1) {
182 cout << indent << "HLTChainList has " << size() << " chains" << endl;
183 if(detail>=2) {
184 for(HLTChain* ch : *this)
185 ch->print(indent + " ", detail);
186 cout << indent << "- ---------------------------------------------------------- " << endl;
187 }
188 }
189}
size_t size() const
Number of registered mappings.

◆ setEFLowerChainCounter()

void TrigConf::HLTChainList::setEFLowerChainCounter ( )

Definition at line 144 of file HLTChainList.cxx.

144 {
145 for(HLTChain *ch : *this) {
146 if(ch->level()!="EF" || ch->lower_chain_name()=="") continue;
147 HLTChain * l2ch = chain(ch->lower_chain_name());
148 if(l2ch==0) {
149 cerr << "ERROR: Did not find lower chain name '" << ch->lower_chain_name() << "' for chain '" << ch->chain_name() << "'" << endl;
150 continue;
151 }
152 ch->set_lower_chain_counter( l2ch->chain_counter() );
153 }
154}

◆ setL2LowerChainCounter()

void TrigConf::HLTChainList::setL2LowerChainCounter ( const CTPConfig * ctpcfg)

Definition at line 118 of file HLTChainList.cxx.

118 {
119 if(ctpcfg==0)
120 throw runtime_error("setL2LowerChainCounter: no CTPConfig object available");
121
122 const TrigConf::Menu& menu = ctpcfg->menu();
123
124 std::map<std::string,int> ctpFromName;
125 for(const TriggerItem* item : menu.itemVector())
126 ctpFromName[item->name()] = item->ctpId();
127
128 for(HLTChain* ch : *this) {
129 if(ch->level() == "EF") continue;
130 std::string low_chain_names = ch->lower_chain_name();
131 std::erase(low_chain_names,' ');
132 vector<string> low_chain_names_V = tokenize(low_chain_names,",");
133 std::vector<int> lccs;
134 for(const std::string& lowerChainName : low_chain_names_V)
135 lccs.push_back(ctpFromName[lowerChainName]);
136 ch->set_lower_chain_counter(low_chain_names_V.size()==1 ? lccs[0] : -1);
137 ch->set_lower_chain_counters(lccs);
138 }
139}
std::vector< std::string > tokenize(std::string_view the_str, std::string_view delimiters)
Splits the string into smaller substrings.

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const TrigConf::HLTChainList & c )
friend

The documentation for this class was generated from the following files: