Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

PipelineTest.h

00001 #ifndef PIPELINETEST_H
00002 #define PIPELINETEST_H
00003 
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/Sct_CalibrationController.hh"
00008 #include "../CalibrationControllerImpl.h"
00009 
00010 #include "../SctApiAccessException.h"
00011 #include "Sct/LogicErrors.h"
00012 #include "../SctApiCall.h"
00013 
00014 #include <CommonWithDsp/ABCD/ABCDscans.h>
00015 #include <iostream>
00016 #include <vector>
00017 
00018 using namespace Sct;
00019 using namespace std;
00020 using namespace SctCalibrationController::Ipc;
00021 using namespace SctCalibrationController;
00022 
00023 namespace SctCalibrationController {
00024 namespace Scripts {
00025     
00026 class PipelineTest : public TestRequestImpl {
00027 public: 
00028     static PipelineTest& instance() {
00029     static PipelineTest rc;
00030     return rc;
00031     }
00032     
00033     virtual void startTest(Sct_SctApi_T_SctApi& inapi, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) { 
00034     this->api = &inapi;
00035 
00036         // Compression mode X1X
00037         APICALL(api, modifyABCDVar(&st, ST_COMPRESSION, 1), "PipelineTest::startTest")
00038 
00039         // Edge detect off
00040         APICALL(api, modifyABCDVar(&st, ST_EDGE_DETECT, 0), "PipelineTest::startTest")
00041 
00042         // No masked channels
00043         APICALL(api, modifyABCDVar(&st, ST_SEND_MASK, 0), "PipelineTest::startTest")
00044 
00045     name = "PipelineTest";
00046     nScans = 2;
00047     testPoints.push_back(0);
00048     testPoints.push_back(1);
00049     testVariable=ST_MASK;
00050     }
00051     
00052     virtual ScanRequest* getNextScan(unsigned long index) {
00053     // Set configuration
00054     APICALL(api, modifyABCDVar(&st, ST_MASK, 3.0*(1-index)), "PipelineTest::getNextScan")
00055 
00056         ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00057         ScanRequestImpl& request = sl.defaultScan();
00058 
00059     // Create scan
00060         Sct_SctApi_T_Scan* s = 0;
00061         APIRETCALL(api, s, createScan(&st), "PipelineTest::getNextScan")
00062         request.setScan(s);
00063 
00064         APICALL(s, setNTrigs(&st, 100), "PipelineTest::getNextScan")
00065 
00066     // Adjust trigger
00067         Sct_SctApi_T_Trigger* t = 0;
00068         APIRETCALL(s, t, getTrigger1(&st), "PipelineTest::getNextScan")
00069 
00070     // 129 is critical to the pulse arriving correctly
00071         APICALL(t, softPulseL1A(&st, 140, 129), "PipelineTest::getNextScan")
00072 
00073     // "Command" 1 is the delay (starting at 140)
00074     APICALL(t, setCommIncr(&st, 1, 1), "PipelineTest::getNextScan")
00075 
00076     // Configure scan
00077     APICALL(s, configure(&st, ST_ELAPSED, 140, 151, 1), "PipelineTest::getNextScan")
00078 
00079     return &request;
00080     }
00081 
00082     virtual bool canFeedback() {
00083     return false;
00084     }
00085 
00086     virtual void endTest() {
00087     api = 0;
00088     }
00089 
00090 private:
00091     PipelineTest() {}
00092     Sct_SctApi_T_SctApi* api;
00093 };
00094 }
00095 }
00096 #endif //PIPELINETEST_H

Generated on Thu Jul 15 09:50:49 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5