Changeset 2823
- Timestamp:
- 01/15/04 17:38:45 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2821 r2823 26 26 27 27 28 29 28 2004/01/15: Markus Gaug 30 29 … … 35 34 * macros/calibration.C 36 35 - replace MHCamera->Draw("proj") by MHCamera->Projection() 36 - produce better fits to the projection 37 37 38 38 * manalysis/MSimulatedAnnealing.[h,cc], -
trunk/MagicSoft/Mars/macros/calibration.C
r2812 r2823 177 177 disp9.SetCamContent(*cam, 8); 178 178 disp9.SetCamError(*cam, 9); 179 179 180 disp10.SetCamContent(*cam, 9); 180 181 181 disp11.SetCamContent(*cam, 10); 182 182 … … 215 215 216 216 // Charges 217 TCanvas *c1 = &d3->AddTab("Fitted Charges"); 218 c1->Divide(2,3); 219 220 TObject *obj1; 221 222 c1->cd(1); 223 obj1=disp1.DrawCopy("hist"); 224 ((MHCamera*)obj1)->AddNotify(*cam); 225 226 c1->cd(3); 227 gPad->SetBorderMode(0); 228 obj1->Draw(); 229 ((MHCamera*)obj1)->SetPrettyPalette(); 230 231 c1->cd(5); 232 gPad->SetBorderMode(0); 233 Float_t he = gStyle->GetStatH(); 234 Float_t wi = gStyle->GetStatH(); 235 gStyle->SetStatH(0.4); 236 gStyle->SetStatW(0.25); 237 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 238 h2->Fit("gaus","Q"); 239 h2->GetFunction("gaus")->SetLineColor(kYellow); 240 h2->Draw(); 241 gStyle->SetStatH(he); 242 gStyle->SetStatW(wi); 243 244 c1->cd(2); 245 obj1=disp3.DrawCopy("hist"); 246 ((MHCamera*)obj1)->AddNotify(*cam); 247 248 c1->cd(4); 249 gPad->SetBorderMode(0); 250 obj1->Draw(); 251 ((MHCamera*)obj1)->SetPrettyPalette(); 252 253 c1->cd(6); 254 gPad->SetBorderMode(0); 255 Float_t he = gStyle->GetStatH(); 256 Float_t wi = gStyle->GetStatH(); 257 gStyle->SetStatH(0.4); 258 gStyle->SetStatW(0.25); 259 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 260 h2->Fit("gaus","Q"); 261 h2->GetFunction("gaus")->SetLineColor(kYellow); 262 h2->Draw(); 263 gStyle->SetStatH(he); 264 gStyle->SetStatW(wi); 217 TCanvas &c1 = d3->AddTab("Fitted Charges"); 218 c1.Divide(2,3); 219 220 CamDraw(c1,disp1,cam,1,2,1); 221 CamDraw(c1,disp3,cam,2,2,3); 265 222 266 223 // Fit Probability 267 TCanvas *c12 = &d3->AddTab("Fit Prob."); 268 c12->Divide(1, 3); 269 270 c12->cd(1); 271 obj1=disp5.DrawCopy("hist"); 272 ((MHCamera*)obj1)->AddNotify(*cam); 273 274 c12->cd(2); 275 gPad->SetBorderMode(0); 276 obj1->Draw(); 277 ((MHCamera*)obj1)->SetPrettyPalette(); 224 TCanvas &c2 = d3->AddTab("Fit Prob."); 225 c2.Divide(1,3); 226 227 CamDraw(c2,disp5,cam,1,1,3); 228 229 // Times 230 TCanvas &c3 = d3->AddTab("Fitted Times"); 231 c3.Divide(3,3); 232 233 CamDraw(c3,disp6,cam,1,3,1); 234 CamDraw(c3,disp7,cam,2,3,0); 235 CamDraw(c3,disp8,cam,3,3,0); 236 237 // Pedestals 238 TCanvas &c4 = d3->AddTab("Pedestals"); 239 c4.Divide(2,3); 240 241 CamDraw(c4,disp9,cam,1,2,0); 242 CamDraw(c4,disp10,cam,2,2,1); 243 244 // Reduced Sigmas 245 TCanvas &c5 = d3->AddTab("Reduced Sigmas"); 246 c5.Divide(2,3); 247 248 CamDraw(c5,disp11,cam,1,2,2); 249 CamDraw(c5,disp16,cam,2,2,2); 250 251 // F-Factor Method 252 TCanvas &c6 = d3->AddTab("F-Factor Method"); 253 c6.Divide(2,3); 254 255 CamDraw(c6,disp12,cam,1,2,1); 256 CamDraw(c6,disp13,cam,2,2,1); 257 258 // Blind Pixel Method 259 TCanvas &c7 = d3->AddTab("Blind Pixel Method"); 260 c7.Divide(2, 3); 261 262 CamDraw(c7,disp14,cam,1,2,9); 263 CamDraw(c7,disp15,cam,2,2,1); 264 265 } 266 267 void CamDraw(TCanvas &c, MHCamera &cam, MCamEvent *evt, Int_t i, Int_t j, Int_t fit) 268 { 269 270 c.cd(i); 271 gPad->SetBorderMode(0); 272 MHCamera *obj1=(MHCamera*)cam.DrawCopy("hist"); 273 obj1->AddNotify(*evt); 274 275 c.cd(i+j); 276 gPad->SetBorderMode(0); 277 obj1->Draw(); 278 ((MHCamera*)obj1)->SetPrettyPalette(); 279 280 c.cd(i+2*j); 281 gPad->SetBorderMode(0); 282 Float_t he = gStyle->GetStatH(); 283 Float_t wi = gStyle->GetStatH(); 284 gStyle->SetStatH(0.4); 285 gStyle->SetStatW(0.25); 278 286 279 c12->cd(3); 280 gPad->SetBorderMode(0); 281 Float_t he = gStyle->GetStatH(); 282 Float_t wi = gStyle->GetStatH(); 283 gStyle->SetStatH(0.4); 284 gStyle->SetStatW(0.25); 285 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 286 h2->Fit("gaus","Q"); 287 h2->GetFunction("gaus")->SetLineColor(kYellow); 288 h2->Draw(); 289 gStyle->SetStatH(he); 290 gStyle->SetStatW(wi); 291 292 // Times 293 TCanvas *c2 = &d3->AddTab("Fitted Times"); 294 c2->Divide(3, 3); 295 296 c2->cd(1); 297 obj1=disp6.DrawCopy("hist"); 298 ((MHCamera*)obj1)->AddNotify(*cam); 299 300 c2->cd(4); 301 obj1->Draw(); 302 ((MHCamera*)obj1)->SetPrettyPalette(); 303 304 c2->cd(7); 305 gPad->SetBorderMode(0); 306 Float_t he = gStyle->GetStatH(); 307 Float_t wi = gStyle->GetStatH(); 308 gStyle->SetStatH(0.4); 309 gStyle->SetStatW(0.25); 310 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 311 h2->Fit("gaus","Q"); 312 h2->GetFunction("gaus")->SetLineColor(kYellow); 313 h2->Draw(); 314 gStyle->SetStatH(he); 315 gStyle->SetStatW(wi); 316 317 c2->cd(2); 318 obj1=disp7.DrawCopy("hist"); 319 ((MHCamera*)obj1)->AddNotify(*cam); 320 321 c2->cd(5); 322 obj1->Draw(); 323 ((MHCamera*)obj1)->SetPrettyPalette(); 324 325 c2->cd(8); 326 gPad->SetBorderMode(0); 327 Float_t he = gStyle->GetStatH(); 328 Float_t wi = gStyle->GetStatH(); 329 gStyle->SetStatH(0.4); 330 gStyle->SetStatW(0.25); 331 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 332 h2->Fit("gaus","Q"); 333 h2->GetFunction("gaus")->SetLineColor(kYellow); 334 h2->Draw(); 335 gStyle->SetStatH(he); 336 gStyle->SetStatW(wi); 337 338 c2->cd(3); 339 obj1=disp8.DrawCopy("hist"); 340 ((MHCamera*)obj1)->AddNotify(*cam); 341 342 c2->cd(6); 343 obj1->Draw(); 344 ((MHCamera*)obj1)->SetPrettyPalette(); 345 346 c2->cd(9); 347 gPad->SetBorderMode(0); 348 Float_t he = gStyle->GetStatH(); 349 Float_t wi = gStyle->GetStatH(); 350 gStyle->SetStatH(0.4); 351 gStyle->SetStatW(0.25); 352 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 353 h2->Fit("gaus","Q"); 354 h2->GetFunction("gaus")->SetLineColor(kYellow); 355 h2->Draw(); 356 gStyle->SetStatH(he); 357 gStyle->SetStatW(wi); 358 359 // Pedestals 360 TCanvas *c3 = &d3->AddTab("Pedestals"); 361 c3->Divide(2, 3); 362 363 c3->cd(1); 364 obj1=disp9.DrawCopy("hist"); 365 ((MHCamera*)obj1)->AddNotify(*cam); 366 367 c3->cd(3); 368 obj1->Draw(); 369 ((MHCamera*)obj1)->SetPrettyPalette(); 370 371 c3->cd(5); 372 gPad->SetBorderMode(0); 373 Float_t he = gStyle->GetStatH(); 374 Float_t wi = gStyle->GetStatH(); 375 gStyle->SetStatH(0.4); 376 gStyle->SetStatW(0.25); 377 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 378 h2->Fit("gaus","Q"); 379 h2->GetFunction("gaus")->SetLineColor(kYellow); 380 h2->Draw(); 381 gStyle->SetStatH(he); 382 gStyle->SetStatW(wi); 383 384 c3->cd(2); 385 obj1=disp10.DrawCopy("hist"); 386 ((MHCamera*)obj1)->AddNotify(*cam); 387 388 c3->cd(4); 389 obj1->Draw(); 390 ((MHCamera*)obj1)->SetPrettyPalette(); 391 392 c3->cd(6); 393 gPad->SetBorderMode(0); 394 Float_t he = gStyle->GetStatH(); 395 Float_t wi = gStyle->GetStatH(); 396 gStyle->SetStatH(0.4); 397 gStyle->SetStatW(0.25); 398 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 399 h2->Fit("gaus","Q"); 400 h2->GetFunction("gaus")->SetLineColor(kYellow); 401 h2->Draw(); 402 gStyle->SetStatH(he); 403 gStyle->SetStatW(wi); 404 405 // Reduced Sigmas 406 TCanvas *c4 = &d3->AddTab("Reduced Sigmas"); 407 c4->Divide(2,3); 408 409 c4->cd(1); 410 obj1=disp11.DrawCopy("hist"); 411 ((MHCamera*)obj1)->AddNotify(*cam); 412 413 c4->cd(3); 414 obj1->Draw(); 415 ((MHCamera*)obj1)->SetPrettyPalette(); 416 417 c4->cd(5); 418 gPad->SetBorderMode(0); 419 Float_t he = gStyle->GetStatH(); 420 Float_t wi = gStyle->GetStatH(); 421 gStyle->SetStatH(0.4); 422 gStyle->SetStatW(0.25); 423 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 424 h2->Fit("gaus","Q"); 425 h2->GetFunction("gaus")->SetLineColor(kYellow); 426 h2->Draw(); 427 gStyle->SetStatH(he); 428 gStyle->SetStatW(wi); 429 430 c4->cd(2); 431 obj1=disp16.DrawCopy("hist"); 432 ((MHCamera*)obj1)->AddNotify(*cam); 433 434 c4->cd(4); 435 obj1->Draw(); 436 ((MHCamera*)obj1)->SetPrettyPalette(); 437 438 c4->cd(6); 439 gPad->SetBorderMode(0); 440 Float_t he = gStyle->GetStatH(); 441 Float_t wi = gStyle->GetStatH(); 442 gStyle->SetStatH(0.4); 443 gStyle->SetStatW(0.25); 444 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 445 h2->Fit("gaus","Q"); 446 h2->GetFunction("gaus")->SetLineColor(kYellow); 447 h2->Draw(); 448 gStyle->SetStatH(he); 449 gStyle->SetStatW(wi); 450 451 // F-Factor Method 452 TCanvas *c5 = &d3->AddTab("F-Factor Method"); 453 c5->Divide(2, 3); 454 455 c5->cd(1); 456 obj1=disp12.DrawCopy("hist"); 457 ((MHCamera*)obj1)->AddNotify(*cam); 458 459 c5->cd(3); 460 obj1->Draw(); 461 ((MHCamera*)obj1)->SetPrettyPalette(); 462 463 c5->cd(5); 464 gPad->SetBorderMode(0); 465 Float_t he = gStyle->GetStatH(); 466 Float_t wi = gStyle->GetStatH(); 467 gStyle->SetStatH(0.4); 468 gStyle->SetStatW(0.25); 469 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 470 h2->Fit("gaus","Q"); 471 h2->GetFunction("gaus")->SetLineColor(kYellow); 472 h2->Draw(); 473 gStyle->SetStatH(he); 474 gStyle->SetStatW(wi); 475 476 c5->cd(2); 477 obj1=disp13.DrawCopy("hist"); 478 ((MHCamera*)obj1)->AddNotify(*cam); 479 480 c5->cd(4); 481 obj1->Draw(); 482 ((MHCamera*)obj1)->SetPrettyPalette(); 483 484 c5->cd(6); 485 gPad->SetBorderMode(0); 486 Float_t he = gStyle->GetStatH(); 487 Float_t wi = gStyle->GetStatH(); 488 gStyle->SetStatH(0.4); 489 gStyle->SetStatW(0.25); 490 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 491 h2->Fit("gaus","Q"); 492 h2->GetFunction("gaus")->SetLineColor(kYellow); 493 h2->Draw(); 494 gStyle->SetStatH(he); 495 gStyle->SetStatW(wi); 496 497 // Blind Pixel Method 498 TCanvas *c6 = &d3->AddTab("Blind Pixel Method"); 499 c6->Divide(2, 3); 500 501 c6->cd(1); 502 obj1=disp14.DrawCopy("hist"); 503 ((MHCamera*)obj1)->AddNotify(*cam); 504 505 c6->cd(3); 506 obj1->Draw(); 507 ((MHCamera*)obj1)->SetPrettyPalette(); 508 509 510 c6->cd(2); 511 obj1=disp15.DrawCopy("hist"); 512 ((MHCamera*)obj1)->AddNotify(*cam); 513 514 c6->cd(4); 515 obj1->Draw(); 516 ((MHCamera*)obj1)->SetPrettyPalette(); 517 518 c6->cd(6); 519 gPad->SetBorderMode(0); 520 Float_t he = gStyle->GetStatH(); 521 Float_t wi = gStyle->GetStatH(); 522 gStyle->SetStatH(0.4); 523 gStyle->SetStatW(0.25); 524 TH1D *h2 = ((MHCamera*)obj1)->Projection(obj1->GetName()); 525 h2->Fit("gaus","Q"); 526 h2->GetFunction("gaus")->SetLineColor(kYellow); 527 h2->Draw(); 528 gStyle->SetStatH(he); 529 gStyle->SetStatW(wi); 287 TH1D *obj2 = (TH1D*)obj1->Projection(); 288 obj2->Draw(); 289 obj2->SetBit(kCanDelete); 290 291 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 292 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 293 const Double_t integ = obj2->Integral("width")/2.5; 294 const Double_t mean = obj2->GetMean(); 295 const Double_t rms = obj2->GetRMS(); 296 const Double_t width = max-min; 297 298 switch (fit) 299 { 300 case 0: 301 TF1 *sgaus = new TF1("sgaus","gaus(0)",min,max); 302 sgaus->SetParNames("Area","#mu","#sigma"); 303 sgaus->SetParameters(integ/rms,mean,rms); 304 sgaus->SetParLimits(0,0.,integ); 305 sgaus->SetParLimits(1,min,max); 306 sgaus->SetParLimits(2,0,width/1.5); 307 obj2->Fit("sgaus","QLR"); 308 obj2->GetFunction("sgaus")->SetLineColor(kYellow); 309 break; 310 311 case 1: 312 TF1 *dgaus = new TF1("dgaus","gaus(0)+gaus(3)",min,max); 313 dgaus->SetParNames("A1","#mu1","#sigma1","A2","#mu2","#sigma2"); 314 dgaus->SetParameters(integ/width,max-width/6.,width/4., 315 integ/width,min+width/6.,width/4.); 316 dgaus->SetParLimits(0,0,integ); 317 dgaus->SetParLimits(1,min,max); 318 dgaus->SetParLimits(2,0,width/3.); 319 dgaus->SetParLimits(3,0,integ); 320 dgaus->SetParLimits(4,min,max); 321 dgaus->SetParLimits(5,0,width/3.); 322 obj2->Fit("dgaus","QLR"); 323 obj2->GetFunction("dgaus")->SetLineColor(kYellow); 324 break; 325 326 case 2: 327 TF1 *tgaus = new TF1("tgaus","gaus(0)+gaus(3)+gaus(6)",min,max); 328 tgaus->SetParNames("A1","#mu1","#sigma1","A2","#mu2","#sigma2","A3","#mu3","#sigma3"); 329 tgaus->SetParameters(integ/width,max-width/6.,width/4., 330 integ/width,min+width/6.,width/4., 331 integ/width,min+width/6.,width/2.); 332 tgaus->SetParLimits(0,0,integ); 333 tgaus->SetParLimits(1,min,max); 334 tgaus->SetParLimits(2,0,width/4.); 335 tgaus->SetParLimits(3,0,integ); 336 tgaus->SetParLimits(4,min,max); 337 tgaus->SetParLimits(5,0,width/4.); 338 tgaus->SetParLimits(6,0,integ); 339 tgaus->SetParLimits(7,min,max); 340 tgaus->SetParLimits(8,0,width/2.); 341 obj2->Fit("tgaus","QLR"); 342 obj2->GetFunction("tgaus")->SetLineColor(kYellow); 343 break; 344 case 3: 345 obj2->Fit("pol0","Q"); 346 obj2->GetFunction("pol0")->SetLineColor(kYellow); 347 break; 348 case 9: 349 break; 350 default: 351 obj2->Fit("gaus","Q"); 352 obj2->GetFunction("gaus")->SetLineColor(kYellow); 353 break; 354 } 355 356 gStyle->SetStatH(he); 357 gStyle->SetStatW(wi); 530 358 531 359 } 532
Note:
See TracChangeset
for help on using the changeset viewer.