Changeset 2931
- Timestamp:
- 01/27/04 20:32:42 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationBlindPix.cc
r2833 r2931 45 45 // 46 46 MCalibrationBlindPix::MCalibrationBlindPix(const char *name, const char *title) 47 : fHist(NULL),48 fLambda(-1.),49 fMu0 (-1.),50 fMu1 (-1.),51 fSigma0(-1.),52 fSigma1(-1.),53 fErrLambda(-1.),54 fErrMu0 (-1.),55 fErrMu1 (-1.),56 fErrSigma0(-1.),57 fErrSigma1(-1.),58 fTime (-1.),59 fErrTime (-1.)60 47 { 61 48 … … 68 55 *fLog << warn << dbginf << " Could not create MHCalibrationBlindPixel " << endl; 69 56 57 Clear(); 70 58 } 71 59 … … 82 70 { 83 71 fHist->Reset(); 72 73 fLambda = -1.; 74 fMu0 = -1.; 75 fMu1 = -1.; 76 fSigma0 = -1.; 77 fSigma1 = -1.; 78 fErrLambda = -1.; 79 fErrMu0 = -1.; 80 fErrMu1 = -1.; 81 fErrSigma0 = -1.; 82 fErrSigma1 = -1.; 83 fTime = -1.; 84 fErrTime = -1; 85 84 86 } 85 87 -
trunk/MagicSoft/Mars/mcalib/MCalibrationBlindPix.h
r2904 r2931 52 52 53 53 MHCalibrationBlindPixel *GetHist() const { return fHist; } 54 MHCalibrationBlindPixel *GetHist() { return fHist; } 54 55 55 Bool_t IsFitOK() 56 Bool_t IsFitOK() const { return fHist->IsFitOK(); } 56 57 57 58 // Fill histos 58 Bool_t FillCharge(Float_t q) { return fHist->FillBlindPixelCharge(q); }59 Bool_t FillTime(Float_t t) { return fHist->FillBlindPixelTime(t); }60 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillBlindPixelChargevsN(rq,t); }59 Bool_t FillCharge(Float_t q) const { return fHist->FillBlindPixelCharge(q); } 60 Bool_t FillTime(Float_t t) const { return fHist->FillBlindPixelTime(t); } 61 Bool_t FillRChargevsTime(Float_t rq, Int_t t) const { return fHist->FillBlindPixelChargevsN(rq,t); } 61 62 62 63 // Fits 63 64 Bool_t FitCharge(); 64 65 Bool_t FitTime(); 65 void ChangeFitFunc(MHCalibrationBlindPixel::FitFunc_t f) { fHist->ChangeFitFunc(f); }66 void ChangeFitFunc(MHCalibrationBlindPixel::FitFunc_t f) const { fHist->ChangeFitFunc(f); } 66 67 67 68 // Draws 68 void Draw(Option_t *opt="") 69 TObject *DrawClone(Option_t *opt="") const {return fHist->DrawClone(opt); }69 void Draw(Option_t *opt="") { fHist->Draw(opt); } 70 TObject *DrawClone(Option_t *opt="") const { return fHist->DrawClone(opt); } 70 71 71 72 ClassDef(MCalibrationBlindPix, 1) // Storage Container for Calibration information of one pixel -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
r2904 r2931 262 262 return kFALSE; 263 263 } 264 265 264 266 265 fNumHiGainSamples = fSignals->GetNumUsedHiGainFADCSlices(); -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
r2930 r2931 70 70 // 71 71 MCalibrationCam::MCalibrationCam(const char *name, const char *title) 72 : fNumPhotInsidePlexiglassAvailable(kFALSE), 73 fMeanPhotInsidePlexiglass(-1.), 74 fMeanPhotErrInsidePlexiglass(-1.), 75 fNumPhotOutsidePlexiglassAvailable(kFALSE), 76 fMeanPhotOutsidePlexiglass(-1.), 77 fMeanPhotErrOutsidePlexiglass(-1.), 78 fOffsets(NULL), 72 : fOffsets(NULL), 79 73 fSlopes(NULL), 80 fOffvsSlope(NULL), 81 fNumExcludedPixels(0) 82 74 fOffvsSlope(NULL) 83 75 { 84 76 fName = name ? name : "MCalibrationCam"; … … 89 81 fPINDiode = new MCalibrationPINDiode(); 90 82 83 Clear(); 91 84 } 92 85 … … 125 118 // fSize is the old size (in most cases: 1) 126 119 // 127 void MCalibrationCam::InitSize(const UInt_t size)120 void MCalibrationCam::InitSize(const UInt_t i) 128 121 { 129 122 … … 131 124 // check if we have already initialized to size 132 125 // 133 if (CheckBounds( size))126 if (CheckBounds(i)) 134 127 return; 135 128 136 fPixels->ExpandCreate( size);129 fPixels->ExpandCreate(i); 137 130 138 131 } … … 156 149 Bool_t MCalibrationCam::CheckBounds(Int_t i) const 157 150 { 158 return i < fPixels->GetEntriesFast();151 return i < GetSize(); 159 152 } 160 153 … … 187 180 188 181 189 // --------------------------------------------------------------------------190 //191 // Return true if pixel is inside bounds of the TClonesArray fPixels192 //193 Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const194 {195 if (!CheckBounds(idx))196 return kFALSE;197 198 return kTRUE;199 }200 201 // --------------------------------------------------------------------------202 //203 // Return true if pixel has already been fitted once (independent of the result)204 //205 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const206 {207 208 if (!CheckBounds(idx))209 return kFALSE;210 211 return (*this)[idx].IsFitted();212 }213 214 215 182 // -------------------------------------- 216 183 // 217 184 void MCalibrationCam::Clear(Option_t *o) 218 185 { 219 fPixels->ForEach(TObject, Clear)(); 220 } 221 222 // -------------------------------------------------------------------------- 223 // 224 // Sets the user ranges of all histograms such that 225 // empty bins at the edges are not used. Additionally, it rebins the 226 // histograms such that in total, 50 bins are used. 227 // 228 void MCalibrationCam::CutEdges() 229 { 230 231 fBlindPixel->GetHist()->CutAllEdges(); 232 fPINDiode->GetHist()->CutAllEdges(); 233 234 TIter Next(fPixels); 235 MCalibrationPix *pix; 236 while ((pix=(MCalibrationPix*)Next())) 237 { 238 pix->GetHist()->CutAllEdges(); 239 } 186 187 fPixels->ForEach(TObject, Clear)(); 188 fBlindPixel->Clear(); 189 fPINDiode->Clear(); 190 191 fNumPhotInsidePlexiglassAvailable = kFALSE; 192 fMeanPhotInsidePlexiglass = -1.; 193 fMeanPhotErrInsidePlexiglass = -1.; 194 fNumPhotOutsidePlexiglassAvailable = kFALSE; 195 fMeanPhotOutsidePlexiglass = -1.; 196 fMeanPhotErrOutsidePlexiglass = -1.; 197 198 fNumExcludedPixels = 0; 240 199 241 200 return; 242 201 } 243 202 244 203 // -------------------------------------------------------------------------- 245 204 // … … 312 271 313 272 *fLog << all << fNumExcludedPixels << " excluded pixels " << endl; 314 315 } 273 } 274 275 // -------------------------------------------------------------------------- 276 // 277 // Return true if pixel is inside bounds of the TClonesArray fPixels 278 // 279 Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const 280 { 281 if (!CheckBounds(idx)) 282 return kFALSE; 283 284 return kTRUE; 285 } 286 287 // -------------------------------------------------------------------------- 288 // 289 // Return true if pixel has already been fitted once (independent of the result) 290 // 291 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const 292 { 293 294 if (!CheckBounds(idx)) 295 return kFALSE; 296 297 return (*this)[idx].IsFitted(); 298 } 299 300 // -------------------------------------------------------------------------- 301 // 302 // Sets the user ranges of all histograms such that 303 // empty bins at the edges are not used. Additionally, it rebins the 304 // histograms such that in total, 50 bins are used. 305 // 306 void MCalibrationCam::CutEdges() 307 { 308 309 fBlindPixel->GetHist()->CutAllEdges(); 310 fPINDiode->GetHist()->CutAllEdges(); 311 312 TIter Next(fPixels); 313 MCalibrationPix *pix; 314 while ((pix=(MCalibrationPix*)Next())) 315 { 316 pix->GetHist()->CutAllEdges(); 317 } 318 319 return; 320 } 321 316 322 317 323 // The types are as follows: … … 500 506 { 501 507 502 if (!fPINDiode->IsFit OK())503 return kFALSE; 504 505 const Float_t mean = fPINDiode->Get Mean();506 const Float_t merr = fPINDiode->Get MeanError();508 if (!fPINDiode->IsFitValid()) 509 return kFALSE; 510 511 const Float_t mean = fPINDiode->GetCharge(); 512 const Float_t merr = fPINDiode->GetErrCharge(); 507 513 508 514 switch (fColor) -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
r2930 r2931 37 37 TH2D* fOffvsSlope; //! 38 38 39 UInt_t 39 UInt_t fNumExcludedPixels; 40 40 41 41 public: … … 60 60 61 61 // Getters 62 Int_t GetSize() const;63 UInt_t GetNumPixels() const { return fNumPixels; }62 Int_t GetSize() const; 63 UInt_t GetNumPixels() const { return fNumPixels; } 64 64 65 MCalibrationBlindPix *GetBlindPixel() const { return fBlindPixel; } 66 MCalibrationPINDiode *GetPINDiode() const { return fPINDiode; } 65 MCalibrationBlindPix *GetBlindPixel() const { return fBlindPixel; } 66 MCalibrationPINDiode *GetPINDiode() const { return fPINDiode; } 67 MCalibrationBlindPix *GetBlindPixel() { return fBlindPixel; } 68 MCalibrationPINDiode *GetPINDiode() { return fPINDiode; } 67 69 68 70 Bool_t GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma); -
trunk/MagicSoft/Mars/mcalib/MCalibrationPINDiode.cc
r2922 r2931 44 44 // 45 45 MCalibrationPINDiode::MCalibrationPINDiode(const char *name, const char *title) 46 : fHist(NULL), 47 fCharge(-1.), 48 fErrCharge(-1.), 49 fPed(-1.), 50 fPedRms(-1.), 51 fSigmaCharge(-1.), 52 fErrSigmaCharge(-1.), 53 fTime(-1.), 54 fErrTime(-1.) 46 : fChargeLimit(3.), 47 fChargeErrLimit(0.), 48 fChargeRelErrLimit(1.), 49 fFlags(0) 55 50 { 56 51 … … 62 57 if (!fHist) 63 58 *fLog << warn << dbginf << " Could not create MHCalibrationPINDiode " << endl; 64 59 60 Clear(); 61 65 62 } 66 63 … … 77 74 { 78 75 fHist->Reset(); 76 77 CLRBIT(fFlags, kExcluded); 78 CLRBIT(fFlags, kFitValid); 79 CLRBIT(fFlags, kFitted); 80 81 fCharge = -1.; 82 fErrCharge = -1.; 83 fSigmaCharge = -1.; 84 fErrSigmaCharge = -1.; 85 fRSigmaSquare = -1.; 86 fChargeProb = -1.; 87 fPed = -1.; 88 fPedRms = -1.; 89 fTime = -1.; 90 fSigmaTime = -1.; 91 fTimeChiSquare = -1.; 92 93 } 94 95 96 // -------------------------------------------------------------------------- 97 // 98 // Set the pedestals from outside 99 // 100 void MCalibrationPINDiode::SetPedestal(Float_t ped, Float_t pedrms) 101 { 102 103 fPed = ped; 104 fPedRms = pedrms; 105 106 } 107 108 // -------------------------------------------------------------------------- 109 // 110 // Set the Excluded Bit from outside 111 // 112 void MCalibrationPINDiode::SetExcluded(Bool_t b ) 113 { 114 b ? SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded); 115 } 116 117 118 // -------------------------------------------------------------------------- 119 // 120 // Set the Excluded Bit from outside 121 // 122 void MCalibrationPINDiode::SetExcludeQualityCheck(Bool_t b ) 123 { 124 b ? SETBIT(fFlags, kExcludeQualityCheck) : CLRBIT(fFlags, kExcludeQualityCheck); 125 } 126 127 // -------------------------------------------------------------------------- 128 // 129 // Set the Excluded Bit from outside 130 // 131 void MCalibrationPINDiode::SetFitValid(Bool_t b ) 132 { 133 b ? SETBIT(fFlags, kFitValid) : CLRBIT(fFlags, kFitValid); 134 } 135 136 // -------------------------------------------------------------------------- 137 // 138 // Set the Excluded Bit from outside 139 // 140 void MCalibrationPINDiode::SetFitted(Bool_t b ) 141 { 142 b ? SETBIT(fFlags, kFitted) : CLRBIT(fFlags, kFitted); 143 } 144 145 Bool_t MCalibrationPINDiode::IsExcluded() const 146 { 147 return TESTBIT(fFlags,kExcluded); 148 } 149 150 Bool_t MCalibrationPINDiode::IsFitValid() const 151 { 152 return TESTBIT(fFlags, kFitValid); 153 } 154 155 Bool_t MCalibrationPINDiode::IsFitted() const 156 { 157 return TESTBIT(fFlags, kFitted); 79 158 } 80 159 81 160 Bool_t MCalibrationPINDiode::FitCharge() 82 161 { 83 if(!fHist->FitCharge()) 84 return kFALSE; 85 162 163 // 164 // 1) Return if the charge distribution is already succesfully fitted 165 // or if the histogram is empty 166 // 167 if (fHist->IsFitOK() || fHist->IsEmpty()) 168 return kTRUE; 169 170 // 171 // 4) Fit the Lo Gain histograms with a Gaussian 172 // 173 if(fHist->FitCharge()) 174 { 175 SETBIT(fFlags,kFitted); 176 } 177 else 178 { 179 *fLog << warn << "WARNING: Could not fit charges of PINDiode " << endl; 180 // 181 // 5) In case of failure print out the fit results 182 // 183 // fHist->PrintChargeFitResult(); 184 CLRBIT(fFlags,kFitted); 185 } 186 187 // 188 // 6) Retrieve the results and store them in this class 189 // 86 190 fCharge = fHist->GetChargeMean(); 87 191 fErrCharge = fHist->GetChargeMeanErr(); 88 192 fSigmaCharge = fHist->GetChargeSigma(); 89 193 fErrSigmaCharge = fHist->GetChargeSigmaErr(); 194 fChargeProb = fHist->GetChargeProb(); 195 196 if (CheckChargeFitValidity()) 197 SETBIT(fFlags,kFitValid); 198 else 199 { 200 CLRBIT(fFlags,kFitValid); 201 return kFALSE; 202 } 90 203 91 204 return kTRUE; … … 93 206 } 94 207 208 // 209 // The check return kTRUE if: 210 // 211 // 1) PINDiode has a fitted charge greater than 5*PedRMS 212 // 2) PINDiode has a fit error greater than 0. 213 // 3) PINDiode has a fitted charge greater its charge error 214 // 4) PINDiode has a fit Probability greater than 0.0001 215 // 5) PINDiode has a charge sigma bigger than its Pedestal RMS 216 // 217 Bool_t MCalibrationPINDiode::CheckChargeFitValidity() 218 { 219 220 if (TESTBIT(fFlags,kExcludeQualityCheck)) 221 return kTRUE; 222 223 if (fCharge < fChargeLimit*GetPedRms()) 224 { 225 *fLog << warn << "WARNING: Fitted Charge is smaller than " 226 << fChargeLimit << " Pedestal RMS in PINDiode " << endl; 227 return kFALSE; 228 } 229 230 if (fErrCharge < fChargeErrLimit) 231 { 232 *fLog << warn << "WARNING: Error of Fitted Charge is smaller than " 233 << fChargeErrLimit << " in PINDiode " << endl; 234 return kFALSE; 235 } 236 237 if (fCharge < fChargeRelErrLimit*fErrCharge) 238 { 239 *fLog << warn << "WARNING: Fitted Charge is smaller than " 240 << fChargeRelErrLimit << "* its error in PINDiode " << endl; 241 return kFALSE; 242 } 243 244 if (!fHist->IsFitOK()) 245 { 246 *fLog << warn << "WARNING: Probability of Fitted Charge too low in PINDiode " << endl; 247 return kFALSE; 248 } 249 250 if (fSigmaCharge < GetPedRms()) 251 { 252 *fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl; 253 return kFALSE; 254 } 255 return kTRUE; 256 } 257 258 259 // -------------------------------------------------------------------------- 260 // 261 // 1) Fit the arrival times 262 // 2) Retrieve the results 263 // 3) Note that because of the low number of bins, the NDf is sometimes 0, so 264 // Root does not give a reasonable Probability, the Chisquare is more significant 265 // 95 266 Bool_t MCalibrationPINDiode::FitTime() 96 267 { 97 268 98 269 if(!fHist->FitTimeHiGain()) 99 return kFALSE; 100 101 fTime = fHist->GetTime(); 102 fErrTime = fHist->GetErrTime(); 103 270 { 271 *fLog << warn << "WARNING: Could not fit Hi Gain times of PIN Diode" << endl; 272 fHist->PrintTimeFitResult(); 273 return kFALSE; 274 } 275 276 fTime = fHist->GetTimeMean(); 277 fSigmaTime = fHist->GetTimeSigma(); 278 fTimeChiSquare = fHist->GetTimeChiSquare(); 279 fTimeProb = fHist->GetTimeProb(); 280 281 if (CheckTimeFitValidity()) 282 SETBIT(fFlags,kFitValid); 283 else 284 CLRBIT(fFlags,kFitValid); 285 104 286 return kTRUE; 105 106 } 287 } 288 289 // 290 // The check returns kTRUE if: 291 // 292 // The mean arrival time is at least 1.0 slices from the used edge slices 293 // 294 Bool_t MCalibrationPINDiode::CheckTimeFitValidity() 295 { 296 297 if (TESTBIT(fFlags,kExcludeQualityCheck)) 298 return kTRUE; 299 300 return kTRUE; 301 } 302 -
trunk/MagicSoft/Mars/mcalib/MCalibrationPINDiode.h
r2904 r2931 11 11 12 12 MHCalibrationPINDiode *fHist; // Pointer to the histograms performing the fits, etc. 13 14 const Float_t fChargeLimit; // The limit (in units of PedRMS) for acceptance of the fitted mean charge 15 const Float_t fChargeErrLimit; // The limit (in units of PedRMS) for acceptance of the fitted charge sigma 16 const Float_t fChargeRelErrLimit; // The limit (in units of Error of fitted charge) for acceptance of the fitted mean 13 17 18 Float_t fPed; // The mean pedestal (from MPedestalPix) 19 Float_t fPedRms; // The pedestal RMS (from MPedestalPix) 20 14 21 Float_t fCharge; // The mean charge after the fit 15 22 Float_t fErrCharge; // The error of mean charge after the fit 16 Float_t fPed; // The mean pedestal (from MPedestalPix)17 Float_t fPedRms; // The pedestal RMS (from MPedestalPix)18 23 Float_t fSigmaCharge; // The sigma of the mean charge after the fit 19 24 Float_t fErrSigmaCharge; // The error of the sigma of the mean charge after the fit 20 Float_t fTime; // The mean arrival time after the fit 21 Float_t fErrTime; // The error of the mean arrival time after the fit 25 Float_t fRSigmaSquare; // The reduced squares of sigmas after the fit 26 Float_t fChargeProb; // The probability of the fit function 27 28 Float_t fTime; // The mean arrival time after the fit 29 Float_t fSigmaTime; // The error of the mean arrival time after the fit 30 Float_t fTimeChiSquare; // The Chi Square of the fit function 31 Float_t fTimeProb; // The probability of the fit function 32 33 Byte_t fFlags; // Flag for the set Bits 34 35 enum { kExcluded, kExcludeQualityCheck, 36 kFitValid, kFitted }; 37 38 Bool_t CheckChargeFitValidity(); 39 Bool_t CheckTimeFitValidity(); 40 Bool_t CheckOscillations(); 22 41 23 42 public: … … 28 47 void Clear(Option_t *o=""); 29 48 30 void SetPed(Float_t ped) { fPed = ped; }31 void SetPedRms(Float_t pedrms) { fPedRms = pedrms;}49 // Getter 50 MHCalibrationPINDiode *GetHist() const { return fHist; } 32 51 33 Float_t GetMean() const { return fCharge; } 34 Float_t GetMeanError() const { return fErrCharge; } 52 // Charges 53 Float_t GetCharge() const { return fCharge; } 54 Float_t GetErrCharge() const { return fErrCharge; } 55 Float_t GetChargeProb() const { return fChargeProb; } 56 Float_t GetSigmaCharge() const { return fSigmaCharge; } 57 Float_t GetErrSigmaCharge() const { return fErrSigmaCharge; } 58 Float_t GetRSigmaSquare() const { return fRSigmaSquare; } 35 59 36 Bool_t IsFitOK() const { return fCharge > 0 && fErrCharge > 0; } 60 // Times 61 Float_t GetTime() const { return fTime; } 62 Float_t GetSigmaTime() const { return fSigmaTime; } 63 Float_t GetTimeChiSquare() const { return fTimeChiSquare; } 64 Float_t GetTimeProb() const { return fTimeProb; } 37 65 66 // Pedestals 67 Float_t GetPed() const { return fPed; } 68 Float_t GetPedRms() const { return fPedRms; } 69 70 Bool_t IsExcluded() const; 71 Bool_t IsFitValid() const; 72 Bool_t IsFitted() const; 73 74 // Setters 75 void SetPedestal(Float_t ped, Float_t pedrms); 76 void SetExcluded(Bool_t b = kTRUE); 77 void SetExcludeQualityCheck(Bool_t b = kTRUE); 78 void SetFitValid(Bool_t b = kTRUE); 79 void SetFitted(Bool_t b = kTRUE); 80 81 // Fill histos 38 82 Bool_t FillCharge(Float_t q) { return fHist->FillChargeHiGain(q); } 39 83 Bool_t FillTime(Float_t t) { return fHist->FillTimeHiGain(t); } 40 84 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); } 41 85 86 // Fits 42 87 Bool_t FitCharge(); 43 88 Bool_t FitTime(); 89 90 // Draws 91 void Draw(Option_t *opt="") { fHist->Draw(opt); } 92 TObject *DrawClone(Option_t *opt="") const { return fHist->DrawClone(opt); } 44 93 45 MHCalibrationPINDiode *GetHist() const { return fHist; } 46 47 ClassDef(MCalibrationPINDiode, 1) // Storage Container for Calibration information of one pixel 94 ClassDef(MCalibrationPINDiode, 1) // Storage Container for Calibration information of the PIN Diode 48 95 }; 49 96 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.cc
r2922 r2931 58 58 // 59 59 MHCalibrationBlindPixel::MHCalibrationBlindPixel(const char *name, const char *title) 60 : fHBlindPixelCharge(NULL), 61 fHBlindPixelTime(NULL), 62 fHBlindPixelChargevsN(NULL), 63 fHBlindPixelPSD(NULL), 64 fSinglePheFit(NULL), 65 fTimeGausFit(NULL), 66 fSinglePhePedFit(NULL), 67 fBlindPixelChargefirst(0.), 68 fBlindPixelChargelast(0.), 69 fBlindPixelChargenbins(0), 70 fFitLegend(NULL), fFitOK(kFALSE), 71 fLambda(0.), fMu0(0.), fMu1(0.), fSigma0(0.), fSigma1(0.), 72 fLambdaErr(0.), fMu0Err(0.), fMu1Err(0.), fSigma0Err(0.), fSigma1Err(0.), 73 fChisquare(0.), fProb(0.), fNdf(0), 74 fMeanTime(0.), fMeanTimeErr(0.), fSigmaTime(0.), fSigmaTimeErr(0.), 75 fLambdaCheck(0.), fLambdaCheckErr(0.), 76 fFitFunc(kEPoisson4) 60 : fBlindPixelChargeNbins(500), 61 fBlindPixelTimeNbins(32), 62 fBlindPixelChargevsNbins(1000), 63 fBlindPixelTimeFirst(-0.25), 64 fBlindPixelTimeLast(15.75), 65 fHBlindPixelPSD(NULL), 66 fSinglePheFit(NULL), 67 fTimeGausFit(NULL), 68 fSinglePhePedFit(NULL), 69 fFitLegend(NULL) 77 70 { 78 71 … … 81 74 82 75 // Create a large number of bins, later we will rebin 83 fBlindPixelChargefirst = -1000.; 84 fBlindPixelChargelast = gkStartBlindPixelBinNr; 85 fBlindPixelChargenbins = gkStartBlindPixelBinNr+(int)fBlindPixelChargefirst; 76 fBlindPixelChargefirst = -100.; 77 fBlindPixelChargelast = 400.; 86 78 87 79 fHBlindPixelCharge = new TH1F("HBlindPixelCharge","Distribution of Summed FADC Slices", 88 fBlindPixelCharge nbins,fBlindPixelChargefirst,fBlindPixelChargelast);80 fBlindPixelChargeNbins,fBlindPixelChargefirst,fBlindPixelChargelast); 89 81 fHBlindPixelCharge->SetXTitle("Sum FADC Slices"); 90 82 fHBlindPixelCharge->SetYTitle("Nr. of events"); … … 92 84 fHBlindPixelCharge->SetDirectory(NULL); 93 85 94 Axis_t tfirst = -0.5; 95 Axis_t tlast = 15.5; 96 Int_t nbins = 16; 97 98 fHBlindPixelTime = new TH1F("HBlindPixelTime","Distribution of Mean Arrival Times",nbins,tfirst,tlast); 86 fHBlindPixelTime = new TH1F("HBlindPixelTime","Distribution of Mean Arrival Times", 87 fBlindPixelTimeNbins,fBlindPixelTimeFirst,fBlindPixelTimeLast); 99 88 fHBlindPixelTime->SetXTitle("Mean Arrival Times [FADC slice nr]"); 100 89 fHBlindPixelTime->SetYTitle("Nr. of events"); … … 102 91 fHBlindPixelTime->SetDirectory(NULL); 103 92 104 // We define a reasonable number and later enlarge it if necessary 105 nbins = 20000; 106 Axis_t nfirst = -0.5; 107 Axis_t nlast = (Axis_t)nbins - 0.5; 108 109 fHBlindPixelChargevsN = new TH1I("HBlindPixelChargevsN","Sum of Charges vs. Event Number",nbins,nfirst,nlast); 93 fHBlindPixelChargevsN = new TH1I("HBlindPixelChargevsN","Sum of Charges vs. Event Number", 94 fBlindPixelChargevsNbins,-0.5,(Axis_t)fBlindPixelChargevsNbins-0.5); 110 95 fHBlindPixelChargevsN->SetXTitle("Event Nr."); 111 96 fHBlindPixelChargevsN->SetYTitle("Sum of FADC slices"); 112 97 fHBlindPixelChargevsN->SetDirectory(NULL); 113 98 99 Clear(); 114 100 } 115 101 … … 126 112 if (fHBlindPixelPSD) 127 113 delete fHBlindPixelPSD; 128 129 114 if (fSinglePheFit) 130 115 delete fSinglePheFit; … … 136 121 } 137 122 123 void MHCalibrationBlindPixel::Clear(Option_t *o) 124 { 125 126 fBlindPixelChargefirst = -100.; 127 fBlindPixelChargelast = 400.; 128 129 fLambda = 0.; 130 fMu0 = 0.; 131 fMu1 = 0.; 132 fSigma0 = 0.; 133 fSigma1 = 0.; 134 135 fLambdaErr = 0.; 136 fMu0Err = 0.; 137 fMu1Err = 0.; 138 fSigma0Err = 0.; 139 fSigma1Err = 0.; 140 141 fChisquare = -1.; 142 fProb = -1.; 143 fNdf = -1; 144 145 fMeanTime = -1.; 146 fMeanTimeErr = -1.; 147 fSigmaTime = -1.; 148 fSigmaTimeErr = -1.; 149 150 fLambdaCheck = -1.; 151 fLambdaCheckErr = -1.; 152 153 fFitFunc = kEPoisson4; 154 155 if (fFitLegend) 156 delete fFitLegend; 157 if (fHBlindPixelPSD) 158 delete fHBlindPixelPSD; 159 if (fSinglePheFit) 160 delete fSinglePheFit; 161 if (fTimeGausFit) 162 delete fTimeGausFit; 163 if(fSinglePhePedFit) 164 delete fSinglePhePedFit; 165 166 return; 167 } 168 169 void MHCalibrationBlindPixel::Reset() 170 { 171 172 Clear(); 173 174 fHBlindPixelCharge->Reset(); 175 fHBlindPixelTime->Reset(); 176 fHBlindPixelChargevsN->Reset(); 177 178 } 179 138 180 Bool_t MHCalibrationBlindPixel::FillBlindPixelCharge(Float_t q) 139 181 { … … 149 191 { 150 192 return fHBlindPixelChargevsN->Fill(t,rq) > -1; 151 }152 153 154 void MHCalibrationBlindPixel::ResetBin(Int_t i)155 {156 fHBlindPixelCharge->SetBinContent (i, 1.e-20);157 fHBlindPixelTime->SetBinContent(i, 1.e-20);158 193 } 159 194 … … 578 613 fBlindPixelChargefirst = fHBlindPixelCharge->GetBinLowEdge(fHBlindPixelCharge->GetXaxis()->GetFirst()); 579 614 fBlindPixelChargelast = fHBlindPixelCharge->GetBinLowEdge(fHBlindPixelCharge->GetXaxis()->GetLast())+fHBlindPixelCharge->GetBinWidth(0); 580 fBlindPixelChargenbins = nbins;581 615 582 616 CutEdges(fHBlindPixelChargevsN,0); -
trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h
r2920 r2931 17 17 private: 18 18 19 const Int_t fBlindPixelChargeNbins; 20 const Int_t fBlindPixelTimeNbins; 21 const Int_t fBlindPixelChargevsNbins; 22 const Axis_t fBlindPixelTimeFirst; 23 const Axis_t fBlindPixelTimeLast; 24 19 25 TH1F* fHBlindPixelCharge; // Histogram with the single Phe spectrum 20 26 TH1F* fHBlindPixelTime; // Variance of summed FADC slices … … 28 34 Axis_t fBlindPixelChargefirst; 29 35 Axis_t fBlindPixelChargelast; 30 Int_t fBlindPixelChargenbins; 31 32 void ResetBin(Int_t i); 36 33 37 void DrawLegend(); 34 38 … … 65 69 ~MHCalibrationBlindPixel(); 66 70 71 void Clear(Option_t *o=""); 72 void Reset(); 73 67 74 Bool_t FillBlindPixelCharge(Float_t q); 68 75 Bool_t FillBlindPixelTime(Float_t t); -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc
r2905 r2931 36 36 #include <TH1.h> 37 37 #include <TF1.h> 38 #include <TPaveText.h> 38 39 39 40 ClassImp(MHCalibrationPINDiode); … … 46 47 // 47 48 MHCalibrationPINDiode::MHCalibrationPINDiode(const char *name, const char *title) 48 : fVarGausFit(NULL) 49 : fChargeNbins(1000), 50 fTimeNbins(64), 51 fChargevsNbins(10000), 52 fTimeFirst(-0.25), 53 fTimeLast(31.75) 49 54 { 50 55 … … 53 58 54 59 // Create a large number of bins, later we will rebin 55 fChargeFirstHiGain = -1000.; 56 fChargeLastHiGain = gkStartPINDiodeBinNr; 57 fChargeNbinsHiGain = gkStartPINDiodeBinNr; 60 fChargeFirstHiGain = -100.5; 61 fChargeLastHiGain = 1999.5; 58 62 59 fHP Charge = new TH1I("HPCharge","Distribution of Summed FADC Slices",60 fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain);61 fHP Charge->SetXTitle("Sum FADC Slices");62 fHP Charge->SetYTitle("Nr. of events");63 fHP Charge->Sumw2();64 fHP Charge->SetDirectory(0);63 fHPINDiodeCharge = new TH1F("HPINDiodeCharge","Distribution of Summed FADC Slices PINDiode", 64 fChargeNbins,fChargeFirstHiGain,fChargeLastHiGain); 65 fHPINDiodeCharge->SetXTitle("Sum FADC Slices"); 66 fHPINDiodeCharge->SetYTitle("Nr. of events"); 67 fHPINDiodeCharge->Sumw2(); 68 fHPINDiodeCharge->SetDirectory(NULL); 65 69 66 fErrChargeFirst = 0.; 67 fErrChargeLast = gkStartPINDiodeBinNr; 68 fErrChargeNbins = gkStartPINDiodeBinNr; 70 fHPINDiodeTime = new TH1F("HPINDiodeTime","Distribution of Mean Arrival Times PINDiode", 71 fTimeNbins,fTimeFirst,fTimeLast); 72 fHPINDiodeTime->SetXTitle("Mean Arrival Times [FADC slice nr]"); 73 fHPINDiodeTime->SetYTitle("Nr. of events"); 74 fHPINDiodeTime->Sumw2(); 75 fHPINDiodeTime->SetDirectory(NULL); 69 76 70 fH ErrCharge = new TH1F("HErrCharge","Distribution of Variances of Summed FADC Slices",fErrChargeNbins,fErrChargeFirst,fErrChargeLast);71 fHErrCharge->SetXTitle("Variance Summed FADC Slices");72 fH ErrCharge->SetYTitle("Nr. of events");73 fH ErrCharge->Sumw2();74 fH ErrCharge->SetDirectory(0);77 fHPINDiodeChargevsN = new TH1I("HPINDiodeChargevsN","Sum of Hi Gain Charges vs. Event Number Pixel ", 78 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5); 79 fHPINDiodeChargevsN->SetXTitle("Event Nr."); 80 fHPINDiodeChargevsN->SetYTitle("Sum of Hi Gain FADC slices"); 81 fHPINDiodeChargevsN->SetDirectory(NULL); 75 82 76 Int_t tfirst = 0; 77 Int_t tlast = 31; 78 Int_t nbins = 32; 79 80 fHPTime = new TH1F("HPTime","Distribution of Mean Arrival Times",nbins,tfirst,tlast); 81 fHPTime->SetXTitle("Mean Arrival Times [FADC slice nr]"); 82 fHPTime->SetYTitle("Nr. of events"); 83 fHPTime->Sumw2(); 84 fHPTime->SetDirectory(0); 85 83 Clear(); 86 84 } 87 85 … … 89 87 { 90 88 91 delete fHPCharge; 92 delete fHErrCharge; 89 delete fHPINDiodeCharge; 90 delete fHPINDiodeTime; 91 delete fHPINDiodeChargevsN; 92 93 if (fChargeGausFit) 94 delete fChargeGausFit; 95 if (fTimeGausFit) 96 delete fTimeGausFit; 97 if (fFitLegend) 98 delete fFitLegend; 99 } 100 101 void MHCalibrationPINDiode::Clear(Option_t *o) 102 { 93 103 94 if (fVarGausFit) 95 delete fVarGausFit; 96 97 delete fHPTime; 104 fTotalEntries = 0; 105 106 fChargeFirstHiGain = -100.5; 107 fChargeLastHiGain = 1999.5; 108 109 fChargeChisquare = -1.; 110 fChargeProb = -1.; 111 fChargeNdf = -1; 112 fTimeChisquare = -1.; 113 fTimeProb = -1.; 114 fTimeNdf = -1; 115 fTimeMean = -1.; 116 fTimeSigma = -1.; 117 118 fTimeLowerFitRangeHiGain = 0; 119 fTimeUpperFitRangeHiGain = 0; 120 fTimeLowerFitRangeLoGain = 0; 121 fTimeUpperFitRangeLoGain = 0; 122 123 if (fChargeGausFit) 124 delete fChargeGausFit; 125 if (fTimeGausFit) 126 delete fTimeGausFit; 127 if (fFitLegend) 128 delete fFitLegend; 129 130 return; 98 131 99 132 } 100 133 101 const Double_t MHCalibrationPINDiode::GetTime() const 134 void MHCalibrationPINDiode::Reset() 102 135 { 103 return fVarGausFit->GetParameter(2); 136 137 Clear(); 138 139 fHPINDiodeCharge->Reset(); 140 fHPINDiodeTime->Reset(); 141 fHPINDiodeChargevsN->Reset(); 104 142 } 105 143 106 const Double_t MHCalibrationPINDiode::GetErrTime() const 144 145 Bool_t MHCalibrationPINDiode::FillCharge(Float_t q) 107 146 { 108 return fVarGausFit->GetParameter(3);147 return (fHPINDiodeCharge->Fill(q) > -1); 109 148 } 149 150 Bool_t MHCalibrationPINDiode::FillTime(Float_t t) 151 { 152 return (fHPINDiodeTime->Fill(t) > -1); 153 } 154 155 Bool_t MHCalibrationPINDiode::FillChargevsN(Float_t q, Int_t n) 156 { 157 return (fHPINDiodeChargevsN->Fill(n,q) > -1); 158 } 159 160 void MHCalibrationPINDiode::CutAllEdges() 161 { 162 163 Int_t nbins = 30; 164 165 CutEdges(fHPINDiodeCharge,nbins); 166 167 fChargeFirstHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetFirst()); 168 fChargeLastHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetLast()) 169 +fHPINDiodeCharge->GetBinWidth(0); 170 CutEdges(fHPINDiodeChargevsN,0); 171 172 } 173 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.h
r2904 r2931 9 9 class TH1F; 10 10 class TF1; 11 class TPaveText; 11 12 12 13 class MHCalibrationPINDiode : public MHCalibrationPixel … … 14 15 private: 15 16 16 TH1 I* fHPCharge; //->Histogram containing the summed 32 PINDiode slices17 TH1F* fH ErrCharge; //->Variance of summed FADC slices18 TH1F* fHP Time; //->Histogram with time evolution of summed charges17 TH1F* fHPINDiodeCharge; // Histogram containing the summed 32 PINDiode slices 18 TH1F* fHPINDiodeErrCharge; // Variance of summed FADC slices 19 TH1F* fHPINDiodeTime; // Histogram with time evolution of summed charges 19 20 20 T F1 *fVarGausFit;21 TH1I* fHPINDiodeChargevsN; // Summed Charge vs. Event Nr. 21 22 22 Float_t fErrChargeFirst; 23 Float_t fErrChargeLast; 24 UShort_t fErrChargeNbins; 23 const Int_t fChargeNbins; 24 const Int_t fTimeNbins; 25 const Int_t fChargevsNbins; 26 27 const Axis_t fTimeFirst; 28 const Axis_t fTimeLast; 25 29 26 30 public: … … 29 33 ~MHCalibrationPINDiode(); 30 34 31 const Double_t GetTime() const;32 const Double_t GetErrTime() const;35 void Clear(Option_t *o=""); 36 void Reset(); 33 37 38 // Fill histos 39 Bool_t FillCharge(Float_t q); 40 Bool_t FillTime(Float_t t); 41 Bool_t FillChargevsN(Float_t q, Int_t n); 42 43 // Fits -- not yet implemented 44 Bool_t FitCharge(Option_t *option="RQ0") { return kTRUE; } 45 Bool_t FitTime(Option_t *option="RQ0") { return kTRUE; } 46 47 // Others 48 void CutAllEdges(); 49 34 50 ClassDef(MHCalibrationPINDiode, 0) // Histograms from the Calibration PIN Diode 35 51 }; -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.h
r2922 r2931 19 19 20 20 Int_t fPixId; // Pixel Nr 21 Int_t fTotalEntries; // Number of entries22 21 23 22 TArrayF *fHiGains; //-> … … 25 24 26 25 protected: 26 27 Int_t fTotalEntries; // Number of entries 27 28 28 29 TH1F* fHChargeHiGain; // Summed FADC slices High Gain
Note:
See TracChangeset
for help on using the changeset viewer.