Changeset 3551 for trunk/MagicSoft/Mars/macros/calibration.C
- Timestamp:
- 03/19/04 16:56:19 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/calibration.C
r3463 r3551 24 24 #include "MAGIC.h" 25 25 26 27 26 void calibration() 28 27 { 29 28 30 // const char *inpath = "/remote/home/pc2/operator/NewCalBoxTest/"; 31 // const char *inpath = "/remote/home/pc2/operator/Crab20040214/"; 32 // const char *inpath = "./"; 33 //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_02_10/"; 34 //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_26/"; 29 //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_02_10/"; 30 //const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_26/"; 35 31 const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_27/"; 36 //const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/"; 37 38 MRunIter pruns; 39 MRunIter cruns; 40 41 pruns.AddRun(12386,inpath); 42 cruns.AddRun(12525,inpath); 43 // pruns.AddRun(14400,inpath); 44 // cruns.AddRuns(14401,14409,inpath); 45 // pruns.AddRuns(15487,15494,inpath); 46 // cruns.AddRuns(15495,15508,inpath); 47 // pruns.AddRun(19816,inpath); // CalboxTest 48 // cruns.AddRun(19820,inpath); // 3blue 49 // cruns.AddRun(19820,inpath); // 1blue 50 51 gStyle->SetOptStat(1111); 52 gStyle->SetOptFit(); 53 54 MStatusDisplay *display = new MStatusDisplay; 55 display->SetUpdateTime(3000); 56 display->Resize(850,700); 57 58 MJPedestal pedloop; 59 pedloop.SetInput(&pruns); 60 pedloop.SetDisplay(display); 61 62 if (!pedloop.Process()) 63 return; 64 65 // 66 // Now the short version: 67 // 68 /* 32 //const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/"; 33 // const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2004_03_03/"; 34 // const TString inpath = "/home/rootdata/BlindPixel/"; 35 36 // const TString inpath = "."; 37 MRunIter pruns; 38 MRunIter cruns; 39 40 // pruns.AddRun(20491,inpath); 41 // pruns.AddRun(20123,inpath); 42 43 pruns.AddRun(12386,inpath); 44 // pruns.AddRun(14400,inpath); 45 // cruns.AddRuns(14401,14409,inpath); 46 // pruns.AddRuns(15487,15494,inpath); 47 // cruns.AddRuns(12525,12529,inpath); 48 cruns.AddRun(12525,inpath); 49 // cruns.AddRuns(15495,15508,inpath); 50 // cruns.AddRun(20491,inpath); 51 // cruns.AddRun(20129,inpath); 52 53 gStyle->SetOptStat(1111); 54 gStyle->SetOptFit(); 55 56 MStatusDisplay *display = new MStatusDisplay; 57 display->SetUpdateTime(3000); 58 display->Resize(850,700); 59 60 MBadPixelsCam badcam; 61 badcam.AsciiRead("badpixels.dat"); 62 63 /************************************/ 64 /* FIRST LOOP: PEDESTAL COMPUTATION */ 65 /************************************/ 66 67 MJPedestal pedloop; 68 pedloop.SetInput(&pruns); 69 pedloop.SetDisplay(display); 70 pedloop.SetBadPixels(badcam); 71 72 if (!pedloop.Process()) 73 return; 74 75 // 76 // Now the short version: 77 // 78 /* 69 79 MJCalibration calloop; 70 80 calloop.SetInput(&cruns); … … 72 82 if (!calloop.Process(pedloop.GetPedestalCam())) 73 83 return; 74 #if 0 75 */ 76 // 77 // The longer version: 78 // 79 80 // 81 // Create a empty Parameter List and an empty Task List 82 // 83 MParList plist; 84 MTaskList tlist; 85 plist.AddToList(&tlist); 86 plist.AddToList(&pedloop.GetPedestalCam()); 87 88 gLog << endl;; 89 gLog << "Calculate MCalibrationCam from Runs " << cruns.GetRunsAsString() << endl; 90 gLog << endl; 91 92 MReadMarsFile read("Events"); 93 read.DisableAutoScheme(); 94 static_cast<MRead&>(read).AddFiles(cruns); 95 96 MGeomCamMagic geomcam; 97 MExtractedSignalCam sigcam; 98 MArrivalTimeCam timecam; 99 MCalibrationChargeCam calcam; 100 MCalibrationChargePINDiode pindiode; 101 MCalibrationChargeBlindPix blindpix; 102 103 MHCalibrationRelTimeCam histtime; 104 MHCalibrationChargeCam histcharge; 105 MHCalibrationChargePINDiode histpin; 106 MHCalibrationChargeBlindPix histblind; 107 // histblind.SetSinglePheCut(80); 108 // 109 // As long, as we don't have digital modules, 110 // we have to set the color of the pulser LED by hand 111 // 112 blindpix.SetColor(kCT1); 113 // pindiode.SetColor(kCT1); 114 // 115 // Get the previously created MPedestalCam into the new Parameter List 116 // 117 plist.AddToList(&geomcam); 118 plist.AddToList(&sigcam); 119 plist.AddToList(&timecam); 120 plist.AddToList(&calcam); 121 plist.AddToList(&histtime); 122 plist.AddToList(&histcharge); 123 // plist.AddToList(&histpin); 124 plist.AddToList(&histblind); 125 plist.AddToList(&pedloop.GetBadPixels()); 126 127 // 128 // We saw that the signal jumps between slices, 129 // thus take the sliding window 130 // 131 MExtractSignal2 sigcalc2; 132 MExtractPINDiode pincalc; 133 MExtractBlindPixel blindcalc; 134 // blindcalc.SetRange(11,16); 135 136 MArrivalTimeCalc2 timecalc; 137 MCalibrationChargeCalc calcalc; 138 MGeomApply geomapl; 139 140 MFillH filltime( "MHCalibrationRelTimeCam" , "MArrivalTimeCam"); 141 // MFillH fillpin ("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode"); 142 MFillH fillblind("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel"); 143 MFillH fillcam ("MHCalibrationChargeCam" , "MExtractedSignalCam"); 144 145 // 146 // Skip the HiGain vs. LoGain calibration 147 // 148 calcalc.SkipHiLoGainCalibration(); 149 150 // 151 // Apply a filter against cosmics 152 // (was directly in MCalibrationCalc in earlier versions) 153 // 154 MFCosmics cosmics; 155 MContinue cont(&cosmics); 156 157 tlist.AddToList(&read); 158 tlist.AddToList(&geomapl); 159 tlist.AddToList(&sigcalc2); 160 tlist.AddToList(&blindcalc); 161 // tlist.AddToList(&pincalc); 162 // 163 // In case, you want to skip the cosmics rejection, 164 // uncomment the next line 165 // 166 tlist.AddToList(&cont); 167 // 168 // In case, you want to skip the somewhat lengthy calculation 169 // of the arrival times using a spline, uncomment the next two lines 170 // 171 tlist.AddToList(&timecalc); 172 tlist.AddToList(&filltime); 173 // tlist.AddToList(&fillpin); 174 tlist.AddToList(&fillblind); 175 tlist.AddToList(&fillcam); 176 // 177 tlist.AddToList(&calcalc); 178 // 179 // Create and setup the eventloop 180 // 181 MEvtLoop evtloop; 182 evtloop.SetParList(&plist); 183 evtloop.SetDisplay(display); 184 185 // 186 // Execute second analysis 187 // 188 if (!evtloop.Eventloop()) 189 return; 190 191 tlist.PrintStatistics(); 192 193 // 194 // print the most important results of all pixels to a file 195 // 196 MLog gauglog; 197 gauglog.SetOutputFile(Form("%s%s",calcam.GetName(),".txt"),1); 198 calcam.SetLogStream(&gauglog); 199 calcam.Print(); 200 calcam.SetLogStream(&gLog); 201 // 202 // just one example how to get the plots of individual pixels 203 // 204 // histblind.DrawClone("all"); 205 // histcharge[5].DrawClone("all"); 206 // histcharge(5).DrawClone("all"); 207 // histtime[5].DrawClone("fourierevents"); 208 209 // Create histograms to display 210 MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges"); 211 MHCamera disp2 (geomcam, "Cal;SigmaCharge", "Sigma of Fitted Charges"); 212 MHCamera disp3 (geomcam, "Cal;FitProb", "Probability of Fit"); 213 MHCamera disp4 (geomcam, "Cal;RSigma", "Reduced Sigmas"); 214 MHCamera disp5 (geomcam, "Cal;RSigma/Charge", "Reduced Sigma per Charge"); 215 MHCamera disp6 (geomcam, "Cal;FFactorPh", "Nr. of Photo-electrons (F-Factor Method)"); 216 MHCamera disp7 (geomcam, "Cal;FFactorConv", "Conversion Factor to photons (F-Factor Method)"); 217 MHCamera disp8 (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)"); 218 MHCamera disp9 (geomcam, "Cal;BlindPixPh", "Photon flux inside plexiglass (Blind Pixel Method)"); 219 MHCamera disp10 (geomcam, "Cal;BlindPixConv", "Conversion Factor to photons (Blind Pixel Method)"); 220 MHCamera disp11 (geomcam, "Cal;BlindPixFFactor","Total F-Factor (Blind Pixel Method)"); 221 MHCamera disp12 (geomcam, "Cal;PINDiodePh", "Photon flux outside plexiglass (PIN Diode Method)"); 222 MHCamera disp13 (geomcam, "Cal;PINDiodeConv", "Conversion Factor tp photons (PIN Diode Method)"); 223 MHCamera disp14 (geomcam, "Cal;PINDiodeFFactor","Total F-Factor (PIN Diode Method)"); 224 MHCamera disp15 (geomcam, "Cal;Excluded", "Pixels previously excluded"); 225 MHCamera disp16 (geomcam, "Cal;NotFitted", "Pixels that could not be fitted"); 226 MHCamera disp17 (geomcam, "Cal;NotFitValid", "Pixels with not valid fit results"); 227 MHCamera disp18 (geomcam, "Cal;HiGainOscillating", "Oscillating Pixels HI Gain"); 228 MHCamera disp19 (geomcam, "Cal;LoGainOscillating", "Oscillating Pixels LO Gain"); 229 MHCamera disp20 (geomcam, "Cal;HiGainPickup", "Number Pickup events Hi Gain"); 230 MHCamera disp21 (geomcam, "Cal;LoGainPickup", "Number Pickup events Lo Gain"); 231 MHCamera disp22 (geomcam, "Cal;Saturation", "Pixels with saturated Hi Gain"); 232 MHCamera disp23 (geomcam, "Cal;FFactorValid", "Pixels with valid F-Factor calibration"); 233 MHCamera disp24 (geomcam, "Cal;BlindPixelValid", "Pixels with valid BlindPixel calibration"); 234 MHCamera disp25 (geomcam, "Cal;PINdiodeFFactorValid", "Pixels with valid PINDiode calibration"); 235 236 MHCamera disp26 (geomcam, "Cal;Ped", "Pedestals"); 237 MHCamera disp27 (geomcam, "Cal;PedRms", "Pedestal RMS"); 238 239 MHCamera disp28 (geomcam, "time;Time", "Rel. Arrival Times"); 240 MHCamera disp29 (geomcam, "time;SigmaTime", "Sigma of Rel. Arrival Times"); 241 MHCamera disp30 (geomcam, "time;TimeProb", "Probability of Time Fit"); 242 MHCamera disp31 (geomcam, "time;NotFitValid", "Pixels with not valid fit results"); 243 MHCamera disp32 (geomcam, "time;Oscillating", "Oscillating Pixels"); 244 245 MHCamera disp33 (geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times"); 246 MHCamera disp34 (geomcam, "Cal;AbsTimeRms", "RMS of Arrival Times"); 247 248 // Fitted charge means and sigmas 249 disp1.SetCamContent(calcam, 0); 250 disp1.SetCamError( calcam, 1); 251 disp2.SetCamContent(calcam, 2); 252 disp2.SetCamError( calcam, 3); 253 254 // Fit probabilities 255 disp3.SetCamContent(calcam, 4); 256 257 // Reduced Sigmas and reduced sigmas per charge 258 disp4.SetCamContent(calcam, 5); 259 disp4.SetCamError( calcam, 6); 260 disp5.SetCamContent(calcam, 7); 261 disp5.SetCamError( calcam, 8); 262 263 // F-Factor Method 264 disp6.SetCamContent(calcam, 9); 265 disp6.SetCamError( calcam, 10); 266 disp7.SetCamContent(calcam, 11); 267 disp7.SetCamError( calcam, 12); 268 disp8.SetCamContent(calcam, 13); 269 disp8.SetCamError( calcam, 14); 270 271 /// Blind Pixel Method 272 disp9.SetCamContent(calcam, 15); 273 disp9.SetCamError( calcam, 16); 274 disp10.SetCamContent(calcam,17); 275 disp10.SetCamError( calcam,18); 276 disp11.SetCamContent(calcam,19); 277 disp11.SetCamError( calcam,20); 278 279 // PIN Diode Method 280 disp12.SetCamContent(calcam,21); 281 disp12.SetCamError( calcam,22); 282 disp13.SetCamContent(calcam,23); 283 disp13.SetCamError( calcam,24); 284 disp14.SetCamContent(calcam,25); 285 disp14.SetCamError( calcam,26); 286 287 // Pixels with defects 288 disp15.SetCamContent(calcam,27); 289 disp16.SetCamContent(calcam,28); 290 disp17.SetCamContent(calcam,29); 291 disp18.SetCamContent(calcam,30); 292 disp19.SetCamContent(calcam,31); 293 disp20.SetCamContent(calcam,32); 294 disp21.SetCamContent(calcam,33); 295 296 // Lo Gain calibration 297 disp22.SetCamContent(calcam,34); 298 299 // Valid flags 300 disp23.SetCamContent(calcam,35); 301 disp24.SetCamContent(calcam,36); 302 disp25.SetCamContent(calcam,37); 303 304 // Pedestals 305 disp26.SetCamContent(calcam,38); 306 disp26.SetCamError( calcam,39); 307 disp27.SetCamContent(calcam,40); 308 disp27.SetCamError( calcam,41); 309 310 // Relative Times 311 disp28.SetCamContent(histtime,0); 312 disp28.SetCamError( histtime,1); 313 disp29.SetCamContent(histtime,2); 314 disp29.SetCamError( histtime,3); 315 disp30.SetCamContent(histtime,4); 316 disp31.SetCamContent(histtime,5); 317 disp32.SetCamContent(histtime,6); 318 319 // Absolute Times 320 disp33.SetCamContent(calcam,42); 321 disp33.SetCamError( calcam,43); 322 disp34.SetCamContent(calcam,43); 323 324 disp1.SetYTitle("Charge [FADC units]"); 325 disp2.SetYTitle("\\sigma_{Charge} [FADC units]"); 326 disp3.SetYTitle("P_{Charge} [1]"); 327 328 disp4.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]"); 329 disp5.SetYTitle("Reduced Sigma / Mean Charge [1]"); 330 331 disp6.SetYTitle("Nr. Photo-electrons [1]"); 332 disp7.SetYTitle("Conversion Factor [Ph/FADC Count]"); 333 disp8.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1] "); 334 335 disp9.SetYTitle("Photon flux [ph/mm^2]"); 336 disp10.SetYTitle("Conversion Factor [Phot/FADC Count]"); 337 disp11.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 338 339 disp12.SetYTitle("Photon flux [ph/mm^2]"); 340 disp13.SetYTitle("Conversion Factor [Phot/FADC Count]"); 341 disp14.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 342 343 disp15.SetYTitle("[1]"); 344 disp16.SetYTitle("[1]"); 345 disp17.SetYTitle("[1]"); 346 disp18.SetYTitle("[1]"); 347 disp19.SetYTitle("[1]"); 348 disp20.SetYTitle("[1]"); 349 disp21.SetYTitle("[1]"); 350 disp22.SetYTitle("[1]"); 351 disp23.SetYTitle("[1]"); 352 disp24.SetYTitle("[1]"); 353 disp25.SetYTitle("[1]"); 354 355 disp26.SetYTitle("Ped [FADC Counts ]"); 356 disp27.SetYTitle("RMS_{Ped} [FADC Counts ]"); 357 358 disp28.SetYTitle("Time Offset [ns]"); 359 disp29.SetYTitle("Timing resolution [ns]"); 360 disp30.SetYTitle("P_{Time} [1]"); 361 362 disp31.SetYTitle("[1]"); 363 disp32.SetYTitle("[1]"); 364 365 disp33.SetYTitle("Mean Abs. Time [FADC slice]"); 366 disp34.SetYTitle("RMS Abs. Time [FADC slices]"); 367 368 gStyle->SetOptStat(1111); 369 gStyle->SetOptFit(); 370 371 // Charges 372 TCanvas &c1 = display->AddTab("Fit.Charge"); 373 c1.Divide(2, 3); 374 375 CamDraw(c1, disp1,calcam,1, 2 , 2); 376 CamDraw(c1, disp2,calcam,2, 2 , 2); 377 378 // Fit Probability 379 TCanvas &c2 = display->AddTab("Fit.Prob"); 380 c2.Divide(1,3); 381 382 CamDraw(c2, disp3,calcam,1, 1 , 4); 383 384 // Reduced Sigmas 385 TCanvas &c3 = display->AddTab("Red.Sigma"); 386 c3.Divide(2,3); 387 388 CamDraw(c3, disp4,calcam,1, 2 , 2); 389 CamDraw(c3, disp5,calcam,2, 2 , 2); 390 391 // F-Factor Method 392 TCanvas &c4 = display->AddTab("F-Factor"); 393 c4.Divide(3,3); 394 395 CamDraw(c4, disp6,calcam,1, 3 , 2); 396 CamDraw(c4, disp7,calcam,2, 3 , 2); 397 CamDraw(c4, disp8,calcam,3, 3 , 2); 398 399 // Blind Pixel Method 400 TCanvas &c5 = display->AddTab("BlindPix"); 401 c5.Divide(3, 3); 402 403 CamDraw(c5, disp9,calcam,1, 3 , 9); 404 CamDraw(c5, disp10,calcam,2, 3 , 2); 405 CamDraw(c5, disp11,calcam,3, 3 , 2); 406 407 // PIN Diode Method 408 TCanvas &c6 = display->AddTab("PINDiode"); 409 c6.Divide(3,3); 410 411 CamDraw(c6, disp12,calcam,1, 3 , 9); 412 CamDraw(c6, disp13,calcam,2, 3 , 2); 413 CamDraw(c6, disp14,calcam,3, 3 , 2); 414 415 // Defects 416 TCanvas &c7 = display->AddTab("Defects"); 417 c7.Divide(7,2); 418 419 CamDraw(c7, disp15,calcam,1,7, 0); 420 CamDraw(c7, disp16,calcam,2,7, 0); 421 CamDraw(c7, disp17,calcam,3,7, 0); 422 CamDraw(c7, disp18,calcam,4,7, 0); 423 CamDraw(c7, disp19,calcam,5,7, 0); 424 CamDraw(c7, disp20,calcam,6,7, 0); 425 CamDraw(c7, disp21,calcam,7,7, 0); 426 427 // Valid flags 428 TCanvas &c8 = display->AddTab("Validity"); 429 c8.Divide(4,2); 430 431 CamDraw(c8, disp22,calcam,1,4,0); 432 CamDraw(c8, disp23,calcam,2,4,0); 433 CamDraw(c8, disp24,calcam,3,4,0); 434 CamDraw(c8, disp25,calcam,4,4,0); 435 436 437 // Pedestals 438 TCanvas &c9 = display->AddTab("Pedestals"); 439 c9.Divide(2,3); 440 441 CamDraw(c9,disp26,calcam,1,2,1); 442 CamDraw(c9,disp27,calcam,2,2,2); 443 444 // Rel. Times 445 TCanvas &c10 = display->AddTab("Fitted Rel. Times"); 446 c10.Divide(3,3); 447 448 CamDraw(c10,disp28,calcam,1,3,2); 449 CamDraw(c10,disp29,calcam,2,3,2); 450 CamDraw(c10,disp30,calcam,3,3,4); 451 452 // Time Defects 453 TCanvas &c11 = display->AddTab("Time Def."); 454 c11.Divide(2,2); 455 456 CamDraw(c11, disp31,calcam,1,2, 0); 457 CamDraw(c11, disp32,calcam,2,2, 0); 458 459 // Abs. Times 460 TCanvas &c12 = display->AddTab("Abs. Times"); 461 c12.Divide(2,3); 462 463 CamDraw(c12,disp33,calcam,1,2,2); 464 CamDraw(c12,disp34,calcam,2,2,2); 465 466 #endif 84 // #if 0 85 */ 86 // 87 // The longer version: 88 // 89 90 // 91 // Create a empty Parameter List and an empty Task List 92 // 93 MParList plist; 94 MTaskList tlist; 95 plist.AddToList(&tlist); 96 plist.AddToList(&pedloop.GetPedestalCam()); 97 plist.AddToList(&badcam); 98 99 gLog << endl;; 100 gLog << "Calculate MCalibrationCam from Runs " << cruns.GetRunsAsString() << endl; 101 gLog << endl; 102 103 MReadMarsFile read("Events"); 104 read.DisableAutoScheme(); 105 static_cast<MRead&>(read).AddFiles(cruns); 106 107 MGeomCamMagic geomcam; 108 MExtractedSignalCam sigcam; 109 MArrivalTimeCam timecam; 110 MCalibrationChargeCam calcam; 111 MCalibrationChargePINDiode pindiode; 112 MCalibrationChargeBlindPix blindpix; 113 114 MHCalibrationRelTimeCam histtime; 115 MHCalibrationChargeCam histcharge; 116 MHCalibrationChargePINDiode histpin; 117 MHCalibrationChargeBlindPix histblind; 118 histblind.SetSinglePheCut(1000); 119 // 120 // As long, as we don't have digital modules, 121 // we have to set the color of the pulser LED by hand 122 // 123 blindpix.SetColor(kCT1); 124 // pindiode.SetColor(kCT1); 125 // 126 // Get the previously created MPedestalCam into the new Parameter List 127 // 128 plist.AddToList(&geomcam); 129 plist.AddToList(&sigcam); 130 plist.AddToList(&timecam); 131 plist.AddToList(&calcam); 132 plist.AddToList(&histtime); 133 plist.AddToList(&histcharge); 134 // plist.AddToList(&histpin); 135 plist.AddToList(&histblind); 136 plist.AddToList(&pedloop.GetBadPixels()); 137 138 // 139 // We saw that the signal jumps between slices, 140 // thus take the sliding window 141 // 142 MExtractSignal2 sigcalc2; 143 MExtractPINDiode pincalc; 144 MExtractBlindPixel blindcalc; 145 sigcalc2.SetRange(2,15,6,5,14,6); 146 blindcalc.SetRange(11,29); 147 148 MArrivalTimeCalc2 timecalc; 149 MCalibrationChargeCalc calcalc; 150 MGeomApply geomapl; 151 152 MFillH filltime( "MHCalibrationRelTimeCam" , "MArrivalTimeCam"); 153 // MFillH fillpin ("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode"); 154 MFillH fillblind("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel"); 155 MFillH fillcam ("MHCalibrationChargeCam" , "MExtractedSignalCam"); 156 157 // 158 // Skip the HiGain vs. LoGain calibration 159 // 160 calcalc.SkipHiLoGainCalibration(); 161 162 // 163 // Apply a filter against cosmics 164 // (was directly in MCalibrationCalc in earlier versions) 165 // 166 MFCosmics cosmics; 167 MContinue cont(&cosmics); 168 169 tlist.AddToList(&read); 170 tlist.AddToList(&geomapl); 171 tlist.AddToList(&sigcalc2); 172 tlist.AddToList(&blindcalc); 173 // tlist.AddToList(&pincalc); 174 // 175 // In case, you want to skip the cosmics rejection, 176 // uncomment the next line 177 // 178 tlist.AddToList(&cont); 179 // 180 // In case, you want to skip the somewhat lengthy calculation 181 // of the arrival times using a spline, uncomment the next two lines 182 // 183 tlist.AddToList(&timecalc); 184 tlist.AddToList(&filltime); 185 // tlist.AddToList(&fillpin); 186 tlist.AddToList(&fillblind); 187 tlist.AddToList(&fillcam); 188 // 189 tlist.AddToList(&calcalc); 190 // 191 // Create and setup the eventloop 192 // 193 MEvtLoop evtloop; 194 evtloop.SetParList(&plist); 195 evtloop.SetDisplay(display); 196 197 // 198 // Execute second analysis 199 // 200 if (!evtloop.Eventloop()) 201 return; 202 203 tlist.PrintStatistics(); 204 205 // 206 // print the most important results of all pixels to a file 207 // 208 MLog gauglog; 209 gauglog.SetOutputFile(Form("%s%s",calcam.GetName(),".txt"),1); 210 calcam.SetLogStream(&gauglog); 211 badcam.Print(); 212 // calcam.Print(); 213 calcam.SetLogStream(&gLog); 214 // 215 // just one example how to get the plots of individual pixels 216 // 217 // histblind.DrawClone("all"); 218 //histcharge[5].DrawClone("all"); 219 // histcharge(5).DrawClone("all"); 220 // histtime[5].DrawClone("fourierevents"); 221 222 // Create histograms to display 223 MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges"); 224 MHCamera disp2 (geomcam, "Cal;SigmaCharge", "Sigma of Fitted Charges"); 225 MHCamera disp3 (geomcam, "Cal;FitProb", "Probability of Fit"); 226 MHCamera disp4 (geomcam, "Cal;RSigma", "Reduced Sigmas"); 227 MHCamera disp5 (geomcam, "Cal;RSigma/Charge", "Reduced Sigma per Charge"); 228 MHCamera disp6 (geomcam, "Cal;FFactorPh", "Nr. of Photo-electrons (F-Factor Method)"); 229 MHCamera disp7 (geomcam, "Cal;FFactorConv", "Conversion Factor to photons (F-Factor Method)"); 230 MHCamera disp8 (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)"); 231 MHCamera disp9 (geomcam, "Cal;BlindPixConv", "Conversion Factor to photons (Blind Pixel Method)"); 232 MHCamera disp10 (geomcam, "Cal;BlindPixFFactor","Total F-Factor (Blind Pixel Method)"); 233 MHCamera disp11 (geomcam, "Cal;PINDiodeConv", "Conversion Factor tp photons (PIN Diode Method)"); 234 MHCamera disp12 (geomcam, "Cal;PINDiodeFFactor","Total F-Factor (PIN Diode Method)"); 235 MHCamera disp13 (geomcam, "Cal;Excluded", "Pixels previously excluded"); 236 MHCamera disp14 (geomcam, "Cal;NotFitted", "Pixels that could not be fitted"); 237 MHCamera disp15 (geomcam, "Cal;NotFitValid", "Pixels with not valid fit results"); 238 MHCamera disp16 (geomcam, "Cal;HiGainOscillating", "Oscillating Pixels HI Gain"); 239 MHCamera disp17 (geomcam, "Cal;LoGainOscillating", "Oscillating Pixels LO Gain"); 240 MHCamera disp18 (geomcam, "Cal;HiGainPickup", "Number Pickup events Hi Gain"); 241 MHCamera disp19 (geomcam, "Cal;LoGainPickup", "Number Pickup events Lo Gain"); 242 MHCamera disp20 (geomcam, "Cal;Saturation", "Pixels with saturated Hi Gain"); 243 MHCamera disp21 (geomcam, "Cal;FFactorValid", "Pixels with valid F-Factor calibration"); 244 MHCamera disp22 (geomcam, "Cal;BlindPixelValid", "Pixels with valid BlindPixel calibration"); 245 MHCamera disp23 (geomcam, "Cal;PINdiodeFFactorValid", "Pixels with valid PINDiode calibration"); 246 247 MHCamera disp24 (geomcam, "Cal;Ped", "Pedestals"); 248 MHCamera disp25 (geomcam, "Cal;PedRms", "Pedestal RMS"); 249 250 MHCamera disp26 (geomcam, "time;Time", "Rel. Arrival Times"); 251 MHCamera disp27 (geomcam, "time;SigmaTime", "Sigma of Rel. Arrival Times"); 252 MHCamera disp28 (geomcam, "time;TimeProb", "Probability of Time Fit"); 253 MHCamera disp29 (geomcam, "time;NotFitValid", "Pixels with not valid fit results"); 254 MHCamera disp30 (geomcam, "time;Oscillating", "Oscillating Pixels"); 255 256 MHCamera disp31 (geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times"); 257 MHCamera disp32 (geomcam, "Cal;AbsTimeRms", "RMS of Arrival Times"); 258 259 // Fitted charge means and sigmas 260 disp1.SetCamContent(calcam, 0); 261 disp1.SetCamError( calcam, 1); 262 disp2.SetCamContent(calcam, 2); 263 disp2.SetCamError( calcam, 3); 264 265 // Fit probabilities 266 disp3.SetCamContent(calcam, 4); 267 268 // Reduced Sigmas and reduced sigmas per charge 269 disp4.SetCamContent(calcam, 5); 270 disp4.SetCamError( calcam, 6); 271 disp5.SetCamContent(calcam, 7); 272 disp5.SetCamError( calcam, 8); 273 274 // F-Factor Method 275 disp6.SetCamContent(calcam, 9); 276 disp6.SetCamError( calcam, 10); 277 disp7.SetCamContent(calcam, 11); 278 disp7.SetCamError( calcam, 12); 279 disp8.SetCamContent(calcam, 13); 280 disp8.SetCamError( calcam, 14); 281 282 // Blind Pixel Method 283 disp9.SetCamContent(calcam, 16); 284 disp9.SetCamError( calcam, 17); 285 disp10.SetCamContent(calcam,18); 286 disp10.SetCamError( calcam,19); 287 288 // PIN Diode Method 289 disp11.SetCamContent(calcam,21); 290 disp11.SetCamError( calcam,22); 291 disp12.SetCamContent(calcam,23); 292 disp12.SetCamError( calcam,24); 293 294 // Pixels with defects 295 disp13.SetCamContent(calcam,26); 296 disp14.SetCamContent(calcam,27); 297 disp15.SetCamContent(badcam,9); 298 disp16.SetCamContent(badcam,16); 299 disp17.SetCamContent(badcam,15); 300 disp18.SetCamContent(calcam,28); 301 disp19.SetCamContent(calcam,29); 302 303 // Lo Gain calibration 304 disp20.SetCamContent(calcam,30); 305 306 // Valid flags 307 disp21.SetCamContent(calcam,15); 308 disp22.SetCamContent(calcam,20); 309 disp23.SetCamContent(calcam,25); 310 311 // Pedestals 312 disp24.SetCamContent(calcam,31); 313 disp24.SetCamError( calcam,32); 314 disp25.SetCamContent(calcam,33); 315 disp25.SetCamError( calcam,34); 316 317 // Relative Times 318 disp26.SetCamContent(histtime,0); 319 disp26.SetCamError( histtime,1); 320 disp27.SetCamContent(histtime,2); 321 disp27.SetCamError( histtime,3); 322 disp28.SetCamContent(histtime,4); 323 disp29.SetCamContent(histtime,5); 324 disp30.SetCamContent(histtime,6); 325 326 // Absolute Times 327 disp31.SetCamContent(calcam,35); 328 disp31.SetCamError( calcam,35); 329 disp32.SetCamContent(calcam,36); 330 331 disp1.SetYTitle("Charge [FADC units]"); 332 disp2.SetYTitle("\\sigma_{Charge} [FADC units]"); 333 disp3.SetYTitle("P_{Charge} [1]"); 334 335 disp4.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]"); 336 disp5.SetYTitle("Reduced Sigma / Mean Charge [1]"); 337 338 disp6.SetYTitle("Nr. Photo-electrons [1]"); 339 disp7.SetYTitle("Conversion Factor [Ph/FADC Count]"); 340 disp8.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1] "); 341 342 disp9.SetYTitle("Conversion Factor [Phot/FADC Count]"); 343 disp10.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 344 345 disp11.SetYTitle("Conversion Factor [Phot/FADC Count]"); 346 disp12.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]"); 347 348 disp13.SetYTitle("[1]"); 349 disp14.SetYTitle("[1]"); 350 disp15.SetYTitle("[1]"); 351 disp16.SetYTitle("[1]"); 352 disp17.SetYTitle("[1]"); 353 disp18.SetYTitle("[1]"); 354 disp19.SetYTitle("[1]"); 355 disp20.SetYTitle("[1]"); 356 disp21.SetYTitle("[1]"); 357 disp22.SetYTitle("[1]"); 358 disp23.SetYTitle("[1]"); 359 360 disp24.SetYTitle("Ped [FADC Counts ]"); 361 disp25.SetYTitle("RMS_{Ped} [FADC Counts ]"); 362 363 disp26.SetYTitle("Time Offset [ns]"); 364 disp27.SetYTitle("Timing resolution [ns]"); 365 disp28.SetYTitle("P_{Time} [1]"); 366 367 disp29.SetYTitle("[1]"); 368 disp30.SetYTitle("[1]"); 369 370 disp31.SetYTitle("Mean Abs. Time [FADC slice]"); 371 disp32.SetYTitle("RMS Abs. Time [FADC slices]"); 372 373 gStyle->SetOptStat(1111); 374 gStyle->SetOptFit(); 375 376 // Charges 377 TCanvas &c1 = display->AddTab("Fit.Charge"); 378 c1.Divide(2, 4); 379 380 CamDraw(c1, disp1,calcam,1, 2 , 2); 381 CamDraw(c1, disp2,calcam,2, 2 , 2); 382 383 // Fit Probability 384 TCanvas &c2 = display->AddTab("Fit.Prob"); 385 c2.Divide(1,4); 386 387 CamDraw(c2, disp3,calcam,1,1,4); 388 389 // Reduced Sigmas 390 TCanvas &c3 = display->AddTab("Red.Sigma"); 391 c3.Divide(2,4); 392 393 CamDraw(c3, disp4,calcam,1, 2 , 2); 394 CamDraw(c3, disp5,calcam,2, 2 , 2); 395 396 397 // F-Factor Method 398 TCanvas &c4 = display->AddTab("F-Factor"); 399 c4.Divide(3,4); 400 401 CamDraw(c4, disp6,calcam,1, 3 , 2); 402 CamDraw(c4, disp7,calcam,2, 3 , 2); 403 CamDraw(c4, disp8,calcam,3, 3 , 2); 404 405 406 // Blind Pixel Method 407 TCanvas &c5 = display->AddTab("BlindPix"); 408 c5.Divide(2, 4); 409 410 CamDraw(c5, disp9 ,calcam,1,2, 2); 411 CamDraw(c5, disp10,calcam,2,2, 2); 412 413 // PIN Diode Method 414 TCanvas &c6 = display->AddTab("PINDiode"); 415 c6.Divide(2,4); 416 417 CamDraw(c6, disp11,calcam,1,2, 2); 418 CamDraw(c6, disp12,calcam,2,2, 2); 419 420 // Defects 421 TCanvas &c7 = display->AddTab("Defects"); 422 c7.Divide(4,2); 423 424 CamDraw(c7, disp13,calcam,1,4, 0); 425 CamDraw(c7, disp14,calcam,2,4, 0); 426 CamDraw(c7, disp18,calcam,3,4, 0); 427 CamDraw(c7, disp19,calcam,4,4, 0); 428 429 // BadCam 430 TCanvas &c8 = display->AddTab("Defects"); 431 c8.Divide(3,2); 432 433 CamDraw(c8, disp15,badcam,1,3, 0); 434 CamDraw(c8, disp16,badcam,2,3, 0); 435 CamDraw(c8, disp17,badcam,3,3, 0); 436 437 // Valid flags 438 TCanvas &c9 = display->AddTab("Validity"); 439 c9.Divide(4,2); 440 441 CamDraw(c9, disp20,calcam,1,4,0); 442 CamDraw(c9, disp21,calcam,2,4,0); 443 CamDraw(c9, disp22,calcam,3,4,0); 444 CamDraw(c9, disp23,calcam,4,4,0); 445 446 // Pedestals 447 TCanvas &c10 = display->AddTab("Pedestals"); 448 c10.Divide(2,4); 449 450 CamDraw(c10,disp24,calcam,1,2,1); 451 CamDraw(c10,disp25,calcam,2,2,2); 452 453 // Rel. Times 454 TCanvas &c11 = display->AddTab("Fitted Rel. Times"); 455 c11.Divide(3,4); 456 457 CamDraw(c11,disp26,calcam,1,3,2); 458 CamDraw(c11,disp27,calcam,2,3,2); 459 CamDraw(c11,disp28,calcam,3,3,4); 460 461 // Time Defects 462 TCanvas &c12 = display->AddTab("Time Def."); 463 c12.Divide(2,2); 464 465 CamDraw(c12, disp29,calcam,1,2, 0); 466 CamDraw(c12, disp30,calcam,2,2, 0); 467 468 // Abs. Times 469 TCanvas &c13 = display->AddTab("Abs. Times"); 470 c13.Divide(2,4); 471 472 CamDraw(c13,disp31,calcam,1,2,2); 473 CamDraw(c13,disp32,calcam,2,2,2); 474 467 475 } 468 476 469 void CamDraw(TCanvas &c, MHCamera &cam, MCamEvent &evt, Int_t i, Int_t j, Int_t fit) 477 478 void CamDraw(TCanvas &c, MHCamera &cam, TObject &evt, Int_t i, Int_t j, Int_t fit) 470 479 { 480 481 TArrayI s0(6); 482 s0[0] = 1; 483 s0[1] = 2; 484 s0[2] = 3; 485 s0[3] = 4; 486 s0[4] = 5; 487 s0[5] = 6; 488 489 TArrayI s1(3); 490 s1[0] = 6; 491 s1[1] = 1; 492 s1[2] = 2; 493 494 TArrayI s2(3); 495 s2[0] = 3; 496 s2[1] = 4; 497 s2[2] = 5; 498 499 TArrayI inner(1); 500 inner[0] = 0; 501 502 TArrayI outer(1); 503 outer[0] = 1; 471 504 472 505 c.cd(i); 473 506 gPad->SetBorderMode(0); 474 MHCamera *obj1=(MHCamera*)cam.DrawCopy("hist"); 475 // obj1->AddNotify(evt); 476 507 gPad->SetTicks(); 508 MHCamera *obj1 = (MHCamera*)cam.DrawCopy("hist"); 509 obj1->SetDirectory(NULL); 510 477 511 c.cd(i+j); 478 gPad->SetBorderMode(0); 512 // obj1->AddNotify(&evt); 513 obj1->SetPrettyPalette(); 479 514 obj1->Draw(); 480 ((MHCamera*)obj1)->SetPrettyPalette();481 515 482 516 if (fit != 0) 483 517 { 518 484 519 c.cd(i+2*j); 485 520 gPad->SetBorderMode(0); 486 TH1D *obj2 = (TH1D*)obj1->Projection(obj1.GetName());487 488 // obj2->Sumw2();521 gPad->SetTicks(); 522 TProfile *obj2 = obj1->RadialProfile(Form("%s%s",obj1->GetName(),"_rad")); 523 obj2->SetDirectory(NULL); 489 524 obj2->Draw(); 490 525 obj2->SetBit(kCanDelete); 491 492 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 493 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 494 const Double_t integ = obj2->Integral("width")/2.5066283; 495 const Double_t mean = obj2->GetMean(); 496 const Double_t rms = obj2->GetRMS(); 526 527 TProfile *hprof[2]; 528 hprof[0] = obj1->RadialProfileS(s0, inner,Form("%s%s",obj1->GetName(), "Inner")); 529 hprof[1] = obj1->RadialProfileS(s0, outer,Form("%s%s",obj1->GetName(), "Outer")); 530 531 532 for (Int_t k=0; k<2; k++) 533 { 534 Double_t min = cam.GetGeomCam().GetMinRadius(k); 535 Double_t max = cam.GetGeomCam().GetMaxRadius(k); 536 537 hprof[k]->SetLineColor(kRed+k); 538 hprof[k]->SetDirectory(0); 539 hprof[k]->SetBit(kCanDelete); 540 hprof[k]->Draw("same"); 541 hprof[k]->Fit("pol1","Q","",min,max); 542 hprof[k]->GetFunction("pol1")->SetLineColor(kRed+k); 543 } 544 545 gPad->Modified(); 546 gPad->Update(); 547 548 c.cd(i+3*j); 549 gPad->SetBorderMode(0); 550 gPad->SetTicks(); 551 TH1D *obj3 = (TH1D*)obj1->Projection(Form("%s%s",obj1->GetName(),"_py")); 552 obj3->SetDirectory(NULL); 553 // obj3->Sumw2(); 554 obj3->Draw(); 555 obj3->SetBit(kCanDelete); 556 557 gPad->Modified(); 558 gPad->Update(); 559 560 const Double_t min = obj3->GetBinCenter(obj3->GetXaxis()->GetFirst()); 561 const Double_t max = obj3->GetBinCenter(obj3->GetXaxis()->GetLast()); 562 const Double_t integ = obj3->Integral("width")/2.5066283; 563 const Double_t mean = obj3->GetMean(); 564 const Double_t rms = obj3->GetRMS(); 497 565 const Double_t width = max-min; 498 566 … … 510 578 sgaus->SetParLimits(1,min,max); 511 579 sgaus->SetParLimits(2,0,width/1.5); 512 obj 2->Fit("sgaus","QLR");513 obj 2->GetFunction("sgaus")->SetLineColor(kYellow);580 obj3->Fit("sgaus","QLR"); 581 obj3->GetFunction("sgaus")->SetLineColor(kYellow); 514 582 break; 515 583 … … 530 598 dgaus->SetParLimits(4,mean,max-(width/10.)); 531 599 dgaus->SetParLimits(5,0,width/2.); 532 obj 2->Fit("dgaus","QLRM");533 obj 2->GetFunction("dgaus")->SetLineColor(kYellow);600 obj3->Fit("dgaus","QLRM"); 601 obj3->GetFunction("dgaus")->SetLineColor(kYellow); 534 602 break; 535 603 … … 558 626 tgaus->SetParLimits(7,min,max); 559 627 tgaus->SetParLimits(8,width/4.,width/1.5); 560 obj 2->Fit("tgaus","QLRM");561 obj 2->GetFunction("tgaus")->SetLineColor(kYellow);628 obj3->Fit("tgaus","QLRM"); 629 obj3->GetFunction("tgaus")->SetLineColor(kYellow); 562 630 break; 563 631 case 4: 564 obj 2->Fit("pol0","Q");565 obj 2->GetFunction("pol0")->SetLineColor(kYellow);632 obj3->Fit("pol0","Q"); 633 obj3->GetFunction("pol0")->SetLineColor(kYellow); 566 634 break; 567 635 case 9: 568 636 break; 569 637 default: 570 obj 2->Fit("gaus","Q");571 obj 2->GetFunction("gaus")->SetLineColor(kYellow);638 obj3->Fit("gaus","Q"); 639 obj3->GetFunction("gaus")->SetLineColor(kYellow); 572 640 break; 573 641 } 574 642 575 TArrayI s0(3); 576 s0[0] = 6; 577 s0[1] = 1; 578 s0[2] = 2; 579 580 TArrayI s1(3); 581 s1[0] = 3; 582 s1[1] = 4; 583 s1[2] = 5; 584 585 TArrayI inner(1); 586 inner[0] = 0; 587 588 TArrayI outer(1); 589 outer[0] = 1; 643 590 644 591 645 // Just to get the right (maximum) binning 592 646 TH1D *half[4]; 593 half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner");594 half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner");595 half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");596 half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");597 598 for ( int i=0; i<4; i++)647 half[0] = (TH1D*)obj1->ProjectionS(s1, inner, "Sector 6-1-2 Inner"); 648 half[1] = (TH1D*)obj1->ProjectionS(s2, inner, "Sector 3-4-5 Inner"); 649 half[2] = (TH1D*)obj1->ProjectionS(s1, outer, "Sector 6-1-2 Outer"); 650 half[3] = (TH1D*)obj1->ProjectionS(s2, outer, "Sector 3-4-5 Outer"); 651 652 for (Int_t k=0; k<4; k++) 599 653 { 600 half[ i]->SetLineColor(kRed+i);601 half[ i]->SetDirectory(0);602 half[ i]->SetBit(kCanDelete);603 half[ i]->Draw("same");654 half[k]->SetLineColor(kRed+k); 655 half[k]->SetDirectory(0); 656 half[k]->SetBit(kCanDelete); 657 half[k]->Draw("same"); 604 658 } 605 659 … … 610 664 } 611 665 612
Note:
See TracChangeset
for help on using the changeset viewer.