ATLAS Offline Software
MuonTrackSteeringStrategy.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUON_MUONTRACKSTEERINGSTRATEGY_H
6 #define MUON_MUONTRACKSTEERINGSTRATEGY_H
7 
8 #include <bitset>
9 #include <iostream>
10 #include <string>
11 #include <vector>
12 
13 #include "GaudiKernel/MsgStream.h"
15 
16 namespace Muon {
18  public:
19  enum Option {
25  DoRefinement = 0x5,
28  Last = 0x8
29  };
30 
31  MuonTrackSteeringStrategy(const std::string & name, const std::bitset<Last> & bits,
32  std::vector<std::vector<MuonStationIndex::ChIndex> >& path, std::vector<unsigned int>& seedOrder) :
34 
36  MuonTrackSteeringStrategy(const std::string & name, std::vector<std::string> & options,
37  std::vector<std::vector<MuonStationIndex::ChIndex> >& path) :
38  m_name(name), m_path(path) {
39  for (unsigned int i = 0; i < Last; ++i) m_bits.set(i, 0);
40  for (unsigned int i = 0; i < options.size(); ++i) setOption(options[i], true);
41  }
42 
43  MuonTrackSteeringStrategy(const std::string & name, std::vector<std::string> & options,
44  std::vector<std::vector<MuonStationIndex::ChIndex> >& path, std::vector<unsigned int>& seedOrder) :
46  for (unsigned int i = 0; i < Last; ++i) m_bits.set(i, 0);
47  for (unsigned int i = 0; i < options.size(); ++i) setOption(options[i], true);
48  }
49 
50  void setOption(Option, bool value);
51  void setOption(const std::string&, bool value);
52  bool option(Option) const;
53  const std::bitset<Last>& allOptions() const { return m_bits; }
54 
55  // Set methods
56  void setCh(const std::vector<MuonStationIndex::ChIndex>& val, const unsigned int layer);
57  void setCh(const std::vector<std::vector<MuonStationIndex::ChIndex> >& val) { m_path = val; }
58 
59  // Get methods
60  const std::vector<std::vector<MuonStationIndex::ChIndex> >& getAll() const { return m_path; }
61  const std::vector<MuonStationIndex::ChIndex>& getCh(const unsigned int) const;
62 
63  // for the name
64  const std::string& getName() const { return m_name; }
65  void setName(const std::string& name) { m_name = name; }
66 
67  const std::vector<unsigned int>& seeds() const { return m_seeds; }
68  void setSeeds(const std::vector<unsigned int>& val) { m_seeds = val; }
69 
70  private:
71  std::string m_name;
72  std::bitset<Last> m_bits;
73  std::vector<std::vector<MuonStationIndex::ChIndex> > m_path;
74  std::vector<unsigned int> m_seeds;
75  };
76 } // namespace Muon
77 
78 inline void Muon::MuonTrackSteeringStrategy::setOption(const std::string& opt, bool value) {
79  if (opt == "CutSeedsOnTracks")
81  else if (opt == "CombineSegInStation")
83  else if (opt == "DynamicSeeding")
85  else if (opt == "PreferOutsideIn")
87  else if (opt == "AllowOneSharedHit")
89  else if (opt == "DoRefinement")
91  else if (opt == "DoAmbiSolving")
93  else if (opt == "BarrelEndcapFilter")
95  else {
96  // Attempt to interpret the string as a seed sequence
97  std::vector<unsigned int> seeds;
98  bool success = true;
99  for (unsigned int i = 0; i < opt.size() && success; ++i) {
100  int holder = int(opt[i]) - 48;
101  if (holder < 0 || holder > 9)
102  success = false;
103  else
104  seeds.push_back(holder);
105  }
106  if (success) setSeeds(seeds);
107  }
108 }
109 
111  if (opt == Last) return;
112  m_bits[opt] = value;
113 }
114 
115 inline void Muon::MuonTrackSteeringStrategy::setCh(const std::vector<MuonStationIndex::ChIndex>& val, const unsigned int layer) {
116  if (layer < m_path.size())
117  m_path[layer] = val;
118  else { // assume the user knows what he or she is doing
119  m_path.resize(layer + 1);
120  m_path[layer] = val;
121  }
122 }
123 
124 inline const std::vector<Muon::MuonStationIndex::ChIndex>& Muon::MuonTrackSteeringStrategy::getCh(const unsigned int layer = 0) const {
125  if (layer >= m_path.size()) {
126  throw std::range_error("MuonTrackSteering a path beyond the possible paths is chosen");
127  }
128  return m_path[layer];
129 }
130 
132  return m_bits[static_cast<unsigned int>(op)];
133 }
134 
135 inline std::ostream& operator<<(std::ostream& sl, const Muon::MuonTrackSteeringStrategy& mtss) {
136  sl << "MuonTrackSteeringStrategy " << mtss.getName() << " with options: " << mtss.allOptions() << " with seeds";
137  if (mtss.seeds().size()) {
138  for (unsigned int i = 0; i < mtss.seeds().size(); ++i) { sl << " " << mtss.seeds()[i]; }
139  } else
140  sl << " <none>";
141  sl << " and chambers are: " << std::endl;
142  for (unsigned int i = 0; i < mtss.getAll().size(); ++i) {
143  sl << "\t Step " << i << " : ( ";
144  for (unsigned int j = 0; j < mtss.getCh(i).size() - 1; ++j) sl << mtss.getCh(i)[j] << " , ";
145  if (mtss.getCh(i).size()) sl << mtss.getCh(i)[mtss.getCh(i).size() - 1];
146  sl << " ) " << std::endl;
147  }
148  return sl;
149 }
150 
151 inline MsgStream& operator<<(MsgStream& sl, const Muon::MuonTrackSteeringStrategy& mtss) {
152  sl << "MuonTrackSteeringStrategy " << mtss.getName() << " with options: " << mtss.allOptions() << " with seeds";
153  if (mtss.seeds().size()) {
154  for (unsigned int i = 0; i < mtss.seeds().size(); ++i) { sl << " " << mtss.seeds()[i]; }
155  } else
156  sl << " <none>";
157  sl << " and chambers are: " << std::endl;
158  for (unsigned int i = 0; i < mtss.getAll().size(); ++i) {
159  sl << "\t Step " << i << " : ( ";
160  for (unsigned int j = 0; j < mtss.getCh(i).size() - 1; ++j) sl << mtss.getCh(i)[j] << " , ";
161  if (mtss.getCh(i).size()) sl << mtss.getCh(i)[mtss.getCh(i).size() - 1];
162  sl << " ) " << std::endl;
163  }
164  return sl;
165 }
166 
167 #endif
Muon::MuonTrackSteeringStrategy::setCh
void setCh(const std::vector< MuonStationIndex::ChIndex > &val, const unsigned int layer)
Definition: MuonTrackSteeringStrategy.h:115
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
Muon::MuonTrackSteeringStrategy::getName
const std::string & getName() const
Definition: MuonTrackSteeringStrategy.h:64
Muon::MuonTrackSteeringStrategy::AllowOneSharedHit
@ AllowOneSharedHit
Definition: MuonTrackSteeringStrategy.h:24
Muon::MuonTrackSteeringStrategy::m_name
std::string m_name
Definition: MuonTrackSteeringStrategy.h:71
Muon::MuonTrackSteeringStrategy::setCh
void setCh(const std::vector< std::vector< MuonStationIndex::ChIndex > > &val)
Definition: MuonTrackSteeringStrategy.h:57
Muon::MuonTrackSteeringStrategy::CutSeedsOnTracks
@ CutSeedsOnTracks
Definition: MuonTrackSteeringStrategy.h:20
Muon::MuonTrackSteeringStrategy::getAll
const std::vector< std::vector< MuonStationIndex::ChIndex > > & getAll() const
Definition: MuonTrackSteeringStrategy.h:60
Muon::MuonTrackSteeringStrategy::m_bits
std::bitset< Last > m_bits
List of all of the options available.
Definition: MuonTrackSteeringStrategy.h:72
athena.value
value
Definition: athena.py:124
Muon::MuonTrackSteeringStrategy::m_path
std::vector< std::vector< MuonStationIndex::ChIndex > > m_path
Definition: MuonTrackSteeringStrategy.h:73
Muon::MuonTrackSteeringStrategy::MuonTrackSteeringStrategy
MuonTrackSteeringStrategy(const std::string &name, const std::bitset< Last > &bits, std::vector< std::vector< MuonStationIndex::ChIndex > > &path, std::vector< unsigned int > &seedOrder)
Definition: MuonTrackSteeringStrategy.h:31
Muon::MuonTrackSteeringStrategy::setName
void setName(const std::string &name)
Definition: MuonTrackSteeringStrategy.h:65
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MuonTrackSteeringStrategy::PreferOutsideIn
@ PreferOutsideIn
Definition: MuonTrackSteeringStrategy.h:23
Muon::MuonTrackSteeringStrategy::option
bool option(Option) const
Definition: MuonTrackSteeringStrategy.h:131
Muon::MuonTrackSteeringStrategy::BarrelEndcapFilter
@ BarrelEndcapFilter
Definition: MuonTrackSteeringStrategy.h:27
Muon::MuonTrackSteeringStrategy::DoRefinement
@ DoRefinement
Definition: MuonTrackSteeringStrategy.h:25
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Muon::MuonTrackSteeringStrategy::DoAmbiSolving
@ DoAmbiSolving
Definition: MuonTrackSteeringStrategy.h:26
Muon::MuonTrackSteeringStrategy::getCh
const std::vector< MuonStationIndex::ChIndex > & getCh(const unsigned int) const
Definition: MuonTrackSteeringStrategy.h:124
lumiFormat.i
int i
Definition: lumiFormat.py:85
ActsTrackFindingConfig.seedOrder
list seedOrder(flags, *list pixel=None, list strip=None)
Definition: ActsTrackFindingConfig.py:25
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::MuonTrackSteeringStrategy::setSeeds
void setSeeds(const std::vector< unsigned int > &val)
Definition: MuonTrackSteeringStrategy.h:68
m_path
std::string m_path
the path being used
Definition: OutputStreamData.cxx:88
Muon::MuonTrackSteeringStrategy::Last
@ Last
Definition: MuonTrackSteeringStrategy.h:28
Muon::MuonTrackSteeringStrategy::Option
Option
Definition: MuonTrackSteeringStrategy.h:19
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
Muon::MuonTrackSteeringStrategy::m_seeds
std::vector< unsigned int > m_seeds
Definition: MuonTrackSteeringStrategy.h:74
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Muon::MuonTrackSteeringStrategy::MuonTrackSteeringStrategy
MuonTrackSteeringStrategy(const std::string &name, std::vector< std::string > &options, std::vector< std::vector< MuonStationIndex::ChIndex > > &path, std::vector< unsigned int > &seedOrder)
Definition: MuonTrackSteeringStrategy.h:43
Muon::MuonTrackSteeringStrategy
Definition: MuonTrackSteeringStrategy.h:17
Muon::operator<<
std::ostream & operator<<(std::ostream &ostr, const Muon::HedgehogBoard &board)
Definition: HedgehogBoard.cxx:11
Muon::MuonTrackSteeringStrategy::seeds
const std::vector< unsigned int > & seeds() const
Definition: MuonTrackSteeringStrategy.h:67
Muon::MuonTrackSteeringStrategy::MuonTrackSteeringStrategy
MuonTrackSteeringStrategy(const std::string &name, std::vector< std::string > &options, std::vector< std::vector< MuonStationIndex::ChIndex > > &path)
Constructor that assumes the seed order could come as part of the options.
Definition: MuonTrackSteeringStrategy.h:36
Muon::MuonTrackSteeringStrategy::setOption
void setOption(Option, bool value)
Definition: MuonTrackSteeringStrategy.h:110
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Muon::MuonTrackSteeringStrategy::DynamicSeeding
@ DynamicSeeding
Definition: MuonTrackSteeringStrategy.h:22
Muon::MuonTrackSteeringStrategy::CombineSegInStation
@ CombineSegInStation
Definition: MuonTrackSteeringStrategy.h:21
MuonStationIndex.h
Muon::MuonTrackSteeringStrategy::allOptions
const std::bitset< Last > & allOptions() const
Definition: MuonTrackSteeringStrategy.h:53