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

ThreePointGainTest.h

00001 #ifndef THREEPOINTGAINTEST_H
00002 #define THREEPOINTGAINTEST_H
00003 
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/Sct_CalibrationController.hh"
00008 #include "../CalibrationControllerImpl.h"
00009 
00010 #include "../SctApiAccessException.h"
00011 #include "Sct/LogicErrors.h"
00012 #include "../SctApiCall.h"
00013 
00014 #include <CommonWithDsp/ABCD/ABCDscans.h>
00015 #include <iostream>
00016 #include <vector>
00017 
00018 using namespace Sct;
00019 using namespace std;
00020 using namespace SctCalibrationController::Ipc;
00021 
00022 namespace SctCalibrationController {
00023 namespace Scripts {
00024     
00025 class ThreePointGainTest : public TestRequestImpl {
00026 public: 
00027     static ThreePointGainTest& instance() {
00028     static ThreePointGainTest rc;
00029     return rc;
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), "ThreePointGainTest::startTest")
00037 
00038         // Edge detect off
00039         APICALL(&api, modifyABCDVar(&st, ST_EDGE_DETECT, 0), "ThreePointGainTest::startTest")
00040 
00041         // No masked channels
00042         APICALL(&api, modifyABCDVar(&st, ST_SEND_MASK, 0), "ThreePointGainTest::startTest")
00043 
00044     name = "NPtGainTest";
00045     testVariable = ST_QCAL;
00046 
00047     charges.push_back(1.5);
00048     charges.push_back(2);
00049     charges.push_back(2.5);
00050 
00051     testPoints = charges;
00052     nScans = testPoints.size();
00053     }
00054 
00055     virtual ScanRequest* getNextScan(unsigned long index) {
00056     ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00057 
00058     APICALL(api, modifyABCDVar(&st, ST_QCAL, charges[index]), "ThreePointGainTest::getNextScan")
00059 
00060         return &sl.thresholdScanfC(1000, charges[index]);       
00061     }
00062     
00063     virtual bool canFeedback() {
00064     return true;
00065     }
00066     
00067     virtual void endTest() {
00068     api = 0;
00069     charges.clear();
00070     }
00071     
00072     
00073 private:
00074     ThreePointGainTest() {}
00075     Sct_SctApi_T_SctApi* api;    
00076     vector<double> charges;
00077 };
00078 }
00079 }
00080 #endif //THREEPOINTGAINTEST_H

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