ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
LVL1MUCTPIPHASE1::OverlapHelper Class Reference
Collaboration diagram for LVL1MUCTPIPHASE1::OverlapHelper:

Public Member Functions

std::string make_key (std::string prefix, int global_sec, int roi)
 
std::string make_pair (const std::string &lhs, const std::string &rhs) const
 
void create_indices ()
 
std::vector< std::string > get_lhs_keys (const std::string &dettype, int roi, int sector) const
 
std::vector< std::string > get_rhs_keys (const std::string &dettype, int roi, int sector) const
 
std::vector< std::string > relevant_regions (int side, const std::string &dettype, int roi, int sector) const
 
void configure (const std::string &lutFile)
 

Public Attributes

MuctpiXMLHelper xmlHelper
 
std::map< int, std::set< std::string > > global_pairs
 
std::array< std::map< std::string, std::vector< std::string > >, 2 > lhs_index
 
std::array< std::map< std::string, std::vector< std::string > >, 2 > rhs_index
 

Detailed Description

Definition at line 68 of file MuonSectorProcessor.cxx.

Member Function Documentation

◆ configure()

void LVL1MUCTPIPHASE1::OverlapHelper::configure ( const std::string &  lutFile)
inline

Definition at line 132 of file MuonSectorProcessor.cxx.

133  {
135  read_xml(lutFile, inputTree);
136 
137  boost::property_tree::ptree topEle = inputTree.get_child("MUCTPI_LUT");
138 
139  // iterate through elements of the XML
140  for(const boost::property_tree::ptree::value_type &x: topEle) {
141 
142  std::string topElementName = x.first;
143  ptree lut = x.second;
144 
145  if (topElementName != "LUT") continue;
146 
147  std::string SectorId1 = xmlHelper.getAttribute(lut,"SectorId1");
148  std::string SectorId2 = xmlHelper.getAttribute(lut,"SectorId2");
149 
150  unsigned left_mod = 32;
151  unsigned right_mod = 32;
152  if (SectorId1[0] == 'E') left_mod = 48;
153  if (SectorId1[0] == 'F') left_mod = 24;
154  if (SectorId2[0] == 'E') right_mod = 48;
155  if (SectorId2[0] == 'F') right_mod = 24;
156 
157  std::string snum_left = std::string(1,SectorId1[1])+std::string(1,SectorId1[2]);
158  int sec_left = std::stoi(snum_left) % left_mod;
159 
160  std::string snum_right = std::string(1,SectorId2[1])+std::string(1,SectorId2[2]);
161  int sec_right = std::stoi(snum_right) % right_mod;
162 
163  std::string side = xmlHelper.getAttribute(lut,"Side");
164  int active_side = (side == "C") ? 0 : 1;
165 
166  std::string System1 = SectorId1.substr(0,1);
167  std::string System2 = SectorId2.substr(0,1);
168 
169  for(const boost::property_tree::ptree::value_type &z: lut) {
170  std::string menuElementName = z.first;
171  if(menuElementName!="Element" && menuElementName!="BBElement")continue;
172  ptree ele = z.second;
173  auto roi1 = xmlHelper.getIntAttribute(ele, "RoI1");
174  auto roi2 = xmlHelper.getIntAttribute(ele, "RoI2");
175  auto lhs_key = make_key(System1,sec_left,roi1);
176  auto rhs_key = make_key(System2,sec_right,roi2);
177  auto region = make_pair(lhs_key,rhs_key);
178  global_pairs[active_side].insert(region);
179  }
180  }
181  create_indices();
182  }

◆ create_indices()

void LVL1MUCTPIPHASE1::OverlapHelper::create_indices ( )
inline

Definition at line 87 of file MuonSectorProcessor.cxx.

87  {
88  for(const auto& side_regions : global_pairs ){
89  for(const auto& region : side_regions.second){
90  auto split = region.find(':');
91  auto left = region.substr(0,split);
92  auto right = region.substr(split+1,std::string::npos);
93  lhs_index[side_regions.first][left].push_back(right);
94  rhs_index[side_regions.first][right].push_back(left);
95  }
96  }
97  }

◆ get_lhs_keys()

std::vector<std::string> LVL1MUCTPIPHASE1::OverlapHelper::get_lhs_keys ( const std::string &  dettype,
int  roi,
int  sector 
) const
inline

Definition at line 99 of file MuonSectorProcessor.cxx.

99  {
100  std::vector<std::string> r;
101  r.push_back(dettype + std::to_string(sector) + "_" + std::to_string(roi));
102  return r;
103  }

◆ get_rhs_keys()

std::vector<std::string> LVL1MUCTPIPHASE1::OverlapHelper::get_rhs_keys ( const std::string &  dettype,
int  roi,
int  sector 
) const
inline

Definition at line 105 of file MuonSectorProcessor.cxx.

