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 21 of file HLTChainList.cxx.

22{}

◆ HLTChainList() [2/2]

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

constructor with configuration data

Parameters
chainListlist of all HLT chains

Definition at line 25 of file HLTChainList.cxx.

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

◆ ~HLTChainList()

TrigConf::HLTChainList::~HLTChainList ( )

default destructor

Definition at line 30 of file HLTChainList.cxx.

30 {
31 clear();
32}

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 42 of file HLTChainList.cxx.

42 {
43 pair<iterator, bool> ins = insert(chain);
44 if(!ins.second)
45 throw runtime_error("Can't insert chain '" + chain->name() + "', because a uniqueness constraint is violated");
46 return ins.second;
47}
HLTChain * chain(const std::string &chainname) const
access the chain by name returns null-pointer if chain not found

◆ applyPrescaleSet()

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

set prescales of all chains

Definition at line 70 of file HLTChainList.cxx.

70 {
71 for(HLTChain *ch: *this) {
72 if(ch->level_enum() == HLTLevel::HLT ) {
73 // merged menu
74 if (pss->hasPrescale( ch->chain_counter(), HLTLevel::HLT ) ) {
75 // merged prescales (Run 2)
76 const HLTPrescale& sc = pss->getPrescale( ch->chain_counter(), HLTLevel::HLT );
77 ch->set_prescales( sc );
78 } else {
79 // prescale set has not been merged yet (LS 1)
80 if(ch->mergeCounter.l2==0 && ch->mergeCounter.ef==0) {
81 throw runtime_error("Merged HLT chain has no info about L2 or EF counter");
82 } else if(ch->mergeCounter.l2==0) {
83 const HLTPrescale& efps = pss->getPrescale( ch->mergeCounter.ef, HLTLevel::EF );
84 ch->set_prescales( efps );
85 } else if(ch->mergeCounter.ef==0) {
86 const HLTPrescale& l2ps = pss->getPrescale( ch->mergeCounter.ef, HLTLevel::L2 );
87 ch->set_prescales( l2ps );
88 } else {
89 const HLTPrescale& l2ps = pss->getPrescale( ch->mergeCounter.l2, HLTLevel::L2 );
90 const HLTPrescale& efps = pss->getPrescale( ch->mergeCounter.ef, HLTLevel::EF );
91 HLTTEUtils::mergeL2EFPrescales( ch, l2ps, efps);
92 }
93 }
94 } else {
95 // menu not merged
96 const HLTPrescale& sc = pss->getPrescale( ch->chain_counter(), str2lvl(ch->level()) );
97 ch->set_prescales( sc );
98 }
99 }
100}
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 52 of file HLTChainList.cxx.

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

◆ 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 61 of file HLTChainList.cxx.

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

◆ clear()

void TrigConf::HLTChainList::clear ( )

Definition at line 34 of file HLTChainList.cxx.

34 {
35 for(HLTChain* ch : *this) {
36 delete ch;
37 }
38 HLTChainContainer::clear();
39}

◆ compareTo()

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

Definition at line 154 of file HLTChainList.cxx.

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

◆ extractPrescaleSet()

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

extract prescales from all chains

Definition at line 104 of file HLTChainList.cxx.

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

◆ 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 177 of file HLTChainList.cxx.

177 {
178 if(detail>=1) {
179 cout << indent << "HLTChainList has " << size() << " chains" << endl;
180 if(detail>=2) {
181 for(HLTChain* ch : *this)
182 ch->print(indent + " ", detail);
183 cout << indent << "- ---------------------------------------------------------- " << endl;
184 }
185 }
186}

◆ setEFLowerChainCounter()

void TrigConf::HLTChainList::setEFLowerChainCounter ( )

Definition at line 141 of file HLTChainList.cxx.

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

◆ setL2LowerChainCounter()

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

Definition at line 115 of file HLTChainList.cxx.

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

◆ operator<<

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

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