ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MuctpiXMLParser Class Reference

#include <MuctpiXMLParser.h>

Inheritance diagram for MuctpiXMLParser:
Collaboration diagram for MuctpiXMLParser:

Public Member Functions

 MuctpiXMLParser ()
 
virtual ~MuctpiXMLParser () override=default
 
void printConfiguration () const
 
void setVerbosity (int v)
 
const MuCTPiGeometrygetMuCTPiGeometry () const
 
void readConfiguration (const std::string &inputfile)
 
void setConfiguration (boost::property_tree::ptree ptree)
 
void parseConfiguration ()
 

Private Member Functions

void setOctant (boost::property_tree::ptree menuElement, MioctGeometry &octant)
 
void setSector (boost::property_tree::ptree menuElement, MioctSectorGeometry &sector)
 
void setROI (boost::property_tree::ptree menuElement, MioctROIGeometry &roi)
 
void setTopoCell (boost::property_tree::ptree menuElement, MioctTopoCellGeometry &topocell)
 
void setPtEncoding (boost::property_tree::ptree menuElement, L1MuonPtEncoding &ptEncoding)
 
bool msgLvl (const MSGTC::Level lvl) const
 Test the output level. More...
 
MsgStreamTC & msg () const
 The standard message stream. More...
 
MsgStreamTC & msg (const MSGTC::Level lvl) const
 The standard message stream. More...
 

Private Attributes

int m_verbosity {0}
 
boost::property_tree::ptree m_muctpiPT
 
MuCTPiGeometry m_muctpi
 
MuctpiXMLHelper m_xmlHelper
 
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
 MsgStreamTC instance (a std::cout like with print-out levels) More...
 
std::string m_name
 

Detailed Description

Definition at line 33 of file MuctpiXMLParser.h.

Constructor & Destructor Documentation

◆ MuctpiXMLParser()

MuctpiXMLParser::MuctpiXMLParser ( )

Definition at line 29 of file MuctpiXMLParser.cxx.

29  :
30  TrigConf::TrigConfMessaging("MuctpiXMLParser")
31 {}

◆ ~MuctpiXMLParser()

virtual MuctpiXMLParser::~MuctpiXMLParser ( )
overridevirtualdefault

Member Function Documentation

◆ getMuCTPiGeometry()

const MuCTPiGeometry& MuctpiXMLParser::getMuCTPiGeometry ( ) const
inline

Definition at line 52 of file MuctpiXMLParser.h.

52 {return m_muctpi; }

