00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ROSFADCREADOUTTOOL_H_QWST9VOD
00014 #define ROSFADCREADOUTTOOL_H_QWST9VOD
00015
00016 #include "ReadoutSim/IROsFadcReadoutTool.h"
00017 #include "Event/ElecFeeCrate.h"
00018
00019 #include "GaudiAlg/GaudiTool.h"
00020
00021 namespace DayaBay{
00022 class ReadoutPmtCrate;
00023 }
00024
00025 class ROsFadcReadoutTool : public GaudiTool, virtual public IROsFadcReadoutTool
00026 {
00027 public:
00028
00029 ROsFadcReadoutTool(const std::string& type,
00030 const std::string& name,
00031 const IInterface* parent);
00032
00033 virtual ~ROsFadcReadoutTool();
00034
00035 virtual StatusCode readoutFADC(const DayaBay::ElecFeeCrate *elecCrate,
00036 DayaBay::ReadoutPmtCrate *roCrate,
00037 unsigned int startCycle, unsigned int stopCycle);
00038
00039 virtual StatusCode initialize();
00040 virtual StatusCode finalize();
00041
00042 private:
00043 typedef std::map<int,DayaBay::AnalogSignal> analogFADCmap;
00044
00045
00046 int m_simFrequency;
00047
00048 int m_eSumFrequency;
00049
00050 int m_fadcFrequency;
00051 double m_adcRange;
00052 double m_adcBits;
00053 double m_adcOffset;
00054
00055 private:
00056
00057 double linearInterpolate(double y1, double y2, double mu, double leftPoint, double rightPoint);
00058
00059 StatusCode fillFadcMap(const DayaBay::ElecFeeCrate::AnalogMap& input,
00060 analogFADCmap& output);
00061
00062 StatusCode upsample(const DayaBay::AnalogSignal& signal,
00063 DayaBay::AnalogSignal& output,
00064 int inputFrequency,
00065 int outputFrequency, int start, int stop);
00066
00067 StatusCode digitize(const DayaBay::AnalogSignal& signal,
00068 DayaBay::DigitalSignal& output,
00069 double range, double bits, double offset);
00070
00071 const int getFadcInputChId(const DayaBay::FeeChannelId& boardId);
00072
00073 };
00074
00075 #endif