ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MuonGM::StationSelector Class Reference

#include <StationSelector.h>

Collaboration diagram for MuonGM::StationSelector:

Public Types

using StationMap = std::map< std::string, Station *, std::less< std::string > >
 
using StationIterator = StationMap::const_iterator
 

Public Member Functions

 StationSelector (const MYSQL &mysql, const std::string &filename)
 
 StationSelector (const MYSQL &mysql, std::vector< std::string > s)
 
StationIterator begin ()
 
StationIterator end ()
 

Static Public Member Functions

static void SetSelectionType (int t)
 

Private Member Functions

bool select (const std::string &name)
 

Private Attributes

std::vector< std::string > m_selector {}
 
StationMap m_theMap {}
 

Static Private Attributes

static std::atomic< int > m_selectType = 0
 

Detailed Description

Definition at line 17 of file StationSelector.h.

Member Typedef Documentation

◆ StationIterator

using MuonGM::StationSelector::StationIterator = StationMap::const_iterator

Definition at line 20 of file StationSelector.h.

◆ StationMap

using MuonGM::StationSelector::StationMap = std::map<std::string, Station*, std::less<std::string> >

Definition at line 19 of file StationSelector.h.

Constructor & Destructor Documentation

◆ StationSelector() [1/2]

MuonGM::StationSelector::StationSelector ( const MYSQL mysql,
const std::string &  filename 
)

Definition at line 20 of file StationSelector.cxx.

20  {
21  std::ifstream from;
22  from.open(filename.c_str());
23  char buffer[200];
24  while (from.getline(buffer, 200)) {
25  std::istringstream line(buffer);
26  std::string key;
27  line >> key;
28  m_selector.push_back(key);
29  }
30 
31  for (const auto& [name, station] : mysql.stationMap()) {
32  if (select(name))
33  m_theMap[name] = station.get();
34  }
35  }

◆ StationSelector() [2/2]

MuonGM::StationSelector::StationSelector ( const MYSQL mysql,
std::vector< std::string >  s 
)

Definition at line 37 of file StationSelector.cxx.

37  : m_selector(std::move(s)) {
39  for (const auto& [name, station] : mysql.stationMap()) {
40  if (select(name))
41  m_theMap[name] = station.get();
42  }
43  }

Member Function Documentation

◆ begin()

StationSelector::StationIterator MuonGM::StationSelector::begin ( )

Definition at line 45 of file StationSelector.cxx.

45 { return m_theMap.begin(); }

◆ end()

StationSelector::StationIterator MuonGM::StationSelector::end ( )

Definition at line 46 of file StationSelector.cxx.

46 { return m_theMap.end(); }

◆ select()

bool MuonGM::StationSelector::select ( const std::string &  name)
private

Definition at line 48 of file StationSelector.cxx.

48  {
49  MsgStream log(Athena::getMessageSvc(), "MuonGeoModel");
50  int selFlag = m_selectType;
51  if (m_selector[0] == "*") {
52  selFlag = 1; // override JO choice for general configuration
53  }
54 
55  if (selFlag == 1) {
56  for (unsigned int k = 0; k < m_selector.size(); k++) {
57  std::string sel = m_selector[k];
58 
59  if (sel.size() <= name.size()) {
60  bool myflag = true;
61  for (unsigned int i = 0; i < sel.size(); i++) {
62  if (sel[i] == '*')
63  continue;
64  if (sel[i] != name[i]) {
65  myflag = false;
66  break;
67  }
68  }
69 
70  if (myflag)
71  return myflag;
72  }
73  }
74  return false;
75  } else if (selFlag == 2) {
76  for (unsigned int k = 0; k < m_selector.size(); k++) {
77  std::string sel = m_selector[k];
78 
79  if (sel.size() != name.size())
80  continue; // require exact match
81 
82  bool myflag = true;
83  for (unsigned int i = 0; i < sel.size(); i++) {
84  if (sel[i] == '*')
85  continue;
86  if (sel[i] != name[i]) {
87  myflag = false;
88  break;
89  }
90  }
91 
92  if (myflag) {
93  log << MSG::INFO << " StationSelector: removing station " << name << endmsg;
94  return false;
95  }
96  }
97 
98  return true;
99  }
100 
101  return true;
102  }

◆ SetSelectionType()

void MuonGM::StationSelector::SetSelectionType ( int  t)
static

Definition at line 104 of file StationSelector.cxx.

104 { m_selectType = t; }

Member Data Documentation

◆ m_selector

std::vector<std::string> MuonGM::StationSelector::m_selector {}
private

Definition at line 28 of file StationSelector.h.

◆ m_selectType

std::atomic< int > MuonGM::StationSelector::m_selectType = 0
staticprivate

Definition at line 31 of file StationSelector.h.

◆ m_theMap

StationMap MuonGM::StationSelector::m_theMap {}
private

Definition at line 29 of file StationSelector.h.


The documentation for this class was generated from the following files:
checkFileSG.line
line
Definition: checkFileSG.py:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MuonGM::StationSelector::m_selector
std::vector< std::string > m_selector
Definition: StationSelector.h:28
MuonGM::StationSelector::m_theMap
StationMap m_theMap
Definition: StationSelector.h:29
skel.it
it
Definition: skel.GENtoEVGEN.py:423
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonGM::StationSelector::m_selectType
static std::atomic< int > m_selectType
Definition: StationSelector.h:31
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonGM::StationSelector::select
bool select(const std::string &name)
Definition: StationSelector.cxx:48
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
sel
sel
Definition: SUSYToolsTester.cxx:92
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonGM::StationSelector::StationIterator
StationMap::const_iterator StationIterator
Definition: StationSelector.h:20
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37