Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:57

0001 /* -*- C++ -*- */
0002 #ifndef HcalTBSlowDataUnpacker_h_included
0003 #define HcalTBSlowDataUnpacker_h_included 1
0004 
0005 #include "TBDataFormats/HcalTBObjects/interface/HcalTBRunData.h"
0006 #include "TBDataFormats/HcalTBObjects/interface/HcalTBEventPosition.h"
0007 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0008 
0009 #include <map>
0010 #include <string>
0011 
0012 namespace hcaltb {
0013   /** \brief Unpacks "SlowData" packages used for SiPM calibration and other purposes in HCAL Local DAQ.
0014 
0015       To use this code in an analysis module, you need only:
0016 
0017       analyze(const edm::Event& iEvent, const edm::EventSetup&) {
0018       
0019       edm::Handle<edm::FEDRawDataCollection> rawraw;  
0020       iEvent.getByType(rawraw);        
0021 
0022       hcaltb::HcalTBSlowDataUnpacker sdp;
0023       std::map<std::string,std::string> strings;
0024       std::map<std::string,double> numerics;
0025       // if regular slow data
0026       sdp.unpackMaps(rawraw->FEDData(hcaltb::HcalTBSlowDataUnpacker::STANDARD_FED_ID),strings,numerics);
0027       // if SiPM Cal slow data (different 'FED')
0028       sdp.unpackMaps(rawraw->FEDData(hcaltb::HcalTBSlowDataUnpacker::SIPM_CAL_FED_ID),strings,numerics);
0029       
0030   */
0031   class HcalTBSlowDataUnpacker {
0032   public:
0033     HcalTBSlowDataUnpacker(void) {}
0034 
0035     void unpack(const FEDRawData& raw, HcalTBRunData& htbrd, HcalTBEventPosition& htbep) const;
0036 
0037     void unpackMaps(const FEDRawData& raw,
0038                     std::map<std::string, std::string>& strings,
0039                     std::map<std::string, double>& numerics) const;
0040 
0041     static const int STANDARD_FED_ID = 3;
0042     static const int SIPM_CAL_FED_ID = 11;
0043   };
0044 }  // namespace hcaltb
0045 
0046 #endif  // HcalTBSlowDataUnpacker_h_included