00001 00007 #ifndef _FLOATINGDAQFEEPEDESTALSVC_H_ 00008 #define _FLOATINGDAQFEEPEDESTALSVC_H_ 00009 00010 #include "FloatingFeePedestalSvc/IFloatingFeePedestalSvc.h" 00011 #include "GaudiKernel/Service.h" 00012 00013 #include <map> 00014 #include <list> 00015 00016 namespace DayaBay{ 00017 class ReadoutHeader; 00018 class FeeChannelId; 00019 00020 } 00021 00022 class FloatingDaqFeePedestalSvc : public Service, 00023 virtual public IFloatingFeePedestalSvc 00024 { 00025 00026 public: 00027 // Service interface implementation 00028 FloatingDaqFeePedestalSvc(const std::string& name, ISvcLocator *svc); 00029 ~FloatingDaqFeePedestalSvc(); 00030 virtual StatusCode initialize(); 00031 virtual StatusCode finalize(); 00032 virtual StatusCode queryInterface(const InterfaceID& riid, 00033 void** ppvInterface); 00034 00035 00036 // Record the preAdc value from past events, 00037 StatusCode cumulate( const DayaBay::ReadoutHeader* rh ); 00038 00039 // Return the FEE Calibration data. Return negative value when error. 00040 double pedestal( const DayaBay::FeeChannelId& channelId, 00041 int gain ) const; 00042 00044 typedef std::map<DayaBay::FeeChannelId, std::list<float> > PreAdcArray; 00045 typedef std::map<DayaBay::FeeChannelId, double > PedestalArray; 00046 00047 private: 00049 double m_limit; 00050 00051 double m_timeCutInSec; 00052 TimeStamp m_lastTrig; 00053 00054 PreAdcArray m_finePreAdc; 00055 PreAdcArray m_crsePreAdc; 00056 00057 PedestalArray m_finePedes; 00058 PedestalArray m_crsePedes; 00059 00060 double updatePedestal( std::list<float>& PreAdcs, float newPreAdc ); 00061 00062 }; 00063 00064 #endif // _FLOATINGDAQFEEPEDESTALSVC_H_