File indexing completed on 2023-03-17 10:41:53
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 std::vector<unsigned int> lut;
0040 std::vector<uint64_t> mask;
0041 } Config;
0042
0043 LutXml();
0044 LutXml(XERCES_CPP_NAMESPACE::InputSource& _source);
0045 LutXml(std::string filename);
0046 ~LutXml() override;
0047
0048 void init(void);
0049 void addLut(Config& _config, XMLDOMBlock* checksums_xml = nullptr);
0050 std::string& getCurrentBrick(void);
0051
0052 std::vector<unsigned int>* getLutFast(uint32_t det_id);
0053
0054
0055
0056
0057
0058 HcalSubdetector subdet_from_crate(int crate, int slot, int fiber);
0059 int a_to_i(char* inbuf);
0060 int create_lut_map(void);
0061
0062 static std::string get_checksum(std::vector<unsigned int>& lut);
0063
0064
0065
0066
0067
0068 int test_access(std::string filename);
0069
0070
0071
0072
0073 typedef std::map<uint32_t, std::vector<unsigned int> >::const_iterator const_iterator;
0074 const_iterator begin() const;
0075 const_iterator end() const;
0076 const_iterator find(uint32_t) const;
0077
0078 protected:
0079 XMLCh* root;
0080 XMLCh* brick;
0081 XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, std::string _value);
0082 XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, int _value);
0083
0084 template <typename T>
0085 XERCES_CPP_NAMESPACE::DOMElement* addData(std::string _elements, std::string _encoding, const T& _lut);
0086
0087 XERCES_CPP_NAMESPACE::DOMElement* add_checksum(XERCES_CPP_NAMESPACE::DOMDocument* parent, Config& config);
0088
0089 XERCES_CPP_NAMESPACE::DOMElement* brickElem;
0090
0091
0092 std::map<uint32_t, std::vector<unsigned int> > lut_map;
0093 };
0094
0095 #endif