ATLAS Offline Software
Loading...
Searching...
No Matches
TDTUtilities.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10#include <string>
11#include <vector>
12#include <algorithm>
13
14#include "TTree.h"
15#include "TROOT.h"
16
17#include <iostream>
18
19
20
22
23 // splitting a string at the ','
24 std::vector<std::string>
25 split(const std::string& line) {
26 std::vector<std::string> res;
27 std::string::size_type old_pos = 0, pos = line.find(',',0);
28 while( pos != std::string::npos ) {
29 res.push_back(line.substr(old_pos,pos-old_pos));
30 old_pos = pos + 1;
31 pos = line.find(',', old_pos);
32 }
33 // last entry
34 if (old_pos < line.size())
35 res.push_back(line.substr(old_pos,line.size()-old_pos));
36 return res;
37 }
38}
39
40
41std::vector< std::string >
42Trig::convertStringToVector(const std::string& triggerNames) {
43 std::string temp(triggerNames);
44 std::string::size_type pos;
45 // new erase all spaces
46 while ((pos = temp.find_first_of(' ')) != std::string::npos)
47 temp.erase(pos,1);
48 return TDTUtilities_impl::split(temp);
49}
50
51
52std::vector< std::string >
53Trig::keyWrap(const std::vector< std::string >& triggerNames) {
54 std::vector< std::string > v;
55 v.assign(triggerNames.begin(),triggerNames.end());
56 std::sort(v.begin(),v.end());
57 v.erase( std::unique(v.begin(),v.end()),v.end());
58 return v;
59}
60
61
63{
64 std::string s;
65 //coverity[copy_constructor_call]
66 return (TrigConf::HLTTriggerElement::getLabel(te.getId(), s) ? s : "");
67}
std::pair< std::vector< unsigned int >, bool > res
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
static bool getLabel(unsigned int id, std::string &label)
find name from ID in the map m_IdToLabel
std::vector< std::string > split(const std::string &line)
std::vector< std::string > convertStringToVector(const std::string &triggerNames)
makes a split of list of chains into the vector of chains
std::string getTEName(const HLT::TriggerElement &te)
converts TEid to TE name (this may not always work, it depends on the availability of config)
std::vector< std::string > keyWrap(const std::vector< std::string > &triggerNames)
normalizes the list of triggers (patterns) by sorting and uniquing them
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.