forked from cms-sw/cmssw
/
LutXml.h
94 lines (75 loc) · 2.77 KB
/
LutXml.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef CaloOnlineTools_HcalOnlineDb_LutXml_h
#define CaloOnlineTools_HcalOnlineDb_LutXml_h
// -*- C++ -*-
//
// Package: CaloOnlineTools/HcalOnlineDb
// Class : LutXml
//
/**\class LutXml LutXml.h CalibCalorimetry/HcalTPGAlgos/interface/LutXml.h
Description: <one line class summary>
Usage:
<usage>
*/
//
// Original Author: Gena Kukartsev, kukarzev@fnal.gov
// Created: Tue Mar 18 14:30:33 CDT 2008
//
#include <vector>
#include <map>
#include "CalibCalorimetry/HcalTPGAlgos/interface/XMLDOMBlock.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include <cstdint>
class LutXml : public XMLDOMBlock {
public:
typedef struct _Config {
_Config();
std::string infotype;
int ieta, iphi, depth, crate, slot, topbottom, fiber, fiberchan, lut_type;
std::string creationtag;
std::string creationstamp;
std::string formatrevision;
std::string targetfirmware;
int generalizedindex;
std::vector<unsigned int> lut;
std::vector<uint64_t> mask;
} Config;
LutXml();
LutXml(XERCES_CPP_NAMESPACE::InputSource& _source);
LutXml(std::string filename);
~LutXml() override;
void init(void);
void addLut(Config& _config, XMLDOMBlock* checksums_xml = nullptr);
std::string& getCurrentBrick(void);
std::vector<unsigned int>* getLutFast(uint32_t det_id);
//
//_____ following removed as a xalan-c component_____________________
//
//std::vector<unsigned int> getLut( int lut_type, int crate, int slot, int topbottom, int fiber, int fiber_channel );
HcalSubdetector subdet_from_crate(int crate, int slot, int fiber);
int a_to_i(char* inbuf);
int create_lut_map(void);
static std::string get_checksum(std::vector<unsigned int>& lut);
//
//_____ following removed as a xalan-c component_____________________
//
//int test_xpath( std::string filename );
int test_access(std::string filename);
//LutXml & operator+=( const LutXml & other);
//Iterators and find
typedef std::map<uint32_t, std::vector<unsigned int> >::const_iterator const_iterator;
const_iterator begin() const;
const_iterator end() const;
const_iterator find(uint32_t) const;
protected:
XMLCh* root;
XMLCh* brick;
XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, std::string _value);
XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, int _value);
template <typename T>
XERCES_CPP_NAMESPACE::DOMElement* addData(std::string _elements, std::string _encoding, const T& _lut);
XERCES_CPP_NAMESPACE::DOMElement* add_checksum(XERCES_CPP_NAMESPACE::DOMDocument* parent, Config& config);
XERCES_CPP_NAMESPACE::DOMElement* brickElem;
//std::map<uint32_t,std::vector<unsigned int> > * lut_map;
std::map<uint32_t, std::vector<unsigned int> > lut_map;
};
#endif