File indexing completed on 2024-04-06 11:58:10
0001 #ifndef CaloOnlineTools_HcalOnlineDb_LutXml_h
0002 #define CaloOnlineTools_HcalOnlineDb_LutXml_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <vector>
0022 #include <map>
0023 #include "CalibCalorimetry/HcalTPGAlgos/interface/XMLDOMBlock.h"
0024 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0025 #include <cstdint>
0026
0027 class LutXml : public XMLDOMBlock {
0028 public:
0029 typedef struct _Config {
0030 _Config();
0031 std::string infotype;
0032 int ieta, iphi, depth, crate, slot, topbottom, fiber, fiberchan, lut_type;
0033 std::string creationtag;
0034 std::string creationstamp;
0035 std::string formatrevision;
0036 std::string targetfirmware;
0037 int generalizedindex;
0038 int weight;
0039 int codedvetothreshold;
0040 std::vector<unsigned int> lut;
0041 std::vector<uint64_t> mask;
0042 } Config;
0043
0044 LutXml();
0045 LutXml(XERCES_CPP_NAMESPACE::InputSource& _source);
0046 LutXml(std::string filename);
0047 ~LutXml() override;
0048
0049 void init(void);
0050 void addLut(Config& _config, XMLDOMBlock* checksums_xml = nullptr);
0051 std::string& getCurrentBrick(void);
0052
0053 std::vector<unsigned int>* getLutFast(uint32_t det_id);
0054
0055
0056
0057
0058
0059 HcalSubdetector subdet_from_crate(int crate, int slot, int fiber);
0060 int a_to_i(char* inbuf);
0061 int create_lut_map(void);
0062
0063 static std::string get_checksum(std::vector<unsigned int>& lut);
0064
0065
0066
0067
0068
0069 int test_access(std::string filename);
0070
0071
0072
0073
0074 typedef std::map<uint32_t, std::vector<unsigned int> >::const_iterator const_iterator;
0075 const_iterator begin() const;
0076 const_iterator end() const;
0077 const_iterator find(uint32_t) const;
0078
0079 protected:
0080 XMLCh* root;
0081 XMLCh* brick;
0082 XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, std::string _value);
0083 XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, int _value);
0084
0085 template <typename T>
0086 XERCES_CPP_NAMESPACE::DOMElement* addData(std::string _elements, std::string _encoding, const T& _lut);
0087
0088 XERCES_CPP_NAMESPACE::DOMElement* add_checksum(XERCES_CPP_NAMESPACE::DOMDocument* parent, Config& config);
0089
0090 XERCES_CPP_NAMESPACE::DOMElement* brickElem;
0091
0092
0093 std::map<uint32_t, std::vector<unsigned int> > lut_map;
0094 };
0095
0096 #endif