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(std::string _tag, bool split_by_crate = true);
95 
96  std::map<int, std::shared_ptr<LutXml> > getHEFineGrainLUTs(std::string _tag, bool split_by_crate = true);
97 
98  // add two std::map<s with LUTs. Designed mainly for joining compression LUTs to linearization ones.
99  void addLutMap(std::map<int, std::shared_ptr<LutXml> >& result, const std::map<int, std::shared_ptr<LutXml> >& other);
100 
101  // read LUTs from ASCII master file.
102  HcalLutSet getLutSetFromFile(std::string _filename, int _type = 1); // _type = 1 - linearization, 2 - compression
103 
104  int writeLutXmlFiles(std::map<int, std::shared_ptr<LutXml> >& _xml,
105  std::string _tag = "default_tag",
106  bool split_by_crate = true);
107 
108  int createLinLutXmlFiles(std::string _tag, std::string _lin_file, bool split_by_crate = true);
109  int createCompLutXmlFilesFromCoder(std::string _tag, bool split_by_crate = true);
110  int createAllLutXmlFiles(std::string _tag, std::string _lin_file, std::string _comp_file, bool split_by_crate = true);
111  int createAllLutXmlFilesFromCoder(const HcalTPGCoder& _coder, std::string _tag, bool split_by_crate = true);
113  const HcalTPGCoder& _coder,
114  std::string _lin_file,
115  bool split_by_crate = true);
117  const HcalTPGCoder& _coder,
118  const CaloTPGTranscoderULUT& _transcoder,
119  std::string _lin_file,
120  bool split_by_crate = true);
121 
123  const HcalTPGCoder& _coder,
124  const CaloTPGTranscoderULUT& _transcoder,
125  std::string _lin_file,
126  bool split_by_crate = true);
127 
128  int createAllLutXmlFilesLinAsciiCompCoder(std::string _tag, std::string _lin_file, bool split_by_crate = true);
129 
130  // tests
131  // reading LUTs from a local XML
132  int test_xml_access(std::string _tag, std::string _filename);
133  int test_direct_xml_parsing(std::string _filename);
134  void test_emap(void);
135 
136  // connect to local XML file with LUTs and local ASCII file with LMAP
137  // connection interface through protected members db and lmap
138  int read_lmap(std::string lmap_hbef_file, std::string lmap_ho_file);
139  int read_luts(std::string lut_xml_file);
140  int local_connect(std::string lut_xml_file, std::string lmap_hbef_file, std::string lmap_ho_file);
141 
142  // hcal::ConfigurationDatabase::LinearizerLUT
143  // hcal::ConfigurationDatabase::CompressionLUT
144  std::vector<unsigned int> getLutFromXml_old(std::string tag,
145  uint32_t _rawid,
146  hcal::ConfigurationDatabase::LUTType _lt);
147  std::vector<unsigned int> getLutFromXml(std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt);
148 
149  std::map<int, std::shared_ptr<LutXml> > get_brickSet_from_oracle(
151  const std::string _accessor =
152  "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22");
153 
156  const std::string db_accessor =
157  "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22",
158  bool split_by_crate = true);
159 
160  int create_lut_loader(std::string file_list,
161  std::string _prefix,
162  std::string tag_name,
163  std::string comment = "default comment",
164  std::string version = "V00-01-01",
165  int subversion = 1);
166 
167  // get md5 checksums for LUTs
168  std::string get_checksum(std::vector<unsigned int>& lut);
169 
170  static int getInt(std::string number);
172  static std::string get_time_stamp(time_t _time);
173 
174  // gives the iterator a list of channels
175  int initChannelIterator(std::vector<HcalGenericDetId>& map);
176 
177 protected:
188 };
189 
191 public:
192  static int getLutXml_test(std::vector<unsigned int>& _lut) { return 0; }
193 
194  static int getLutSetFromFile_test(std::string _filename);
195 
196  static int getInt_test(std::string number);
197 
198 protected:
200 };
201 
202 #endif
HcalLutManager::local_connect
int local_connect(std::string lut_xml_file, std::string lmap_hbef_file, std::string lmap_ho_file)
Definition: HcalLutManager.cc:1388
HcalLutManager::createAllLutXmlFilesFromCoder
int createAllLutXmlFilesFromCoder(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:1166
HcalLutManager::createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC
int createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC(std::string _tag, const HcalTPGCoder &_coder, const CaloTPGTranscoderULUT &_transcoder, std::string _lin_file, bool split_by_crate=true)
Definition: HcalLutManager.cc:1675
HcalLutManager::test_direct_xml_parsing
int test_direct_xml_parsing(std::string _filename)
Definition: HcalLutManager.cc:1643
HcalLutManager::createLinLutXmlFiles
int createLinLutXmlFiles(std::string _tag, std::string _lin_file, bool split_by_crate=true)
Definition: HcalLutManager.cc:1104
HcalChannelIterator
Definition: HcalChannelIterator.h:26
LMap.h
HcalLutManager::_ass
HcalAssistant _ass
Definition: HcalLutManager.h:183
LMap
Definition: LMap.h:66
HcalLutManager::getLinearizationLutXmlFromCoderEmap
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromCoderEmap(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:757
HcalChannelIterator.h
HCALConfigDB.h
AllObjects.h
HcalLutManager_test::getLutXml_test
static int getLutXml_test(std::vector< unsigned int > &_lut)
Definition: HcalLutManager.h:192
HcalLutManager::getCompressionLutXmlFromAsciiMaster
std::map< int, std::shared_ptr< LutXml > > getCompressionLutXmlFromAsciiMaster(std::string _filename, std::string _tag, int _crate=-1, bool split_by_crate=true)
Definition: HcalLutManager.cc:515
HcalLutManager::createAllLutXmlFiles
int createAllLutXmlFiles(std::string _tag, std::string _lin_file, std::string _comp_file, bool split_by_crate=true)
Definition: HcalLutManager.cc:1122
HcalLutSet::eta_min
std::vector< int > eta_min
Definition: HcalLutManager.h:35
HcalGenericDetId.h
HcalLutManager::getMasks
std::map< int, std::shared_ptr< LutXml > > getMasks(int var, std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:683
HcalChannelQuality
Definition: HcalChannelQuality.h:17
HcalLutManager::createCompLutXmlFilesFromCoder
int createCompLutXmlFilesFromCoder(std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:1149
HcalLutManager::cq
const HcalChannelQuality * cq
Definition: HcalLutManager.h:185
HcalLutManager::status_word_to_mask
uint32_t status_word_to_mask
Definition: HcalLutManager.h:187
LutXml.h
HcalLutManager_test::lut_xml
LutXml * lut_xml
Definition: HcalLutManager.h:199
HcalLutManager::create_lut_loader
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)
Definition: HcalLutManager.cc:1543
XMLDOMBlock
Definition: XMLDOMBlock.h:39
HcalLutSet::eta_max
std::vector< int > eta_max
Definition: HcalLutManager.h:35
HcalTPGCoder
Definition: HcalTPGCoder.h:26
HcalLutManager::addLutMap
void addLutMap(std::map< int, std::shared_ptr< LutXml > > &result, const std::map< int, std::shared_ptr< LutXml > > &other)
Definition: HcalLutManager.cc:1273
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
HcalLutSet::lut
std::vector< std::vector< unsigned int > > lut
Definition: HcalLutManager.h:36
HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromAsciiMasterEmap(std::string _filename, std::string _tag, int _crate, bool split_by_crate=true)
Definition: HcalLutManager.cc:339
HcalLutSet::phi_max
std::vector< int > phi_max
Definition: HcalLutManager.h:35
HcalLutSet::depth_min
std::vector< int > depth_min
Definition: HcalLutManager.h:35
HcalLutManager::lmap
LMap * lmap
Definition: HcalLutManager.h:181
HcalFinegrainBit.h
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
HcalAssistant.h
HcalLutManager::get_checksum
std::string get_checksum(std::vector< unsigned int > &lut)
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
HcalLutManager::lut_xml
LutXml * lut_xml
Definition: HcalLutManager.h:178
HcalLutManager::emap
const HcalElectronicsMap * emap
Definition: HcalLutManager.h:184
HcalLutManager::get_time_stamp
static std::string get_time_stamp(time_t _time)
Definition: HcalLutManager.cc:1285
trackingPlots.other
other
Definition: trackingPlots.py:1460
HcalLutManager_test::getLutSetFromFile_test
static int getLutSetFromFile_test(std::string _filename)
Definition: HcalLutManager.cc:133
HcalLutManager::writeLutXmlFiles
int writeLutXmlFiles(std::map< int, std::shared_ptr< LutXml > > &_xml, std::string _tag="default_tag", bool split_by_crate=true)
Definition: HcalLutManager.cc:1089
CaloTPGTranscoderULUT.h
HcalLutManager::_iter
HcalChannelIterator _iter
Definition: HcalLutManager.h:182
HcalAssistant
Definition: HcalAssistant.h:43
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HCALConfigDB
Gather config data from online DB.
Definition: HCALConfigDB.h:20
HcalLutManager::get_xml_files_from_db
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)
Definition: HcalLutManager.cc:1455
HcalLutManager::createLutXmlFiles_HBEFFromCoder_HOFromAscii
int createLutXmlFiles_HBEFFromCoder_HOFromAscii(std::string _tag, const HcalTPGCoder &_coder, std::string _lin_file, bool split_by_crate=true)
Definition: HcalLutManager.cc:1222
HcalLutManager::getLutFromXml_old
std::vector< unsigned int > getLutFromXml_old(std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt)
Definition: HcalLutManager.cc:1405
HcalLutManager::test_xml_access
int test_xml_access(std::string _tag, std::string _filename)
Definition: HcalLutManager.cc:1294
HcalLutManager::read_luts
int read_luts(std::string lut_xml_file)
Definition: HcalLutManager.cc:1381
HcalLutManager::getLutXml
std::string & getLutXml(std::vector< unsigned int > &_lut)
Definition: HcalLutManager.cc:95
HcalLutManager::createAllLutXmlFilesLinAsciiCompCoder
int createAllLutXmlFilesLinAsciiCompCoder(std::string _tag, std::string _lin_file, bool split_by_crate=true)
Definition: HcalLutManager.cc:1252
HcalLutManager::initChannelIterator
int initChannelIterator(std::vector< HcalGenericDetId > &map)
Definition: HcalLutManager.cc:90
HcalLutManager::~HcalLutManager
~HcalLutManager()
Definition: HcalLutManager.cc:83
HcalLutManager::getLutSetFromFile
HcalLutSet getLutSetFromFile(std::string _filename, int _type=1)
Definition: HcalLutManager.cc:170
HcalLutManager::getZdcLutXml
std::map< int, std::shared_ptr< LutXml > > getZdcLutXml(std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:1717
HcalLutManager::conditions
const HcalDbService * conditions
Definition: HcalLutManager.h:186
HcalSubdetector.h
HcalLutSet::phi_min
std::vector< int > phi_min
Definition: HcalLutManager.h:35
HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap_new
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromAsciiMasterEmap_new(std::string _filename, std::string _tag, int _crate, bool split_by_crate=true)
Definition: HcalLutManager.cc:435
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalLutManager::db
HCALConfigDB * db
Definition: HcalLutManager.h:180
HcalLutManager::HcalLutManager
HcalLutManager()
Definition: HcalLutManager.cc:46
HcalLutManager::get_subdetector
static HcalSubdetector get_subdetector(std::string _subdet)
Definition: HcalLutManager.cc:117
HcalDbService
Definition: HcalDbService.h:26
HcalLutManager
Various manipulations with trigger Lookup Tables.
Definition: HcalLutManager.h:39
HcalLutManager::get_brickSet_from_oracle
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")
Definition: HcalLutManager.cc:1472
HcalLutSet::label
std::string label
Definition: HcalLutManager.h:33
HcalLutManager_test::getInt_test
static int getInt_test(std::string number)
HcalLutManager::getInt
static int getInt(std::string number)
Definition: HcalLutManager.cc:111
HcalLutManager::lut_checksums_xml
XMLDOMBlock * lut_checksums_xml
Definition: HcalLutManager.h:179
HcalLutSet::depth_max
std::vector< int > depth_max
Definition: HcalLutManager.h:35
HcalDbService.h
HcalLutManager::read_lmap
int read_lmap(std::string lmap_hbef_file, std::string lmap_ho_file)
Definition: HcalLutManager.cc:1371
HcalLutManager::init
void init(void)
Definition: HcalLutManager.cc:72
mps_fire.result
result
Definition: mps_fire.py:311
genParticles_cff.map
map
Definition: genParticles_cff.py:11
HcalLutManager::getLutXmlFromAsciiMaster
std::map< int, std::shared_ptr< LutXml > > getLutXmlFromAsciiMaster(std::string _filename, std::string _tag, int _crate=-1, bool split_by_crate=true)
Definition: HcalLutManager.cc:253
HcalLutManager_test
Definition: HcalLutManager.h:190
LutXml
Definition: LutXml.h:27
HcalLutSet::subdet
std::vector< std::string > subdet
Definition: HcalLutManager.h:34
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
HcalLutManager::getLinearizationLutXmlFromCoder
std::map< int, std::shared_ptr< LutXml > > getLinearizationLutXmlFromCoder(const HcalTPGCoder &_coder, std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:601
CaloTPGTranscoderULUT
Definition: CaloTPGTranscoderULUT.h:18
HcalLutManager::test_emap
void test_emap(void)
Definition: HcalLutManager.cc:1618
HcalLutSet
Definition: HcalLutManager.h:31
HcalTPGCoder.h
HcalLutManager::getHEFineGrainLUTs
std::map< int, std::shared_ptr< LutXml > > getHEFineGrainLUTs(std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:835
HcalLutManager::getLutFromXml
std::vector< unsigned int > getLutFromXml(std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt)
Definition: HcalLutManager.cc:1394
HcalLutManager::getCompressionLutXmlFromCoder
std::map< int, std::shared_ptr< LutXml > > getCompressionLutXmlFromCoder(std::string _tag, bool split_by_crate=true)
Definition: HcalLutManager.cc:1010