CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CalibCalorimetry/HcalTPGAlgos/interface/LutXml.h

Go to the documentation of this file.
00001 #ifndef CaloOnlineTools_HcalOnlineDb_LutXml_h
00002 #define CaloOnlineTools_HcalOnlineDb_LutXml_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     CaloOnlineTools/HcalOnlineDb
00006 // Class  :     LutXml
00007 // 
00016 //
00017 // Original Author:  Gena Kukartsev, kukarzev@fnal.gov
00018 //         Created:  Tue Mar 18 14:30:33 CDT 2008
00019 // $Id: LutXml.h,v 1.5 2010/08/06 20:24:02 wmtan Exp $
00020 //
00021 
00022 #include <vector>
00023 #include <map>
00024 #include "CalibCalorimetry/HcalTPGAlgos/interface/XMLDOMBlock.h"
00025 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00026 #include <stdint.h>
00027 
00028 class LutXml : public XMLDOMBlock
00029 {
00030   
00031  public:
00032     
00033   typedef struct _Config
00034   {
00035     _Config();
00036     int ieta, iphi, depth, crate, slot, topbottom, fiber, fiberchan, lut_type;
00037     std::string creationtag;
00038     std::string creationstamp;
00039     std::string formatrevision;
00040     std::string targetfirmware;
00041     int generalizedindex;
00042     std::vector<unsigned int> lut;
00043   } Config;
00044   
00045   LutXml();
00046   LutXml( InputSource & _source );
00047   LutXml( std::string filename );
00048   virtual ~LutXml();
00049   
00050   void init( void );
00051   void addLut( Config & _config, XMLDOMBlock * checksums_xml = 0 );
00052   std::string & getCurrentBrick( void );
00053   
00054   std::vector<unsigned int> * getLutFast( uint32_t det_id );
00055   //
00056   //_____ following removed as a xalan-c component_____________________
00057   //
00058   //std::vector<unsigned int> getLut( int lut_type, int crate, int slot, int topbottom, int fiber, int fiber_channel );
00059 
00060   HcalSubdetector subdet_from_crate(int crate, int eta, int depth);
00061   int a_to_i(char * inbuf);
00062   int create_lut_map( void );
00063 
00064   static std::string get_checksum( std::vector<unsigned int> & lut );
00065 
00066   //
00067   //_____ following removed as a xalan-c component_____________________
00068   //
00069   //int test_xpath( std::string filename );
00070   int test_access( std::string filename );
00071 
00072   //LutXml & operator+=( const LutXml & other);
00073 
00074   //Iterators and find
00075   typedef std::map<uint32_t,std::vector<unsigned int> >::const_iterator const_iterator;
00076   const_iterator begin() const;
00077   const_iterator end() const;
00078   const_iterator find(uint32_t) const;
00079 
00080  protected:  
00081 
00082   XMLCh * root;
00083   XMLCh * brick;
00084   DOMElement * addParameter( std::string _name, std::string _type, std::string _value );
00085   DOMElement * addParameter( std::string _name, std::string _type, int _value );
00086   DOMElement * addData( std::string _elements, std::string _encoding, std::vector<unsigned int> _lut );
00087 
00088   DOMElement * add_checksum( DOMDocument * parent, Config & config );
00089 
00090   DOMElement * brickElem;
00091 
00092   //std::map<uint32_t,std::vector<unsigned int> > * lut_map;
00093   std::map<uint32_t,std::vector<unsigned int> > lut_map;
00094 
00095 };
00096 
00097 
00098 #endif