Changeset 2880 for trunk/MagicSoft/Mars
- Timestamp:
- 01/21/04 23:00:33 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2879 r2880 20 20 plexiglass is not intended to be calculated any more (previous 21 21 bug) 22 - exclude excluded pixels in eventloop 22 23 23 24 -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
r2879 r2880 261 261 { 262 262 263 *fLog << "HALLO: " << fExcludedPixelsFile.Data() << endl;264 265 263 fExcludedPixelsFile = gSystem->ExpandPathName(fExcludedPixelsFile.Data()); 266 264 … … 388 386 const UInt_t pixid = pixel.GetPixelId(); 389 387 388 MCalibrationPix &pix = (*fCalibrations)[pixid]; 389 390 if (pix.IsExcluded()) 391 continue; 392 390 393 MExtractedSignalPix &sig = (*fSignals)[pixid]; 391 394 … … 394 397 Float_t mtime = sig.GetMeanArrivalTime(); 395 398 396 MCalibrationPix &pix = (*fCalibrations)[pixid];397 399 398 400 switch(pixid) -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
r2852 r2880 303 303 *fLog << all << endl; 304 304 305 TIter Next3(fPixels); 306 while ((pix=(MCalibrationPix*)Next3())) 307 if (pix->IsExcluded()) 308 *fLog << all << pix->GetPixId() << endl; 309 305 310 *fLog << all << fNumExcludedPixels << " excluded pixels " << endl; 306 311 … … 425 430 // -------------------------------------------------------------------------- 426 431 // 427 432 // 428 433 // 429 434 Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass() … … 442 447 *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption 443 448 * gkCalibrationInnerPixelArea; // correct for area 449 450 444 451 break; 445 452 case kECBlue: -
trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.cc
r2852 r2880 67 67 // 68 68 MHCalibrationBlindPixel::MHCalibrationBlindPixel(const char *name, const char *title) 69 : fFitLegend(NULL), fFitOK(kFALSE), 69 : fHBlindPixelCharge(NULL), 70 fHBlindPixelTime(NULL), 71 fHBlindPixelChargevsN(NULL), 72 fHBlindPixelPSD(NULL), 73 fSinglePheFit(NULL), 74 fTimeGausFit(NULL), 75 fSinglePhePedFit(NULL), 76 fBlindPixelChargefirst(0.), 77 fBlindPixelChargelast(0.), 78 fBlindPixelChargenbins(0), 79 fFitLegend(NULL), fFitOK(kFALSE), 70 80 fLambda(0.), fMu0(0.), fMu1(0.), fSigma0(0.), fSigma1(0.), 71 81 fLambdaErr(0.), fMu0Err(0.), fMu1Err(0.), fSigma0Err(0.), fSigma1Err(0.), … … 122 132 delete fHBlindPixelTime; 123 133 delete fHBlindPixelChargevsN; 124 134 135 if (fHBlindPixelPSD) 136 delete fHBlindPixelPSD; 137 138 if (fSinglePheFit) 139 delete fSinglePheFit; 140 if (fTimeGausFit) 141 delete fTimeGausFit; 142 if(fSinglePhePedFit) 143 delete fSinglePhePedFit; 144 125 145 } 126 146 … … 208 228 } 209 229 210 211 TObject *MHCalibrationBlindPixel::DrawClone(Option_t *opt) const 230 TObject *MHCalibrationBlindPixel::DrawClone(Option_t *option) const 212 231 { 213 232 214 233 gROOT->SetSelectedPad(NULL); 215 216 TObject *newobj = Clone(); 217 234 235 // TVirtualPad *padsav = gPad; 236 237 // TObject *newobj = (TObject *)IsA()->New(); 238 // Copy(*newobj); 239 // TObject *newobj = Clone(); 240 MHCalibrationBlindPixel *newobj = (MHCalibrationBlindPixel*)Clone(); 241 242 if (!newobj) 243 return 0; 218 244 newobj->SetBit(kCanDelete); 219 if (!newobj) 220 return 0; 221 222 // ((MHCalibrationBlindPixel*)newobj)->Draw(opt); 223 newobj->Draw(opt); 245 246 if (strlen(option)) 247 newobj->Draw(option); 248 // ((MHCalibrationBlindPixel*)newobj)->Draw(option); 249 // newobj->Draw(option); 250 else 251 newobj->Draw(GetDrawOption()); 252 // ((MHCalibrationBlindPixel*)newobj)->Draw(GetDrawOption()); 253 // newobj->Draw(GetDrawOption()); 254 // if (padsav) padsav->cd(); 255 224 256 return newobj; 225 257 } 226 258 227 228 259 229 260 // ------------------------------------------------------------------------- … … 239 270 TCanvas *c = MakeDefCanvas(this,550,700); 240 271 241 c->Divide(2, 2);272 c->Divide(2,3); 242 273 243 274 gROOT->SetSelectedPad(NULL); 244 275 245 276 c->cd(1); 277 gPad->SetLogx(0); 246 278 gPad->SetLogy(1); 247 279 gPad->SetTicks(); 248 280 249 fHBlindPixelCharge->Draw Copy(opt);281 fHBlindPixelCharge->Draw(opt); 250 282 251 283 if (fFitOK) 252 fSinglePheFit .SetLineColor(kGreen);284 fSinglePheFit->SetLineColor(kGreen); 253 285 else 254 fSinglePheFit .SetLineColor(kRed);286 fSinglePheFit->SetLineColor(kRed); 255 287 256 fSinglePheFit .DrawCopy("same");288 fSinglePheFit->Draw("same"); 257 289 c->Modified(); 258 290 c->Update(); 259 291 260 fSinglePhePedFit .SetLineColor(kBlue);261 fSinglePhePedFit .DrawCopy("same");292 fSinglePhePedFit->SetLineColor(kBlue); 293 fSinglePhePedFit->Draw("same"); 262 294 263 295 c->cd(2); … … 269 301 gPad->SetLogy(1); 270 302 gPad->SetBorderMode(0); 271 fHBlindPixelTime->DrawCopy(opt); 272 273 if (fHBlindPixelTime->GetFunction("GausTime")) 274 { 275 TF1 *tfit = fHBlindPixelTime->GetFunction("GausTime"); 276 if (tfit->GetProb() < 0.01) 277 tfit->SetLineColor(kRed); 278 else 279 tfit->SetLineColor(kGreen); 280 281 tfit->DrawCopy("same"); 282 c->Modified(); 283 c->Update(); 284 } 303 fHBlindPixelTime->Draw(opt); 285 304 286 305 c->cd(4); 287 306 288 fHBlindPixelChargevsN->Draw Copy(opt);307 fHBlindPixelChargevsN->Draw(opt); 289 308 290 309 c->Modified(); 291 310 c->Update(); 311 312 c->cd(5); 313 314 // fHBlindPixelPSD = (TH1F*)MFFT::PowerSpectrumDensity(fHBlindPixelChargevsN); 315 // TH1F *hist = MFFT::PowerSpectrumDensity((*this)->fHBlindPixelChargevsN); 316 317 // fHBlindPixelPSD->Draw(opt); 318 c->Modified(); 319 c->Update(); 320 292 321 } 293 322 … … 305 334 } 306 335 307 TF1 simulateSinglePhe; 308 309 InitFit(simulateSinglePhe,fBlindPixelChargefirst,fBlindPixelChargelast); 310 336 if (!InitFit(fBlindPixelChargefirst,fBlindPixelChargelast)) 337 return kFALSE; 338 311 339 for (Int_t i=0;i<10000; i++) 312 fHBlindPixelCharge->Fill( simulateSinglePhe.GetRandom());340 fHBlindPixelCharge->Fill(fSinglePheFit->GetRandom()); 313 341 314 342 return kTRUE; 315 343 } 316 344 317 void MHCalibrationBlindPixel::InitFit(TF1& f,Axis_t min, Axis_t max)345 Bool_t MHCalibrationBlindPixel::InitFit(Axis_t min, Axis_t max) 318 346 { 319 347 … … 337 365 338 366 case kEPoisson4: 339 f =TF1("SinglePheFit",&fPoissonKto4,min,max,6);340 f .SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);341 f .SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");342 f .SetParLimits(0,0.,1.);343 f .SetParLimits(1,min,(max-min)/1.5);344 f .SetParLimits(2,(max-min)/2.,(max-0.05*(max-min)));345 f .SetParLimits(3,1.0,(max-min)/2.0);346 f .SetParLimits(4,1.0,(max-min)/2.5);347 f .SetParLimits(5,norm-0.1,norm+0.1);367 fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto4,min,max,6); 368 fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm); 369 fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area"); 370 fSinglePheFit->SetParLimits(0,0.,1.); 371 fSinglePheFit->SetParLimits(1,min,(max-min)/1.5); 372 fSinglePheFit->SetParLimits(2,(max-min)/2.,(max-0.05*(max-min))); 373 fSinglePheFit->SetParLimits(3,1.0,(max-min)/2.0); 374 fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5); 375 fSinglePheFit->SetParLimits(5,norm-0.1,norm+0.1); 348 376 break; 349 377 350 378 case kEPoisson5: 351 f =TF1("SinglePheFit",&fPoissonKto5,min,max,6);352 f .SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);353 f .SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");354 f .SetParLimits(0,0.,1.);355 f .SetParLimits(1,min,(max-min)/1.5);356 f .SetParLimits(2,(max-min)/2.,(max-0.05*(max-min)));357 f .SetParLimits(3,1.0,(max-min)/2.0);358 f .SetParLimits(4,1.0,(max-min)/2.5);359 f .SetParLimits(5,norm-0.1,norm+0.1);379 fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto5,min,max,6); 380 fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm); 381 fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area"); 382 fSinglePheFit->SetParLimits(0,0.,1.); 383 fSinglePheFit->SetParLimits(1,min,(max-min)/1.5); 384 fSinglePheFit->SetParLimits(2,(max-min)/2.,(max-0.05*(max-min))); 385 fSinglePheFit->SetParLimits(3,1.0,(max-min)/2.0); 386 fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5); 387 fSinglePheFit->SetParLimits(5,norm-0.1,norm+0.1); 360 388 break; 361 389 362 390 case kEPoisson6: 363 f =TF1("SinglePheFit",&fPoissonKto6,min,max,6);364 f .SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);365 f .SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");366 f .SetParLimits(0,0.,1.);367 f .SetParLimits(1,min,(max-min)/1.5);368 f .SetParLimits(2,(max-min)/2.,(max-0.05*(max-min)));369 f .SetParLimits(3,1.0,(max-min)/2.0);370 f .SetParLimits(4,1.0,(max-min)/2.5);371 f .SetParLimits(5,norm-0.1,norm+0.1);391 fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto6,min,max,6); 392 fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm); 393 fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area"); 394 fSinglePheFit->SetParLimits(0,0.,1.); 395 fSinglePheFit->SetParLimits(1,min,(max-min)/1.5); 396 fSinglePheFit->SetParLimits(2,(max-min)/2.,(max-0.05*(max-min))); 397 fSinglePheFit->SetParLimits(3,1.0,(max-min)/2.0); 398 fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5); 399 fSinglePheFit->SetParLimits(5,norm-0.1,norm+0.1); 372 400 break; 373 401 … … 380 408 case kEMichele: 381 409 break; 382 410 411 default: 412 *fLog << warn << "WARNING: Could not find Fit Function for Blind Pixel " << endl; 413 return kFALSE; 414 break; 383 415 } 384 } 385 386 void MHCalibrationBlindPixel::ExitFit(TF1 &f) 416 417 return kTRUE; 418 } 419 420 void MHCalibrationBlindPixel::ExitFit(TF1 *f) 387 421 { 388 422 … … 398 432 case kEPoisson6: 399 433 case kEPoisson7: 400 fLambda = fSinglePheFit .GetParameter(0);401 fMu0 = fSinglePheFit .GetParameter(1);402 fMu1 = fSinglePheFit .GetParameter(2);403 fSigma0 = fSinglePheFit .GetParameter(3);404 fSigma1 = fSinglePheFit .GetParameter(4);434 fLambda = fSinglePheFit->GetParameter(0); 435 fMu0 = fSinglePheFit->GetParameter(1); 436 fMu1 = fSinglePheFit->GetParameter(2); 437 fSigma0 = fSinglePheFit->GetParameter(3); 438 fSigma1 = fSinglePheFit->GetParameter(4); 405 439 406 fLambdaErr = fSinglePheFit .GetParError(0);407 fMu0Err = fSinglePheFit .GetParError(1);408 fMu1Err = fSinglePheFit .GetParError(2);409 fSigma0Err = fSinglePheFit .GetParError(3);410 fSigma1Err = fSinglePheFit .GetParError(4);440 fLambdaErr = fSinglePheFit->GetParError(0); 441 fMu0Err = fSinglePheFit->GetParError(1); 442 fMu1Err = fSinglePheFit->GetParError(2); 443 fSigma0Err = fSinglePheFit->GetParError(3); 444 fSigma1Err = fSinglePheFit->GetParError(4); 411 445 break; 412 446 default: … … 426 460 rmax = (rmax != 0.) ? rmax : fBlindPixelChargelast; 427 461 428 InitFit(fSinglePheFit,rmin,rmax); 429 430 fHBlindPixelCharge->Fit(&fSinglePheFit,opt); 462 if (!InitFit(rmin,rmax)) 463 return kFALSE; 464 465 fHBlindPixelCharge->Fit(fSinglePheFit,opt); 466 431 467 432 468 ExitFit(fSinglePheFit); 433 469 434 fProb = fSinglePheFit .GetProb();435 fChisquare = fSinglePheFit .GetChisquare();436 fNdf = fSinglePheFit .GetNDF();470 fProb = fSinglePheFit->GetProb(); 471 fChisquare = fSinglePheFit->GetChisquare(); 472 fNdf = fSinglePheFit->GetNDF(); 437 473 438 474 // Perform the cross-check fitting only the pedestal: 439 fSinglePhePedFit = TF1("GausPed","gaus",rmin,fMu0);440 fHBlindPixelCharge->Fit( &fSinglePhePedFit,opt);475 fSinglePhePedFit = new TF1("GausPed","gaus",rmin,fMu0); 476 fHBlindPixelCharge->Fit(fSinglePhePedFit,opt); 441 477 442 478 const Stat_t entries = fHBlindPixelCharge->Integral("width"); 443 479 444 Double_t pedarea = fSinglePhePedFit .GetParameter(0)*gkSq2Pi*fSinglePhePedFit.GetParameter(2);480 Double_t pedarea = fSinglePhePedFit->GetParameter(0)*gkSq2Pi*fSinglePhePedFit->GetParameter(2); 445 481 fLambdaCheck = TMath::Log(entries/pedarea); 446 fLambdaCheckErr = fSinglePhePedFit .GetParError(0)/fSinglePhePedFit.GetParameter(0)447 + fSinglePhePedFit .GetParError(2)/fSinglePhePedFit.GetParameter(2);482 fLambdaCheckErr = fSinglePhePedFit->GetParError(0)/fSinglePhePedFit->GetParameter(0) 483 + fSinglePhePedFit->GetParError(2)/fSinglePhePedFit->GetParameter(2); 448 484 449 485 *fLog << inf << "Results of the Blind Pixel Fit: " << endl; … … 512 548 const Double_t area_guess = entries/gkSq2Pi; 513 549 514 fTimeGausFit = TF1("GausTime","gaus",rmin,rmax);515 fTimeGausFit .SetParameters(area_guess,mu_guess,sigma_guess);516 fTimeGausFit .SetParNames("Area","#mu","#sigma");517 fTimeGausFit .SetParLimits(0,0.,entries);518 fTimeGausFit .SetParLimits(1,rmin,rmax);519 fTimeGausFit .SetParLimits(2,0.,rmax-rmin);520 521 fHBlindPixelTime->Fit( &fTimeGausFit,opt);522 rmin = fTimeGausFit .GetParameter(1) - 2.*fTimeGausFit.GetParameter(2);523 rmax = fTimeGausFit .GetParameter(1) + 2.*fTimeGausFit.GetParameter(2);524 fTimeGausFit .SetRange(rmin,rmax);525 526 fHBlindPixelTime->Fit( &fTimeGausFit,opt);527 528 fMeanTime = fTimeGausFit .GetParameter(2);529 fSigmaTime = fTimeGausFit .GetParameter(3);530 fMeanTimeErr = fTimeGausFit .GetParError(2);531 fSigmaTimeErr = fTimeGausFit .GetParError(3);550 fTimeGausFit = new TF1("GausTime","gaus",rmin,rmax); 551 fTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 552 fTimeGausFit->SetParNames("Area","#mu","#sigma"); 553 fTimeGausFit->SetParLimits(0,0.,entries); 554 fTimeGausFit->SetParLimits(1,rmin,rmax); 555 fTimeGausFit->SetParLimits(2,0.,rmax-rmin); 556 557 fHBlindPixelTime->Fit(fTimeGausFit,opt); 558 rmin = fTimeGausFit->GetParameter(1) - 2.*fTimeGausFit->GetParameter(2); 559 rmax = fTimeGausFit->GetParameter(1) + 2.*fTimeGausFit->GetParameter(2); 560 fTimeGausFit->SetRange(rmin,rmax); 561 562 fHBlindPixelTime->Fit(fTimeGausFit,opt); 563 564 fMeanTime = fTimeGausFit->GetParameter(2); 565 fSigmaTime = fTimeGausFit->GetParameter(3); 566 fMeanTimeErr = fTimeGausFit->GetParError(2); 567 fSigmaTimeErr = fTimeGausFit->GetParError(3); 532 568 533 569 *fLog << inf << "Results of the Times Fit: " << endl; 534 *fLog << inf << "Chisquare: " << fTimeGausFit .GetChisquare() << endl;535 *fLog << inf << "Ndf: " << fTimeGausFit .GetNDF() << endl;570 *fLog << inf << "Chisquare: " << fTimeGausFit->GetChisquare() << endl; 571 *fLog << inf << "Ndf: " << fTimeGausFit->GetNDF() << endl; 536 572 537 573 return kTRUE; -
trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h
r2852 r2880 10 10 #endif 11 11 12 #ifndef MARS_MFFT 13 #include "MFFT.h" 14 #endif 15 12 16 #ifndef ROOT_TH1 13 17 #include "TH1.h" … … 25 29 #include "TPaveText.h" 26 30 #endif 31 32 27 33 28 34 const Double_t NoWay = 10000000000.0; … … 34 40 private: 35 41 36 TH1F* fHBlindPixelCharge; //-> Histogram with the single Phe spectrum 37 TH1I* fHBlindPixelTime; //-> Variance of summed FADC slices 38 TH1I* fHBlindPixelChargevsN; //-> Summed Charge vs. Event Nr. 39 40 TF1 fSinglePheFit; 41 TF1 fTimeGausFit; 42 TF1 fSinglePhePedFit; 42 TH1F* fHBlindPixelCharge; // Histogram with the single Phe spectrum 43 TH1I* fHBlindPixelTime; // Variance of summed FADC slices 44 TH1I* fHBlindPixelChargevsN; // Summed Charge vs. Event Nr. 45 TH1F* fHBlindPixelPSD; // Power spectrum density of fHBlindPixelChargevsN 46 47 TF1 *fSinglePheFit; 48 TF1 *fTimeGausFit; 49 TF1 *fSinglePhePedFit; 43 50 44 51 Axis_t fBlindPixelChargefirst; 45 Axis_t fBlindPixelChargelast; 52 Axis_t fBlindPixelChargelast; 46 53 Int_t fBlindPixelChargenbins; 47 54 … … 49 56 void DrawLegend(); 50 57 51 TPaveText *fFitLegend; //!58 TPaveText *fFitLegend; 52 59 Bool_t fFitOK; 53 60 … … 73 80 Double_t fSigmaTimeErr; 74 81 75 Double_t fLambdaCheck;76 Double_t fLambdaCheckErr;82 Double_t fLambdaCheck; 83 Double_t fLambdaCheckErr; 77 84 78 85 public: … … 112 119 const Bool_t IsFitOK() { return fFitOK; } 113 120 121 const TH1I *GetHBlindPixelChargevsN() const { return fHBlindPixelChargevsN; } 122 const TH1F *GetHBlindPixelPSD() const { return fHBlindPixelPSD; } 123 114 124 // Draws 115 125 TObject *DrawClone(Option_t *option="") const; … … 137 147 private: 138 148 139 void InitFit(TF1& f,Axis_t min, Axis_t max);140 void ExitFit(TF1 &f);149 Bool_t InitFit(Axis_t min, Axis_t max); 150 void ExitFit(TF1 *f); 141 151 142 152 inline static Double_t fFitFuncMichele(Double_t *x, Double_t *par)
Note:
See TracChangeset
for help on using the changeset viewer.