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/Sct_CalibrationController.hh"
00007 #include "../CalibrationControllerImpl.h"
00008 #include "../ipc/ScanRequest.h"
00009 #include "../SctApiAccessException.h"
00010 #include "../SctApiCall.h"
00011 #include "Sct/LogicErrors.h"
00012 
00013 #include <CommonWithDsp/ABCD/ABCDscans.h>
00014 
00015 using namespace Sct;
00016 using namespace SctCalibrationController::Ipc;
00017 namespace SctCalibrationController {
00018 namespace Scripts {
00019 
00020 class SynchTriggerNoiseTest  : public TestRequestImpl {
00021 public:
00022     static SynchTriggerNoiseTest& instance() {
00023       static SynchTriggerNoiseTest stnt;
00024       return stnt;
00025     }
00026 
00027     virtual void startTest(Sct_SctApi_T_SctApi& api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {   
00028     this->api = &api;
00029 
00030         // Compression mode X1X
00031         APICALL(&api, modifyABCDVar(&st, ST_COMPRESSION, 1), "SynchTriggerNoiseTest::startTest")
00032 
00033         // Edge detect off
00034         APICALL(&api, modifyABCDVar(&st, ST_EDGE_DETECT, 0), "SynchTriggerNoiseTest::startTest")
00035 
00036         // No masked channels
00037         APICALL(&api, modifyABCDVar(&st, ST_SEND_MASK, 0), "SynchTriggerNoiseTest::startTest")
00038 
00039         // 1 fC threshold
00040         APICALL(&api, modifyABCDVar(&st, ST_QTHR, 1.0), "SynchTriggerNoiseTest::startTest")
00041 
00042     name = "SynchTriggerNoiseTest";
00043     testVariable = ST_ELAPSED;
00044     nScans = 1;
00045     testPoints.push_back(0.);
00046     }
00047 
00048 
00049     virtual ScanRequest* getNextScan(unsigned long index) {
00050         ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00051         ScanRequestImpl& request = sl.defaultScan();
00052 
00053     // Create scan
00054         Sct_SctApi_T_Scan* s = 0;
00055         APIRETCALL(api, s, createScan(&st), "SynchTriggerNoiseTest::getNextScan")
00056         request.setScan(s);
00057 
00058     // Currently this is divided by 15 (nth)
00059     // At 100kHz 1e5 is 1 second
00060         APICALL(s, setNTrigs(&st, 100000), "Failed to set triggers")
00061 
00062         // This doesn't work with group distribution which is the default otherwise
00063     APICALL(s, setOption(&st, Sct_SctApi_T_Scan_ScanOptions_distSlave, 0), "Failed to set distSlave option")
00064 
00065     APICALL(s, setOption(&st, Sct_SctApi_T_Scan_ScanOptions_tim, 1), "Failed to set TIM option")
00066     APICALL(s, setOption(&st, Sct_SctApi_T_Scan_ScanOptions_nth, 15), "Failed to set nth option")
00067 
00068     // Adjust trigger
00069         Sct_SctApi_T_Trigger* t = 0;
00070         APIRETCALL(s, t, getTrigger1(&st), "Failed to get trigger1")
00071 
00072         APICALL(t, singleL1A(&st), "Failed to set trigger type")
00073 
00074     // Configure scan
00075         APICALL(s, configure(&st, ST_ELAPSED, 0, 5, 1), "Failed to set Scan information")
00076 
00077     return &request;
00078     }
00079 
00080     virtual bool canFeedback() {
00081     return false;
00082     }
00083 
00084     virtual void endTest() {
00085     api = 0;
00086     }
00087 
00088 private:
00089     SynchTriggerNoiseTest() {}
00090     Sct_SctApi_T_SctApi* api;
00091 };
00092     
00093 }
00094 }
00095 
00096 #endif //SYNCHTRIGGERNOISETEST_H

Generated on Fri Jan 14 12:47:08 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5