RxDelayTest.h

00001 #ifndef SCTCALIBRATIONCONTROLLER_RXDELAYTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_RXDELAYTEST_H
00003 
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/CalibrationController.hh"
00008 
00009 #include "../SctApiAccessException.h"
00010 #include "../SctApiCall.h"
00011 #include "../CalibrationControllerImpl.h"
00012 #include "Sct/LogicErrors.h"
00013 #include "SctApi/extraScans.h"
00014 
00015 #include <Sct/AbcdScans.h>
00016 #include <iostream>
00017 #include <vector>
00018 
00019 using namespace Sct;
00020 using namespace std;
00021 using namespace SctCalibrationController::Ipc;
00022 using namespace SctCalibrationController;
00023 
00024 namespace SctCalibrationController {
00025 namespace Scripts {
00026 
00029 class RxDelayTest : public TestRequestImpl {
00030 private:
00031    static const bool registeredInTestLibrary;
00032 
00033 public: 
00034     static Sct_CalibrationController::TestRequest_ptr instance() {
00035     static RxDelayTest rc;
00036     rc.setFitAlgorithm("NONE");
00037     rc.setAnalysisAlgorithm("RxDelayTest");
00038     return rc._this();
00039     }
00040     
00041     virtual void startTestRealImpl(Sct_SctApi::SctApiIPC_ptr the_api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {  
00042     this->api = Sct_SctApi::SctApiIPC::_duplicate(the_api);
00043         // No masked channels
00044     name = "RxDelayTest";
00045     testVariable = ST_ELAPSED;
00046     nScans = 1;
00047     // put module in clock / 2 mode.
00048     APICALL(api, modifyABCDVar(ST_FEEDTHROUGH, 0), "RxDelayTest::startTest");
00049     testPoints.push_back(nTriggers);
00050     }
00051     
00052     virtual Sct_CalibrationController::ScanRequest_ptr getNextScanRealImpl(unsigned long index) {
00053     Sct_CalibrationController::ScanLibrary_var sl = CalibrationControllerImpl::instance()->getScanLibrary();
00054     const bool issueSoftReset = false;
00055     Sct_CalibrationController::ScanRequest_ptr request = sl->rawScan(nTriggers, issueSoftReset);
00056     // put BOC in sample-at-clock-by-two mode
00057     request->setClockByTwoCorba(true);
00058     Sct_SctApi::Scan_var scan = request->getScanCorba();
00059 
00060     APICALL(scan, configure(ST_RX_DELAY, 0, 24, 1), "Failed to set Scan information")
00061         return request;
00062     }
00063     
00064     virtual bool canFeedbackRealImpl() {
00065     return true;
00066     }
00067     
00068     virtual void endTestRealImpl() {
00069       // put module back in not clock/2 mode
00070         APICALL(api, modifyABCDVar(ST_FEEDTHROUGH, 1), "RxDelayTest::endTest");
00071     api = Sct_SctApi::SctApiIPC::_nil();
00072     }
00073     
00074 private:
00075     RxDelayTest() {}
00076     Sct_SctApi::SctApiIPC_var api;    
00077     static const int nTriggers = 10;
00078 };
00079 }
00080 }
00081 #endif //SCTCALIBRATIONCONTROLLER_RXDELAYTEST_H

Generated on Mon Feb 6 14:01:26 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6