90 mod_ids.push_back((*map_it).first);
95 std::vector<unsigned int> mod_ids;
98 mod_ids.push_back((*map_it).first);
136 bool serialize_indivisible(uint32_t* output,
138 const std::vector<uint32_t>& indivisible,
139 unsigned int umax_size,
143 auto size_indivisible = indivisible.size();
144 auto size_needed = data_size + size_indivisible + (first ? 0 : 1);
149 if(truncating && size_needed > umax_size)
153 output[data_size++] = size_indivisible;
155 std::copy(std::begin(indivisible),
156 std::end(indivisible),
158 data_size += size_indivisible;
171 void serialize_collections(uint32_t * output,
173 const std::vector<uint32_t>& nav,
174 const std::vector<std::pair<unsigned, unsigned>>& boundaries)
176 const auto nav_begin = std::begin(nav);
177 for(
const auto& bpair : boundaries)
179 assert(bpair.first < nav.size());
180 assert(bpair.second >= bpair.first);
181 assert(bpair.second <= nav.size());
183 std::copy(nav_begin + bpair.first,
184 nav_begin + bpair.second,
186 data_size += bpair.second - bpair.first;
195 find_cuts(
const std::set<std::pair<CLID, std::string>>& collections,
196 const std::vector<std::pair<CLID, std::string>>& idname_include,
197 const std::vector<std::pair<CLID, std::string>>& idname_exclude,
198 std::vector<unsigned int> cuts,
199 std::vector<std::pair<unsigned int, unsigned int>>& out)
201 for(
const auto& coll : collections)
203 if(std::find(std::begin(idname_exclude),
204 std::end(idname_exclude),
205 coll) == std::end(idname_exclude))
207 auto it = std::find(std::begin(idname_include),
208 std::end(idname_include),
210 if(it != std::end(idname_include))
212 auto pos = std::distance(std::begin(idname_include), it);
213 out.emplace_back(
cuts.at(pos + 1),
225 unsigned add_collection_to_size(
unsigned current_size,
226 const std::pair<unsigned, unsigned>& pair)
228 return current_size + pair.second - pair.first;
236 calc_colls_size(
const std::vector<std::pair<unsigned, unsigned>>& boundaries)
238 return std::accumulate(std::begin(boundaries), std::end(boundaries), 0,
239 add_collection_to_size);
254 const auto& collections = modid_coll_it->second;
255 find_cuts(collections,
260 find_cuts(collections,
267 return std::make_pair(cuts_dsonly, cuts_reg);
273 static constexpr auto num_size_words = 3u;
279 unsigned int umax_size,
280 bool truncating)
const
282 auto calc_size_needed = [data_size](
unsigned int nav_size)
283 {
return nav_size + data_size + 1; };
286 auto is_within_size = [umax_size, &calc_size_needed](
unsigned int cut)
287 {
return calc_size_needed(cut) <= umax_size; };
291 if(
static_cast<unsigned int>(data_size) < umax_size)
294 auto cut_nav_size = tot_nav_size;
297 if(truncating && calc_size_needed(tot_nav_size) > umax_size)
303 endnav -= tot_nav_size - cut_nav_size;
310 output[data_size++] = cut_nav_size;
312 data_size += cut_nav_size;
323 unsigned int umax_size,
324 unsigned int nav_size,
326 bool truncating)
const
328 if(nav_size + data_size < umax_size)
330 output[data_size++] = nav_size;
331 auto index_for_size_in_nav_preamble = data_size + 1;
337 output[index_for_size_in_nav_preamble] = nav_size;
348 if(
static_cast<unsigned int>(data_size) < umax_size)
349 output[data_size++] = 0;
360 unsigned int estimated_size)
365 auto umax_size =
static_cast<unsigned int>(max_size);
366 output =
new uint32_t[std::min(umax_size, estimated_size)];
368 truncating = max_size >= 0 && estimated_size > umax_size;
372 return serialize_indivisible(output, data_size,
m_headerResult, umax_size,
379 unsigned int umax_size,
380 bool truncating)
const
382 return serialize_indivisible(output, data_size,
m_chainsResult, umax_size,
385 serialize_indivisible(output, data_size,
m_extras, umax_size,
391 unsigned int umax_size,
392 unsigned int nav_size,
394 bool truncating)
const
396 if(
static_cast<unsigned int>(data_size) < umax_size)
398 output[data_size++] = 0;
401 &&
static_cast<unsigned int>(data_size) < umax_size)
403 output[data_size++] = 0;
416 bool truncating{
false};
419 max_size, estim_size) &&
421 max_size, truncating);
431 bool truncating{
false};
433 auto navsize = calc_colls_size(dscuts.first) + calc_colls_size(dscuts.second);
448 const unsigned int mod_id)
450 uint32_t *
aux =
nullptr;
454 auto uptr = std::unique_ptr<uint32_t[]>{
aux};
456 output.reserve(data_size);
457 std::copy(
aux,
aux + data_size, std::back_inserter(output));
466 const unsigned int mod_id)
468 return mod_id ?
serialize_DS(output, data_size, max_size, mod_id)
488 if (data_size == 0 )
return false;
489 std::vector<uint32_t> rawResult(&source[0], &source[data_size]);
501 unsigned version = raw[0];
507 rawIndNumOfFixedBit = 12;
508 }
else if (version == 2 ) {
511 std::cerr <<
"HLTResult::unpackFromStorable has noticed a class version mismatch and does not know how to translate: raw data version " << raw[0] <<
" current class version " <<
m_HLTResultClassVersion << std::endl;
519 raw.begin()+rawIndNumOfFixedBit);
524 if ( raw.size() == rawIndNumOfFixedBit )
528 uint32_t offset = rawIndNumOfFixedBit;
529 uint32_t sizeOfChains = raw[offset];
532 uint32_t readEnd = offset + sizeOfChains;
533 bool truncation =
false;
535 if ( readEnd > raw.size() ){
536 readEnd = raw.size();
542 offset += sizeOfChains;
552 uint32_t sizeOfNavigation = raw[offset];
557 readEnd = offset + sizeOfNavigation;
558 if (readEnd > raw.size()) {
559 readEnd = raw.size();
564 if ( offset > readEnd )
568 raw.begin()+readEnd);
577 offset += sizeOfNavigation;
581 uint32_t sizeOfExtras = 0;
582 if (offset < raw.size()) {
583 sizeOfExtras = raw[offset++];
589 readEnd = offset + sizeOfExtras;
590 if (readEnd > raw.size()) {
591 readEnd = raw.size();
595 if ( offset > readEnd )
599 raw.begin()+readEnd);
617 std::vector<unsigned int> sizes;
HLT::HLTResult is sumarising result of trigger decision evaluation (online/offline) It contains basic...
void setCreatedOutsideHLT(bool created)
void setNumOfSatisfiedSigs(uint32_t sigs)
sget number of satisfied signatures
virtual uint32_t error_bits() const
bit flags to explain problems during processing
ErrorCode getLvlConverterStatus() const
overall hlt status: if StatusCode::isFailure(), event should be discarded from physics stream (and,...
HLTResult & operator=(HLTResult rhs)
unified assignement operator
std::vector< uint32_t > m_headerResult
the full payload, and sub-payloads
std::vector< std::pair< unsigned int, unsigned int > > CutPairs
std::vector< uint32_t > m_extras
extra storeage (which can be used to store some operational infos)
bool serialize_body_DS(uint32_t *output, int &data_size, unsigned int max_size, unsigned int nav_size, const CutPairVecs &dscuts, bool truncating) const
friend void swap(HLTResult &lhs, HLTResult &rhs)
void setLvl1Id(uint32_t id)
sets event number (Lvl1-id)
bool serialize(std::vector< uint32_t > &output, const unsigned int mod_id)
void setHLTLevel(HLTLevel hltLevel)
static unsigned int calc_total_size_DS(unsigned int ds_nav_size)
Calculate the size of a DS result, given the size of its navigation.
std::vector< unsigned int > listOfModIDs() const
return the rob module ID vector
uint32_t getConfigSuperMasterKey() const
gets the key of the menu which was used to trigger this event
bool serialize_bootstrap(uint32_t *&output, int &data_size, bool &truncating, int max_size, unsigned int estimated_size)
std::vector< std::pair< CLID, std::string > > m_id_name
void setConfigSuperMasterKey(uint32_t key)
sets the key of the menu which was used to trigger this event
void setHLTStatus(ErrorCode hltStatus)
std::map< unsigned int, std::set< std::pair< CLID, std::string > > > m_modID_id_name
std::vector< unsigned int > m_navigationResultCuts_DSonly
bool serialize_DS(uint32_t *&output, int &data_size, int max_size, unsigned int mod_id)
std::vector< std::pair< CLID, std::string > > m_id_name_DSonly
ErrorCode getHLTStatus() const
overall hlt status: if StatusCode::isFailure(), event should be discarded from physics stream (and,...
uint32_t getConfigPrescalesKey() const
gets the key of the prescales config which was used to trigger this event
unsigned int estimateSize() const
Estimate the size this HLTResult would ocuppy once serialized.
bool serialize_body_regular(uint32_t *output, int &data_size, unsigned int umax_size, bool truncating) const
virtual bool error() const
problems during processing
static const uint32_t m_HLTResultClassVersion
the version of this HLTResult class
std::vector< uint32_t > m_navigationResult
storage of navigation (serialized also)
HLTExtraData & getExtraData()
bool serialize_navigation_reg(uint32_t *output, int &data_size, unsigned int umax_size, bool truncating) const
bool isEmpty() const
true if result is empty
CutPairVecs findDSCuts(unsigned int) const
Find the pairs of cut points that mark the boundaries of DS collections for the given module id.
std::vector< uint32_t > m_navigationResult_DSonly
storage of navigation (serialized also) for DataScouting
bool serialize_regular(uint32_t *&output, int &data_size, int max_size)
HLTExtraData * m_extraData
object for m_extras deserialization (on demand)
unsigned int size() const
void setErrorCoordinates(unsigned int chainCounter=0, unsigned int step=0)
sets the information about the error, namely chain in which the error happened and the step
std::vector< unsigned int > partSizes() const
std::pair< CutPairs, CutPairs > CutPairVecs
bool serialize_navigation_DS(uint32_t *output, int &data_size, unsigned int umax_size, unsigned int nav_size, const CutPairVecs &dscuts, bool truncating) const
bool deserialize(const std::vector< uint32_t > &source)
GenericResult::deserialize( const std::vector<uint32_t>& source )
std::vector< uint32_t > m_chainsResult
storege of serialized chains
@ IndHLTResultClassVersion
@ IndConfigPrescalesKey
configuration key for prescales
@ IndNumOfFixedBit
total number of fixed bits
@ IndConfigSuperMasterKey
configuration key for the menu
void setAccepted(bool acc)
sets HLT decision
bool isHLTResultTruncated() const
is serialized HLTResult truncated
void setLvlConverterStatus(ErrorCode status)
void setConfigPrescalesKey(uint32_t key)
sets the key of the prescales config which was used to trigger this event
void setHLTResultTruncated(bool truncated)
bool unpackFromStorable(const std::vector< uint32_t > &raw)
split the rawResult vector into rawPartialResult's
void setPassThrough(bool fa)
set passTrough flag
std::vector< unsigned int > m_navigationResultCuts
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void swap(HLTExtraData &, HLTExtraData &)
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
@ ABORT_JOB
if things go really wrong, i.e.
@ CONTINUE
if all is OK the processing should be continued
@ ABORT_CHAIN
if things went wrong but it is not severe, other unrelated chains will continue
@ ABORT_EVENT
if things went wrong severely, event corruption suspected
@ NAV_ERROR
suspected Navigation error
@ TIMEOUT
the timeout occured
@ NO_LVL2_CHAINS
in the LVL2 result unpacked at EF no active LVL2 chains are present, that means no seeding informatio...
@ NO_LVL1_ITEMS
in the LVL1 result delivered to LVL2 none of LVL1 items are present, that means no seeding informatio...
@ WRONG_HLT_RESULT
error while unpacking HLT reult (happnes at EF when LVL2 result is unpacked)
@ NO_HLT_RESULT
no HLT result is present (means that LVL2 result was not delivered to EF)