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

NoiseOccupancyTest.h

Go to the documentation of this file.
00001 #ifndef NOISEOCCUPANCY_H
00002 #define NOISEOCCUPANCY_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 "../SctApiException.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 NoiseOccupancyTest : public TestRequestImpl {
00026 public: 
00027     static NoiseOccupancyTest& instance() {
00028     static NoiseOccupancyTest no;
00029     return no;
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     Sct_SctApiStatus status;
00036     api.modifyABCDVar(&status, ST_COMPRESSION, 1);     // X1X
00037     if (status.returnCode != 0)
00038         throw SctApiException(status.returnCode, "NoiseOccupancyTest::startTest", __FILE__, __LINE__);
00039     
00040     api.modifyABCDVar(&status, ST_EDGE_DETECT, 0);     // EDGE detect off.
00041     if (status.returnCode != 0)
00042         throw SctApiException(status.returnCode, "NoiseOccupancyTest::startTest", __FILE__, __LINE__);
00043     
00044     api.modifyABCDVar(&status, ST_SEND_MASK, 0);     // Send mask off
00045     if (status.returnCode != 0)
00046         throw SctApiException(status.returnCode, "NoiseOccupancyTest::startTest", __FILE__, __LINE__);
00047 
00048     name = "NoiseOccupancyTest";
00049     testVariable = ST_ELAPSED;
00050     nScans = 1;
00051     testPoints.push_back(0.);
00052     }
00053     
00054     virtual Sct_SctApi_T_Scan* getNextScan(unsigned long index) {
00055     if (api == 0) 
00056         throw InvariantViolatedError("Api pointer is 0 in getNextScan!", __FILE__, __LINE__);
00057     
00058     ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00059     
00060     Sct_SctApiStatus status;
00061     api->modifyABCDVar(&status, ST_QCAL, 0.);
00062     if (status.returnCode != 0)
00063         throw SctApiException(status.returnCode, "NoiseOccupancyTest::getNextScan", __FILE__, __LINE__);
00064     
00065     return &sl.thresholdScanfC(2000, 0);
00066     }
00067     
00068     virtual bool canFeedback() {
00069     return false;
00070     }
00071     
00072     virtual void endTest() {
00073     api = 0;
00074     }
00075     
00076     
00077 private:
00078     NoiseOccupancyTest() {}
00079     Sct_SctApi_T_SctApi* api;    
00080 };
00081 }
00082 }
00083 #endif //RESPONSECURVE_H

Generated on Mon Dec 15 19:36:09 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3