Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef ROC_READOUTAPPLICATION_H
00015 #define ROC_READOUTAPPLICATION_H
00016
00017 #include "dabc/Application.h"
00018 #include "dabc/threads.h"
00019 #include "dabc/MemoryPool.h"
00020 #include "dabc/Manager.h"
00021 #include "dabc/Module.h"
00022
00023 #include "roc/Factory.h"
00024 #include "roc/Board.h"
00025 #include "roc/Commands.h"
00026 #include "roc/BoardsVector.h"
00027
00028
00029
00030
00031 namespace roc {
00032
00033 class ReadoutApplication : public dabc::Application {
00034 public:
00035 ReadoutApplication();
00036 virtual ~ReadoutApplication();
00037
00038 virtual bool IsModulesRunning();
00039
00040
00042 bool DoRawReadout() const { return fRawReadout; }
00043
00045 bool DoSuperCombiner() const { return fSuperCombiner; }
00046
00048 int NumRocs() const { return Par(roc::xmlNumRocs).AsInt(1); }
00049
00051 std::string RocAddr(int index = 0) const;
00052
00054 int NumSusibo() const { return Par(roc::xmlNumSusibo).AsInt(0); }
00055
00057 int SusiboAddr(int index = 0) const;
00058
00060 int NumSlaves() const { return Par(roc::xmlNumSlaves).AsInt(0); }
00061
00063 std::string SlaveAddr(int index = 0) const;
00064
00066 int NumMbs() const { return Par(roc::xmlNumMbs).AsInt(0); }
00067
00069 std::string MbsAddr(int index = 0) const;
00070
00072 int NumTRBs() const { return Par(roc::xmlNumTRBs).AsInt(0); }
00073
00075 std::string TRBAddr(int index = 0) const;
00076
00078 std::string DataServerKind() const;
00079
00080 std::string OutputFileName() const { return Par(xmlRawFile).AsStdStr(); }
00081
00082 std::string EpicsStreamNode() const { return Par(roc::xmlEpicsStreamNode).AsStdStr(); }
00083
00084 std::string EpicsTransportNode() const { return Par(roc::xmlEpicsTransportNode).AsStdStr(); }
00085
00086 virtual bool CreateAppModules();
00087
00088 virtual bool AfterAppModulesStopped();
00089
00090 virtual bool BeforeAppModulesDestroyed();
00091
00092 virtual int SMCommandTimeout() const { return 20; }
00093
00094 virtual int ExecuteCommand(dabc::Command cmd);
00095
00096 bool CreateRawOpticInput(const std::string& portname, const std::string& rocaddr, bool isfirstoptic, int numoptics);
00097
00098 bool CreateRawUdpInput(const std::string& portname, const std::string& rocaddr, int rocindx);
00099
00100 static bool CreateRocCombiner(const char* modulename,
00101 bool bnetmode,
00102 const char* inppoolname,
00103 const char* outpoolname,
00104 unsigned buffersize,
00105 int numoutputs,
00106 bool skiperrordata,
00107 roc::BoardsVector& brds);
00108
00109 protected:
00110
00111 roc::BoardsVector fRocBrds;
00113 enum ECalibrationState { calNONE, calOFF, calON };
00114
00115 bool fRawReadout;
00116 bool fSuperCombiner;
00117 bool fDoMeasureADC;
00118 bool fCheckSlavesConn;
00119 int fFirstSlavePort;
00120 bool fMasterNode;
00121 std::string fServerOutPort;
00122 std::string fFileOutPort;
00124 ECalibrationState fCalibrState;
00125
00126 bool SwitchCalibrationMode(bool on);
00127
00128 bool ConnectSlave(int nslave, int ninp);
00129
00130 virtual void ProcessParameterEvent(const dabc::ParameterEvent& evnt);
00131
00132 virtual double ProcessTimeout(double last_diff);
00133
00134 bool StartFile(const std::string& filename);
00135 bool StopFile();
00136
00137 int NumOpticRocs();
00138 int NumUdpRocs();
00139
00140
00141
00142
00143 };
00144 }
00145
00146 #endif