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