00001 #ifndef L1Trigger_RPCPatternsParser_h 00002 #define L1Trigger_RPCPatternsParser_h 00003 /******************************************************************************* 00004 * * 00005 * Karol Bunkowski * 00006 * Warsaw University 2005 * 00007 * * 00008 *******************************************************************************/ 00009 00010 00011 #include <string> 00012 #include <iostream> 00013 00014 #include <xercesc/sax2/Attributes.hpp> 00015 #include <xercesc/sax2/DefaultHandler.hpp> 00016 00017 #include "L1Trigger/RPCTrigger/interface/RPCConst.h" 00018 #include "CondFormats/L1TObjects/interface/RPCPattern.h" 00019 //#include "L1Trigger/RPCTrigger/interface/RPCException.h" 00020 00021 XERCES_CPP_NAMESPACE_USE 00022 class RPCPatternsParser : public DefaultHandler { 00023 public: 00024 //class SAX2PatHandler : public DefaultHandler { 00025 //public: 00026 // SAX2PatHandler(); 00027 // ~SAX2PatHandler(); 00028 00029 // void startElement(const XMLCh* const uri, const XMLCh* const localname, 00030 // const XMLCh* const qname, const Attributes& attrs); 00031 00032 // void endElement (const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname); 00033 //}; 00034 00035 RPCPatternsParser(); 00036 ~RPCPatternsParser(); 00037 00038 00039 void startElement(const XMLCh* const uri, const XMLCh* const localname, 00040 const XMLCh* const qname, const Attributes& attrs); 00041 00042 void endElement (const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname); 00043 00044 void parse(std::string fileName); 00045 00046 const RPCPattern::RPCPatVec& getPatternsVec(const RPCConst::l1RpcConeCrdnts& coneCrds) const; 00047 00048 const RPCPattern::RPCPatVec& getPatternsVec(const int tower, const int sc, const int sg) const; 00049 00050 const RPCPattern::TQualityVec & getQualityVec() const{ //XXX - clean me! 00051 return m_QualityVec; 00052 }; 00053 00054 00055 private: 00056 //virtual void startElement(const XMLCh* const name, xercesc::AttributeList& attributes); 00057 00058 //virtual void endElement(const XMLCh* const name); 00059 00060 static int m_InstanceCount; 00061 00062 std::string m_CurrElement; 00063 00064 RPCPattern::TQualityVec m_QualityVec; 00065 00066 typedef std::map<RPCConst::l1RpcConeCrdnts, RPCPattern::RPCPatVec> TPatternsVecsMap; 00067 00068 TPatternsVecsMap m_PatternsVecsMap; 00069 00070 TPatternsVecsMap::iterator m_CurPacIt; 00071 00072 RPCPattern m_CurPattern; 00073 }; 00074 00075 #endif