CMS 3D CMS Logo

HcalLutManager.h
Go to the documentation of this file.
1 #ifndef HcalLutManager_h
2 #define HcalLutManager_h
3 
12 #include <iostream>
13 #include <string>
14 #include <vector>
15 #include <map>
28 
29 class XMLDOMBlock;
30 
31 class HcalLutSet {
32 public:
34  std::vector<std::string> subdet;
36  std::vector<std::vector<unsigned int> > lut;
37 };
38 
40 public:
42  HcalLutManager(std::vector<HcalGenericDetId>& map);
44  const HcalChannelQuality* _cq = nullptr,
45  uint32_t _status_word_to_mask = 0x0000);
46 
48  const HcalChannelQuality* _cq = nullptr,
49  uint32_t _status_word_to_mask = 0x0000);
50 
52 
53  void init(void);
54  std::string& getLutXml(std::vector<unsigned int>& _lut);
55 
56  // crate=-1 stands for all crates
57  // legacy - use old LMAP. Use the xxxEmap method instead
58  std::map<int, std::shared_ptr<LutXml> > getLutXmlFromAsciiMaster(std::string _filename,
59  std::string _tag,
60  int _crate = -1,
61  bool split_by_crate = true);
62 
63  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromAsciiMasterEmap(std::string _filename,
64  std::string _tag,
65  int _crate,
66  bool split_by_crate = true);
67 
68  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromAsciiMasterEmap_new(std::string _filename,
69  std::string _tag,
70  int _crate,
71  bool split_by_crate = true);
72 
73  std::map<int, std::shared_ptr<LutXml> > getCompressionLutXmlFromAsciiMaster(std::string _filename,
74  std::string _tag,
75  int _crate = -1,
76  bool split_by_crate = true);
77 
78  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromCoder(const HcalTPGCoder& _coder,
79  std::string _tag,
80  bool split_by_crate = true);
81 
82  std::map<int, std::shared_ptr<LutXml> > getMasks(int var, std::string _tag, bool split_by_crate = true);
83 
84  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromCoderEmap(const HcalTPGCoder& _coder,
85  std::string _tag,
86  bool split_by_crate = true);
87 
88  std::map<int, std::shared_ptr<LutXml> > getCompressionLutXmlFromCoder(std::string _tag, bool split_by_crate = true);
89 
90  std::map<int, std::shared_ptr<LutXml> > getCompressionLutXmlFromCoder(const CaloTPGTranscoderULUT& _coder,
91  std::string _tag,
92  bool split_by_crate = true);
93 
94  std::map<int, std::shared_ptr<LutXml> > getZdcLutXml(const HcalTPGCoder& _coder,
95  std::string _tag,
96  bool split_by_crate = true,
97  bool ootpu_lut = false);
98 
99  std::map<int, std::shared_ptr<LutXml> > getHEFineGrainLUTs(std::string _tag, bool split_by_crate = true);
100 
101  // add two std::map<s with LUTs. Designed mainly for joining compression LUTs to linearization ones.
102  void addLutMap(std::map<int, std::shared_ptr<LutXml> >& result, const std::map<int, std::shared_ptr<LutXml> >& other);
103 
104  // read LUTs from ASCII master file.
105  HcalLutSet getLutSetFromFile(std::string _filename, int _type = 1); // _type = 1 - linearization, 2 - compression
106 
107  int writeLutXmlFiles(std::map<int, std::shared_ptr<LutXml> >& _xml,
108  std::string _tag = "default_tag",
109  bool split_by_crate = true);
110 
111  int createLinLutXmlFiles(std::string _tag, std::string _lin_file, bool split_by_crate = true);
112  int createCompLutXmlFilesFromCoder(std::string _tag, bool split_by_crate = true);
113  int createAllLutXmlFiles(std::string _tag, std::string _lin_file, std::string _comp_file, bool split_by_crate = true);
114  int createAllLutXmlFilesFromCoder(const HcalTPGCoder& _coder, std::string _tag, bool split_by_crate = true);
116  const HcalTPGCoder& _coder,
117  std::string _lin_file,
118  bool split_by_crate = true);
120  const HcalTPGCoder& _coder,
121  const CaloTPGTranscoderULUT& _transcoder,
122  std::string _lin_file,
123  bool split_by_crate = true);
124 
126  const HcalTPGCoder& _coder,
127  const CaloTPGTranscoderULUT& _transcoder,
128  std::string _lin_file,
129  bool split_by_crate = true);
130 
131  int createAllLutXmlFilesLinAsciiCompCoder(std::string _tag, std::string _lin_file, bool split_by_crate = true);
132 
133  // tests
134  // reading LUTs from a local XML
135  int test_xml_access(std::string _tag, std::string _filename);
136  int test_direct_xml_parsing(std::string _filename);
137  void test_emap(void);
138 
139  // connect to local XML file with LUTs and local ASCII file with LMAP
140  // connection interface through protected members db and lmap
141  int read_lmap(std::string lmap_hbef_file, std::string lmap_ho_file);
142  int read_luts(std::string lut_xml_file);
143  int local_connect(std::string lut_xml_file, std::string lmap_hbef_file, std::string lmap_ho_file);
144 
145  // hcal::ConfigurationDatabase::LinearizerLUT
146  // hcal::ConfigurationDatabase::CompressionLUT
147  std::vector<unsigned int> getLutFromXml_old(std::string tag,
148  uint32_t _rawid,
149  hcal::ConfigurationDatabase::LUTType _lt);
150  std::vector<unsigned int> getLutFromXml(std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt);
151 
152  std::map<int, std::shared_ptr<LutXml> > get_brickSet_from_oracle(
154  const std::string _accessor =
155  "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22");
156 
159  const std::string db_accessor =
160  "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22",
161  bool split_by_crate = true);
162 
163  int create_lut_loader(std::string file_list,
164  std::string _prefix,
165  std::string tag_name,
166  std::string comment = "default comment",
167  std::string version = "V00-01-01",
168  int subversion = 1);
169 
170  // get md5 checksums for LUTs
171  std::string get_checksum(std::vector<unsigned int>& lut);
172 
173  static int getInt(std::string number);
175  static std::string get_time_stamp(time_t _time);
176 
177  // gives the iterator a list of channels
178  int initChannelIterator(std::vector<HcalGenericDetId>& map);
179 
180 protected:
191 };
192 
194 public:
195  static int getLutXml_test(std::vector<unsigned int>& _lut) { return 0; }
196 
197  static int getLutSetFromFile_test(std::string _filename);
198 
199  static int getInt_test(std::string number);
200 
201 protected:
203 };
204 
205 #endif
static int getInt_test(std::string number)
int initChannelIterator(std::vector< HcalGenericDetId > &map)
std::vector< std::vector< unsigned int > > lut
std::string label
Definition: LutXml.h:27
static int getLutSetFromFile_test(std::string _filename)
std::vector< int > phi_max
int createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC(std::string _tag, const HcalTPGCoder &_coder, const CaloTPGTranscoderULUT &_transcoder, std::string _lin_file, bool split_by_crate=true)
std::map< int, std::shared_ptr< LutXml > > getZdcLutXml(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true, bool ootpu_lut=false)
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromCoderEmap(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true)
std::vector< std::string > subdet
static int getLutXml_test(std::vector< unsigned int > &_lut)
Various manipulations with trigger Lookup Tables.
std::string & getLutXml(std::vector< unsigned int > &_lut)
std::vector< int > phi_min
std::vector< int > depth_max
int get_xml_files_from_db(std::string tag, const std::string db_accessor="occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22", bool split_by_crate=true)
std::map< int, std::shared_ptr< LutXml > > getCompressionLutXmlFromCoder(std::string _tag, bool split_by_crate=true)
static HcalSubdetector get_subdetector(std::string _subdet)
void addLutMap(std::map< int, std::shared_ptr< LutXml > > &result, const std::map< int, std::shared_ptr< LutXml > > &other)
int createCompLutXmlFilesFromCoder(std::string _tag, bool split_by_crate=true)
int createLinLutXmlFiles(std::string _tag, std::string _lin_file, bool split_by_crate=true)
std::map< int, std::shared_ptr< LutXml > > getCompressionLutXmlFromAsciiMaster(std::string _filename, std::string _tag, int _crate=-1, bool split_by_crate=true)
std::string get_checksum(std::vector< unsigned int > &lut)
HCALConfigDB * db
int test_direct_xml_parsing(std::string _filename)
const HcalChannelQuality * cq
int writeLutXmlFiles(std::map< int, std::shared_ptr< LutXml > > &_xml, std::string _tag="default_tag", bool split_by_crate=true)
int read_luts(std::string lut_xml_file)
std::vector< int > depth_min
HcalSubdetector
Definition: HcalAssistant.h:31
HcalLutSet getLutSetFromFile(std::string _filename, int _type=1)
HcalChannelIterator _iter
void init(void)
XMLDOMBlock * lut_checksums_xml
std::map< int, std::shared_ptr< LutXml > > getLutXmlFromAsciiMaster(std::string _filename, std::string _tag, int _crate=-1, bool split_by_crate=true)
Gather config data from online DB.
Definition: HCALConfigDB.h:20
const HcalElectronicsMap * emap
int test_xml_access(std::string _tag, std::string _filename)
int create_lut_loader(std::string file_list, std::string _prefix, std::string tag_name, std::string comment="default comment", std::string version="V00-01-01", int subversion=1)
int createAllLutXmlFiles(std::string _tag, std::string _lin_file, std::string _comp_file, bool split_by_crate=true)
std::map< int, std::shared_ptr< LutXml > > getHEFineGrainLUTs(std::string _tag, bool split_by_crate=true)
HcalAssistant _ass
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromAsciiMasterEmap_new(std::string _filename, std::string _tag, int _crate, bool split_by_crate=true)
static int getInt(std::string number)
static std::string get_time_stamp(time_t _time)
int local_connect(std::string lut_xml_file, std::string lmap_hbef_file, std::string lmap_ho_file)
std::vector< unsigned int > getLutFromXml(std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt)
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromAsciiMasterEmap(std::string _filename, std::string _tag, int _crate, bool split_by_crate=true)
int createAllLutXmlFilesLinAsciiCompCoder(std::string _tag, std::string _lin_file, bool split_by_crate=true)
std::vector< int > eta_max
int read_lmap(std::string lmap_hbef_file, std::string lmap_ho_file)
std::map< int, std::shared_ptr< LutXml > > getMasks(int var, std::string _tag, bool split_by_crate=true)
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromCoder(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true)
Definition: LMap.h:66
int createLutXmlFiles_HBEFFromCoder_HOFromAscii(std::string _tag, const HcalTPGCoder &_coder, std::string _lin_file, bool split_by_crate=true)
std::vector< int > eta_min
std::map< int, std::shared_ptr< LutXml > > get_brickSet_from_oracle(std::string tag, const std::string _accessor="occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22")
uint32_t status_word_to_mask
int createAllLutXmlFilesFromCoder(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true)
void test_emap(void)
std::vector< unsigned int > getLutFromXml_old(std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt)
const HcalDbService * conditions