ATLAS Offline Software
Loading...
Searching...
No Matches
Run2toRun3ConvertersHLT.cxx File Reference

Go to the source code of this file.

Macros

#define BOOST_BIND_GLOBAL_PLACEHOLDERS

Functions

template<typename COLL>
boost::property_tree::ptree asArray (const COLL &data)
std::vector< int > legMult (const TrigConf::HLTChain *cptr)
std::vector< std::string > l1thresholds (const TrigConf::HLTFrame *frame, const TrigConf::HLTChain *cptr)
void printJSON (boost::property_tree::ptree &p)
bool convertHLTMenu (const TrigConf::HLTFrame *frame, TrigConf::HLTMenu &menu)
void convertRun2HLTMenuToRun3 (const TrigConf::HLTFrame *frame, const std::string &filename)
void convertRun2HLTPrescalesToRun3 (const TrigConf::HLTFrame *frame, const std::string &filename)

Macro Definition Documentation

◆ BOOST_BIND_GLOBAL_PLACEHOLDERS

#define BOOST_BIND_GLOBAL_PLACEHOLDERS

Definition at line 9 of file Run2toRun3ConvertersHLT.cxx.

Function Documentation

◆ asArray()

template<typename COLL>
boost::property_tree::ptree asArray ( const COLL & data)

Definition at line 22 of file Run2toRun3ConvertersHLT.cxx.

22 {
23 using ptree = boost::property_tree::ptree;
24 ptree array;
25 for ( const auto& el: data ) {
26 ptree one;
27 one.put("", el);
28 array.push_back(std::make_pair("", one));
29 }
30 return array;
31}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
boost::property_tree::ptree ptree

◆ convertHLTMenu()

bool convertHLTMenu ( const TrigConf::HLTFrame * frame,
TrigConf::HLTMenu & menu )

Definition at line 59 of file Run2toRun3ConvertersHLT.cxx.

59 {
60 using ptree = boost::property_tree::ptree;
61 ptree top;
62 top.put("filetype", "hltmenu");
63 top.put("name", frame->name());
64 ptree pChains;
65
66 std::map<std::string, const TrigConf::HLTStreamTag*> allStreams;
67
68 for ( auto cptr : frame->getHLTChainList() ) {
69 ptree pChain;
70 pChain.put("counter", cptr->chain_counter());
71 pChain.put("nameHash", cptr->chain_hash_id());
72 pChain.put("l1item", cptr->lower_chain_name());
73 pChain.add_child("l1thresholds", asArray(l1thresholds(frame, cptr)));
74 pChain.add_child("legMultiplicities", asArray(legMult(cptr)) );
75 pChain.add_child("sequencers", asArray(std::vector<std::string>({"missing"})));
76
77 std::vector<std::string> strNames;
78 for ( const auto st: cptr->streams()) {
79 strNames.push_back(st->stream());
80 allStreams[st->stream()] = st;
81 }
82 pChain.add_child("streams", asArray(strNames));
83
84 pChain.add_child("groups", asArray(cptr->groups()));
85
86 // Signature data
87 // Note: This is run-2 only.
88 // It is propagated here to allow legacy trigger feature access.
89 std::vector<uint32_t> counters;
90 std::vector<int> logics;
91 std::vector<std::string> labels;
92 ptree outputTEs_outerArray; // outputTEs is a std::vector<std::vector<std::string>>
93
94 for(auto& signature : cptr->signatureList() ){
95 uint32_t cntr = signature->signature_counter();
96 counters.push_back(cntr);
97 logics.push_back(signature->logic());
98 labels.push_back(signature->label());
99 ptree outputTEs_innerArray;
100 for(auto& outputTE : signature->outputTEs()){
101 outputTEs_innerArray.push_back( ptree::value_type("", outputTE->name()) );
102 }
103 outputTEs_outerArray.push_back( ptree::value_type("", outputTEs_innerArray) );
104 }
105
106 ptree pSig;
107 pSig.add_child("counters", asArray(counters));
108 pSig.add_child("logics", asArray(logics));
109 pSig.add_child("outputTEs", outputTEs_outerArray);
110 pSig.add_child("labels", asArray(labels));
111
112 pChain.add_child("signature", pSig);
113 // End of signature data
114
115 pChains.push_back(std::make_pair(cptr->chain_name(), pChain));
116 }
117 ptree pStreams;
118 for ( auto [sname, stream]: allStreams ) {
119 ptree pStream;
120 pStream.put("name", sname);
121 pStream.put("type", stream->type());
122 pStream.put("obeyLB", stream->obeyLB());
123 pStream.put("forceFullEventBuilding", true); // TODO understand how to get this information from old menu
124 pStreams.push_back(std::make_pair(sname, pStream));
125 }
126
127 top.add_child("chains", pChains);
128
129 top.add_child("streams", pStreams);
130 ptree pSequencers;
131 pSequencers.add_child("missing", asArray(std::vector<std::string>({""})));
132 top.add_child("sequencers", pSequencers);
133
134 // Set run2 sequence information:
135 const TrigConf::HLTSequenceList& sequenceList = frame->getHLTSequenceList();
136 std::vector<std::string> outputTEs;
137 ptree inputTEs_outerArray; // sequenceInputTEs is a std::vector<std::vector<std::string>>
138 ptree algorithms_outerArray; // sequenceAlgorithms is a std::vector<std::vector<std::string>>
139 for(auto& seq : sequenceList){
140 outputTEs.push_back(seq->outputTE()->name());
141
142 ptree inputTEs_innerArray;
143 for(auto& input : seq->inputTEs()) {
144 inputTEs_innerArray.push_back( ptree::value_type("", input->name()) );
145 }
146 inputTEs_outerArray.push_back( ptree::value_type("", inputTEs_innerArray) );
147
148 ptree algorithms_innerArray;
149 for(const std::string& alg : seq->algorithms()) {
150 algorithms_innerArray.push_back( ptree::value_type("", alg) );
151 }
152 algorithms_outerArray.push_back( ptree::value_type("", algorithms_innerArray) );
153 }
154 ptree pSequence;
155 pSequence.add_child("outputTEs", asArray(outputTEs));
156 pSequence.add_child("inputTEs", inputTEs_outerArray);
157 pSequence.add_child("algorithms", algorithms_outerArray);
158 top.add_child("sequence_run2", pSequence);
159
160 menu.setData(std::move(top));
161 menu.setSMK(frame->smk());
162 return true;
163}
std::vector< int > legMult(const TrigConf::HLTChain *cptr)
std::vector< std::string > l1thresholds(const TrigConf::HLTFrame *frame, const TrigConf::HLTChain *cptr)
boost::property_tree::ptree asArray(const COLL &data)
@ top
const HLTSequenceList & getHLTSequenceList() const
const accessor to the list of HLT sequences
Definition HLTFrame.h:50
const HLTChainList & getHLTChainList() const
const accessor to the list of HLT chains
Definition HLTFrame.h:49
list of HLT sequences
const std::string & name() const
unsigned int smk() const
make the sidebar many part of the config
Definition hcg.cxx:552
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
setEventNumber uint32_t

