19 std::ostream&
operator<<( std::ostream&
s,
const std::vector<T>&
v)
21 s<<
"[";
for(
auto i:
v){
s <<
i <<
", ";}
s <<
"]";
25 std::string TrigNavStructure::m_unspecifiedLabel =
"";
31 for (
auto& factory :
m_factory) factory.reset();
40 std::lock_guard<std::recursive_mutex> lock(
getMutex());
43 if ( factory.
empty() )
49 std::lock_guard<std::recursive_mutex> lock(
getMutex());
52 if ( not factory.
empty() )
59 std::lock_guard<std::recursive_mutex> lock(
getMutex());
80 std::vector<TriggerElement*>
list;
81 list.push_back(seednode);
86 std::lock_guard<std::recursive_mutex> lock(
getMutex());
93 for (
it = seeds.begin();
it != seeds.end(); ++
it ) {
111 for ( ; itbegin != itend; ++itbegin ) {
130 if ( te->
getId() ==
id )
132 std::vector<TriggerElement*>::const_iterator
it;
155 if ( initialNode == 0 )
158 std::lock_guard<std::recursive_mutex> lock(
getMutex());
165 if ( te == initialNode ) {
167 const std::vector< TriggerElement* >& allTEs = factory.
listOfProduced();
168 std::vector< TriggerElement* >::const_iterator allIt;
169 for (allIt = allTEs.begin(); allIt != allTEs.end(); ++allIt) {
183 ss <<
"id:" << dec << te->
getId() <<
";"
186 <<
"ptr:" << hex << te <<
";"
189 std::vector<TriggerElement*>::const_iterator seedIt;
209 for ( ;
it != itEnd; ++
it ) {
218 std::lock_guard<std::recursive_mutex> lock(
getMutex());
223 const std::vector<TriggerElement*>& fullList = factory.
listOfProduced();
224 std::vector<TriggerElement*>
all;
225 all.reserve(fullList.size());
227 for(std::vector<TriggerElement*>::const_iterator iter = fullList.begin(); iter != fullList.end(); ++iter) {
228 if(! (*iter)->transient() ) {
229 all.push_back( *iter );
241 std::map<TriggerElement*, uint16_t>
keys;
244 std::vector<TriggerElement*>::const_iterator
it;
265 std::lock_guard<std::recursive_mutex> lock(
getMutex());
270 std::vector<uint32_t>::const_iterator& inputIt =
start;
271 const size_t payloadSize = *inputIt++;
274 std::cerr <<
"size of the navigation payload smaller than the one required to save TEs. " <<
totalSize <<
" < " << payloadSize << std::endl;
279 const unsigned int size = *inputIt++;
281 std::map<uint16_t, TriggerElement* >
keys;
283 for (
unsigned int i = 0;
i <
size; ++
i ) {
292 if ( not factory.
empty() ) {
295 std::vector<TriggerElement*>::const_iterator roiTEit;
315 std::vector<TriggerElement*>::const_iterator
it;
333 for ( std::vector<TriggerElement*>::const_iterator roi_te =
rois.begin();
334 roi_te !=
rois.end(); ++roi_te) {
337 std::vector<TriggerElement*>::const_iterator te = tes.begin();
338 for ( ; te != tes.end(); ++te) {
345 std::vector< TriggerElement* >&
output,
346 const bool activeOnly)
const {
347 std::lock_guard<std::recursive_mutex> lock(
getMutex());
351 std::back_insert_iterator<std::vector<TriggerElement*> > outputIt(
output );
364 std::lock_guard<std::recursive_mutex> lock(
getMutex());
368 std::back_insert_iterator<std::vector<TriggerElement*> > outputIt(
output );
377 std::lock_guard<std::recursive_mutex> lock(
getMutex());
384 std::lock_guard<std::recursive_mutex> lock(
getMutex());
391 std::lock_guard<std::recursive_mutex> lock(
getMutex());
417 std::vector<const TriggerElement*> vecRoINodes;
420 vecRoINodes.push_back(te1);
422 std::back_insert_iterator<std::vector<const TriggerElement*> > outputIt( vecRoINodes );
426 vecRoINodes.push_back(te2);
428 std::back_insert_iterator<std::vector<const TriggerElement*> > outputIt( vecRoINodes );
432 sort(vecRoINodes.begin(), vecRoINodes.end());
434 std::vector<const TriggerElement*>::const_iterator
it;
435 it = adjacent_find(vecRoINodes.begin(), vecRoINodes.end());
437 if (
it == vecRoINodes.end() )
450 std::vector<TriggerElement*> vecRoINodes1 =
getRoINodes(te1);
451 std::vector<TriggerElement*> vecRoINodes2 =
getRoINodes(te2);
452 sort(vecRoINodes1.begin(), vecRoINodes1.end());
453 sort(vecRoINodes2.begin(), vecRoINodes2.end());
454 return vecRoINodes1 == vecRoINodes2;
462 std::vector<const TriggerElement*> vecRoINodes;
463 std::back_insert_iterator<std::vector<const TriggerElement*> > outputIt( vecRoINodes );
472 sort(vecRoINodes.begin(), vecRoINodes.end());
475 it = adjacent_find(vecRoINodes.begin(), vecRoINodes.end());
476 if (
it == vecRoINodes.end() )
558 std::lock_guard<std::recursive_mutex> lock(
getMutex());
567 std::vector< TriggerElement* >::const_iterator
old = oldFactory.
listOfProduced().begin();
571 (*me)->setActiveState((*old)->getActiveState());
583 std::vector<std::vector<TriggerElement*> >&
output,
584 unsigned int maxResults,
bool onlyActive)
589 std::vector< std::vector<TriggerElement*> >
input;
590 std::vector< std::vector<std::pair<unsigned int, unsigned int> > > newIdxs;
595 std::vector< std::vector<TriggerElement*> >
input =
output;
596 std::vector< std::vector<std::pair<unsigned int, unsigned int> > > currentIdxs = newIdxs;
603 maxResults, onlyActive))
return false;
611 std::vector< std::vector<std::pair<unsigned int, unsigned int> > >& currentIdxs,
613 std::vector<std::vector<TriggerElement*> >& newCombs,
614 std::vector< std::vector<std::pair<unsigned int, unsigned int> > >& newIdxs,
615 unsigned int maxResults,
bool onlyActive)
618 std::vector<TriggerElement*> newTEs;
621 if (currentCombs.size() == 0) {
624 for (
unsigned int j = 0; j < newTEs.size(); j++) {
626 std::vector<TriggerElement*> cbs;
627 cbs.push_back(newTEs[j]);
628 newCombs.push_back(cbs);
631 std::vector<std::pair<unsigned int, unsigned int> > ti;
632 ti.push_back(std::pair<unsigned int, unsigned int>(
type, j));
633 newIdxs.push_back(ti);
639 for (
unsigned int i = 0;
i < currentCombs.size();
i++) {
642 std::vector<TriggerElement*>& comb = currentCombs[
i];
647 std::vector<std::pair<unsigned int, unsigned int> >& ti = currentIdxs[
i];
660 for (
unsigned int j = comb.size(); j > 0; j--)
662 first = ti[j - 1].second;
669 for (
unsigned int j =
first + 1; j < newTEs.size(); j++) {
680 newCombs.push_back(comb);
686 ti.push_back(std::pair<unsigned int, unsigned int>(
type, j));
687 newIdxs.push_back(ti);
691 if (maxResults > 0 && newCombs.size() >= maxResults) {
701 for (std::vector<TriggerElement*>::const_iterator te2 = teVec.begin(); te2 != teVec.end(); ++te2)
702 if (
overlaps(te1, *te2))
return true;
708 if (te1 == te2)
return true;
715 std::vector<const TriggerElement*>&
children,
const bool activeOnly )
const {
720 for (
unsigned i = 0 ;
i < types.size(); ++
i ) {
738 unsigned int n_features = 0;
740 for ( std::vector< TriggerElement::FeatureAccessHelper >::const_iterator
it = sourceTE->
getFeatureAccessHelpers().begin();
757 std::lock_guard<std::recursive_mutex> lock(
getMutex());
759 for (
auto& factory :
m_factory) factory.reset();
769 std::lock_guard<std::recursive_mutex> lock(
getMutex());
776 std::lock_guard<std::recursive_mutex> lock(
getMutex());
779 return holderstorage.
getLabel(clid,sti_or_label);
787 bool single =
true;
bool recursively =
false;
790 if(
status && !features.empty()){
791 return features.front();
801 bool single =
true;
bool recursively =
true;
804 if(
status && !features.empty()){
805 return features.front();
812 bool only_single_feature,
815 std::string& sourcelabel )
const {
823 for (
int it = ( only_single_feature ?
size-1 : 0 );
it != (only_single_feature ? -1 :
size ); only_single_feature ?
it--:
it++ ) {
828 sourcelabel =
label(clid,fea.getIndex().subTypeIndex());
830 features.push_back(fea);
834 if ( only_single_feature )
844 bool only_single_feature,
846 bool travel_backward_recursively,
848 std::string& sourcelabel )
const {
858 if ( ! travel_backward_recursively ) {
868 if ( ! features.empty() ) {
873 bool recursion_status =
true;
878 recursion_status = recursion_status &&
getFeatureAccessors( predecessor, clid, index_or_label,
879 only_single_feature, features_in_branch,
880 travel_backward_recursively,
882 features.insert(features.end(), features_in_branch.begin(), features_in_branch.end());
885 if ( only_single_feature && ( features.size() > 1 || recursion_status ==
false) ) {
900 if(fea.
getCLID() != clid)
return false;
902 if(index_or_label.index() == 0){
904 auto index = std::get<sub_index_type>(index_or_label) ;
908 if(index_or_label.index() == 1){
910 auto label = std::get<std::string>(index_or_label);
916 if(sub == invalid_sub_index)
return false;
924 std::lock_guard<std::recursive_mutex> lock(
getMutex());