File indexing completed on 2026-09-27 09:20:25
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef PANDORA_XML_FILE_READER_H
0009 #define PANDORA_XML_FILE_READER_H 1
0010
0011 #include "Helpers/XmlHelper.h"
0012
0013 #include "Objects/CartesianVector.h"
0014 #include "Objects/TrackState.h"
0015
0016 #include "Pandora/Pandora.h"
0017
0018 #include "Persistency/FileReader.h"
0019
0020 namespace pandora
0021 {
0022
0023
0024
0025
0026 class XmlFileReader : public FileReader
0027 {
0028 public:
0029
0030
0031
0032
0033
0034
0035 XmlFileReader(const pandora::Pandora &pandora, const std::string &fileName);
0036
0037
0038
0039
0040 ~XmlFileReader();
0041
0042
0043
0044
0045
0046
0047 template <typename T>
0048 StatusCode ReadVariable(const std::string &xmlKey, T &t);
0049
0050 private:
0051 StatusCode ReadHeader();
0052 StatusCode GoToNextContainer();
0053 ContainerId GetNextContainerId();
0054 StatusCode GoToGeometry(const unsigned int geometryNumber);
0055 StatusCode GoToEvent(const unsigned int eventNumber);
0056 StatusCode ReadNextGlobalHeaderComponent();
0057 StatusCode ReadNextGeometryComponent();
0058 StatusCode ReadNextEventComponent();
0059
0060
0061
0062
0063 StatusCode ReadVersion();
0064
0065
0066
0067
0068 StatusCode ReadSubDetector();
0069
0070
0071
0072
0073 StatusCode ReadLArTPC();
0074
0075
0076
0077
0078 StatusCode ReadLineGap();
0079
0080
0081
0082
0083 StatusCode ReadBoxGap();
0084
0085
0086
0087
0088 StatusCode ReadConcentricGap();
0089
0090
0091
0092
0093 StatusCode ReadCaloHit();
0094
0095
0096
0097
0098 StatusCode ReadTrack();
0099
0100
0101
0102
0103 StatusCode ReadMCParticle();
0104
0105
0106
0107
0108 StatusCode ReadRelationship();
0109
0110
0111
0112
0113 StatusCode ReadEventInformation();
0114
0115 TiXmlDocument *m_pXmlDocument;
0116 TiXmlNode *m_pContainerXmlNode;
0117 TiXmlElement *m_pCurrentXmlElement;
0118 bool m_isAtFileStart;
0119 };
0120
0121
0122
0123 template <typename T>
0124 inline StatusCode XmlFileReader::ReadVariable(const std::string &xmlKey, T &t)
0125 {
0126 if (!m_pCurrentXmlElement)
0127 return STATUS_CODE_FAILURE;
0128
0129 return XmlHelper::ReadValue(TiXmlHandle(m_pCurrentXmlElement), xmlKey, t);
0130 }
0131
0132 template <>
0133 inline StatusCode XmlFileReader::ReadVariable(const std::string &xmlKey, IntVector &t)
0134 {
0135 if (!m_pCurrentXmlElement)
0136 return STATUS_CODE_FAILURE;
0137
0138 return XmlHelper::ReadVectorOfValues(TiXmlHandle(m_pCurrentXmlElement), xmlKey, t);
0139 }
0140
0141 template <>
0142 inline StatusCode XmlFileReader::ReadVariable(const std::string &xmlKey, FloatVector &t)
0143 {
0144 if (!m_pCurrentXmlElement)
0145 return STATUS_CODE_FAILURE;
0146
0147 return XmlHelper::ReadVectorOfValues(TiXmlHandle(m_pCurrentXmlElement), xmlKey, t);
0148 }
0149
0150 }
0151
0152 #endif