ATLAS Offline Software
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 
21 namespace TDTUtilities_impl {
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 
41 std::vector< std::string >
42 Trig::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 
52 std::vector< std::string >
53 Trig::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 
62 std::string Trig::getTEName(const HLT::TriggerElement& te)
63 {
64  std::string s;
65  return (TrigConf::HLTTriggerElement::getLabel(te.getId(), s) ? s : "");
66 }
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:62
HLT::TriggerElement::getId
te_id_type getId() const
reset internals.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:43
TDTUtilities.h
dq_defect_bulk_create_defects.line
line
Definition: dq_defect_bulk_create_defects.py:27
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:42
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:11
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:53
HLTTriggerElement.h
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
python.PyAthena.v
v
Definition: PyAthena.py:154
TDTUtilities_impl
Definition: TDTUtilities.cxx:21
TDTUtilities_impl::split
std::vector< std::string > split(const std::string &line)
Definition: TDTUtilities.cxx:25
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147