◆ msg() [1/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 81 of file TrigConfMessaging.h.

82  {
83  MsgStreamTC* ms = m_msg_tls.get();
84  if (!ms) {
85  ms = new MsgStreamTC(m_name);
86  m_msg_tls.reset(ms);
87  }
88  return *ms;
89  }

◆ msg() [2/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( const MSGTC::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 91 of file TrigConfMessaging.h.

92  {
93  return msg() << lvl;
94  }

◆ msgLvl()

bool TrigConf::TrigConfMessaging::msgLvl ( const MSGTC::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 70 of file TrigConfMessaging.h.

71  {
72  if (msg().level() <= lvl) {
73  msg() << lvl;
74  return true;
75  }
76  else {
77  return false;
78  }
79  }

◆ parseConfiguration()

void MuctpiXMLParser::parseConfiguration ( )

Definition at line 55 of file MuctpiXMLParser.cxx.

56 {
57 
58  // iterate through elements of topomenu
59  for(const boost::property_tree::ptree::value_type &x: m_muctpiPT) {
60 
61  string menuElementName = x.first;
62  if (menuElementName=="<xmlattr>" || menuElementName=="<xmlcomment>") continue;
63  ptree menuElement = x.second;
64 
65  // get branch attributes
66  if( menuElementName=="MIOCT" ) {
67 
68  MioctGeometry octant;
69  setOctant(menuElement, octant);
70  m_muctpi.addOctant(octant);
71 
72  } else if( menuElementName=="PtEncoding" ) {
73 
74  L1MuonPtEncoding ptEncoding;
75  setPtEncoding(menuElement, ptEncoding);
76  m_muctpi.setPtEncoding(ptEncoding);
77 
78  } else {
79  // TRG_MSG_FATAL("Unknown element" << menuElementName); // validation is checked by the dtd
80  }
81  }
82 
83 
84  TRG_MSG_INFO("Parsing Successful!");
85 
86  // m_muctpi.print();
87 
88 }

◆ printConfiguration()

void MuctpiXMLParser::printConfiguration ( ) const

Definition at line 35 of file MuctpiXMLParser.cxx.

35  {
36  cout << "************************** MuctpiXMLParser **********************" << endl;
37  m_muctpi.print();
38  cout << "*****************************************************************" << endl;
39 }

◆ readConfiguration()

void MuctpiXMLParser::readConfiguration ( const std::string &  inputfile)

Definition at line 43 of file MuctpiXMLParser.cxx.

44 {
45  // populate the ptree m_configuration with the structure of the xml input file
47  read_xml(inputfile, inputTree); // 3 --> trim_whitespace
48 
49  m_muctpiPT = inputTree.get_child("MuCTPiGeometry");
50 
51  TRG_MSG_INFO("Read " << inputfile << " successfully!");
52 }

◆ setConfiguration()

void MuctpiXMLParser::setConfiguration ( boost::property_tree::ptree  ptree)
inline

Definition at line 58 of file MuctpiXMLParser.h.

58 { m_muctpiPT = ptree; }

◆ setOctant()

void MuctpiXMLParser::setOctant ( boost::property_tree::ptree  menuElement,
MioctGeometry octant 
)
private

Definition at line 111 of file MuctpiXMLParser.cxx.

112 {
113  octant.setMioctId( m_xmlHelper.getUIntAttribute(menuElement,"id"));
114  octant.setSlot( m_xmlHelper.getUIntAttribute(menuElement,"slot"));
115 
116  // <Sector>'s
117  //unsigned int counter = 0;
118  for(const boost::property_tree::ptree::value_type &x:menuElement ) {
119  //cout << "reading "<< counter<< " octant\n"; counter++;
120  string menuElementNameO = x.first;
121  if (menuElementNameO=="<xmlattr>" || menuElementNameO=="<xmlcomment>") continue;
122  ptree menuElementO = x.second;
123  // get branch attributes
124 
125  if( menuElementNameO== "Sector" ){
126  MioctSectorGeometry sector;
127  setSector(menuElementO, sector);
128  octant.addSector(sector);
129  }
130  // Decode/TopoCell
131  else if( menuElementNameO == "Decode" ){
132  for(const boost::property_tree::ptree::value_type &y: menuElementO) {
133  string menuElementName1 = y.first;
134  if (menuElementName1=="<xmlattr>" || menuElementName1=="<xmlcomment>") continue;
135  ptree menuElement1 = y.second;
136  MioctTopoCellGeometry tcell;
137  setTopoCell(menuElement1, tcell);
138  octant.addTopoCell(tcell);
139  }
140  } // end of decode
141  }// end of menuEleement loop
142 }

◆ setPtEncoding()

void MuctpiXMLParser::setPtEncoding ( boost::property_tree::ptree  menuElement,
L1MuonPtEncoding ptEncoding 
)
private

Definition at line 91 of file MuctpiXMLParser.cxx.

92 {
93  for(const auto & x : menuElement ) {
94  if( x.first == "PtCodeElement" ) {
95  unsigned int idxP1 = m_xmlHelper.getUIntAttribute(x.second, "pt");
96  if (idxP1 == 0 ){
97  TRG_MSG_WARNING("Avoided attempt to access array out-of-bounds");
98  continue;
99  }
100  unsigned int idx = idxP1 - 1;//unsigned version of -1 would be a very large number
101  unsigned int ptCode = m_xmlHelper.getUIntAttribute(x.second, "code");
102  unsigned int thresholdValue = m_xmlHelper.getUIntAttribute(x.second, "value");
103  //idx is used directly as an array index in this function call, so cannot be
104  //negative or too large
105  ptEncoding.setCodingInfo(idx, ptCode, thresholdValue);
106  }
107  }
108 }

◆ setROI()

void MuctpiXMLParser::setROI ( boost::property_tree::ptree  menuElement,
MioctROIGeometry roi 
)
private

Definition at line 167 of file MuctpiXMLParser.cxx.

168 {
169  unsigned int x = 0;
170  std::stringstream ss; ss << std::hex ;
171 
172  data.setEtamin(m_xmlHelper.getFloatAttribute(menuElement, "etamin"));
173  data.setEtamax(m_xmlHelper.getFloatAttribute(menuElement, "etamax"));
174  data.setEta(m_xmlHelper.getFloatAttribute(menuElement, "eta"));
175  data.setPhimin(m_xmlHelper.getFloatAttribute(menuElement, "phimin"));
176  data.setPhimax(m_xmlHelper.getFloatAttribute(menuElement, "phimax"));
177  data.setPhi(m_xmlHelper.getFloatAttribute(menuElement, "phi"));
178  data.setRoiid(m_xmlHelper.getUIntAttribute(menuElement, "roiid"));
179 
180  ss<< m_xmlHelper.getAttribute(menuElement, "etacode");
181  ss>> x;
182  data.setEtacode( x );
183  ss.clear();
184  ss<< m_xmlHelper.getAttribute(menuElement, "phicode");
185  ss>> x;
186  data.setPhicode( x );
187  //data.print(" ");
188 }

◆ setSector()

void MuctpiXMLParser::setSector ( boost::property_tree::ptree  menuElement,
MioctSectorGeometry sector 
)
private

Definition at line 145 of file MuctpiXMLParser.cxx.

146 {
147  sector.setConnector(m_xmlHelper.getUIntAttribute(menuElement,"connector") );
148  sector.setName(m_xmlHelper.getAttribute(menuElement,"name") );
149 
150  //unsigned int counter = 0;
151  for(const boost::property_tree::ptree::value_type &x:menuElement ) {
152 
153  string menuElementNameO = x.first;
154  if (menuElementNameO=="<xmlattr>" || menuElementNameO=="<xmlcomment>") continue;
155  ptree menuElementO = x.second;
156  // get branch attributes
157 
158  if( menuElementNameO== "ROI" ){
159  //cout << "reading "<< counter<<" ROI\n"; counter++;
160  MioctROIGeometry roi;
161  setROI(menuElementO, roi);
162  sector.addROI(roi);
163  }
164  }
165 }

◆ setTopoCell()

void MuctpiXMLParser::setTopoCell ( boost::property_tree::ptree  menuElement,
MioctTopoCellGeometry topocell 
)
private

Definition at line 190 of file MuctpiXMLParser.cxx.

191 {
192  unsigned int x = 0;
193  std::stringstream ss; ss << std::hex ;
194  data.setEtamin(m_xmlHelper.getFloatAttribute(menuElement, "etamin"));
195  data.setEtamax(m_xmlHelper.getFloatAttribute(menuElement, "etamax"));
196  data.setEta(m_xmlHelper.getFloatAttribute(menuElement, "eta"));
197 
198  data.setPhimin(m_xmlHelper.getFloatAttribute(menuElement, "phimin"));
199  data.setPhimax(m_xmlHelper.getFloatAttribute(menuElement, "phimax"));
200  data.setPhi(m_xmlHelper.getFloatAttribute(menuElement, "phi"));
201  data.setIEta(m_xmlHelper.getIntAttribute(menuElement, "ieta"));
202  data.setIPhi(m_xmlHelper.getIntAttribute(menuElement, "iphi"));
203 
204  ss<< m_xmlHelper.getAttribute(menuElement, "etacode");
205  ss>> x; ss.clear();
206  data.setEtacode( x );
207  ss<< m_xmlHelper.getAttribute(menuElement, "phicode");
208  ss>> x;
209  data.setPhicode( x );
210  //data.print(" ");
211 }

◆ setVerbosity()

void MuctpiXMLParser::setVerbosity ( int  v)
inline

Definition at line 49 of file MuctpiXMLParser.h.

49 { m_verbosity=v; }

Member Data Documentation

◆ m_msg_tls

boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls
mutableprivateinherited

MsgStreamTC instance (a std::cout like with print-out levels)

Definition at line 66 of file TrigConfMessaging.h.

◆ m_muctpi

MuCTPiGeometry MuctpiXMLParser::m_muctpi
private

Definition at line 79 of file MuctpiXMLParser.h.

◆ m_muctpiPT

boost::property_tree::ptree MuctpiXMLParser::m_muctpiPT
private

Definition at line 78 of file MuctpiXMLParser.h.

◆ m_name

std::string TrigConf::TrigConfMessaging::m_name
privateinherited

Definition at line 67 of file TrigConfMessaging.h.

◆ m_verbosity

int MuctpiXMLParser::m_verbosity {0}
private

Definition at line 75 of file MuctpiXMLParser.h.

◆ m_xmlHelper

MuctpiXMLHelper MuctpiXMLParser::m_xmlHelper
private

Definition at line 80 of file MuctpiXMLParser.h.


The documentation for this class was generated from the following files:
MuCTPiGeometry::addOctant
void addOctant(const MioctGeometry &octant)
Definition: MuCTPiGeometry.h:28
MioctSectorGeometry::addROI
void addROI(const MioctROIGeometry &roi)
Definition: MioctSectorGeometry.h:32
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
MuctpiXMLHelper::getAttribute
std::string getAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
Definition: MuctpiXMLHelper.cxx:67
L1MuonPtEncoding::setCodingInfo
void setCodingInfo(unsigned int idx, unsigned int ptCode, unsigned int thresholdValue)
Definition: L1MuonPtEncoding.cxx:13
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
checkNSWValTree.inputTree
inputTree
Definition: checkNSWValTree.py:27
TrigConf::TrigConfMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
Definition: TrigConfMessaging.h:66
MuctpiXMLParser::m_muctpi
MuCTPiGeometry m_muctpi
Definition: MuctpiXMLParser.h:79
MioctSectorGeometry::setName
void setName(const std::string &name)
Definition: MioctSectorGeometry.h:33
MuctpiXMLHelper::getUIntAttribute
unsigned int getUIntAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
Definition: MuctpiXMLHelper.cxx:116
x
#define x
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
MuctpiXMLParser::setPtEncoding
void setPtEncoding(boost::property_tree::ptree menuElement, L1MuonPtEncoding &ptEncoding)
Definition: MuctpiXMLParser.cxx:91
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
MioctGeometry::addTopoCell
void addTopoCell(const MioctTopoCellGeometry &topocell)
Definition: MioctGeometry.h:29
MuctpiXMLParser::setOctant
void setOctant(boost::property_tree::ptree menuElement, MioctGeometry &octant)
Definition: MuctpiXMLParser.cxx:111
L1MuonPtEncoding
Definition: L1MuonPtEncoding.h:10
MioctROIGeometry
Definition: MioctROIGeometry.h:22
TrigConf::TrigConfMessaging::m_name
std::string m_name
Definition: TrigConfMessaging.h:67
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:81
MuctpiXMLParser::setROI
void setROI(boost::property_tree::ptree menuElement, MioctROIGeometry &roi)
Definition: MuctpiXMLParser.cxx:167
MioctGeometry::addSector
void addSector(const MioctSectorGeometry &sector)
Definition: MioctGeometry.h:28
MuCTPiGeometry::print
virtual void print(const std::string &indent="", unsigned int detail=1) const
Definition: MuCTPiGeometry.cxx:19
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
MioctGeometry::setMioctId
void setMioctId(unsigned int id)
Definition: MioctGeometry.h:26
MuctpiXMLParser::setTopoCell
void setTopoCell(boost::property_tree::ptree menuElement, MioctTopoCellGeometry &topocell)
Definition: MuctpiXMLParser.cxx:190
TRG_MSG_WARNING
#define TRG_MSG_WARNING(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:28
MuctpiXMLParser::m_verbosity
int m_verbosity
Definition: MuctpiXMLParser.h:75
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
MuctpiXMLParser::m_muctpiPT
boost::property_tree::ptree m_muctpiPT
Definition: MuctpiXMLParser.h:78
MuctpiXMLHelper::getIntAttribute
int getIntAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
Definition: MuctpiXMLHelper.cxx:84
MioctGeometry::setSlot
void setSlot(int m)
Definition: MioctGeometry.h:27
TrigConf::TrigConfMessaging
Class to provide easy access to TrigConf::MsgStream for TrigConf classes.
Definition: TrigConfMessaging.h:28
MuctpiXMLParser::m_xmlHelper
MuctpiXMLHelper m_xmlHelper
Definition: MuctpiXMLParser.h:80
python.PyAthena.v
v
Definition: PyAthena.py:154
MuctpiXMLParser::setSector
void setSector(boost::property_tree::ptree menuElement, MioctSectorGeometry &sector)
Definition: MuctpiXMLParser.cxx:145
MioctSectorGeometry::setConnector
void setConnector(unsigned int id)
Definition: MioctSectorGeometry.h:34
y
#define y
MioctSectorGeometry
Definition: MioctSectorGeometry.h:20
MioctTopoCellGeometry
Definition: MioctTopoCellGeometry.h:15
FullCPAlgorithmsTest_CA.inputfile
dictionary inputfile
Definition: FullCPAlgorithmsTest_CA.py:62
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
MioctGeometry
Definition: MioctGeometry.h:14
MuctpiXMLHelper::getFloatAttribute
float getFloatAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
Definition: MuctpiXMLHelper.cxx:140
MuCTPiGeometry::setPtEncoding
void setPtEncoding(const L1MuonPtEncoding &ptEncoding)
Definition: MuCTPiGeometry.h:29