Changeset 6035 for trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
- Timestamp:
- 01/27/05 10:14:55 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r6031 r6035 34 34 // but this is NOT recommended! 35 35 // 36 // Resource file entries are case sensitive!37 //38 36 ///////////////////////////////////////////////////////////////////////////// 39 37 #include "MJCalibrateSignal.h" … … 62 60 #include "MCalibrationRelTimeCam.h" 63 61 #include "MCalibrationChargePINDiode.h" 62 #include "MCalibrationHiLoCam.h" 63 64 #include "MCalibrationChargeCalc.h" 65 #include "MCalibrationRelTimeCalc.h" 66 67 #include "MCalibrationIntensityChargeCam.h" 68 #include "MCalibrationIntensityBlindCam.h" 69 #include "MCalibrationIntensityRelTimeCam.h" 70 #include "MCalibrationIntensityQECam.h" 71 #include "MBadPixelsIntensityCam.h" 72 73 #include "MHCalibrationChargeCam.h" 74 #include "MHCalibrationChargeBlindCam.h" 75 #include "MHCalibrationChargePINDiode.h" 76 #include "MHCalibrationRelTimeCam.h" 77 #include "MHCamera.h" 78 79 #include "MCalibCalcFromPast.h" 64 80 65 81 #include "MReadReports.h" … … 72 88 #include "MMcPedestalCopy.h" 73 89 #include "MPointingPosCalc.h" 90 #include "MInterpolatePointingPos.h" 74 91 #include "MPedCalcFromLoGain.h" 75 92 #include "MExtractor.h" 76 93 #include "MExtractTimeAndCharge.h" 94 #include "MExtractPINDiode.h" 95 #include "MExtractBlindPixel.h" 77 96 #include "MFCosmics.h" 78 97 #include "MTaskEnv.h" … … 96 115 // 97 116 MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title) 98 : fIsDataCheck(kFALSE) 117 : fIsDataCheck(kFALSE), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kFALSE), 118 fIsHiLoCalibration(kTRUE) 99 119 { 100 120 fName = name ? name : "MJCalibrateSignal"; … … 102 122 } 103 123 104 Bool_t MJCalibrateSignal::WriteResult( )124 Bool_t MJCalibrateSignal::WriteResult(TObjArray &cont) 105 125 { 106 126 if (fPathOut.IsNull()) … … 115 135 116 136 TFile file(oname, "RECREATE"); 117 if (!file.IsOpen())118 {119 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;120 return kFALSE;121 }122 137 123 138 *fLog << inf << " - MStatusDisplay..." << flush; … … 129 144 *fLog << inf << "ok." << endl; 130 145 131 return kTRUE;146 return fIsInterlaced ? WriteContainer(cont) : kTRUE; 132 147 } 133 148 … … 188 203 Bool_t MJCalibrateSignal::CheckEnvLocal() 189 204 { 205 190 206 SetDataCheck(GetEnv("DataCheck", IsDataCheck())); 207 SetInterlaced(GetEnv("Interlaced", fIsInterlaced)); 208 SetRelTimesUpdate(GetEnv("RelTimesUpdate", fIsRelTimesUpdate)); 209 SetHiLoCalibration(GetEnv("HiLoCalibration", fIsHiLoCalibration)); 210 191 211 return kTRUE; 192 212 } 193 213 194 Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcamab, MPedestalCam &pedcam2, MPedestalCam &pedcam) 214 Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcamab, MPedestalCam &pedcambias, 215 MPedestalCam &pedcamextr) 195 216 { 196 217 if (!fSequence.IsValid()) … … 230 251 231 252 // Read File 232 /* 233 MCalibrationIntensityChargeCam calcam; 234 MCalibrationIntensityQECam qecam; 235 MCalibrationIntensityBlindCam bndcam; 236 MCalibrationIntensityRelTimeCam tmcam; 237 */ 253 MCalibrationIntensityChargeCam ichcam; 254 MCalibrationIntensityQECam iqecam; 255 MCalibrationIntensityBlindCam iblcam; 256 MCalibrationIntensityRelTimeCam itmcam; 257 MBadPixelsIntensityCam ibdcam; 258 259 TObjArray interlacedcont; 260 interlacedcont.Add(&ichcam); 261 interlacedcont.Add(&iqecam); 262 interlacedcont.Add(&iblcam); 263 interlacedcont.Add(&itmcam); 264 interlacedcont.Add(&ibdcam); 265 266 MHCalibrationChargeCam hchacam; 267 MHCalibrationChargeBlindCam hbndcam; 268 MHCalibrationChargePINDiode hpndiod; 269 MHCalibrationRelTimeCam hrelcam; 270 271 hchacam.SetLoGain(kTRUE); 272 hchacam.SetOscillations(kFALSE); 273 hrelcam.SetOscillations(kFALSE); 274 275 interlacedcont.Add(&hchacam); 276 interlacedcont.Add(&hbndcam); 277 interlacedcont.Add(&hpndiod); 278 if (fIsRelTimesUpdate) 279 interlacedcont.Add(&hrelcam); 280 238 281 MCalibrationChargeCam calcam; 239 282 MCalibrationQECam qecam; … … 241 284 MCalibrationChargePINDiode pind; 242 285 MCalibrationRelTimeCam tmcam; 286 MCalibrationHiLoCam hilcam; 287 288 if (fIsHiLoCalibration) 289 interlacedcont.Add(&hilcam); 290 243 291 MBadPixelsCam badpix; 244 292 245 293 MExtractor *extractor1=0; 246 294 MExtractor *extractor2=0; 295 MExtractor *extractor3=0; 247 296 TString geom; 248 297 … … 257 306 return kFALSE; 258 307 308 badpix.Print(); 309 259 310 *fLog << all; 260 311 if (extractor1) … … 263 314 extractor1->Print(); 264 315 *fLog << endl; 316 extractor3 = (MExtractor*)extractor1->Clone(); 265 317 } 266 318 else … … 289 341 plist.AddToList(&badcam); 290 342 plist.AddToList(&calibcont); 343 plist.AddToList(&hilcam); 344 345 if (fIsInterlaced) 346 plist.AddToList(&interlacedcont); 291 347 292 348 // Setup Tasklist … … 326 382 readreal.AddFiles(iter); 327 383 384 MInterpolatePointingPos pextr; 385 // pextr.SetDebug(); // take it out 386 pextr.AddFiles(&iter); 387 328 388 MGeomApply apply; // Only necessary to create geometry 329 389 if (!geom.IsNull()) … … 333 393 // Make sure that pedcamab has the correct name 334 394 pedcamab.SetName("MPedestalFundamental"); 335 pedcam .SetName("MPedestalFromExtractorRndm");336 pedcam 2.SetName("MPedestalFromExtractor");337 plist.AddToList(&pedcam );338 plist.AddToList(&pedcam 2);395 pedcamextr.SetName("MPedestalFromExtractorRndm"); 396 pedcambias.SetName("MPedestalFromExtractor"); 397 plist.AddToList(&pedcamextr); 398 plist.AddToList(&pedcambias); 339 399 plist.AddToList(&pedcamab); 340 400 … … 344 404 MFTriggerPattern ftp; 345 405 ftp.RequireCalibration(); 346 406 // ftp.RequireCalibration(kTRUE); 407 // ftp.DenyCalibration(); 408 // ftp.DenyPedestal(); 409 // ftp.DenyPinDiode(); 410 // ftp.SetInverted(); 347 411 MContinue conttp(&ftp, "ContTrigPattern"); 348 412 // --> tlist2 … … 389 453 } 390 454 if (extractor2) 391 extractor2->SetPedestals(&pedcamab); 455 extractor2->SetPedestals(&pedcamab); 456 457 if (extractor3) 458 extractor3->SetPedestals(&pedcamab); 392 459 393 460 MFCosmics fcosmics; … … 399 466 MTaskEnv taskenv1("ExtractSignal"); 400 467 MTaskEnv taskenv2("ExtractTime"); 468 MTaskEnv taskenv3("ExtractInterlaced"); 401 469 taskenv1.SetDefault(extractor1); 402 470 taskenv2.SetDefault(extractor2); 471 taskenv3.SetDefault(extractor3); 472 403 473 MCalibrateData calib; 404 474 if (filetype==3) // MC file … … 419 489 } 420 490 491 MExtractPINDiode pinext; 492 MExtractBlindPixel bldext; 493 494 MFTriggerPattern fcalib("CalibFilter"); 495 MCalibrationChargeCalc chcalc; 496 MCalibrationRelTimeCalc recalc; 497 MCalibCalcFromPast pacalc; 498 499 fcalib.DenyCalibration(); 500 fcalib.SetInverted(); 501 502 pinext.SetPedestals(&pedcamab); 503 bldext.SetPedestals(&pedcamab); 504 chcalc.SetPedestals(&pedcamextr); 505 506 pacalc.SetChargeCalc(&chcalc); 507 if (fIsRelTimesUpdate) 508 pacalc.SetRelTimeCalc(&recalc); 509 pacalc.SetCalibrate(&calib); 510 511 // 512 // Intensity Calibration histogramming 513 // 514 MFillH filpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode", "FillPINDiode"); 515 MFillH filbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel", "FillBlindCam"); 516 MFillH filcam("MHCalibrationChargeCam", "MExtractedSignalCam", "FillChargeCam"); 517 MFillH filtme("MHCalibrationRelTimeCam", "MArrivalTimeCam", "FillRelTime"); 518 MFillH filhil("MHCalibrationHiLoCam", "MExtractedSignalCam", "FillHiLoRatio"); 519 520 filpin.SetBit(MFillH::kDoNotDisplay); 521 filbnd.SetBit(MFillH::kDoNotDisplay); 522 filcam.SetBit(MFillH::kDoNotDisplay); 523 filtme.SetBit(MFillH::kDoNotDisplay); 524 filhil.SetBit(MFillH::kDoNotDisplay); 525 421 526 MCalibrateRelTimes caltm; 422 527 MBadPixelsCalc bpcal; … … 434 539 MHCamEvent evt1(2, "PedRmsFLG", "Pedestal RMS from Lo Gain;;\\sigma_{p} [fadc/sl]"); 435 540 MHCamEvent evt2(0, "Extra'd", "Extracted Signal;;S [fadc/sl]"); 436 //MHCamEvent evt3(4, "PedPhot", "Calibrated Pedestal;;P [\\gamma]");541 MHCamEvent evt3(4, "PedPhot", "Calibrated Pedestal;;P [\\gamma]"); 437 542 MHCamEvent evt4(5, "PedRMS", "Calibrated Pedestal RMS;;\\sigma_{p} [\\gamma]"); 438 543 MHCamEvent evt5(0, "Interp'd", "Interpolated Signal;;S [\\gamma]"); 439 MHCamEvent evt6(2, "Unsuitable", " Fraction of unsuitable events per Pixel;;[1]");544 MHCamEvent evt6(2, "Unsuitable", "Unsuitable event ratio;;%"); 440 545 MHCamEvent evt7(0, "Times", "Arrival Time;;T [slice]"); 546 // MHCamEvent evt8(0, "HiLoConv", "Ratio Hi-Lo Gain Signal;;Ratio [1]"); 547 // MHCamEvent evt9(5, "HiLoDiff", "Time Diff. Hi-Lo Gain Signal;;\\Delta T [3.33ns]"); 548 441 549 evt0.EnableVariance(); 442 550 evt1.EnableVariance(); 443 551 evt2.EnableVariance(); 444 //evt3.EnableVariance();552 evt3.EnableVariance(); 445 553 evt4.EnableVariance(); 446 554 evt5.EnableVariance(); 447 555 evt7.EnableVariance(); 556 // evt8.EnableVariance(); 557 // evt9.EnableVariance(); 448 558 449 559 MFillH fill0(&evt0, "MPedestalFundamental", "FillPedFLG"); 450 560 MFillH fill1(&evt1, "MPedestalFromExtractor", "FillPedRmsFLG"); 451 561 MFillH fill2(&evt2, "MExtractedSignalCam", "FillExtracted"); 452 //MFillH fill3(&evt3, "MPedPhotFundamental", "FillPedPhot");562 MFillH fill3(&evt3, "MPedPhotFundamental", "FillPedPhot"); 453 563 MFillH fill4(&evt4, "MPedPhotFromExtractor", "FillPedRMS"); 454 564 MFillH fill5(&evt5, "MCerPhotEvt", "FillInterpolated"); 455 565 MFillH fill6(&evt6, "MBadPixelsCam", "FillUnsuitable"); 456 566 MFillH fill7(&evt7, "MArrivalTime", "FillTimes"); 567 // MFillH fill8(&evt8, "MCalibrationHiLoCam", "FillRatio"); 568 // MFillH fill9(&evt9, "MCalibrationHiLoCam", "FillDiff"); 457 569 458 570 // The second rule is for the case reading raw-files! … … 494 606 write.AddContainer("MTimeTrigger", "Trigger", kFALSE); 495 607 // Slow-Control: Drive 496 write.AddContainer("MPointingPos", " Drive",kFALSE);608 write.AddContainer("MPointingPos", "Events", kFALSE); 497 609 write.AddContainer("MReportDrive", "Drive", kFALSE); 498 610 write.AddContainer("MTimeDrive", "Drive", kFALSE); … … 503 615 // Now setup tasklist for events 504 616 MTaskList tlist2; 617 505 618 tlist2.AddToList(&decode); 506 tlist2.AddToList(&conttp);507 619 tlist2.AddToList(&apply); 508 620 tlist2.AddToList(&merge); … … 515 627 tlist2.AddToList(&pedlo3); 516 628 } 629 if (fIsInterlaced) 630 { 631 pinext.SetFilter(&fcalib); 632 bldext.SetFilter(&fcalib); 633 taskenv3.SetFilter(&fcalib); 634 pacalc.SetFilter(&fcalib); 635 filcam.SetFilter(&fcalib); 636 filtme.SetFilter(&fcalib); 637 filbnd.SetFilter(&fcalib); 638 filpin.SetFilter(&fcalib); 639 chcalc.SetFilter(&fcalib); 640 recalc.SetFilter(&fcalib); 641 642 tlist2.AddToList(&fcalib); 643 tlist2.AddToList(&pinext); 644 tlist2.AddToList(&bldext); 645 tlist2.AddToList(&taskenv3); 646 tlist2.AddToList(&pacalc); 647 tlist2.AddToList(&filcam); 648 if (fIsRelTimesUpdate) 649 tlist2.AddToList(&filtme); 650 tlist2.AddToList(&filbnd); 651 tlist2.AddToList(&filpin); 652 tlist2.AddToList(&chcalc); 653 if (fIsRelTimesUpdate) 654 tlist2.AddToList(&recalc); 655 } 656 657 tlist2.AddToList(&conttp); 658 if (extractor1) 659 tlist2.AddToList(&taskenv1); 660 if (extractor2) 661 tlist2.AddToList(&taskenv2); 517 662 tlist2.AddToList(&fill0); 518 663 tlist2.AddToList(&fill1); 519 if (extractor1)520 tlist2.AddToList(&taskenv1);521 if (extractor2)522 tlist2.AddToList(&taskenv2);523 664 tlist2.AddToList(&contcos); 665 if (fIsHiLoCalibration) 666 tlist2.AddToList(&filhil); 524 667 tlist2.AddToList(&fill2); 525 668 tlist2.AddToList(&calib); 526 669 if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge")) 527 670 tlist2.AddToList(&caltm); 671 528 672 tlist2.AddToList(&bpcal); 529 673 tlist2.AddToList(&treat); 530 674 tlist2.AddToList(&fill6); 531 //tlist2.AddToList(&fill3);675 tlist2.AddToList(&fill3); 532 676 tlist2.AddToList(&fill4); 533 677 tlist2.AddToList(&fill5); … … 535 679 tlist2.AddToList(&fill7); 536 680 681 if (fIsHiLoCalibration) 682 { 683 // tlist2.AddToList(&fill8); 684 // tlist2.AddToList(&fill9); 685 } 537 686 // Setup List for Drive-tree 538 687 MPointingPosCalc pcalc; … … 540 689 // Now setup main tasklist 541 690 tlist.AddToList(IsDataCheck() ? (MTask*)&rawread : (MTask*)&readreal); 691 tlist2.AddToList(&pextr); 542 692 tlist.AddToList(&tlist2, IsDataCheck()?"All":"Events"); 543 if (!IsDataCheck()) 544 tlist.AddToList(&pcalc, "Drive"); 693 694 // 695 // !!! Replaced by MInterpolatePointingPos !!! 696 // 697 // if (!IsDataCheck()) 698 // tlist.AddToList(&pcalc, "Drive"); 699 700 545 701 tlist.AddToList(&write); 546 702 … … 562 718 tlist.PrintStatistics(); 563 719 564 if (!WriteResult()) 720 DisplayResult(plist); 721 722 if (!WriteResult(interlacedcont)) 565 723 return kFALSE; 566 724 … … 570 728 return kTRUE; 571 729 } 730 731 732 void MJCalibrateSignal::DisplayResult(MParList &plist) 733 { 734 735 if (!fDisplay) 736 return; 737 738 if (!fIsHiLoCalibration) 739 return; 740 741 // 742 // Get container from list 743 // 744 MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam"); 745 MCalibrationHiLoCam *cam = (MCalibrationHiLoCam*)plist.FindObject("MCalibrationHiLoCam"); 746 747 // Create histograms to display 748 MHCamera disp1 (geomcam, "HiLoConv", "Ratio Amplification HiGain vs. LoGain (Charges)"); 749 MHCamera disp2 (geomcam, "HiLoDiff", "Arrival Time Diff. HiGain vs. LoGain (Times)"); 750 751 disp1.SetCamContent(*cam, 0); 752 disp1.SetCamError( *cam, 1); 753 disp2.SetCamContent(*cam, 5); 754 disp2.SetCamError( *cam, 6); 755 756 disp1.SetYTitle("R [1]"); 757 disp2.SetYTitle("\\Delta T [FADC sl.]"); 758 759 760 TCanvas &c1 = fDisplay->AddTab("HiLoConv"); 761 c1.Divide(2,3); 762 763 disp1.CamDraw(c1, 1, 2, 1); 764 disp2.CamDraw(c1, 2, 2, 1); 765 } 766
Note:
See TracChangeset
for help on using the changeset viewer.