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

ThresholdScan.h

00001 #ifndef THRESHOLDSCAN_H
00002 #define THRESHOLDSCAN_H
00003 
00004 #include "../ipc/Sct_CalibrationController.hh"
00005 
00006 #include "../SctApiException.h"
00007 #include "Sct/LogicErrors.h"
00008 
00009 #include <CommonWithDsp/ABCD/ABCDscans.h>
00010 
00011 using namespace Sct;
00012 
00013 namespace SctCalibrationController {
00014 namespace Scripts {
00015     
00016 class ThresholdScan {
00017 public:
00018     static Sct_SctApi_T_Scan& thresholdScan(Sct_SctApi_T_SctApi& api, unsigned long nTrigs, double calChargefC = -1) {  
00019     Sct_SctApiStatus status;
00020     Sct_SctApi_T_Scan* s = api.defaultScan(&status);
00021     if (status.returnCode != 0)
00022         throw SctApiException(status.returnCode, "thresholdScan", __FILE__, __LINE__);
00023     
00024     s->setNTrigs(&status, nTrigs);
00025     if (status.returnCode != 0)
00026         throw SctApiException(status.returnCode, "thresholdScan", __FILE__, __LINE__);
00027     
00028     Sct_SctApi_T_Trigger* t = s->getTrigger1(&status);
00029     if (status.returnCode != 0)
00030         throw SctApiException(status.returnCode, "thresholdScan", __FILE__, __LINE__);
00031     
00032     t->calL1A(&status, 0x82);
00033     if (status.returnCode != 0)
00034         throw SctApiException(status.returnCode, "thresholdScan", __FILE__, __LINE__);
00035 
00036         s->setOption(&status, Sct_SctApi_T_Scan_ScanOptions_loopCalLine, 1);
00037     if (status.returnCode != 0)
00038         throw SctApiException(status.returnCode, "thresholdScan", __FILE__, __LINE__);
00039 
00040     double lo = 30.0 * (calChargefC - 1);
00041     double hi = 200.0 + 70.0 * (calChargefC - 1);
00042 
00043     if (lo < lowLimit) lo = lowLimit;
00044     if (hi > highLimit) hi = highLimit;
00045 
00046     s->configure(&status, ST_VTHR, lo, hi, 5);
00047     
00048     return *s;
00049     }
00050     
00051 private:
00052     ThresholdScan();
00053     static const double lowLimit = 90;
00054     static const double highLimit = 640;
00055 };
00056     
00057 }
00058 }
00059 
00060 #endif //THRESHOLDSCAN_H

Generated on Mon Nov 17 19:54:21 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3