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 
30 
31 class XMLDOMBlock;
32 
33 class HcalLutSet{
34  public:
36  std::vector<std::string> subdet;
38  std::vector<std::vector<unsigned int> > lut;
39 };
40 
41 
42 
44  public:
45 
46  HcalLutManager( );
47  HcalLutManager(std::vector<HcalGenericDetId> & map);
48  HcalLutManager(const HcalElectronicsMap * _emap,
49  const HcalChannelQuality * _cq = nullptr,
50  uint32_t _status_word_to_mask = 0x0000);
51 
52  HcalLutManager(const HcalDbService *conditions,
53  const HcalChannelQuality * _cq = nullptr,
54  uint32_t _status_word_to_mask = 0x0000);
55 
56  ~HcalLutManager( );
57 
58  void init( void );
59  std::string & getLutXml( std::vector<unsigned int> & _lut );
60 
61  // crate=-1 stands for all crates
62  // legacy - use old LMAP. Use the xxxEmap method instead
63  std::map<int, std::shared_ptr<LutXml> > getLutXmlFromAsciiMaster( std::string _filename,
64  std::string _tag,
65  int _crate = -1,
66  bool split_by_crate = true );
67 
68  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromAsciiMasterEmap( 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> > getLinearizationLutXmlFromAsciiMasterEmap_new( std::string _filename,
74  std::string _tag,
75  int _crate,
76  bool split_by_crate = true );
77 
78  std::map<int, std::shared_ptr<LutXml> > getCompressionLutXmlFromAsciiMaster( std::string _filename,
79  std::string _tag,
80  int _crate = -1,
81  bool split_by_crate = true );
82 
83  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromCoder( const HcalTPGCoder & _coder,
84  std::string _tag,
85  bool split_by_crate = true );
86 
87  std::map<int, std::shared_ptr<LutXml> > getMasks(int var, std::string _tag, bool split_by_crate = true );
88 
89  std::map<int, std::shared_ptr<LutXml> > getLinearizationLutXmlFromCoderEmap( const HcalTPGCoder & _coder,
90  std::string _tag,
91  bool split_by_crate = true );
92 
93  std::map<int, std::shared_ptr<LutXml> > getCompressionLutXmlFromCoder( std::string _tag, bool split_by_crate = true );
94 
95  std::map<int, std::shared_ptr<LutXml> > getCompressionLutXmlFromCoder( const CaloTPGTranscoderULUT & _coder,
96  std::string _tag,
97  bool split_by_crate = true );
98 
99  std::map<int, std::shared_ptr<LutXml> > getZdcLutXml( std::string _tag,
100  bool split_by_crate = true );
101 
102  std::map<int, std::shared_ptr<LutXml> > getHEFineGrainLUTs(std::string _tag, bool split_by_crate = true );
103 
104 
105  // add two std::map<s with LUTs. Designed mainly for joining compression LUTs to linearization ones.
106  void addLutMap(std::map<int,
107  std::shared_ptr<LutXml> > & result,
108  const std::map<int,
109  std::shared_ptr<LutXml> > & other);
110 
111  // read LUTs from ASCII master file.
112  HcalLutSet getLutSetFromFile( std::string _filename, int _type = 1 ); // _type = 1 - linearization, 2 - compression
113 
114  int writeLutXmlFiles( std::map<int, std::shared_ptr<LutXml> > & _xml, std::string _tag = "default_tag", bool split_by_crate = true );
115 
116  int createLinLutXmlFiles( std::string _tag, std::string _lin_file, bool split_by_crate = true );
117  int createCompLutXmlFilesFromCoder( std::string _tag, bool split_by_crate = true );
118  int createAllLutXmlFiles( std::string _tag, std::string _lin_file, std::string _comp_file, bool split_by_crate = true );
119  int createAllLutXmlFilesFromCoder( const HcalTPGCoder & _coder, std::string _tag, bool split_by_crate = true );
120  int createLutXmlFiles_HBEFFromCoder_HOFromAscii( std::string _tag, const HcalTPGCoder & _coder, std::string _lin_file, bool split_by_crate = true );
121  int createLutXmlFiles_HBEFFromCoder_HOFromAscii( std::string _tag, const HcalTPGCoder & _coder, const CaloTPGTranscoderULUT & _transcoder, std::string _lin_file, bool split_by_crate = true );
122 
123  int createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC( std::string _tag, const HcalTPGCoder & _coder, const CaloTPGTranscoderULUT & _transcoder, std::string _lin_file, bool split_by_crate = true );
124 
125  int createAllLutXmlFilesLinAsciiCompCoder( std::string _tag, std::string _lin_file, bool split_by_crate = true );
126 
127  // tests
128  // reading LUTs from a local XML
129  int test_xml_access( std::string _tag, std::string _filename );
130  int test_direct_xml_parsing( std::string _filename );
131  void test_emap(void);
132 
133  // connect to local XML file with LUTs and local ASCII file with LMAP
134  // connection interface through protected members db and lmap
135  int read_lmap( std::string lmap_hbef_file, std::string lmap_ho_file );
136  int read_luts( std::string lut_xml_file );
137  int local_connect( std::string lut_xml_file, std::string lmap_hbef_file, std::string lmap_ho_file );
138 
139  // hcal::ConfigurationDatabase::LinearizerLUT
140  // hcal::ConfigurationDatabase::CompressionLUT
141  std::vector<unsigned int> getLutFromXml_old( std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt );
142  std::vector<unsigned int> getLutFromXml( std::string tag, uint32_t _rawid, hcal::ConfigurationDatabase::LUTType _lt );
143 
144  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" );
145 
146  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 );
147 
148  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 );
149 
150  // get md5 checksums for LUTs
151  std::string get_checksum( std::vector<unsigned int> & lut );
152 
153  static int getInt( std::string number );
154  static HcalSubdetector get_subdetector( std::string _subdet );
155  static std::string get_time_stamp( time_t _time );
156 
157  // gives the iterator a list of channels
158  int initChannelIterator(std::vector<HcalGenericDetId> & map);
159 
160  protected:
161 
172 };
173 
174 
176  public:
177 
178  static int getLutXml_test( std::vector<unsigned int> & _lut ){return 0;}
179 
180  static int getLutSetFromFile_test( std::string _filename );
181 
182  static int getInt_test( std::string number );
183 
184  protected:
186 };
187 
188 #endif
std::vector< std::vector< unsigned int > > lut
std::string label
Definition: LutXml.h:27
std::vector< int > phi_max
std::vector< std::string > subdet
static int getLutXml_test(std::vector< unsigned int > &_lut)
int init
Definition: HydjetWrapper.h:67
Various manipulations with trigger Lookup Tables.
std::vector< int > phi_min
std::vector< int > depth_max
int getInt(ResultSet *rset, int ipar)
HCALConfigDB * db
const HcalChannelQuality * cq
std::vector< int > depth_min
HcalSubdetector
Definition: HcalAssistant.h:31
HcalChannelIterator _iter
XMLDOMBlock * lut_checksums_xml
Gather config data from online DB.
Definition: HCALConfigDB.h:21
const HcalElectronicsMap * emap
HcalAssistant _ass
std::vector< int > eta_max
Definition: LMap.h:75
std::vector< int > eta_min
uint32_t status_word_to_mask
const HcalDbService * conditions
#define comment(par)
Definition: vmac.h:163