RxThresholdTest.h

00001 #ifndef SCTCALIBRATIONCONTROLLER_RXTHRESHOLDTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_RXTHRESHOLDTEST_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 RxThresholdTest : public TestRequestImpl {
00030 private:
00031    static const bool registeredInTestLibrary;
00032 
00033 public: 
00034     static Sct_CalibrationController::TestRequest_ptr instance() {
00035     static RxThresholdTest rc;
00036     rc.setFitAlgorithm("NONE");
00037     rc.setAnalysisAlgorithm("RxThresholdTest");
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 = "RxThresholdTest";
00045     testVariable = ST_ELAPSED;
00046     nScans = 1;
00047     // put in clock / 2 mode.
00048     APICALL(api, modifyABCDVar(ST_FEEDTHROUGH, 0), "RxThresholdTest::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     Sct_SctApi::Scan_var scan = request->getScanCorba();
00057     
00058     APICALL(scan, configure(ST_RX_THRESHOLD, 0, 255, 5), "Failed to set Scan information")
00059         return request;
00060     }
00061     
00062     virtual bool canFeedbackRealImpl() {
00063     return true;
00064     }
00065     
00066     virtual void endTestRealImpl() {
00067       // put back in not clock/2 mode
00068         APICALL(api, modifyABCDVar(ST_FEEDTHROUGH, 1), "RxThresholdTest::startTest");
00069     api = Sct_SctApi::SctApiIPC::_nil();
00070     }
00071 
00072 private:
00073     RxThresholdTest() {}
00074     Sct_SctApi::SctApiIPC_var api;    
00075     static const int nTriggers = 10;
00076 };
00077 }
00078 }
00079 #endif //SCTCALIBRATIONCONTROLLER_RXTHRESHOLDTEST_H

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