TxCurrentTest.h

00001 #ifndef SCTCALIBRATIONCONTROLLER_TXCURRENTTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_TXCURRENTTEST_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     
00027 class TxCurrentTest : public TestRequestImpl {
00028 private:
00029    static const bool registeredInTestLibrary;
00030 
00031 public:
00032    static Sct_CalibrationController::TestRequest_ptr instance() {
00033     static TxCurrentTest rt;
00034     rt.setAnalysisAlgorithm("TxCurrentTest");
00035     rt.setFitAlgorithm("NONE");
00036     return rt._this();
00037     }
00038    
00039    virtual void startTestRealImpl(Sct_SctApi::SctApiIPC_ptr the_api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {   
00040      this->api = Sct_SctApi::SctApiIPC::_duplicate(the_api);
00041      // No masked channels
00042      name = "TxCurrentTest";
00043      testVariable = ST_ELAPSED;
00044      nScans = 1;
00045      testPoints.push_back(nTriggers);
00046    }
00047    
00048    virtual Sct_CalibrationController::ScanRequest_ptr getNextScanRealImpl(unsigned long index) {
00049      Sct_CalibrationController::ScanLibrary_var sl = CalibrationControllerImpl::instance()->getScanLibrary();
00050      const bool issueSoftReset = true;
00051      Sct_CalibrationController::ScanRequest_ptr request = sl->rawScan(nTriggers, issueSoftReset);
00052      Sct_SctApi::Scan_var scan = request->getScanCorba();
00053        // Number of bytes to read from the conf register: There should be about 210 ish bytes.  We will read a few more just so we have some elbow room.  Rather arbitrarily, then we chose to read 256 bits:
00054      const int bitsToRead = 256;
00055      request->setWidthCorba(bitsToRead);
00056      
00057      // This next two executable lines (which disables data
00058      // mode, and thus enables SendConfRegister mode) 
00059      // is the second line which (beyond the test names!) 
00060      // should be the source of difference between THIS
00061      // test and the usual TxCurrentTest:
00062      APICALL(scan, setOption(Sct_SctApi::Scan::enableDataMode, 0), "Failed to disable dataMode (failed to enable SendConfRegIDMode)")
00063        
00064      APICALL(scan, configure(ST_TX_CURRENT, 0, 255, 5), "Failed to set Scan information")
00065      return request;
00066    }
00067     
00068     virtual bool canFeedbackRealImpl() {
00069     return true;
00070     }
00071     
00072     virtual void endTestRealImpl() {
00073       api = Sct_SctApi::SctApiIPC::_nil();
00074     }
00075 
00076 private:
00077     TxCurrentTest() {}
00078     Sct_SctApi::SctApiIPC_var api;    
00079     static const int nTriggers = 10;
00080 };
00081 }
00082 }
00083 #endif //SCTCALIBRATIONCONTROLLER_TXCURRENTTEST_H

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