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 kSecondCalibPlusCablesUnDiplexed = 0x09, 00041 00042 kLatestCalib = 0x09 00043 } AraCalType_t; 00044 00045 Bool_t hasCableDelays(AraCalType::AraCalType_t calType); 00046 Bool_t hasBinWidthCalib(AraCalType::AraCalType_t calType); 00047 Bool_t hasInterleaveCalib(AraCalType::AraCalType_t calType); 00048 Bool_t hasClockAlignment(AraCalType::AraCalType_t calType); 00049 Bool_t hasPedestalSubtraction(AraCalType::AraCalType_t calType); 00050 Bool_t hasCommonMode(AraCalType::AraCalType_t calType); 00051 Bool_t hasUnDiplexing(AraCalType::AraCalType_t calType); 00052 Bool_t hasZeroMean(AraCalType::AraCalType_t calType); 00053 } 00054 00055 class UsefulAtriStationEvent; 00056 class UsefulIcrrStationEvent; 00057 class TGraph; 00058 00060 00064 class AraEventCalibrator : public TObject 00065 { 00066 public: 00067 AraEventCalibrator(); 00068 ~AraEventCalibrator(); 00069 00070 //Instance generator 00071 static AraEventCalibrator* Instance(); 00072 00073 00074 //Icrr calibrations 00075 void setPedFile(char fileName[], AraStationId_t stationId); 00076 void calibrateEvent(UsefulIcrrStationEvent *theEvent, AraCalType::AraCalType_t calType=AraCalType::kJustUnwrap); 00077 int doBinCalibration(UsefulIcrrStationEvent *theEvent, int chanIndex,int overrideRCO=-1); 00078 void fillRCOGuessArray(UsefulIcrrStationEvent *theEvent, int rcoGuess[LAB3_PER_ICRR]); 00079 Double_t estimateClockPeriod(Int_t numPoints,Double_t &rms); 00080 void calcClockAlignVals(UsefulIcrrStationEvent *theEvent, AraCalType::AraCalType_t calType); 00081 Double_t estimateClockLag(TGraph *grClock); 00082 void loadIcrrPedestals(AraStationId_t stationId); 00083 void loadIcrrCalib(AraStationId_t stationId); 00084 int gotIcrrCalibFile[ICRR_NO_STATIONS]; 00085 int gotIcrrPedFile[ICRR_NO_STATIONS]; 00086 char IcrrPedFile[ICRR_NO_STATIONS][FILENAME_MAX]; 00087 00088 float pedestalData[ICRR_NO_STATIONS][LAB3_PER_ICRR][CHANNELS_PER_LAB3][MAX_NUMBER_SAMPLES_LAB3]; 00089 double binWidths[ICRR_NO_STATIONS][LAB3_PER_ICRR][2][MAX_NUMBER_SAMPLES_LAB3]; 00090 double epsilonVals[ICRR_NO_STATIONS][LAB3_PER_ICRR][2]; 00091 double interleaveVals[ICRR_NO_STATIONS][8]; 00092 double clockAlignVals[ICRR_NO_STATIONS][LAB3_PER_ICRR]; //Well by default clock align 0 is 0 00093 00095 double v[MAX_NUMBER_SAMPLES_LAB3]; //Calibrated wrapped 00096 double calwv[MAX_NUMBER_SAMPLES_LAB3]; //Calibrated unwrapped 00097 double rawadc[MAX_NUMBER_SAMPLES_LAB3]; //Uncalibrated unwrapped 00098 double pedsubadc[MAX_NUMBER_SAMPLES_LAB3]; //Pedestal subtracted unwrapped 00099 double sampNums[MAX_NUMBER_SAMPLES_LAB3]; //Sample numbers as doubles 00100 double timeNums[MAX_NUMBER_SAMPLES_LAB3]; 00101 double tempTimeNums[MAX_NUMBER_SAMPLES_LAB3]; 00102 double calTimeNums[MAX_NUMBER_SAMPLES_LAB3]; 00103 double calVoltNums[MAX_NUMBER_SAMPLES_LAB3]; 00104 int indexNums[MAX_NUMBER_SAMPLES_LAB3]; 00105 00106 00107 //Atri Calibrations 00108 UShort_t *fAtriPeds; 00109 Int_t fGotAtriPedFile[ATRI_NO_STATIONS]; 00110 Int_t fGotAtriCalibFile[ATRI_NO_STATIONS]; 00111 char fAtriPedFile[ATRI_NO_STATIONS][FILENAME_MAX]; 00112 Int_t fAtriSampleIndex[DDA_PER_ATRI][RFCHAN_PER_DDA][2][SAMPLES_PER_BLOCK]; 00113 Double_t fAtriSampleTimes[DDA_PER_ATRI][RFCHAN_PER_DDA][2][SAMPLES_PER_BLOCK]; 00114 Double_t fAtriEpsilonTimes[DDA_PER_ATRI][RFCHAN_PER_DDA][2]; 00115 Int_t fAtriNumSamples[DDA_PER_ATRI][RFCHAN_PER_DDA][2]; 00116 00117 void calibrateEvent(UsefulAtriStationEvent *theEvent, AraCalType::AraCalType_t calType=AraCalType::kVoltageTime); 00118 void setAtriPedFile(char *filename, AraStationId_t stationId); 00119 void loadAtriPedestals(AraStationId_t stationId); 00120 void loadAtriCalib(AraStationId_t stationId); 00121 00122 protected: 00123 static AraEventCalibrator *fgInstance; 00124 00125 ClassDef(AraEventCalibrator,1); 00126 00127 }; 00128 00129 00130 #endif //ARAEVENTCALIBRATOR_H
Generated on Mon Jun 3 14:59:46 2013 for ARA ROOT v3.8 Software by