◆ convertRun2HLTMenuToRun3()

void convertRun2HLTMenuToRun3 ( const TrigConf::HLTFrame * frame,
const std::string & filename )

Definition at line 165 of file Run2toRun3ConvertersHLT.cxx.

165 {
167 convertHLTMenu(frame, menu);
168
170 writer.writeJsonFile(filename, menu);
171
172}
bool convertHLTMenu(const TrigConf::HLTFrame *frame, TrigConf::HLTMenu &menu)
HLT menu configuration.
Definition HLTMenu.h:21
Loader of trigger configurations from Json files.
writer
show summary of content
Definition example.py:36

◆ convertRun2HLTPrescalesToRun3()

void convertRun2HLTPrescalesToRun3 ( const TrigConf::HLTFrame * frame,
const std::string & filename )

Definition at line 174 of file Run2toRun3ConvertersHLT.cxx.

174 {
175 using ptree = boost::property_tree::ptree;
176 ptree top;
177 top.put("filetype", "hltprescale");
178 top.put("name", frame->name());
179 ptree pChains;
180 for ( auto cptr : frame->getHLTChainList() ) {
181 ptree pChain;
182 pChain.put("name", cptr->chain_name());
183 pChain.put("counter", cptr->chain_counter());
184 pChain.put("hash", cptr->chain_hash_id());
185 pChain.put("prescale", cptr->prescale());
186 pChain.put("enabled", (cptr->prescale()>0 ? true: false));
187
188 pChains.push_back(std::make_pair(cptr->chain_name(), pChain));
189 }
190 top.add_child("prescales", pChains);
191 TrigConf::HLTPrescalesSet psk(std::move(top));
192
194 convertHLTMenu(frame, menu);
195
197 writer.writeJsonFile(filename, menu, psk);
198}
HLT menu configuration.

◆ l1thresholds()

std::vector< std::string > l1thresholds ( const TrigConf::HLTFrame * frame,
const TrigConf::HLTChain * cptr )

Definition at line 37 of file Run2toRun3ConvertersHLT.cxx.

37 {
38 std::set<std::string> names;
39 for ( const auto sig: cptr->signatures() ) {
40 for ( const auto te: sig->outputTEs() ) {
41 auto sequence = frame->getHLTSequenceList().getSequence(te->name());
42 for ( const auto inTE: sequence->inputTEs() ) {
43 if ( not ( inTE->name().find("L2_") == 0 or inTE->name().find("EF_") == 0 or inTE->name().find("HLT_") == 0 ) ) {
44 names.insert(inTE->name());
45 }
46 }
47 }
48 }
49 return std::vector<std::string>( names.begin(), names.end() );
50}
const std::vector< HLTSignature * > & signatures() const
HLTSequence * getSequence(unsigned int id) const
counts the number of sequences in the menu

◆ legMult()

std::vector< int > legMult ( const TrigConf::HLTChain * cptr)

Definition at line 33 of file Run2toRun3ConvertersHLT.cxx.

33 {
35}
std::vector< int > multiplicities(const std::string &chain)

◆ printJSON()

void printJSON ( boost::property_tree::ptree & p)

Definition at line 52 of file Run2toRun3ConvertersHLT.cxx.

52 {
53 // this code is useful to debug JSON before it is pushed to menu objects expecting certain structure in place
54 std::stringstream ss;
55 boost::property_tree::json_parser::write_json(ss, p);
56 std::cout << ss.str() << std::endl;
57}
static Double_t ss