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

FullBypassTest.h

Go to the documentation of this file.
00001 #ifndef FULLBYPASSTEST_H
00002 #define FULLBYPASSTEST_H
00003 
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/Sct_CalibrationController.hh"
00008 
00009 #include "../SctApiException.h"
00010 #include "Sct/LogicErrors.h"
00011 
00012 #include <CommonWithDsp/ABCD/ABCDscans.h>
00013 #include <iostream>
00014 #include <vector>
00015 
00016 using namespace Sct;
00017 using namespace std;
00018 using namespace SctCalibrationController::Ipc;
00019 using namespace SctCalibrationController;
00020 
00021 namespace SctCalibrationController {
00022 namespace Scripts {
00023     
00024 class FullBypassTest : public TestRequestImpl {
00025 public: 
00026     static FullBypassTest& instance() {
00027     static FullBypassTest fb;
00028     return fb;
00029     }
00030     
00031     virtual void startTest(Sct_SctApi_T_SctApi& api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {   
00032     this->api = &api;
00033     
00034     Sct_SctApiStatus status;
00035     
00036     api.modifyABCDVar(&status, ST_COMPRESSION, 1);     // Compression mode X1X
00037     if (status.returnCode != 0)
00038         throw SctApiException(status.returnCode, "FullBypassTest::startTest", __FILE__, __LINE__);
00039     
00040     api.modifyABCDVar(&status, ST_EDGE_DETECT, 0);     // Edge detect off
00041     if (status.returnCode != 0)
00042         throw SctApiException(status.returnCode, "FullBypassTest::startTest", __FILE__, __LINE__);
00043     
00044     api.modifyABCDVar(&status, ST_MASK, 3);     // No masked channels
00045     if (status.returnCode != 0)
00046         throw SctApiException(status.returnCode, "FullBypassTest::startTest", __FILE__, __LINE__);
00047     
00048     api.modifyABCDVar(&status, ST_SEND_MASK, 1);     // Route mask to pipeline
00049     if (status.returnCode != 0)
00050         throw SctApiException(status.returnCode, "FullBypassTest::startTest", __FILE__, __LINE__);
00051     
00052     name = "FullBypassTest";
00053     testVariable = ST_ELAPSED;  // Actually vary Vdd, but no variable for that
00054     
00055     /*for (unsigned i=0; i<6; ++i){
00056         vdd.push_back(4.0 - 0.1*i);    // 6 scan points, 4.0 -> 3.5 in 0.1 steps.
00057     }*/
00058     vdd.push_back(4.0);
00059     
00060     testPoints = vdd;
00061     nScans = testPoints.size();
00062     }
00063    
00067     virtual Sct_SctApi_T_Scan* getNextScan(unsigned long index) {
00068     if (api == 0) 
00069         throw InvariantViolatedError("Api pointer is 0 in getNextScan!", __FILE__, __LINE__);
00070     
00071     //Sct_SctApiStatus status;
00072     //api->modifyABCDVar(&status, 33, vdd[index]);   // set the digital voltage.
00073     //if (status.returnCode != 0)
00074     //    throw SctApiException(status.returnCode, "FullBypassTest::getNextScan", __FILE__, __LINE__);
00075 
00076     ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();   
00077         return &sl.tokenScan();
00078     }
00079     
00080     virtual bool canFeedback() {
00081     return false;
00082     }    
00083     
00084     virtual void endTest() {
00085     if (api == 0) 
00086         throw InvariantViolatedError("Api pointer is 0 in endTest!", __FILE__, __LINE__);
00087     
00088 /*  Sct_SctApiStatus status;
00089     api->modifyABCDVar(&status, 33, 4.0);  // set the digital voltage to 4
00090     if (status.returnCode != 0)
00091         throw SctApiException(status.returnCode, "FullBypassTest::endTest", __FILE__, __LINE__);
00092     
00093     api->modifyABCDVar(&status, ST_BYPASS, 4);    // 12 chips through 2 links.
00094     if (status.returnCode != 0)
00095         throw SctApiException(status.returnCode, "FullBypassTest::endTest", __FILE__, __LINE__);
00096 */  
00097     api = 0;
00098     }
00099 
00100 private:
00101     FullBypassTest() {}
00102     Sct_SctApi_T_SctApi* api;    
00103     std::vector<double> vdd;
00104 };
00105 }
00106 }
00107 #endif //FULLBYPASSTEST_H

Generated on Mon Dec 15 19:36:03 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3