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

Generated on Mon Feb 6 14:01:35 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6