Changeset 3034 for trunk/MagicSoft/Mars/manalysis/MHPedestalPixel.cc
- Timestamp:
- 02/05/04 17:45:27 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MHPedestalPixel.cc
r3015 r3034 48 48 const Float_t gkSq2Pi = 2.506628274631; 49 49 const Float_t gkProbLimit = 0.01; 50 const Int_t MHPedestalPixel::gkChargeNbins = 500 ; 50 const Int_t MHPedestalPixel::gkChargeNbins = 250 ; 51 const Axis_t MHPedestalPixel::gkChargeFirst = -0.5; 52 const Axis_t MHPedestalPixel::gkChargeLast = 249.5; 51 53 const Int_t MHPedestalPixel::gkChargevsNbins = 1000; 52 54 const Axis_t MHPedestalPixel::gkChargevsNFirst = -0.5; 53 55 const Axis_t MHPedestalPixel::gkChargevsNLast = 999.5; 54 const Axis_t MHPedestalPixel::gkChargeFirst = -0.5;55 const Axis_t MHPedestalPixel::gkChargeLast = 499.5;56 56 57 57 // -------------------------------------------------------------------------- … … 97 97 { 98 98 99 fTotalEntries = 0;99 fTotalEntries = 0; 100 100 101 101 fChargeMean = -1.; … … 196 196 { 197 197 198 gStyle->SetOptFit(1);199 198 gStyle->SetOptStat(111111); 199 gStyle->SetOptFit(); 200 200 201 201 gROOT->SetSelectedPad(NULL); … … 203 203 TCanvas *c = MH::MakeDefCanvas(this,600,900); 204 204 205 c->Divide(1,2);205 // c->Divide(1,2); 206 206 207 207 c->cd(1); … … 210 210 211 211 if (fHPedestalCharge->Integral() > 0) 212 gPad->SetLogy( 1);212 gPad->SetLogy(); 213 213 214 214 fHPedestalCharge->Draw(opt); … … 226 226 c->Update(); 227 227 228 /* 228 229 c->cd(2); 229 230 gPad->SetTicks(); 230 231 231 232 fHPedestalChargevsN->Draw(opt); 233 */ 234 232 235 c->Modified(); 233 236 c->Update(); … … 285 288 286 289 // 287 // If we are not able to fit, try once again 288 // 289 if (fGausFit->GetProb() < gkProbLimit) 290 { 291 292 Axis_t rtry = fGausFit->GetParameter(1) - 2.0*fGausFit->GetParameter(2); 293 rmin = (rtry < rmin ? rmin : rtry); 294 rmax = fGausFit->GetParameter(1) + 2.0*fGausFit->GetParameter(2); 295 fGausFit->SetRange(rmin,rmax); 296 297 fHPedestalCharge->Fit(fGausFit,option); 298 } 290 // In order not to be affected by outliers, 291 // try once again with stricter borders 292 // 293 Axis_t rtry = fGausFit->GetParameter(1) - 2.5*fGausFit->GetParameter(2); 294 rmin = (rtry < rmin ? rmin : rtry); 295 rtry = fGausFit->GetParameter(1) + 2.5*fGausFit->GetParameter(2); 296 rmax = (rtry > rmax ? rmax : rtry); 297 fGausFit->SetRange(rmin,rmax); 298 299 fHPedestalCharge->Fit(fGausFit,option); 299 300 300 301 fChargeChisquare = fGausFit->GetChisquare(); … … 312 313 // The Probability is greater than gkProbLimit (default 0.001 == 99.9%) 313 314 // 314 if (TMath::IsNaN(fChargeMean) || TMath::IsNaN(fChargeMeanErr)) 315 if (TMath::IsNaN(fChargeMean) || 316 TMath::IsNaN(fChargeMeanErr) || 317 TMath::IsNaN(fChargeSigma) || 318 TMath::IsNaN(fChargeSigmaErr)) 319 { 320 Clear(); 321 // CLRBIT(fFlags,kFitOK); 322 return kFALSE; 323 } 324 325 if ((fChargeProb < gkProbLimit) || (TMath::IsNaN(fChargeProb))) 315 326 { 316 327 CLRBIT(fFlags,kFitOK); … … 318 329 } 319 330 320 if ((fChargeProb < gkProbLimit) || (TMath::IsNaN(fChargeProb)))321 {322 CLRBIT(fFlags,kFitOK);323 return kFALSE;324 }325 326 331 SETBIT(fFlags,kFitOK); 327 332 return kTRUE; 328 333 } 329 334 335 void MHPedestalPixel::Renorm(const Float_t nslices) 336 { 337 338 if (!TESTBIT(fFlags,kFitOK)) 339 return; 340 341 Float_t sqslices = TMath::Sqrt(nslices); 342 343 fChargeMean /= nslices; 344 // 345 // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices 346 // 347 fChargeMeanErr /= nslices; 348 // 349 // Sigma goes like PedestalRMS -> scale with sqrt(slices) 350 // 351 fChargeSigma /= sqslices; 352 // 353 // Sigma error goes like PedestalRMS/2.(entries) -> scale with slices 354 // 355 fChargeSigmaErr /= nslices; 356 357 } 358 330 359 void MHPedestalPixel::CutAllEdges() 331 360 { 332 361 333 Int_t nbins = 30;362 Int_t nbins = 15; 334 363 335 364 MH::CutEdges(fHPedestalCharge,nbins);
Note:
See TracChangeset
for help on using the changeset viewer.