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

FullBypassBarrelTest.h

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

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