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

DoubleTriggerNoiseTest.h

00001 #ifndef DOUBLETRIGGERNOISETEST_H
00002 #define DOUBLETRIGGERNOISETEST_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 DoubleTriggerNoiseTest  : public TestRequestImpl {
00022 private:
00023    static const bool registeredInTestLibrary;
00024 
00025 public:
00026     static Sct_CalibrationController::TestRequest_ptr instance() {
00027       static DoubleTriggerNoiseTest dtnt;
00028       return dtnt._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 = Sct_SctApi::SctApiIPC::_duplicate(api);
00033 
00034         // Compression mode X1X
00035         APICALL(api, modifyABCDVar(ST_COMPRESSION, 1), "DoubleTriggerNoiseTest::startTest")
00036 
00037         // Edge detect off
00038         APICALL(api, modifyABCDVar(ST_EDGE_DETECT, 0), "DoubleTriggerNoiseTest::startTest")
00039 
00040         // No masked channels
00041         APICALL(api, modifyABCDVar(ST_SEND_MASK, 0), "DoubleTriggerNoiseTest::startTest")
00042 
00043         // 1 fC threshold
00044         APICALL(api, modifyABCDVar(ST_QTHR, 1.0), "DoubleTriggerNoiseTest::startTest")
00045 
00046     name = "DoubleTriggerNoiseTest";
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(), "DoubleTriggerNoiseTest::getNextScan")
00060         request->setScanCorba(s);
00061 
00062         APICALL(s, setNTrigs(10000), "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         // Only capture every 2nd trigger
00068     APICALL(s, setOption(Sct_SctApi::Scan::nth, 2), "Failed to set nth option")
00069 
00070         // Capture the second of the two triggers (index 1)
00071     APICALL(s, setOption(Sct_SctApi::Scan::nth_rem, 1), "Failed to set nth_rem option")
00072 
00073     // Adjust trigger
00074         Sct_SctApi::Trigger_var t;
00075         APIRETCALL(s, t, getTrigger1(), "Failed to get trigger1")
00076 
00077         APICALL(t, doubleL1A(110), "Failed to set trigger type")
00078 
00079     // Increment delay between triggers
00080     APICALL(t, setCommIncr(1, 1), "DoubleTriggerNoiseTest::getNextScan")
00081 
00082     // Configure scan
00083         APICALL(s, configure(ST_ELAPSED, 110, 140, 1), "Failed to set Scan information")
00084 
00085     return request;
00086     }
00087 
00088     virtual bool canFeedbackRealImpl() {
00089     return false;
00090     }
00091 
00092     virtual void endTestRealImpl() {
00093     api = Sct_SctApi::SctApiIPC::_nil();
00094     }
00095 
00096 private:
00097     DoubleTriggerNoiseTest() {}
00098     Sct_SctApi::SctApiIPC_var api;
00099 };
00100     
00101 }
00102 }
00103 
00104 #endif //DOUBLETRIGGERNOISETEST_H

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