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

SynchTriggerNoiseTest.h

00001 #ifndef SYNCHTRIGGERNOISETEST_H
00002 #define SYNCHTRIGGERNOISETEST_H
00003 
00004 #include <cmath>  // For fabs
00005 
00006 #include "../ipc/TestRequest.h"
00007 #include "../ipc/CalibrationController.hh"
00008 #include "../CalibrationControllerImpl.h"
00009 #include "../ipc/ScanRequest.h"
00010 #include "../SctApiAccessException.h"
00011 #include "../SctApiCall.h"
00012 #include "Sct/LogicErrors.h"
00013 
00014 #include <CommonWithDsp/ABCD/ABCDscans.h>
00015 
00016 using namespace Sct;
00017 using namespace SctCalibrationController::Ipc;
00018 namespace SctCalibrationController {
00019 namespace Scripts {
00020 
00021 class SynchTriggerNoiseTest  : public TestRequestImpl {
00022 private:
00023    static const bool registeredInTestLibrary;
00024 
00025 public:
00026     static Sct_CalibrationController::TestRequest_ptr instance() {
00027       static SynchTriggerNoiseTest stnt;
00028       return stnt._this();
00029     }
00030 
00031     virtual void startTestRealImpl(Sct_SctApi::SctApiIPC_ptr api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {  
00032     this->api = api;
00033 
00034         // Compression mode X1X
00035         APICALL(api, modifyABCDVar(ST_COMPRESSION, 1), "SynchTriggerNoiseTest::startTest")
00036 
00037         // Edge detect off
00038         APICALL(api, modifyABCDVar(ST_EDGE_DETECT, 0), "SynchTriggerNoiseTest::startTest")
00039 
00040         // No masked channels
00041         APICALL(api, modifyABCDVar(ST_SEND_MASK, 0), "SynchTriggerNoiseTest::startTest")
00042 
00043         // 1 fC threshold
00044         APICALL(api, modifyABCDVar(ST_QTHR, 1.0), "SynchTriggerNoiseTest::startTest")
00045 
00046     name = "SynchTriggerNoiseTest";
00047     testVariable = ST_ELAPSED;
00048     nScans = 1;
00049     testPoints.push_back(0.);
00050     }
00051 
00052 
00053     virtual Sct_CalibrationController::ScanRequest_ptr getNextScanRealImpl(unsigned long index) {
00054         Sct_CalibrationController::ScanLibrary_var sl = CalibrationControllerImpl::instance()->getScanLibrary();
00055         Sct_CalibrationController::ScanRequest_ptr request = sl->defaultScan();
00056 
00057     // Create scan
00058         Sct_SctApi::Scan_var s;
00059         APIRETCALL(api, s, createScan(), "SynchTriggerNoiseTest::getNextScan")
00060         request->setScanCorba(s);
00061 
00062         APICALL(s, setNTrigs(1000), "Failed to set triggers")
00063 
00064         // This doesn't work with group distribution which is the default otherwise
00065     APICALL(s, setOption(Sct_SctApi::Scan::distSlave, 0), "Failed to set distSlave option")
00066 
00067     APICALL(s, setOption(Sct_SctApi::Scan::tim, 1), "Failed to set TIM option")
00068     APICALL(s, setOption(Sct_SctApi::Scan::nth, 15), "Failed to set nth option")
00069 
00070     // Adjust trigger
00071         Sct_SctApi::Trigger_var t;
00072         APIRETCALL(s, t, getTrigger1(), "Failed to get trigger1")
00073 
00074         APICALL(t, singleL1A(), "Failed to set trigger type")
00075 
00076     // Configure scan
00077         APICALL(s, configure(ST_ELAPSED, 0, 5, 1), "Failed to set Scan information")
00078 
00079     return request;
00080     }
00081 
00082     virtual bool canFeedbackRealImpl() {
00083     return false;
00084     }
00085 
00086     virtual void endTestRealImpl() {
00087     api = Sct_SctApi::SctApiIPC::_nil();
00088     }
00089 
00090 private:
00091     SynchTriggerNoiseTest() {}
00092     Sct_SctApi::SctApiIPC_var api;
00093 };
00094     
00095 }
00096 }
00097 
00098 #endif //SYNCHTRIGGERNOISETEST_H

Generated on Mon Feb 21 11:43:49 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5