| 1 | #ifndef MARS_MHCalibrationPixel | 
|---|
| 2 | #define MARS_MHCalibrationPixel | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef MARS_MH | 
|---|
| 5 | #include "MH.h" | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | class TArrayF; | 
|---|
| 9 | class TH1F; | 
|---|
| 10 | class TH1I; | 
|---|
| 11 | class TF1; | 
|---|
| 12 | class TProfile; | 
|---|
| 13 | class TPaveText; | 
|---|
| 14 |  | 
|---|
| 15 | class MHCalibrationPixel : public MH | 
|---|
| 16 | { | 
|---|
| 17 |  | 
|---|
| 18 | private: | 
|---|
| 19 |  | 
|---|
| 20 | Int_t fPixId;                  // Pixel Nr | 
|---|
| 21 |  | 
|---|
| 22 | TArrayF *fHiGains;             //-> | 
|---|
| 23 | TArrayF *fLoGains;             //-> | 
|---|
| 24 |  | 
|---|
| 25 | protected: | 
|---|
| 26 |  | 
|---|
| 27 | Int_t fTotalEntries;           // Number of entries | 
|---|
| 28 |  | 
|---|
| 29 | TH1F* fHChargeHiGain;          // Summed FADC slices High Gain | 
|---|
| 30 | TH1F* fHTimeHiGain;            // Mean arrival time in number of FADC sice | 
|---|
| 31 | TH1I* fHChargevsNHiGain;       // Summed Charge vs. Event Nr. | 
|---|
| 32 |  | 
|---|
| 33 | TH1F* fHChargeLoGain;          // Summed FADC slices Low Gain | 
|---|
| 34 | TH1F* fHTimeLoGain;            // Mean arrival time in number of FADC sice | 
|---|
| 35 | TH1I* fHChargevsNLoGain;       // Summed Charge vs. Event Nr. | 
|---|
| 36 |  | 
|---|
| 37 | TF1* fChargeGausFit; | 
|---|
| 38 | TF1* fTimeGausFit; | 
|---|
| 39 |  | 
|---|
| 40 | TProfile* fHivsLoGain; | 
|---|
| 41 |  | 
|---|
| 42 | TPaveText *fFitLegend; | 
|---|
| 43 |  | 
|---|
| 44 | Axis_t  fChargeFirstHiGain; | 
|---|
| 45 | Axis_t  fChargeLastHiGain; | 
|---|
| 46 | Int_t   fChargeNbinsHiGain; | 
|---|
| 47 |  | 
|---|
| 48 | Axis_t  fChargeFirstLoGain; | 
|---|
| 49 | Axis_t  fChargeLastLoGain; | 
|---|
| 50 | Int_t   fChargeNbinsLoGain; | 
|---|
| 51 |  | 
|---|
| 52 | Double_t fChargeChisquare; | 
|---|
| 53 | Double_t fChargeProb; | 
|---|
| 54 | Int_t    fChargeNdf; | 
|---|
| 55 |  | 
|---|
| 56 | Double_t fChargeMean; | 
|---|
| 57 | Double_t fChargeMeanErr; | 
|---|
| 58 | Double_t fChargeSigma; | 
|---|
| 59 | Double_t fChargeSigmaErr; | 
|---|
| 60 |  | 
|---|
| 61 | Double_t fTimeChisquare; | 
|---|
| 62 | Double_t fTimeProb; | 
|---|
| 63 | Int_t    fTimeNdf; | 
|---|
| 64 |  | 
|---|
| 65 | Double_t fTimeMean; | 
|---|
| 66 | Double_t fTimeSigma; | 
|---|
| 67 |  | 
|---|
| 68 | Byte_t   fTimeLowerFitRangeHiGain; | 
|---|
| 69 | Byte_t   fTimeUpperFitRangeHiGain; | 
|---|
| 70 | Byte_t   fTimeLowerFitRangeLoGain; | 
|---|
| 71 | Byte_t   fTimeUpperFitRangeLoGain; | 
|---|
| 72 |  | 
|---|
| 73 | Byte_t   fFlags; | 
|---|
| 74 |  | 
|---|
| 75 | enum   { kUseLoGain, kFitOK }; | 
|---|
| 76 |  | 
|---|
| 77 | Double_t fOffset; | 
|---|
| 78 | Double_t fSlope; | 
|---|
| 79 |  | 
|---|
| 80 | virtual void DrawLegend(); | 
|---|
| 81 |  | 
|---|
| 82 | public: | 
|---|
| 83 |  | 
|---|
| 84 | MHCalibrationPixel(const char *name=NULL, const char *title=NULL); | 
|---|
| 85 | ~MHCalibrationPixel(); | 
|---|
| 86 |  | 
|---|
| 87 | void ChangeHistId(Int_t i); | 
|---|
| 88 |  | 
|---|
| 89 | // Setters | 
|---|
| 90 | void   SetUseLoGain(Bool_t b = kTRUE) | 
|---|
| 91 | { b ? SETBIT(fFlags, kUseLoGain) : SETBIT(fFlags, kUseLoGain); } | 
|---|
| 92 |  | 
|---|
| 93 | void SetTimeFitRangesHiGain(Byte_t low, Byte_t up) { fTimeLowerFitRangeHiGain = low, | 
|---|
| 94 | fTimeUpperFitRangeHiGain = up ;  } | 
|---|
| 95 | void SetTimeFitRangesLoGain(Byte_t low, Byte_t up) { fTimeLowerFitRangeLoGain = low, | 
|---|
| 96 | fTimeUpperFitRangeLoGain = up ;  } | 
|---|
| 97 |  | 
|---|
| 98 | // Getters | 
|---|
| 99 | const TH1F *GetHCharge()                 { return fHChargeHiGain;    } | 
|---|
| 100 | const TH1F *GetHCharge() const           { return fHChargeHiGain;    } | 
|---|
| 101 |  | 
|---|
| 102 | const Double_t GetChargeMean()     const { return fChargeMean;    } | 
|---|
| 103 | const Double_t GetChargeMeanErr()  const { return fChargeMeanErr; } | 
|---|
| 104 | const Double_t GetChargeSigma()    const { return fChargeSigma;   } | 
|---|
| 105 | const Double_t GetChargeSigmaErr() const { return fChargeSigmaErr; } | 
|---|
| 106 | const Double_t GetChargeChiSquare() const { return fChargeChisquare; } | 
|---|
| 107 | const Double_t GetChargeProb()      const { return fChargeProb;      } | 
|---|
| 108 | const Int_t    GetChargeNdf()       const { return fChargeNdf;       } | 
|---|
| 109 |  | 
|---|
| 110 | const Double_t GetTimeMean()        const { return fTimeMean;  } | 
|---|
| 111 | const Double_t GetTimeSigma()       const { return fTimeSigma; } | 
|---|
| 112 |  | 
|---|
| 113 | const Byte_t   GetTimeLowerFitRangeHiGain()  const { return fTimeLowerFitRangeHiGain;  } | 
|---|
| 114 | const Byte_t   GetTimeUpperFitRangeHiGain()  const { return fTimeUpperFitRangeHiGain;  } | 
|---|
| 115 | const Byte_t   GetTimeLowerFitRangeLoGain()  const { return fTimeLowerFitRangeLoGain;  } | 
|---|
| 116 | const Byte_t   GetTimeUpperFitRangeLoGain()  const { return fTimeUpperFitRangeLoGain;  } | 
|---|
| 117 |  | 
|---|
| 118 | const Double_t GetTimeChiSquare()     const { return fTimeChisquare; } | 
|---|
| 119 | const Double_t GetTimeProb()        const { return fTimeProb;      } | 
|---|
| 120 | const Int_t    GetTimeNdf()         const { return fTimeNdf;       } | 
|---|
| 121 |  | 
|---|
| 122 | const TH1F *GetHTime()                    { return fHTimeHiGain; } | 
|---|
| 123 | const TH1F *GetHTime()              const { return fHTimeHiGain; } | 
|---|
| 124 |  | 
|---|
| 125 | const TH1I *GetHChargevsN()               { return fHChargevsNHiGain; } | 
|---|
| 126 | const TH1I *GetHChargevsN()         const { return fHChargevsNHiGain; } | 
|---|
| 127 |  | 
|---|
| 128 | Double_t GetOffset()  { return fOffset; } | 
|---|
| 129 | Double_t GetSlope()   { return fSlope;  } | 
|---|
| 130 |  | 
|---|
| 131 | Bool_t UseLoGain(); | 
|---|
| 132 |  | 
|---|
| 133 | Bool_t IsFitOK()     const; | 
|---|
| 134 | Bool_t IsUseLoGain() const; | 
|---|
| 135 | Bool_t IsEmpty()     const; | 
|---|
| 136 |  | 
|---|
| 137 | // Fill histos | 
|---|
| 138 | Bool_t FillChargeLoGain(Float_t q); | 
|---|
| 139 | Bool_t FillTimeLoGain(Float_t t); | 
|---|
| 140 | Bool_t FillChargevsNLoGain(Float_t q, Int_t n); | 
|---|
| 141 |  | 
|---|
| 142 | Bool_t FillChargeHiGain(Float_t q); | 
|---|
| 143 | Bool_t FillTimeHiGain(Float_t t); | 
|---|
| 144 | Bool_t FillChargevsNHiGain(Float_t q, Int_t n); | 
|---|
| 145 |  | 
|---|
| 146 | Bool_t FillPointInGraph(Float_t qhi, Float_t qlo); | 
|---|
| 147 |  | 
|---|
| 148 | Bool_t SetupFill(const MParList *pList); | 
|---|
| 149 | Bool_t Fill(const MParContainer *, const Stat_t w=1) { return kTRUE; } | 
|---|
| 150 |  | 
|---|
| 151 | // Fits | 
|---|
| 152 | Bool_t FitCharge(Option_t *option="RQ0"); | 
|---|
| 153 |  | 
|---|
| 154 | Bool_t FitTimeHiGain(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); | 
|---|
| 155 | Bool_t FitTimeLoGain(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); | 
|---|
| 156 |  | 
|---|
| 157 | void   FitHiGainvsLoGain(); | 
|---|
| 158 |  | 
|---|
| 159 | // Draws | 
|---|
| 160 | virtual void Draw(Option_t *option=""); | 
|---|
| 161 | TObject *DrawClone(Option_t *option="") const; | 
|---|
| 162 |  | 
|---|
| 163 | // Prints | 
|---|
| 164 | void PrintChargeFitResult(); | 
|---|
| 165 | void PrintTimeFitResult(); | 
|---|
| 166 |  | 
|---|
| 167 | // Others | 
|---|
| 168 | virtual void CutAllEdges(); | 
|---|
| 169 | virtual void Reset(); | 
|---|
| 170 |  | 
|---|
| 171 | ClassDef(MHCalibrationPixel, 1)     // Histograms for each calibrated pixel | 
|---|
| 172 | }; | 
|---|
| 173 |  | 
|---|
| 174 | #endif | 
|---|