ARA ROOT Test BEd Software

AraEvent/AraEventCalibrator.h

00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef ARAEVENTCALIBRATOR_H
00010 #define ARAEVENTCALIBRATOR_H
00011 
00012 //Includes
00013 #include <TObject.h>
00014 #include "araSoft.h"
00015 #include "araAtriStructures.h"
00016 #include "araIcrrStructures.h"
00017 #include "araIcrrDefines.h"
00018 
00019 
00020 #define ADCMV 0.939   /* mV/adc, per Gary's email of 05/04/2006 */
00021 #define SATURATION 1300 
00022 #define NSPERSAMP 0.95
00023 
00025 
00029 namespace AraCalType {
00030   typedef enum EAraCalType {
00031     kNoCalib                        = 0x00, 
00032     kJustUnwrap                     = 0x01, 
00033     kJustPed                        = 0x02, 
00034     kADC                            = 0x03, 
00035     kVoltageTime                    = 0x04, 
00036     kFirstCalib                     = 0x05, 
00037     kFirstCalibPlusCables           = 0x06, 
00038     kSecondCalib                    = 0x07, 
00039     kSecondCalibPlusCables          = 0x08,
00040     kLatestCalib                    = 0x08 
00041   } AraCalType_t;
00042 
00043   Bool_t hasCableDelays(AraCalType::AraCalType_t calType); 
00044   Bool_t hasBinWidthCalib(AraCalType::AraCalType_t calType); 
00045   Bool_t hasInterleaveCalib(AraCalType::AraCalType_t calType); 
00046   Bool_t hasClockAlignment(AraCalType::AraCalType_t calType); 
00047   Bool_t hasPedestalSubtraction(AraCalType::AraCalType_t calType); 
00048   Bool_t hasCommonMode(AraCalType::AraCalType_t calType); 
00049 
00050 } 
00051 
00052 class UsefulAtriStationEvent;
00053 class UsefulIcrrStationEvent;
00054 class TGraph; 
00055 
00057 
00061 class AraEventCalibrator : public TObject
00062 {
00063  public:
00064    AraEventCalibrator(); 
00065    ~AraEventCalibrator(); 
00066 
00067    //Instance generator
00068    static AraEventCalibrator*  Instance(); 
00069    
00070 
00071    //Icrr calibrations
00072    void setPedFile(char fileName[], UInt_t stationId); 
00073    void calibrateEvent(UsefulIcrrStationEvent *theEvent, AraCalType::AraCalType_t calType=AraCalType::kJustUnwrap); 
00074    int doBinCalibration(UsefulIcrrStationEvent *theEvent, int chanIndex,int overrideRCO=-1); 
00075    void fillRCOGuessArray(UsefulIcrrStationEvent *theEvent, int rcoGuess[LAB3_PER_ICRR]); 
00076    Double_t estimateClockPeriod(Int_t numPoints,Double_t &rms);
00077    void calcClockAlignVals(UsefulIcrrStationEvent *theEvent, AraCalType::AraCalType_t calType); 
00078    Double_t estimateClockLag(TGraph *grClock); 
00079    void loadIcrrPedestals(); 
00080    void loadIcrrCalib(); 
00081    int gotPedFile[ICRR_NO_STATIONS]; 
00082    char pedFile[ICRR_NO_STATIONS][FILENAME_MAX]; 
00083  
00084    float pedestalData[ICRR_NO_STATIONS][LAB3_PER_ICRR][CHANNELS_PER_LAB3][MAX_NUMBER_SAMPLES_LAB3]; 
00085    double binWidths[ICRR_NO_STATIONS][LAB3_PER_ICRR][2][MAX_NUMBER_SAMPLES_LAB3]; 
00086    double epsilonVals[ICRR_NO_STATIONS][LAB3_PER_ICRR][2]; 
00087    double interleaveVals[ICRR_NO_STATIONS][8]; 
00088    double clockAlignVals[ICRR_NO_STATIONS][LAB3_PER_ICRR]; //Well by default clock align 0 is 0
00089 
00091    double v[MAX_NUMBER_SAMPLES_LAB3]; //Calibrated wrapped
00092    double calwv[MAX_NUMBER_SAMPLES_LAB3]; //Calibrated unwrapped
00093    double rawadc[MAX_NUMBER_SAMPLES_LAB3]; //Uncalibrated unwrapped
00094    double pedsubadc[MAX_NUMBER_SAMPLES_LAB3]; //Pedestal subtracted unwrapped
00095    double sampNums[MAX_NUMBER_SAMPLES_LAB3]; //Sample numbers as doubles
00096    double timeNums[MAX_NUMBER_SAMPLES_LAB3]; 
00097    double tempTimeNums[MAX_NUMBER_SAMPLES_LAB3]; 
00098    double calTimeNums[MAX_NUMBER_SAMPLES_LAB3]; 
00099    double calVoltNums[MAX_NUMBER_SAMPLES_LAB3]; 
00100    int indexNums[MAX_NUMBER_SAMPLES_LAB3]; 
00101 
00102 
00103    //Atri Calibrations
00104    UShort_t *fAtriPeds;
00105    Int_t fGotAtriPedFile;
00106    char fAtriPedFile[FILENAME_MAX];
00107    Int_t fAtriSampleIndex[DDA_PER_ATRI][RFCHAN_PER_DDA][2][SAMPLES_PER_BLOCK]; 
00108    Double_t fAtriSampleTimes[DDA_PER_ATRI][RFCHAN_PER_DDA][2][SAMPLES_PER_BLOCK]; 
00109    Double_t fAtriEpsilonTimes[DDA_PER_ATRI][RFCHAN_PER_DDA][2]; 
00110 
00111    void calibrateEvent(UsefulAtriStationEvent *theEvent, AraCalType::AraCalType_t calType=AraCalType::kVoltageTime); 
00112    void setAtriPedFile(char *filename);
00113    void loadAtriPedestals();
00114    void loadAtriCalib();
00115 
00116 
00117 
00118 
00119  protected:
00120    static AraEventCalibrator *fgInstance;  
00121 
00122    ClassDef(AraEventCalibrator,1);
00123 
00124 };
00125 
00126 
00127 #endif //ARAEVENTCALIBRATOR_H

Generated on Wed Aug 8 16:20:07 2012 for ARA ROOT Test Bed Software by doxygen 1.4.7