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     // Set QThr to 0.9
00044         //APICALL(api, modifyABCDVar(ST_QTHR, 0.9), "SynchTriggerNoiseTest::startTest")
00045     
00046     name = "NoiseOccupancyTest";
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         // This doesn't work with group distribution which is the default otherwise
00063     //APICALL(s, setOption(Sct_SctApi::Scan::distSlave, 0), "Failed to set distSlave option")
00064       
00065         const unsigned nth_trigger=15;
00066     APICALL(s, setOption(Sct_SctApi::Scan::tim, 1), "Failed to set TIM option")
00067 
00068     APICALL(s, setOption(Sct_SctApi::Scan::distSlave, 0), "Failed to set distSlave option")
00069 
00070     APICALL(s, setOption(Sct_SctApi::Scan::nth, nth_trigger), "Failed to set nth option")
00071 
00072     // Adjust trigger
00073         Sct_SctApi::Trigger_var t;
00074         APIRETCALL(s, t, getTrigger1(), "Failed to get trigger1")
00075 
00076         APICALL(t, singleL1A(), "Failed to set trigger type")
00077 
00078     // set threshold in fC
00079         APICALL(s, configure(ST_QTHR, 1.125, 0.90, -0.0025), "Failed to set Scan information")
00080     // set the number of triggers
00081         APICALL(s, setNTrigs(50000), "Failed to set triggers")
00082 
00083     return request;
00084     }
00085 
00086     virtual bool canFeedbackRealImpl() {
00087     return false;
00088     }
00089 
00090     virtual void endTestRealImpl() {
00091     api = Sct_SctApi::SctApiIPC::_nil();
00092     }
00093 
00094 private:
00095     SynchTriggerNoiseTest() {}
00096     Sct_SctApi::SctApiIPC_var api;
00097 };
00098     
00099 }
00100 }
00101 
00102 #endif //SYNCHTRIGGERNOISETEST_H

Generated on Fri Sep 16 18:01:59 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5