Changeset 3059 for trunk/MagicSoft/Mars
- Timestamp:
- 02/08/04 20:57:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3058 r3059 48 48 - removed times of GetPixelContent 49 49 - added OscillationChecks in GetPixelContent 50 51 * manalysis/MMcCalibrationUpdate.cc 52 - remove calpix.SkipTimeFits which is now obsolet 50 53 51 54 -
trunk/MagicSoft/Mars/macros/calibration.C
r3039 r3059 29 29 const TString calfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_12525_C_Cab-On_E.root"; 30 30 31 32 31 //const TString pedfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03522_P_Park_E.root"; 33 32 //const TString calfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03527_C_Park_E.root"; … … 36 35 TString calname=calfile) 37 36 { 37 38 MStatusDisplay *display = new MStatusDisplay; 39 display->SetUpdateTime(3000); 40 display->Resize(850,700); 38 41 39 42 // … … 63 66 64 67 MPedCalcPedRun pedcalc; 68 pedcalc.SetNumHiGainSamples(14); 65 69 MFillH fill("MPedestalCam", "MExtractedSignalCam"); 66 70 … … 81 85 MEvtLoop evtloop; 82 86 evtloop.SetParList(&plist); 87 evtloop.SetDisplay(display); 83 88 84 89 // … … 92 97 // pedcam(17).DrawClone(); 93 98 94 MStatusDisplay *d1 = new MStatusDisplay; 95 d1->SetUpdateTime(3000); 96 d1->Resize(850,700); 97 98 MHCamera dispped0 (geomcam, "MPedestalPix;Pedestal", "Mean per Slice"); 99 MHCamera dispped1 (geomcam, "MPedestalPix;PedestalErr", "Mean Error per Slice"); 100 MHCamera dispped2 (geomcam, "MPedestalPix;PedestalRms", "RMS per Slice"); 101 MHCamera dispped3 (geomcam, "MPedestalPix;PedestalRmsErr", "RMS Error per Slice"); 102 MHCamera dispped4 (geomcam, "MPedestalPix;Mean", "Fitted Mean per Slice"); 103 MHCamera dispped5 (geomcam, "MPedestalPix;MeanErr", "Fitted Error of Mean per Slice"); 104 MHCamera dispped6 (geomcam, "MPedestalPix;Sigma", "Fitted Sigma per Slice"); 105 MHCamera dispped7 (geomcam, "MPedestalPix;SigmaErr", "Fitted Error of Sigma per Slice"); 106 MHCamera dispped8 (geomcam, "MPedestalPix;Prob", "Probability of Fit"); 107 MHCamera dispped9 (geomcam, "MPedestalPix;DeltaPedestalMean", "Rel. Diff. Mean per Slice (Calc.-Fitte)"); 108 MHCamera dispped11 (geomcam, "MPedestalPix;DeltaPedestalMeanError", "Rel. Diff. Mean Error per Slice (Calc.-Fitted)"); 109 MHCamera dispped12 (geomcam, "MPedestalPix;DeltaRmsSigma", "Rel. Diff. RMS per Slice (Calc.-Fitted)"); 110 MHCamera dispped14 (geomcam, "MPedestalPix;DeltaRmsSigmaError", "Rel. Diff. RMS Error per Slice (Calc.-Fitted)"); 99 MHCamera dispped0 (geomcam, "Ped;Pedestal", "Mean per Slice"); 100 MHCamera dispped1 (geomcam, "Ped;PedestalErr", "Mean Error per Slice"); 101 MHCamera dispped2 (geomcam, "Ped;PedestalRms", "RMS per Slice"); 102 MHCamera dispped3 (geomcam, "Ped;PedestalRmsErr", "RMS Error per Slice"); 103 MHCamera dispped4 (geomcam, "Ped;Mean", "Fitted Mean per Slice"); 104 MHCamera dispped5 (geomcam, "Ped;MeanErr", "Fitted Error of Mean per Slice"); 105 MHCamera dispped6 (geomcam, "Ped;Sigma", "Fitted Sigma per Slice"); 106 MHCamera dispped7 (geomcam, "Ped;SigmaErr", "Fitted Error of Sigma per Slice"); 107 MHCamera dispped8 (geomcam, "Ped;Prob", "Probability of Fit"); 108 MHCamera dispped9 (geomcam, "Ped;DeltaPedestalMean", "Rel. Diff. Mean per Slice (Calc.-Fitte)"); 109 MHCamera dispped11 (geomcam, "Ped;DeltaPedestalMeanError", "Rel. Diff. Mean Error per Slice (Calc.-Fitted)"); 110 MHCamera dispped12 (geomcam, "Ped;DeltaRmsSigma", "Rel. Diff. RMS per Slice (Calc.-Fitted)"); 111 MHCamera dispped14 (geomcam, "Ped;DeltaRmsSigmaError", "Rel. Diff. RMS Error per Slice (Calc.-Fitted)"); 112 111 113 dispped0.SetCamContent(pedcam, 0); 112 114 dispped0.SetCamError(pedcam, 1); … … 147 149 148 150 // Histogram values 149 TCanvas &b1 = d 1->AddTab("Direct Calculation");151 TCanvas &b1 = display->AddTab("Ped.Calc."); 150 152 b1.Divide(4,3); 151 153 … … 156 158 157 159 // Fitted values 158 TCanvas &b2 = d 1->AddTab("Fits");160 TCanvas &b2 = display->AddTab("Ped.Fit"); 159 161 b2.Divide(4,3); 160 162 … … 166 168 167 169 // Fits Probability 168 TCanvas &b3 = d 1->AddTab("Fit Probabilities");170 TCanvas &b3 = display->AddTab("Ped.Fit Prob."); 169 171 b3.Divide(1,3); 170 172 … … 172 174 173 175 // Differences 174 TCanvas &c4 = d 1->AddTab("Relative Difference Calculation-Fits");176 TCanvas &c4 = display->AddTab("Rel.Diff.Calc.-Fit"); 175 177 c4.Divide(4,3); 176 178 … … 180 182 CamDraw(c4,dispped14,pedcam,4,4,1); 181 183 184 182 185 // 183 186 // Create a empty Parameter List and an empty Task List … … 201 204 // 202 205 tlist2.AddToList(&geomapl); 203 204 206 // 205 207 // Now setup the new tasks and tasklist for the calibration … … 273 275 // of the arrival times using a spline, uncomment the next line 274 276 // 275 tlist2.AddToList(&timecalc);277 // tlist2.AddToList(&timecalc); 276 278 tlist2.AddToList(&calcalc); 277 279 … … 281 283 MEvtLoop evtloop2; 282 284 evtloop2.SetParList(&plist2); 283 284 MProgressBar bar; 285 evtloop2.SetProgressBar(&bar); 285 evtloop2.SetDisplay(display); 286 286 287 287 // … … 301 301 // just one example how to get the plots of individual pixels 302 302 // 303 // calcam[18].DrawClone(); 304 305 MHCamera disp1 (geomcam, "MCalibrationPix;Charge", "Fitted Mean Charges"); 306 MHCamera disp3 (geomcam, "MCalibrationPix;SigmaCharge", "Sigma of Fitted Charges"); 307 MHCamera disp5 (geomcam, "MCalibrationPix;ChargeProb", "Probability of Fit"); 308 MHCamera disp6 (geomcam, "MCalibrationPix;Time", "Rel. Arrival Times"); 309 MHCamera disp7 (geomcam, "MCalibrationPix;SigmaTime", "Sigma of Rel. Arrival Times"); 310 MHCamera disp8 (geomcam, "MCalibrationPix;TimeProb", "Probability of Time Fit"); 311 MHCamera disp9 (geomcam, "MCalibrationPix;Ped", "Pedestals"); 312 MHCamera disp10 (geomcam, "MCalibrationPix;PedRms", "Pedestal RMS"); 313 MHCamera disp11 (geomcam, "MCalibrationPix;RSigma", "Reduced Sigmas"); 314 MHCamera disp12 (geomcam, "MCalibrationPix;PheFFactorMethod", "Nr. of Phe's (F-Factor Method)"); 315 MHCamera disp13 (geomcam, "MCalibrationPix;MeanConversionFFactorMethod", 316 "Conversion Factor (F-Factor Method)"); 317 MHCamera disp14 (geomcam, "MCalibrationPix;MeanPhotInsidePlexiglass", 318 "Nr. of Photons (Blind Pixel Method)"); 319 MHCamera disp15 (geomcam, "MCalibrationPix;MeanConversionBlindPixelMethod", 320 "Conversion Factor (Blind Pixel Method)"); 321 MHCamera disp16 (geomcam, "MCalibrationPix;RSigma/Charge", "Reduced Sigma per Charge"); 322 MHCamera disp17 (geomcam, "MCalibrationPix;AbsTimeMean", "Abs. Arrival Times"); 323 MHCamera disp18 (geomcam, "MCalibrationPix;AbsTimeRms", "RMS of Arrival Times"); 324 325 disp1.SetCamContent(calcam, 0); 326 disp1.SetCamError(calcam,1); 327 328 disp3.SetCamContent(calcam, 2); 329 disp3.SetCamError(calcam,3); 330 331 disp5.SetCamContent(calcam, 4); 332 333 disp6.SetCamContent(calcam, 5); 334 disp6.SetCamError(calcam, 6); 335 disp7.SetCamContent(calcam, 6); 336 disp8.SetCamContent(calcam, 7); 337 338 disp9.SetCamContent(calcam, 8); 339 disp9.SetCamError(calcam, 9); 340 341 disp10.SetCamContent(calcam, 9); 342 disp11.SetCamContent(calcam, 10); 343 344 disp12.SetCamContent(calcam, 11); 345 disp12.SetCamError(calcam, 12); 346 347 disp13.SetCamContent(calcam, 13); 348 disp13.SetCamError(calcam, 14); 349 350 disp14.SetCamContent(calcam, 15); 351 disp15.SetCamContent(calcam, 16); 352 disp16.SetCamContent(calcam, 17); 353 354 disp17.SetCamContent(calcam, 18); 355 disp17.SetCamError(calcam, 19); 356 disp18.SetCamContent(calcam, 20); 357 disp18.SetCamError(calcam, 21); 358 359 disp1.SetYTitle("Charge [FADC counts]"); 360 disp3.SetYTitle("\\sigma_{Charge} [FADC counts]"); 361 disp5.SetYTitle("P_{Charge} [1]"); 362 disp6.SetYTitle("Rel. Arr. Time [ns]"); 363 disp7.SetYTitle("\\sigma_{Time} [ns]"); 364 disp8.SetYTitle("P_{Time} [1]"); 365 disp9.SetYTitle("Ped [FADC Counts ]"); 366 disp10.SetYTitle("RMS_{Ped} [FADC Counts ]"); 367 disp11.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]"); 368 disp12.SetYTitle("Nr. Photo-Electrons [1]"); 369 disp13.SetYTitle("Conversion Factor [PhE/FADC Count]"); 370 disp14.SetYTitle("Nr. Photons [1]"); 371 disp15.SetYTitle("Conversion Factor [Phot/FADC Count]"); 372 disp16.SetYTitle("Reduced Sigma / Charge [1]"); 373 disp17.SetYTitle("Mean Abs. Time [FADC slice]"); 374 disp18.SetYTitle("RMS Abs. Time [FADC slices]"); 375 376 MStatusDisplay *d3 = new MStatusDisplay; 377 d3->SetUpdateTime(3000); 378 d3->Resize(850,700); 303 calcam[356].DrawClone(); 304 305 // Create histograms to display 306 MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges"); 307 MHCamera disp2 (geomcam, "Cal;SigmaCharge", "Sigma of Fitted Charges"); 308 MHCamera disp3 (geomcam, "Cal;FitProb", "Probability of Fit"); 309 MHCamera disp4 (geomcam, "Cal;RSigma", "Reduced Sigmas"); 310 MHCamera disp5 (geomcam, "Cal;RSigma/Charge", "Reduced Sigma per Charge"); 311 MHCamera disp6 (geomcam, "Cal;FFactorPhe", "Nr. of Phe's (F-Factor Method)"); 312 MHCamera disp7 (geomcam, "Cal;FFactorConv", "Conversion Factor (F-Factor Method)"); 313 MHCamera disp8 (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)"); 314 MHCamera disp9 (geomcam, "Cal;BlindPixPh", "Nr. of Photons inside plexiglass (Blind Pixel Method)"); 315 MHCamera disp10 (geomcam, "Cal;BlindPixConv", "Conversion Factor (Blind Pixel Method)"); 316 MHCamera disp11 (geomcam, "Cal;BlindPixFFactor","Total F-Factor (Blind Pixel Method)"); 317 MHCamera disp12 (geomcam, "Cal;PINDiodePh", "Nr. of Photons outside plexiglass (PIN Diode Method)"); 318 MHCamera disp13 (geomcam, "Cal;PINDiodeConv", "Conversion Factor (PIN Diode Method)"); 319 MHCamera disp14 (geomcam, "Cal;PINDiodeFFactor","Total F-Factor (PIN Diode Method)"); 320 MHCamera disp15 (geomcam, "Cal;Excluded", "Pixels previously excluded"); 321 MHCamera disp16 (geomcam, "Cal;NotFitted", "Pixels that could not be fitted"); 322 MHCamera disp17 (geomcam, "Cal;NotFitValid", "Pixels with not valid fit results"); 323 MHCamera disp18 (geomcam, "Cal;Oscillating", "Oscillating Pixels"); 324 MHCamera disp19 (geomcam, "Cal;Saturation", "Pixels with saturated Hi Gain"); 325 326 327 MHCamera disp20 (geomcam, "cal;Ped", "Pedestals"); 328 MHCamera disp21 (geomcam, "cal;PedRms", "Pedestal RMS"); 329 330 MHCamera disp22 (geomcam, "cal;Time", "Rel. Arrival Times"); 331 MHCamera disp23 (geomcam, "cal;SigmaTime", "Sigma of Rel. Arrival Times"); 332 MHCamera disp24 (geomcam, "cal;TimeProb", "Probability of Time Fit"); 333 334 MHCamera disp25 (geomcam, "cal;AbsTimeMean", "Abs. Arrival Times"); 335 MHCamera disp26 (geomcam, "cal;AbsTimeRms", "RMS of Arrival Times"); 336 337 338 // Fitted charge means and sigmas 339 disp1.SetCamContent(calcam, 0); 340 disp1.SetCamError( calcam, 1); 341 disp2.SetCamContent(calcam, 2); 342 disp2.SetCamError( calcam, 3); 343 // Fit probabilities 344 disp3.SetCamContent(calcam, 4); 345 346 // Reduced Sigmas and reduced sigmas per charge 347 disp4.SetCamContent(calcam, 5); 348 disp4.SetCamError( calcam, 6); 349 disp5.SetCamContent(calcam, 7); 350 disp5.SetCamError( calcam, 8); 351 352 // F-Factor Method 353 disp6.SetCamContent(calcam, 9); 354 disp6.SetCamError( calcam, 10); 355 disp7.SetCamContent(calcam, 11); 356 disp7.SetCamError( calcam, 12); 357 disp8.SetCamContent(calcam, 13); 358 disp8.SetCamError( calcam, 14); 359 360 /// Blind Pixel Method 361 disp9.SetCamContent(calcam, 15); 362 disp9.SetCamError( calcam, 16); 363 disp10.SetCamContent(calcam,17); 364 disp10.SetCamError( calcam,18); 365 disp11.SetCamContent(calcam,19); 366 disp11.SetCamError( calcam,20); 367 368 // PIN Diode Method 369 disp12.SetCamContent(calcam,21); 370 disp12.SetCamError( calcam,22); 371 disp13.SetCamContent(calcam,23); 372 disp13.SetCamError( calcam,24); 373 disp14.SetCamContent(calcam,25); 374 disp14.SetCamError( calcam,26); 375 376 // Pixels with defects 377 disp15.SetCamContent(calcam,27); 378 disp16.SetCamContent(calcam,28); 379 disp17.SetCamContent(calcam,29); 380 disp18.SetCamContent(calcam,30); 381 382 // Lo Gain calibration 383 disp19.SetCamContent(calcam,31); 384 385 386 // Pedestals 387 disp20.SetCamContent(calcam,35); 388 disp20.SetCamError( calcam,36); 389 disp21.SetCamContent(calcam,37); 390 disp21.SetCamError( calcam,38); 391 392 393 // Relative Times 394 disp20.SetCamContent(calcam,39); 395 disp20.SetCamError( calcam,40); 396 disp21.SetCamContent(calcam,41); 397 disp21.SetCamError( calcam,42); 398 disp22.SetCamContent(calcam,43); 399 400 // Absolute Times 401 disp23.SetCamContent(calcam,44); 402 disp23.SetCamError( calcam,45); 403 disp24.SetCamContent(calcam,46); 404 disp24.SetCamError( calcam,47); 405 406 407 disp1.SetYTitle("Charge [FADC units]"); 408 disp2.SetYTitle("\\sigma_{Charge} [FADC units]"); 409 disp3.SetYTitle("P_{Charge} [1]"); 410 411 disp4.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]"); 412 disp5.SetYTitle("Reduced Sigma / Mean Charge [1]"); 413 414 disp6.SetYTitle("Nr. Photo-Electrons [1]"); 415 disp7.SetYTitle("Conversion Factor [PhE/FADC Count]"); 416 disp8.SetYTitle("\\sqrt{N_{PhE}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 417 418 disp9.SetYTitle("Nr. Photons [1]"); 419 disp10.SetYTitle("Conversion Factor [Phot/FADC Count]"); 420 disp11.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 421 422 disp12.SetYTitle("Nr. Photons [1]"); 423 disp13.SetYTitle("Conversion Factor [Phot/FADC Count]"); 424 disp14.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 425 426 disp15.SetYTitle("[1]"); 427 disp16.SetYTitle("[1]"); 428 disp17.SetYTitle("[1]"); 429 disp18.SetYTitle("[1]"); 430 431 disp19.SetYTitle("Ped [FADC Counts ]"); 432 disp20.SetYTitle("RMS_{Ped} [FADC Counts ]"); 433 434 disp21.SetYTitle("Rel. Arr. Time [ns]"); 435 disp22.SetYTitle("\\sigma_{Time} [ns]"); 436 disp23.SetYTitle("P_{Time} [1]"); 437 438 disp24.SetYTitle("Mean Abs. Time [FADC slice]"); 439 disp25.SetYTitle("RMS Abs. Time [FADC slices]"); 440 379 441 380 442 gStyle->SetOptStat(1111); … … 382 444 383 445 // Charges 384 TCanvas &c1 = d 3->AddTab("Fitted Charges");385 c1.Divide(2, 3);386 387 CamDraw(c1, disp1,calcam,1,2,1);388 CamDraw(c1, disp3,calcam,2,2,1);446 TCanvas &c1 = display->AddTab("Fit.Charge"); 447 c1.Divide(2, 3); 448 449 CamDraw(c1, disp1,calcam,1, 2 , 2); 450 CamDraw(c1, disp2,calcam,2, 2 , 2); 389 451 390 452 // Fit Probability 391 TCanvas &c2 = d 3->AddTab("Fit Prob.");453 TCanvas &c2 = display->AddTab("Fit.Prob"); 392 454 c2.Divide(1,3); 393 455 394 CamDraw(c2,disp5,calcam,1,1,3); 456 CamDraw(c2, disp3,calcam,1, 1 , 4); 457 458 // Reduced Sigmas 459 TCanvas &c3 = display->AddTab("Red.Sigma"); 460 c3.Divide(2,3); 461 462 CamDraw(c3, disp4,calcam,1, 2 , 2); 463 CamDraw(c3, disp5,calcam,2, 2 , 2); 464 465 // F-Factor Method 466 TCanvas &c4 = display->AddTab("F-Factor"); 467 c4.Divide(3,3); 468 469 CamDraw(c4, disp6,calcam,1, 3 , 2); 470 CamDraw(c4, disp7,calcam,2, 3 , 2); 471 CamDraw(c4, disp8,calcam,3, 3 , 2); 472 473 // Blind Pixel Method 474 TCanvas &c5 = display->AddTab("BlindPix"); 475 c5.Divide(3, 3); 476 477 CamDraw(c5, disp9,calcam,1, 3 , 9); 478 CamDraw(c5, disp10,calcam,2, 3 , 2); 479 CamDraw(c5, disp11,calcam,3, 3 , 2); 480 481 // PIN Diode Method 482 TCanvas &c6 = display->AddTab("PINDiode"); 483 c6.Divide(3,3); 484 485 CamDraw(c6, disp12,calcam,1, 3 , 9); 486 CamDraw(c6, disp13,calcam,2, 3 , 2); 487 CamDraw(c6, disp14,calcam,3, 3 , 2); 488 489 // Defects 490 TCanvas &c7 = display->AddTab("Defects"); 491 c7.Divide(4,2); 492 493 CamDraw(c7, disp15,calcam,1,4, 0); 494 CamDraw(c7, disp16,calcam,2,4, 0); 495 CamDraw(c7, disp17,calcam,3,4, 0); 496 CamDraw(c7, disp18,calcam,4,4,0); 497 498 // Lo Gain Calibration 499 TCanvas &c8 = display->AddTab("LowGain"); 500 c8.Divide(1,3); 501 502 CamDraw(c8, disp19,calcam,1,4,0); 503 504 505 // Pedestals 506 TCanvas &c9 = display->AddTab("Pedestals"); 507 c9.Divide(2,3); 508 509 CamDraw(c9,disp20,calcam,1,3,1); 510 CamDraw(c9,disp21,calcam,2,3,2); 511 395 512 396 513 // Rel. Times 397 TCanvas &c3 = d3->AddTab("Fitted Rel. Times"); 398 c3.Divide(3,3); 399 400 CamDraw(c3,disp6,calcam,1,3,1); 401 CamDraw(c3,disp7,calcam,2,3,1); 402 CamDraw(c3,disp8,calcam,3,3,0); 514 TCanvas &c10 = display->AddTab("Fitted Rel. Times"); 515 c10.Divide(3,3); 516 517 CamDraw(c10,disp22,calcam,1,3,2); 518 CamDraw(c10,disp23,calcam,2,3,2); 519 CamDraw(c10,disp24,calcam,3,3,4); 520 403 521 404 522 // Abs. Times 405 TCanvas &c35 = d3->AddTab("Abs. Times"); 406 c35.Divide(2,3); 407 408 CamDraw(c35,disp17,calcam,1,2,1); 409 CamDraw(c35,disp18,calcam,2,2,1); 410 411 // Pedestals 412 TCanvas &c4 = d3->AddTab("Pedestals"); 413 c4.Divide(2,3); 414 415 CamDraw(c4,disp9,calcam,1,2,0); 416 CamDraw(c4,disp10,calcam,2,2,1); 417 418 // Reduced Sigmas 419 TCanvas &c5 = d3->AddTab("Reduced Sigmas"); 420 c5.Divide(2,3); 421 422 // CamDraw(c5,disp11,calcam,1,2,1); 423 CamDraw(c5,disp11,calcam,1,2,2); 424 CamDraw(c5,disp16,calcam,2,2,1); 425 426 // F-Factor Method 427 TCanvas &c6 = d3->AddTab("F-Factor Method"); 428 c6.Divide(2,3); 429 430 CamDraw(c6,disp12,calcam,1,2,1); 431 CamDraw(c6,disp13,calcam,2,2,1); 432 433 // Blind Pixel Method 434 TCanvas &c7 = d3->AddTab("Blind Pixel Method"); 435 c7.Divide(2, 3); 436 437 CamDraw(c7,disp14,calcam,1,2,9); 438 CamDraw(c7,disp15,calcam,2,2,1); 523 TCanvas &c11 = display->AddTab("Abs. Times"); 524 c11.Divide(2,3); 525 526 CamDraw(c11,disp25,calcam,1,2,2); 527 CamDraw(c11,disp26,calcam,2,2,2); 439 528 440 529 } … … 452 541 obj1->Draw(); 453 542 ((MHCamera*)obj1)->SetPrettyPalette(); 454 455 c.cd(i+2*j); 456 gPad->SetBorderMode(0); 457 TH1D *obj2 = (TH1D*)obj1->Projection(); 458 459 obj2->Draw(); 460 obj2->SetBit(kCanDelete); 461 462 463 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 464 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 465 const Double_t integ = obj2->Integral("width")/2.5066283; 466 const Double_t mean = obj2->GetMean(); 467 const Double_t rms = obj2->GetRMS(); 468 const Double_t width = max-min; 469 470 if (rms == 0. || width == 0. ) 471 return; 472 473 switch (fit) 543 544 if (fit != 0) 474 545 { 475 case 0: 476 TF1 *sgaus = new TF1("sgaus","gaus(0)",min,max); 477 sgaus->SetBit(kCanDelete); 478 sgaus->SetParNames("Area","#mu","#sigma"); 479 sgaus->SetParameters(integ/rms,mean,rms); 480 sgaus->SetParLimits(0,0.,integ); 481 sgaus->SetParLimits(1,min,max); 482 sgaus->SetParLimits(2,0,width/1.5); 483 obj2->Fit("sgaus","QLR"); 484 obj2->GetFunction("sgaus")->SetLineColor(kYellow); 485 break; 486 487 case 1: 488 TString dgausform = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"; 489 dgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 490 TF1 *dgaus = new TF1("dgaus",dgausform.Data(),min,max); 491 dgaus->SetBit(kCanDelete); 492 dgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}","A_{2}","#mu_{2}","#sigma_{2}"); 493 dgaus->SetParameters(integ,(min+mean)/2.,width/4., 494 integ/width/2.,(max+mean)/2.,width/4.); 495 // The left-sided Gauss 496 dgaus->SetParLimits(0,integ-1.5,integ+1.5); 497 dgaus->SetParLimits(1,min+(width/10.),mean); 498 dgaus->SetParLimits(2,0,width/2.); 499 // The right-sided Gauss 500 dgaus->SetParLimits(3,0,integ); 501 dgaus->SetParLimits(4,mean,max-(width/10.)); 502 dgaus->SetParLimits(5,0,width/2.); 503 obj2->Fit("dgaus","QLRM"); 504 obj2->GetFunction("dgaus")->SetLineColor(kYellow); 505 break; 506 507 case 2: 508 TString tgausform = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"; 509 tgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 510 tgausform += "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])"; 511 TF1 *tgaus = new TF1("tgaus",tgausform.Data(),min,max); 512 tgaus->SetBit(kCanDelete); 513 tgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}", 514 "A_{2}","#mu_{2}","#sigma_{2}", 515 "A_{3}","#mu_{3}","#sigma_{3}"); 516 tgaus->SetParameters(integ,(min+mean)/2,width/4., 517 integ/width/3.,(max+mean)/2.,width/4., 518 integ/width/3.,mean,width/2.); 519 // The left-sided Gauss 520 tgaus->SetParLimits(0,integ-1.5,integ+1.5); 521 tgaus->SetParLimits(1,min+(width/10.),mean); 522 tgaus->SetParLimits(2,width/15.,width/2.); 523 // The right-sided Gauss 524 tgaus->SetParLimits(3,0.,integ); 525 tgaus->SetParLimits(4,mean,max-(width/10.)); 526 tgaus->SetParLimits(5,width/15.,width/2.); 527 // The Gauss describing the outliers 528 tgaus->SetParLimits(6,0.,integ); 529 tgaus->SetParLimits(7,min,max); 530 tgaus->SetParLimits(8,width/4.,width/1.5); 531 obj2->Fit("tgaus","QLRM"); 532 obj2->GetFunction("tgaus")->SetLineColor(kYellow); 533 break; 534 case 3: 535 obj2->Fit("pol0","Q"); 536 obj2->GetFunction("pol0")->SetLineColor(kYellow); 537 break; 538 case 9: 539 break; 540 default: 541 obj2->Fit("gaus","Q"); 542 obj2->GetFunction("gaus")->SetLineColor(kYellow); 543 break; 546 c.cd(i+2*j); 547 gPad->SetBorderMode(0); 548 TH1D *obj2 = (TH1D*)obj1->Projection(); 549 550 obj2->Draw(); 551 obj2->SetBit(kCanDelete); 552 553 554 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 555 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 556 const Double_t integ = obj2->Integral("width")/2.5066283; 557 const Double_t mean = obj2->GetMean(); 558 const Double_t rms = obj2->GetRMS(); 559 const Double_t width = max-min; 560 561 if (rms == 0. || width == 0. ) 562 return; 563 564 switch (fit) 565 { 566 case 1: 567 TF1 *sgaus = new TF1("sgaus","gaus(0)",min,max); 568 sgaus->SetBit(kCanDelete); 569 sgaus->SetParNames("Area","#mu","#sigma"); 570 sgaus->SetParameters(integ/rms,mean,rms); 571 sgaus->SetParLimits(0,0.,integ); 572 sgaus->SetParLimits(1,min,max); 573 sgaus->SetParLimits(2,0,width/1.5); 574 obj2->Fit("sgaus","QLR"); 575 obj2->GetFunction("sgaus")->SetLineColor(kYellow); 576 break; 577 578 case 2: 579 TString dgausform = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"; 580 dgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 581 TF1 *dgaus = new TF1("dgaus",dgausform.Data(),min,max); 582 dgaus->SetBit(kCanDelete); 583 dgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}","A_{2}","#mu_{2}","#sigma_{2}"); 584 dgaus->SetParameters(integ,(min+mean)/2.,width/4., 585 integ/width/2.,(max+mean)/2.,width/4.); 586 // The left-sided Gauss 587 dgaus->SetParLimits(0,integ-1.5,integ+1.5); 588 dgaus->SetParLimits(1,min+(width/10.),mean); 589 dgaus->SetParLimits(2,0,width/2.); 590 // The right-sided Gauss 591 dgaus->SetParLimits(3,0,integ); 592 dgaus->SetParLimits(4,mean,max-(width/10.)); 593 dgaus->SetParLimits(5,0,width/2.); 594 obj2->Fit("dgaus","QLRM"); 595 obj2->GetFunction("dgaus")->SetLineColor(kYellow); 596 break; 597 598 case 3: 599 TString tgausform = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"; 600 tgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 601 tgausform += "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])"; 602 TF1 *tgaus = new TF1("tgaus",tgausform.Data(),min,max); 603 tgaus->SetBit(kCanDelete); 604 tgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}", 605 "A_{2}","#mu_{2}","#sigma_{2}", 606 "A_{3}","#mu_{3}","#sigma_{3}"); 607 tgaus->SetParameters(integ,(min+mean)/2,width/4., 608 integ/width/3.,(max+mean)/2.,width/4., 609 integ/width/3.,mean,width/2.); 610 // The left-sided Gauss 611 tgaus->SetParLimits(0,integ-1.5,integ+1.5); 612 tgaus->SetParLimits(1,min+(width/10.),mean); 613 tgaus->SetParLimits(2,width/15.,width/2.); 614 // The right-sided Gauss 615 tgaus->SetParLimits(3,0.,integ); 616 tgaus->SetParLimits(4,mean,max-(width/10.)); 617 tgaus->SetParLimits(5,width/15.,width/2.); 618 // The Gauss describing the outliers 619 tgaus->SetParLimits(6,0.,integ); 620 tgaus->SetParLimits(7,min,max); 621 tgaus->SetParLimits(8,width/4.,width/1.5); 622 obj2->Fit("tgaus","QLRM"); 623 obj2->GetFunction("tgaus")->SetLineColor(kYellow); 624 break; 625 case 4: 626 obj2->Fit("pol0","Q"); 627 obj2->GetFunction("pol0")->SetLineColor(kYellow); 628 break; 629 case 9: 630 break; 631 default: 632 obj2->Fit("gaus","Q"); 633 obj2->GetFunction("gaus")->SetLineColor(kYellow); 634 break; 635 } 636 637 gPad->Modified(); 638 gPad->Update(); 639 544 640 } 545 546 gPad->Modified();547 gPad->Update();548 549 /*550 TPaveStats *st = (TPaveStats*)gPad->GetPrimitive("stats");551 st->SetName("Projection");552 st->SetX1NDC(0.7);553 st->SetX2NDC(1.2);554 st->SetY1NDC(0.4);555 st->SetY2NDC(1.2);556 557 gPad->Modified();558 gPad->Update();559 560 */561 641 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
r3029 r3059 35 35 // 3) It initializes a pointer to an MCalibrationPINDiode container 36 36 // 37 // 4)38 //39 37 ///////////////////////////////////////////////////////////////////////////// 40 38 #include "MCalibrationCam.h" … … 48 46 49 47 #include "MGeomCam.h" 48 #include "MGeomPix.h" 50 49 51 50 #include "MCalibrationPix.h" … … 62 61 const Int_t MCalibrationCam::gkBlindPixelId = 559; 63 62 const Int_t MCalibrationCam::gkPINDiodeId = 9999; 64 const Float_t MCalibrationCam::gkTimeSliceWidth = 3.3;65 63 66 64 // -------------------------------------------------------------------------- … … 383 381 return kFALSE; 384 382 385 if ( (!(*this)[idx].IsChargeFitValid()) || (*this)[idx].IsExcluded())386 return kFALSE;387 388 if (idx == gkBlindPixelId)389 return kFALSE;390 391 if (idx == gkPINDiodeId)392 return kFALSE;393 394 383 switch (type) 395 384 { 396 385 case 0: 386 if ((*this)[idx].IsExcluded()) 387 return kFALSE; 397 388 val = (*this)[idx].GetCharge(); 398 389 break; 399 390 case 1: 391 if ((*this)[idx].IsExcluded()) 392 return kFALSE; 400 393 val = (*this)[idx].GetErrCharge(); 401 394 break; 402 395 case 2: 396 if ((*this)[idx].IsExcluded()) 397 return kFALSE; 403 398 val = (*this)[idx].GetSigmaCharge(); 404 399 break; 405 400 case 3: 401 if ((*this)[idx].IsExcluded()) 402 return kFALSE; 406 403 val = (*this)[idx].GetErrSigmaCharge(); 407 404 break; 408 405 case 4: 406 if ((*this)[idx].IsExcluded()) 407 return kFALSE; 409 408 val = (*this)[idx].GetChargeProb(); 410 409 break; 411 410 case 5: 412 if ( !(*this)[idx].IsTimeFitValid())413 return kFALSE; 414 val = (*this)[idx].Get MeanTimeOffset() * gkTimeSliceWidth;411 if ((*this)[idx].IsExcluded()) 412 return kFALSE; 413 val = (*this)[idx].GetRSigmaCharge(); 415 414 break; 416 415 case 6: 417 if ( !(*this)[idx].IsTimeFitValid())418 return kFALSE; 419 val = (*this)[idx].Get TimingPrecision() * gkTimeSliceWidth;416 if ((*this)[idx].IsExcluded()) 417 return kFALSE; 418 val = (*this)[idx].GetErrRSigmaCharge(); 420 419 break; 421 420 case 7: 422 if ( !(*this)[idx].IsTimeFitValid())423 return kFALSE; 424 val = (*this)[idx].Get TimeProb();421 if ((*this)[idx].IsExcluded()) 422 return kFALSE; 423 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetCharge(); 425 424 break; 426 425 case 8: 426 if ((*this)[idx].IsExcluded()) 427 return kFALSE; 428 // relative error RsigmaCharge square 429 val = (*this)[idx].GetErrRSigmaCharge()* (*this)[idx].GetErrRSigmaCharge() 430 / ((*this)[idx].GetRSigmaCharge() * (*this)[idx].GetRSigmaCharge() ); 431 // relative error Charge square 432 val += (*this)[idx].GetErrCharge() * (*this)[idx].GetErrCharge() 433 / ((*this)[idx].GetCharge() * (*this)[idx].GetCharge() ); 434 // calculate relative error out of squares 435 val = TMath::Sqrt(val) ; 436 // multiply with value to get absolute error 437 val *= (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetCharge(); 438 break; 439 case 9: 440 if ((*this)[idx].IsExcluded()) 441 return kFALSE; 442 val = (*this)[idx].GetPheFFactorMethod(); 443 break; 444 case 10: 445 if ((*this)[idx].IsExcluded()) 446 return kFALSE; 447 val = (*this)[idx].GetPheFFactorMethodError(); 448 break; 449 case 11: 450 if ((*this)[idx].IsExcluded()) 451 return kFALSE; 452 val = (*this)[idx].GetMeanConversionFFactorMethod(); 453 break; 454 case 12: 455 if ((*this)[idx].IsExcluded()) 456 return kFALSE; 457 val = (*this)[idx].GetErrorConversionFFactorMethod(); 458 break; 459 case 13: 460 if ((*this)[idx].IsExcluded()) 461 return kFALSE; 462 val = (*this)[idx].GetTotalFFactorFFactorMethod(); 463 break; 464 case 14: 465 if ((*this)[idx].IsExcluded()) 466 return kFALSE; 467 val = (*this)[idx].GetTotalFFactorErrorFFactorMethod(); 468 break; 469 case 15: 470 if ((*this)[idx].IsExcluded()) 471 return kFALSE; 472 if (cam[idx].IsInOuterRing()) 473 val = GetMeanPhotInsidePlexiglass()*gkCalibrationOutervsInnerPixelArea; 474 else 475 val = GetMeanPhotInsidePlexiglass(); 476 break; 477 case 16: 478 if ((*this)[idx].IsExcluded()) 479 return kFALSE; 480 if (cam[idx].IsInOuterRing()) 481 val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 482 else 483 val = (double)fMeanPhotInsidePlexiglass; 484 break; 485 case 17: 486 if ((*this)[idx].IsExcluded()) 487 return kFALSE; 488 if (cam[idx].IsInOuterRing()) 489 val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea; 490 else 491 val = (*this)[idx].GetMeanConversionBlindPixelMethod(); 492 break; 493 case 18: 494 if ((*this)[idx].IsExcluded()) 495 return kFALSE; 496 if (cam[idx].IsInOuterRing()) 497 { 498 val = (*this)[idx].GetErrorConversionBlindPixelMethod()*(*this)[idx].GetErrorConversionBlindPixelMethod() 499 * gkCalibrationOutervsInnerPixelArea * gkCalibrationOutervsInnerPixelArea; 500 val += gkCalibrationOutervsInnerPixelAreaError * gkCalibrationOutervsInnerPixelAreaError 501 * (*this)[idx].GetMeanConversionBlindPixelMethod() *(*this)[idx].GetMeanConversionBlindPixelMethod(); 502 val = TMath::Sqrt(val); 503 } 504 else 505 val = (*this)[idx].GetErrorConversionBlindPixelMethod(); 506 break; 507 case 19: 508 if ((*this)[idx].IsExcluded()) 509 return kFALSE; 510 val = (*this)[idx].GetTotalFFactorBlindPixelMethod(); 511 break; 512 case 20: 513 if ((*this)[idx].IsExcluded()) 514 return kFALSE; 515 val = (*this)[idx].GetTotalFFactorErrorBlindPixelMethod(); 516 break; 517 case 21: 518 if ((*this)[idx].IsExcluded()) 519 return kFALSE; 520 if (cam[idx].IsInOuterRing()) 521 val = GetMeanPhotOutsidePlexiglass()*gkCalibrationOutervsInnerPixelArea; 522 else 523 val = GetMeanPhotOutsidePlexiglass(); 524 break; 525 case 22: 526 if ((*this)[idx].IsExcluded()) 527 return kFALSE; 528 if (cam[idx].IsInOuterRing()) 529 val = (double)fMeanPhotOutsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 530 else 531 val = (double)fMeanPhotOutsidePlexiglass; 532 break; 533 case 23: 534 if ((*this)[idx].IsExcluded()) 535 return kFALSE; 536 if (cam[idx].IsInOuterRing()) 537 val = (*this)[idx].GetMeanConversionPINDiodeMethod()*gkCalibrationOutervsInnerPixelArea; 538 else 539 val = (*this)[idx].GetMeanConversionPINDiodeMethod(); 540 break; 541 case 24: 542 if ((*this)[idx].IsExcluded()) 543 return kFALSE; 544 if (cam[idx].IsInOuterRing()) 545 { 546 val = (*this)[idx].GetErrorConversionPINDiodeMethod()*(*this)[idx].GetErrorConversionPINDiodeMethod() 547 * gkCalibrationOutervsInnerPixelArea * gkCalibrationOutervsInnerPixelArea; 548 val += gkCalibrationOutervsInnerPixelAreaError * gkCalibrationOutervsInnerPixelAreaError 549 * (*this)[idx].GetMeanConversionPINDiodeMethod() *(*this)[idx].GetMeanConversionPINDiodeMethod(); 550 val = TMath::Sqrt(val); 551 } 552 else 553 val = (*this)[idx].GetErrorConversionPINDiodeMethod(); 554 break; 555 case 25: 556 if ((*this)[idx].IsExcluded()) 557 return kFALSE; 558 val = (*this)[idx].GetTotalFFactorBlindPixelMethod(); 559 break; 560 case 26: 561 if ((*this)[idx].IsExcluded()) 562 return kFALSE; 563 val = (*this)[idx].GetTotalFFactorErrorBlindPixelMethod(); 564 break; 565 case 27: 566 if ((*this)[idx].IsExcluded()) 567 val = 1.; 568 else 569 return kFALSE; 570 break; 571 case 28: 572 if ((*this)[idx].IsExcluded()) 573 return kFALSE; 574 if (!(*this)[idx].IsFitted()) 575 val = 1; 576 else 577 return kFALSE; 578 break; 579 case 29: 580 if ((*this)[idx].IsExcluded()) 581 return kFALSE; 582 if (!(*this)[idx].IsFitted()) 583 return kFALSE; 584 if (!(*this)[idx].IsChargeFitValid()) 585 val = 1; 586 else 587 return kFALSE; 588 break; 589 case 30: 590 if ((*this)[idx].IsExcluded()) 591 return kFALSE; 592 if ((*this)[idx].IsOscillating()) 593 val = 1; 594 else 595 return kFALSE; 596 break; 597 case 31: 598 if ((*this)[idx].IsExcluded()) 599 return kFALSE; 600 if ((*this)[idx].IsHiGainSaturation()) 601 val = 1; 602 else 603 return kFALSE; 604 break; 605 case 32: 606 if ((*this)[idx].IsExcluded()) 607 return kFALSE; 608 if ((*this)[idx].IsFFactorMethodValid()) 609 val = 1; 610 else 611 return kFALSE; 612 break; 613 case 33: 614 if ((*this)[idx].IsExcluded()) 615 return kFALSE; 616 if ((*this)[idx].IsBlindPixelMethodValid()) 617 val = 1; 618 else 619 return kFALSE; 620 break; 621 case 34: 622 if ((*this)[idx].IsExcluded()) 623 return kFALSE; 624 if ((*this)[idx].IsPINDiodeMethodValid()) 625 val = 1; 626 else 627 return kFALSE; 628 break; 629 case 35: 630 if ((*this)[idx].IsExcluded()) 631 return kFALSE; 427 632 val = (*this)[idx].GetPed(); 428 633 break; 429 case 9: 634 case 36: 635 if ((*this)[idx].IsExcluded()) 636 return kFALSE; 637 val = 1.; 638 // val = (*this)[idx].GetPedError(); 639 break; 640 case 37: 641 if ((*this)[idx].IsExcluded()) 642 return kFALSE; 430 643 val = (*this)[idx].GetPedRms(); 431 644 break; 432 case 10: 433 val = (*this)[idx].GetRSigmaCharge(); 434 break; 435 case 11: 436 val = (*this)[idx].GetPheFFactorMethod(); 437 break; 438 case 12: 439 val = (*this)[idx].GetPheFFactorMethodError(); 440 break; 441 case 13: 442 val = (*this)[idx].GetMeanConversionFFactorMethod(); 443 break; 444 case 14: 445 val = (*this)[idx].GetErrorConversionFFactorMethod(); 446 break; 447 case 15: 448 if (idx < 397) 449 val = (double)fMeanPhotInsidePlexiglass; 450 else 451 val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea; 452 break; 453 case 16: 454 if (idx < 397) 455 val = (*this)[idx].GetMeanConversionBlindPixelMethod(); 456 else 457 val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea; 458 break; 459 case 17: 460 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetCharge(); 461 break; 462 case 18: 463 if (!(*this)[idx].IsTimeFitValid()) 645 case 38: 646 if ((*this)[idx].IsExcluded()) 647 return kFALSE; 648 val = 1.; 649 // val = (*this)[idx].GetPedRmsError(); 650 break; 651 case 39: 652 if ((*this)[idx].IsExcluded()) 464 653 return kFALSE; 465 654 val = (*this)[idx].GetAbsTimeMean(); 466 655 break; 467 case 19:468 if ( !(*this)[idx].IsTimeFitValid())656 case 40: 657 if ((*this)[idx].IsExcluded()) 469 658 return kFALSE; 470 659 val = (*this)[idx].GetAbsTimeMeanErr(); 471 660 break; 472 case 20:473 if ( !(*this)[idx].IsTimeFitValid())661 case 41: 662 if ((*this)[idx].IsExcluded()) 474 663 return kFALSE; 475 664 val = (*this)[idx].GetAbsTimeRms(); 476 665 break; 477 case 21:478 if ( !(*this)[idx].IsTimeFitValid())666 case 42: 667 if ((*this)[idx].IsExcluded()) 479 668 return kFALSE; 480 669 val = (*this)[idx].GetAbsTimeMeanErr()/TMath::Sqrt(2.);
Note:
See TracChangeset
for help on using the changeset viewer.