Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:17:25

0001 #ifndef CaloOnlineTools_HcalOnlineDb_LutXml_h
0002 #define CaloOnlineTools_HcalOnlineDb_LutXml_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     CaloOnlineTools/HcalOnlineDb
0006 // Class  :     LutXml
0007 //
0008 /**\class LutXml LutXml.h CalibCalorimetry/HcalTPGAlgos/interface/LutXml.h
0009 
0010  Description: <one line class summary>
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Gena Kukartsev, kukarzev@fnal.gov
0018 //         Created:  Tue Mar 18 14:30:33 CDT 2008
0019 //
0020 
0021 #include <vector>
0022 #include <map>
0023 #include "CalibCalorimetry/HcalTPGAlgos/interface/XMLDOMBlock.h"
0024 #include "DataFormats/DetId/interface/DetId.h"
0025 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
0026 #include <cstdint>
0027 
0028 class LutXml : public XMLDOMBlock {
0029 public:
0030   typedef struct _Config {
0031     _Config();
0032     std::string infotype;
0033     int ieta, iphi, depth, crate, slot, topbottom, fiber, fiberchan, lut_type;
0034     std::string creationtag;
0035     std::string creationstamp;
0036     std::string formatrevision;
0037     std::string targetfirmware;
0038     int generalizedindex;
0039     int weight;
0040     int codedvetothreshold;
0041     std::vector<unsigned int> lut;
0042     std::vector<uint64_t> mask;
0043   } Config;
0044 
0045   LutXml();
0046   LutXml(XERCES_CPP_NAMESPACE::InputSource& _source);
0047   LutXml(std::string filename);
0048   ~LutXml() override;
0049 
0050   void init(void);
0051   void addLut(Config& _config, XMLDOMBlock* checksums_xml = nullptr);
0052   std::string& getCurrentBrick(void);
0053 
0054   std::vector<unsigned int>* getLutFast(uint32_t det_id);
0055   //
0056   //_____ following removed as a xalan-c component_____________________
0057   //
0058   //std::vector<unsigned int> getLut( int lut_type, int crate, int slot, int topbottom, int fiber, int fiber_channel );
0059 
0060   DetId detid_from_crate(int crate, int slot, int fiber, int fiberch, bool isTrigger, const HcalElectronicsMap* emap);
0061   int a_to_i(char* inbuf);
0062   int create_lut_map(const HcalElectronicsMap* emap);
0063 
0064   static std::string get_checksum(std::vector<unsigned int>& lut);
0065 
0066   //
0067   //_____ following removed as a xalan-c component_____________________
0068   //
0069   //int test_xpath( std::string filename );
0070   int test_access(std::string filename);
0071 
0072   //LutXml & operator+=( const LutXml & other);
0073 
0074   //Iterators and find
0075   typedef std::map<uint32_t, std::vector<unsigned int> >::const_iterator const_iterator;
0076   const_iterator begin() const;
0077   const_iterator end() const;
0078   const_iterator find(uint32_t) const;
0079 
0080 protected:
0081   XMLCh* root;
0082   XMLCh* brick;
0083   XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, std::string _value);
0084   XERCES_CPP_NAMESPACE::DOMElement* addParameter(std::string _name, std::string _type, int _value);
0085 
0086   template <typename T>
0087   XERCES_CPP_NAMESPACE::DOMElement* addData(std::string _elements, std::string _encoding, const T& _lut);
0088 
0089   XERCES_CPP_NAMESPACE::DOMElement* add_checksum(XERCES_CPP_NAMESPACE::DOMDocument* parent, Config& config);
0090 
0091   XERCES_CPP_NAMESPACE::DOMElement* brickElem;
0092 
0093   //std::map<uint32_t,std::vector<unsigned int> > * lut_map;
0094   std::map<uint32_t, std::vector<unsigned int> > lut_map;
0095 };
0096 
0097 #endif