Changeset 3737 for trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
- Timestamp:
- 04/14/04 17:23:58 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r3730 r3737 38 38 //End_Html 39 39 // 40 // Different signal extractors can be chosen via the command SetExtractorLevel(UInt_t i) 41 // Up to now, the following extractors are available: 42 // i=1: Use MExtractSignal (fixed window) 43 // i=2: Use MExtractSignal2 (sliding window: default) 44 // i=3: Use MExtractSignal3 (coherent sliding window for all pixels) 45 // 40 46 // At the end of the eventloop, plots and results are displayed, depending on 41 47 // the flags set (see DisplayResult()) … … 62 68 */ 63 69 //End_Html 70 // 71 // Different arrival time extractors can be chosen via the command SetArrivalTimeLevel(UInt_t i) 72 // Up to now, the following extractors are available: 73 // i=1: Use MArrivalTimeCalc (using MCubicSpline, arrival time == position at half maximum) 74 // i=2: Use MArrivalTimeCalc2 (mean time of fWindowSize time slices with the highest integral content: default) 64 75 // 65 76 ///////////////////////////////////////////////////////////////////////////// … … 91 102 #include "MCalibrationChargeBlindPix.h" 92 103 #include "MCalibrationChargeCalc.h" 104 105 #include "MHGausEvents.h" 106 #include "MHCalibrationCam.h" 107 #include "MHCalibrationChargeCam.h" 108 #include "MHCalibrationRelTimeCam.h" 109 #include "MCalibrationRelTimeCam.h" 93 110 94 111 #include "MReadMarsFile.h" … … 100 117 #include "MExtractBlindPixel.h" 101 118 #include "MExtractSignal2.h" 119 #include "MExtractSignal3.h" 102 120 #include "MFCosmics.h" 103 121 #include "MContinue.h" 104 122 #include "MFillH.h" 105 123 124 #include "MArrivalTimeCam.h" 125 #include "MArrivalTimeCalc.h" 126 #include "MArrivalTimeCalc2.h" 127 106 128 #include "MJCalibration.h" 107 129 #include "MStatusDisplay.h" … … 115 137 // Default constructor. 116 138 // 117 // Sets fRuns to 0, fColor to kNONE, fDisplay to kNormalDisplay 139 // Sets fRuns to 0, fColor to kNONE, fDisplay to kNormalDisplay, 140 // fRelTime to kFALSE, fExtractorLevel to 2, fArrivalTimeLevel to 2 118 141 // 119 142 MJCalibration::MJCalibration(const char *name, const char *title) 120 : fRuns(0), fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay) 143 : fRuns(0), fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay), 144 fRelTimes(kFALSE), fExtractorLevel(2), fArrivalTimeLevel(2) 121 145 { 122 146 fName = name ? name : "MJCalibration"; … … 265 289 MHCamera disp28(geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times"); 266 290 MHCamera disp29(geomcam, "Cal;AbsTimeRms", "RMS of Arrival Times"); 267 291 MHCamera disp30(geomcam, "time;MeanTime", "Mean Rel. Arrival Times"); 292 MHCamera disp31(geomcam, "time;SigmaTime", "Sigma Rel. Arrival Times"); 293 MHCamera disp32(geomcam, "time;TimeProb", "Probability of Time Fit"); 294 MHCamera disp33(geomcam, "time;NotFitValid", "Pixels with not valid fit results"); 295 MHCamera disp34(geomcam, "time;Oscillating", "Oscillating Pixels"); 296 297 298 268 299 // Fitted charge means and sigmas 269 300 disp1.SetCamContent(fCalibrationCam, 0); … … 366 397 disp29.SetYTitle("RMS Abs. Time [FADC slices]"); 367 398 399 if (fRelTimes) 400 { 401 402 disp30.SetCamContent(fRelTimeCam,0); 403 disp30.SetCamError( fRelTimeCam,1); 404 disp31.SetCamContent(fRelTimeCam,2); 405 disp31.SetCamError( fRelTimeCam,3); 406 disp32.SetCamContent(fRelTimeCam,4); 407 disp33.SetCamContent(fBadPixels,20); 408 disp34.SetCamContent(fBadPixels,21); 409 410 disp30.SetYTitle("Time Offset [ns]"); 411 disp31.SetYTitle("Timing resolution [ns]"); 412 disp32.SetYTitle("P_{Time} [1]"); 413 disp33.SetYTitle("[1]"); 414 disp34.SetYTitle("[1]"); 415 } 416 368 417 gStyle->SetOptStat(1111); 369 418 gStyle->SetOptFit(); … … 401 450 CamDraw(c4, 2, 3, disp24, 0); 402 451 CamDraw(c4, 3, 3, disp25, 0); 452 453 if (fRelTimes) 454 { 455 // Rel. Times 456 TCanvas &c5 = fDisplay->AddTab("Rel. Times"); 457 c5.Divide(2,4); 458 459 CamDraw(c5, 1, 2, disp30, 2); 460 CamDraw(c5, 2, 2, disp31, 2); 461 } 462 403 463 404 464 return; … … 456 516 CamDraw(c16, 2, 2, disp29, 1); 457 517 518 if (fRelTimes) 519 { 520 // Rel. Times 521 TCanvas &c17 = fDisplay->AddTab("Rel. Times"); 522 c17.Divide(2,4); 523 524 CamDraw(c17, 1, 2, disp30, 2, 1); 525 CamDraw(c17, 2, 2, disp31, 2, 1); 526 } 527 458 528 return; 459 529 } … … 462 532 { 463 533 534 MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam"); 535 536 for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++) 537 { 538 cam->GetAverageHiGainArea(aidx).DrawClone("all"); 539 cam->GetAverageLoGainArea(aidx).DrawClone("all"); 540 } 541 542 for (Int_t sector=1;sector<cam->GetAverageSectors();sector++) 543 { 544 cam->GetAverageHiGainSector(sector).DrawClone("all"); 545 cam->GetAverageLoGainSector(sector).DrawClone("all"); 546 } 547 464 548 // Charges 465 549 TCanvas &c21 = fDisplay->AddTab("Fit.Charge"); … … 535 619 CamDraw(c30, 1, 2, disp28, 2); 536 620 CamDraw(c30, 2, 2, disp29, 1); 621 622 if (fRelTimes) 623 { 624 // Rel. Times 625 TCanvas &c31 = fDisplay->AddTab("Rel. Times"); 626 c31.Divide(3,4); 627 628 CamDraw(c31, 1, 3, disp30, 2, 1); 629 CamDraw(c31, 2, 3, disp31, 2, 1); 630 CamDraw(c31, 3, 3, disp32, 4, 1); 631 632 // Time Defects 633 TCanvas &c32 = fDisplay->AddTab("Time Def."); 634 c32.Divide(2,2); 635 636 CamDraw(c32, 1, 2, disp33,0); 637 CamDraw(c32, 2, 2, disp34,0); 638 639 MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam"); 640 641 for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++) 642 { 643 cam->GetAverageHiGainArea(aidx).DrawClone("all"); 644 cam->GetAverageLoGainArea(aidx).DrawClone("all"); 645 } 646 647 for (Int_t sector=1;sector<cam->GetAverageSectors();sector++) 648 { 649 cam->GetAverageHiGainSector(sector).DrawClone("all"); 650 cam->GetAverageLoGainSector(sector).DrawClone("all"); 651 } 652 653 } 537 654 538 655 return; … … 772 889 // 2) MCalibrationQECam (fQECam) 773 890 // 3) MCalibrationChargeCam (fCalibrationCam) 774 // 4) MBadPixelsCam (fBadPixels) 775 // 5) MCalibrationChargePINDiode 776 // 6) MCalibrationChargeBlindPix 891 // 4) MCalibrationRelTimeCam (fRelTimeCam) (only if flag fRelTimes is chosen) 892 // 5) MBadPixelsCam (fBadPixels) 893 // 6) MCalibrationChargePINDiode 894 // 7) MCalibrationChargeBlindPix 777 895 // - Put into the MTaskList: 778 896 // 1) MReadMarsFile 779 897 // 2) MBadPixelsMerge 780 898 // 3) MGeomApply 781 // 4) MExtractSignal 2899 // 4) MExtractSignal, MExtractSignal2 or MExtractSignal3, depending on fExtractorLevel 782 900 // 5) MExtractPINDiode 783 901 // 6) MExtractBlindPixel 784 // 7) MContinue(MFCosmics) 785 // 8) MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode") 786 // 9) MFillH("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel") 787 // 10) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam") 788 // 11) MCalibrationChargeCalc 902 // 7) MArrivalTimeCalc, MArrivalTimeCalc2, depending on fArrivalTimeLevel (only if flag fRelTimes is chosen) 903 // 8) MContinue(MFCosmics) 904 // 9) MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode") 905 // 10) MFillH("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel") 906 // 11) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam") 907 // 12) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam") 908 // 13) MCalibrationChargeCalc 909 // 14) MFillH("MHCalibrationRelTimeCam", "MArrivalTimeCam") (only if flag fRelTimes is chosen) 789 910 // - Execute MEvtLoop 790 911 // - DisplayResult() … … 793 914 Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam) 794 915 { 795 if (!fRuns) 796 { 797 *fLog << err << "No Runs choosen... abort." << endl; 798 return kFALSE; 799 } 800 801 if (fRuns->GetNumRuns() != fRuns->GetNumEntries()) 802 { 803 *fLog << err << "Number of files found doesn't match number of runs... abort." << endl; 804 return kFALSE; 805 } 806 807 *fLog << inf; 808 fLog->Separator(GetDescriptor()); 809 *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl; 810 *fLog << endl; 811 812 MReadMarsFile read("Events"); 813 read.DisableAutoScheme(); 814 static_cast<MRead&>(read).AddFiles(*fRuns); 815 816 // 817 // As long, as we don't have digital modules, 818 // we have to set the color of the pulser LED by hand 819 // 820 MCalibrationChargePINDiode pindiode; 821 MCalibrationChargeBlindPix blindpix; 822 823 // Setup Tasklist 824 MParList plist; 825 plist.AddToList(&pedcam); 826 plist.AddToList(&fBadPixels); 827 plist.AddToList(&fQECam); 828 plist.AddToList(&fCalibrationCam); 829 plist.AddToList(&pindiode); 830 plist.AddToList(&blindpix); 831 832 MTaskList tlist; 833 plist.AddToList(&tlist); 834 835 MGeomApply apply; 836 // MBadPixelsMerge merge(&fBadPixels); 837 MExtractPINDiode pinext; 838 MExtractBlindPixel blindext; 839 // MExtractSignal extract; // Do not use this at the moment... 840 MExtractSignal2 extract; 841 MCalibrationChargeCalc calcalc; 842 843 // 844 // As long as there are no DM's, have to colour by hand 845 // 846 calcalc.SetPulserColor(fColor); 847 848 MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode"); 849 MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel"); 850 MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam"); 851 fillpin.SetNameTab("PINDiode"); 852 fillbnd.SetNameTab("BlindPix"); 853 fillcam.SetNameTab("Charge"); 854 855 // 856 // Apply a filter against cosmics 857 // (will have to be needed in the future 858 // when the calibration hardware-trigger is working) 859 // 860 MFCosmics cosmics; 861 MContinue cont(&cosmics); 862 863 tlist.AddToList(&read); 864 // tlist.AddToList(&merge); 865 tlist.AddToList(&apply); 866 tlist.AddToList(&extract); 867 tlist.AddToList(&pinext); 868 tlist.AddToList(&blindext); 869 tlist.AddToList(&cont); 870 tlist.AddToList(&fillcam); 871 tlist.AddToList(&fillpin); 872 tlist.AddToList(&fillbnd); 873 tlist.AddToList(&calcalc); 874 875 // Create and setup the eventloop 876 MEvtLoop evtloop(fName); 877 evtloop.SetParList(&plist); 878 evtloop.SetDisplay(fDisplay); 879 evtloop.SetLogStream(fLog); 880 881 // Execute first analysis 882 if (!evtloop.Eventloop()) 883 { 884 *fLog << err << GetDescriptor() << ": Failed." << endl; 885 return kFALSE; 886 } 887 888 tlist.PrintStatistics(); 889 890 DisplayResult(plist); 891 892 if (!WriteResult()) 893 return kFALSE; 894 895 *fLog << inf << GetDescriptor() << ": Done." << endl; 896 897 return kTRUE; 916 if (!fRuns) 917 { 918 *fLog << err << "No Runs choosen... abort." << endl; 919 return kFALSE; 920 } 921 922 if (fRuns->GetNumRuns() != fRuns->GetNumEntries()) 923 { 924 *fLog << err << "Number of files found doesn't match number of runs... abort." << endl; 925 return kFALSE; 926 } 927 928 *fLog << inf; 929 fLog->Separator(GetDescriptor()); 930 *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl; 931 *fLog << endl; 932 933 MReadMarsFile read("Events"); 934 read.DisableAutoScheme(); 935 static_cast<MRead&>(read).AddFiles(*fRuns); 936 937 MCalibrationChargePINDiode pindiode; 938 MCalibrationChargeBlindPix blindpix; 939 940 // Setup Tasklist 941 MParList plist; 942 plist.AddToList(&pedcam); 943 plist.AddToList(&fBadPixels); 944 plist.AddToList(&fQECam); 945 plist.AddToList(&fCalibrationCam); 946 plist.AddToList(&pindiode); 947 plist.AddToList(&blindpix); 948 949 MTaskList tlist; 950 plist.AddToList(&tlist); 951 952 MGeomApply apply; 953 // MBadPixelsMerge merge(&fBadPixels); 954 MExtractPINDiode pinext; 955 MExtractBlindPixel blindext; 956 MExtractSignal extract1; 957 MExtractSignal2 extract2; 958 MExtractSignal3 extract3; 959 MArrivalTimeCalc tmecalc1; 960 MArrivalTimeCalc2 tmecalc2; 961 MCalibrationChargeCalc calcalc; 962 963 // 964 // As long as there are no DM's, have to colour by hand 965 // 966 calcalc.SetPulserColor(fColor); 967 968 MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode"); 969 MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel"); 970 MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam"); 971 MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam"); 972 fillpin.SetNameTab("PINDiode"); 973 fillbnd.SetNameTab("BlindPix"); 974 fillcam.SetNameTab("Charge"); 975 filltme.SetNameTab("RelTimes"); 976 977 978 // 979 // Apply a filter against cosmics 980 // (will have to be needed in the future 981 // when the calibration hardware-trigger is working) 982 // 983 MFCosmics cosmics; 984 MContinue cont(&cosmics); 985 986 tlist.AddToList(&read); 987 // tlist.AddToList(&merge); 988 tlist.AddToList(&apply); 989 990 if (fExtractorLevel <= 1) 991 tlist.AddToList(&extract1); 992 else if (fExtractorLevel == 2) 993 tlist.AddToList(&extract2); 994 else if (fExtractorLevel == 3) 995 tlist.AddToList(&extract3); 996 else 997 { 998 *fLog << err << GetDescriptor() 999 << ": No valid Signal extractor has been chosen, have only: " << fExtractorLevel 1000 << " aborting..." << endl; 1001 return kFALSE; 1002 } 1003 1004 1005 tlist.AddToList(&pinext); 1006 tlist.AddToList(&blindext); 1007 1008 if (fRelTimes) 1009 { 1010 plist.AddToList(&fRelTimeCam); 1011 if (fArrivalTimeLevel <= 1) 1012 tlist.AddToList(&tmecalc1); 1013 else if (fArrivalTimeLevel == 2) 1014 tlist.AddToList(&tmecalc2); 1015 else 1016 { 1017 *fLog << err << GetDescriptor() 1018 << ": No valid Signal ArrivalTime Level has been chosen, have only: " << fArrivalTimeLevel 1019 << " aborting..." << endl; 1020 return kFALSE; 1021 } 1022 } 1023 1024 tlist.AddToList(&cont); 1025 tlist.AddToList(&fillcam); 1026 tlist.AddToList(&fillpin); 1027 tlist.AddToList(&fillbnd); 1028 tlist.AddToList(&calcalc); 1029 1030 if (fRelTimes) 1031 tlist.AddToList(&filltme); 1032 1033 // Create and setup the eventloop 1034 MEvtLoop evtloop(fName); 1035 evtloop.SetParList(&plist); 1036 evtloop.SetDisplay(fDisplay); 1037 evtloop.SetLogStream(fLog); 1038 1039 // Execute first analysis 1040 if (!evtloop.Eventloop()) 1041 { 1042 *fLog << err << GetDescriptor() << ": Failed." << endl; 1043 return kFALSE; 1044 } 1045 1046 tlist.PrintStatistics(); 1047 1048 DisplayResult(plist); 1049 1050 if (!WriteResult()) 1051 return kFALSE; 1052 1053 *fLog << inf << GetDescriptor() << ": Done." << endl; 1054 1055 return kTRUE; 898 1056 } 899 1057
Note:
See TracChangeset
for help on using the changeset viewer.