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