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

FullBypassEndcapTest.h

00001 #ifndef FULLBYPASSENDCAPTEST_H
00002 #define FULLBYPASSENDCAPTEST_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 FullBypassEndcapTest : public TestRequestImpl {
00026 public:
00027     static FullBypassEndcapTest& instance() {
00028     static FullBypassEndcapTest 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), "FullBypassEndcapTest::startTest")
00037 
00038         // Edge detect off
00039         APICALL(&api, modifyABCDVar(&st, ST_EDGE_DETECT, 0), "FullBypassEndcapTest::startTest")
00040 
00041         // No masked channels
00042         APICALL(&api, modifyABCDVar(&st, ST_MASK, 3), "FullBypassEndcapTest::startTest")
00043 
00044         // Route mask to pipeline
00045         APICALL(&api, modifyABCDVar(&st, ST_SEND_MASK, 1), "FullBypassEndcapTest::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     ScanRequest& srequest = sl.tokenScan();
00075     
00076     Sct_SctApi_T_Scan* scan = srequest.getScan();
00077     if (scan) {
00078       APICALL(scan, configure(&st, ST_TOKEN, 0, 61, 1), "Failed to set Scan information") ;
00079     }
00080     return &srequest;
00081     }
00082     
00083     virtual bool canFeedback() {
00084     return false;
00085     }    
00086     
00087     virtual void endTest() {
00088     if (api == 0) 
00089         throw InvariantViolatedError("Api pointer is 0 in endTest!", __FILE__, __LINE__);
00090     
00091 /*  Sct_SctApiStatus status;
00092     api->modifyABCDVar(&status, 33, 4.0);  // set the digital voltage to 4
00093     if (status.returnCode != 0)
00094         throw SctApiAccessException(status.returnCode, "FullBypassTest::endTest", __FILE__, __LINE__);
00095     
00096     api->modifyABCDVar(&status, ST_BYPASS, 4);    // 12 chips through 2 links.
00097     if (status.returnCode != 0)
00098         throw SctApiAccessException(status.returnCode, "FullBypassTest::endTest", __FILE__, __LINE__);
00099 */  
00100     api = 0;
00101     }
00102 
00103 private:
00104     FullBypassEndcapTest() {}
00105     Sct_SctApi_T_SctApi* api;    
00106     std::vector<double> vdd;
00107 };
00108 }
00109 }
00110 #endif //FULLBYPASSTEST_H

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