105  {
106  std::vector<std::string> r;
107  r.push_back(dettype + std::to_string(sector) + "_" + std::to_string(roi));
108  return r;
109  }

◆ make_key()

std::string LVL1MUCTPIPHASE1::OverlapHelper::make_key ( std::string  prefix,
int  global_sec,
int  roi 
)
inline

Definition at line 77 of file MuonSectorProcessor.cxx.

77  {
78  prefix += std::to_string(global_sec) + "_" + std::to_string(roi);
79  return prefix;
80  }

◆ make_pair()

std::string LVL1MUCTPIPHASE1::OverlapHelper::make_pair ( const std::string &  lhs,
const std::string &  rhs 
) const
inline

Definition at line 82 of file MuonSectorProcessor.cxx.

82  {
83  return lhs + ":" + rhs;
84  }

◆ relevant_regions()

std::vector<std::string> LVL1MUCTPIPHASE1::OverlapHelper::relevant_regions ( int  side,
const std::string &  dettype,
int  roi,
int  sector 
) const
inline

Definition at line 111 of file MuonSectorProcessor.cxx.

111  {
112  std::vector<std::string> r;
113  for(const auto& key : get_lhs_keys(dettype,roi,sector)){
114  auto x = lhs_index[side].find(key);
115  if(x != lhs_index[side].end()){
116  for(const auto& rr : x->second){
117  r.push_back(make_pair(key,rr));
118  }
119  }
120  }
121  for(const auto& key : get_rhs_keys(dettype,roi,sector)){
122  auto x = rhs_index[side].find(key);
123  if(x != rhs_index[side].end()){
124  for(const auto& rr : x->second){
125  r.push_back(make_pair(rr,key));
126  }
127  }
128  }
129  return r;
130  }

Member Data Documentation

◆ global_pairs

std::map<int,std::set<std::string> > LVL1MUCTPIPHASE1::OverlapHelper::global_pairs

Definition at line 72 of file MuonSectorProcessor.cxx.

◆ lhs_index

std::array<std::map<std::string,std::vector<std::string> >,2> LVL1MUCTPIPHASE1::OverlapHelper::lhs_index

Definition at line 74 of file MuonSectorProcessor.cxx.

◆ rhs_index

std::array<std::map<std::string,std::vector<std::string> >,2> LVL1MUCTPIPHASE1::OverlapHelper::rhs_index

Definition at line 75 of file MuonSectorProcessor.cxx.

◆ xmlHelper

MuctpiXMLHelper LVL1MUCTPIPHASE1::OverlapHelper::xmlHelper

Definition at line 71 of file MuonSectorProcessor.cxx.


The documentation for this class was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
MuctpiXMLHelper::getAttribute
std::string getAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
Definition: MuctpiXMLHelper.cxx:67
LVL1MUCTPIPHASE1::OverlapHelper::xmlHelper
MuctpiXMLHelper xmlHelper
Definition: MuonSectorProcessor.cxx:71
checkNSWValTree.inputTree
inputTree
Definition: checkNSWValTree.py:27
x
#define x
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LVL1MUCTPIPHASE1::OverlapHelper::global_pairs
std::map< int, std::set< std::string > > global_pairs
Definition: MuonSectorProcessor.cxx:72
LVL1MUCTPIPHASE1::OverlapHelper::create_indices
void create_indices()
Definition: MuonSectorProcessor.cxx:87
z
#define z
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
LVL1MUCTPIPHASE1::OverlapHelper::make_pair
std::string make_pair(const std::string &lhs, const std::string &rhs) const
Definition: MuonSectorProcessor.cxx:82
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
MuctpiXMLHelper::getIntAttribute
int getIntAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
Definition: MuctpiXMLHelper.cxx:84
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
LVL1MUCTPIPHASE1::OverlapHelper::lhs_index
std::array< std::map< std::string, std::vector< std::string > >, 2 > lhs_index
Definition: MuonSectorProcessor.cxx:74
LVL1MUCTPIPHASE1::OverlapHelper::make_key
std::string make_key(std::string prefix, int global_sec, int roi)
Definition: MuonSectorProcessor.cxx:77
LVL1MUCTPIPHASE1::OverlapHelper::get_rhs_keys
std::vector< std::string > get_rhs_keys(const std::string &dettype, int roi, int sector) const
Definition: MuonSectorProcessor.cxx:105
LVL1MUCTPIPHASE1::OverlapHelper::get_lhs_keys
std::vector< std::string > get_lhs_keys(const std::string &dettype, int roi, int sector) const
Definition: MuonSectorProcessor.cxx:99
rr
const boost::regex rr(r_r)
LVL1MUCTPIPHASE1::OverlapHelper::rhs_index
std::array< std::map< std::string, std::vector< std::string > >, 2 > rhs_index
Definition: MuonSectorProcessor.cxx:75
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37