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/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 
00027 class ThreePointGainTest : public TestRequestImpl {
00028 private:
00029    static const bool registeredInTestLibrary;
00030 
00031 public: 
00032     static Sct_CalibrationController::TestRequest_ptr instance() {
00033     static ThreePointGainTest rc;
00034     return rc._this();
00035     }
00036     
00037     virtual void startTestRealImpl(Sct_SctApi::SctApiIPC_ptr api, 
00038                string& name, 
00039                unsigned short& testVariable, 
00040                unsigned long& nScans, 
00041                vector<double>& testPoints) {    
00042     this->api = Sct_SctApi::SctApiIPC::_duplicate(api);
00043 
00044         // Compression mode X1X
00045         APICALL(api, modifyABCDVar(ST_COMPRESSION, 1), "ThreePointGainTest::startTest")
00046 
00047         // Edge detect off
00048         APICALL(api, modifyABCDVar(ST_EDGE_DETECT, 0), "ThreePointGainTest::startTest")
00049 
00050         // No masked channels
00051         APICALL(api, modifyABCDVar(ST_SEND_MASK, 0), "ThreePointGainTest::startTest")
00052 
00053     name = "NPtGainTest";
00054     testVariable = ST_QCAL;
00055 
00056     charges.push_back(1.5);
00057     charges.push_back(2);
00058     charges.push_back(2.5);
00059 
00060     testPoints = charges;
00061     nScans = testPoints.size();
00062     }
00063 
00064     virtual Sct_CalibrationController::ScanRequest_ptr getNextScanRealImpl(unsigned long index) {
00065     Sct_CalibrationController::ScanLibrary_var sl = CalibrationControllerImpl::instance()->getScanLibrary();
00066 
00067     APICALL(api, modifyABCDVar(ST_QCAL, charges[index]), "ThreePointGainTest::getNextScan")
00068 
00069         return sl->thresholdScanfC(500, charges[index]);        
00070     }
00071     
00072     virtual bool canFeedbackRealImpl() {
00073     return true;
00074     }
00075     
00076     virtual void endTestRealImpl() {
00077     api = Sct_SctApi::SctApiIPC::_nil();
00078     charges.clear();
00079     }
00080     
00081     
00082 private:
00083     ThreePointGainTest() {}
00084     Sct_SctApi::SctApiIPC_var api;    
00085     vector<double> charges;
00086 };
00087 }
00088 }
00089 #endif //THREEPOINTGAINTEST_H

Generated on Fri Sep 16 18:02:02 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5