Changeset 4609 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 08/13/04 14:59:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/MagicSoft/Mars/mjobs/MJCalibration.cc ¶
r4607 r4609 87 87 #include "MJCalibration.h" 88 88 89 #include <TEnv.h> 89 90 #include <TFile.h> 90 91 #include <TStyle.h> … … 96 97 97 98 #include "MRunIter.h" 99 #include "MSequence.h" 98 100 #include "MParList.h" 99 101 #include "MTaskList.h" … … 125 127 #include "MRawFileRead.h" 126 128 #include "MGeomApply.h" 129 #include "MTaskEnv.h" 127 130 #include "MBadPixelsMerge.h" 128 131 #include "MBadPixelsCam.h" … … 158 161 // 159 162 MJCalibration::MJCalibration(const char *name, const char *title) 160 : f Runs(0), fExtractor(NULL), fTimeExtractor(NULL),163 : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fTimeExtractor(NULL), 161 164 fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay), 162 165 fRelTimes(kFALSE), fDataCheck(kFALSE), fDebug(kFALSE) … … 171 174 } 172 175 176 MJCalibration::~MJCalibration() 177 { 178 if (fEnv) 179 delete fEnv; 180 } 173 181 174 182 // -------------------------------------------------------------------------- … … 224 232 TString title = fDisplay->GetTitle(); 225 233 title += "-- Calibration "; 226 title += f Runs->GetRunsAsString();234 title += fSequence ? Form("calib%06d", fSequence->GetSequence()) : fRuns->GetRunsAsString(); 227 235 title += " --"; 228 236 fDisplay->SetTitle(title); … … 234 242 235 243 // Create histograms to display 236 MHCamera disp1 (geomcam, Form("%s%s","Charge",(fRuns->GetRunsAsFileName()).Data()), 237 "Fitted Mean Charges"); 238 MHCamera disp2 (geomcam, Form("%s%s","SigmaCharge",(fRuns->GetRunsAsFileName()).Data()), 239 "Sigma of Fitted Charges"); 240 MHCamera disp3 (geomcam, Form("%s%s","RSigma",(fRuns->GetRunsAsFileName()).Data()), 241 "Reduced Sigmas"); 242 MHCamera disp4 (geomcam, Form("%s%s","RSigmaPerCharge",(fRuns->GetRunsAsFileName()).Data()), 243 "Reduced Sigma per Charge"); 244 MHCamera disp5 (geomcam, Form("%s%s","NumPhes",(fRuns->GetRunsAsFileName()).Data()), 245 "Nr. of Phe's (F-Factor Method)"); 246 MHCamera disp6 (geomcam, Form("%s%s","ConvFADC2Phes",(fRuns->GetRunsAsFileName()).Data()), 247 "Conversion Factor (F-Factor Method)"); 248 MHCamera disp7 (geomcam, Form("%s%s","TotalFFactor",(fRuns->GetRunsAsFileName()).Data()), 249 "Total F-Factor (F-Factor Method)"); 250 MHCamera disp8 (geomcam, Form("%s%s","CascadesQEFFactor",(fRuns->GetRunsAsFileName()).Data()), 251 "Cascades QE (F-Factor Method)"); 252 MHCamera disp9 (geomcam, Form("%s%s","CascadesQEBlindPix",(fRuns->GetRunsAsFileName()).Data()), 253 "Cascades QE (Blind Pixel Method)"); 254 MHCamera disp10(geomcam, Form("%s%s","CascadesQEPINDiode",(fRuns->GetRunsAsFileName()).Data()), 255 "Cascades QE (PIN Diode Method)"); 256 MHCamera disp11(geomcam, Form("%s%s","CascadesQECombined",(fRuns->GetRunsAsFileName()).Data()), 257 "Cascades QE (Combined Method)"); 258 MHCamera disp12(geomcam, Form("%s%s","FFactorValid",(fRuns->GetRunsAsFileName()).Data()), 259 "Pixels with valid F-Factor calibration"); 260 MHCamera disp13(geomcam, Form("%s%s","BlindPixelValid",(fRuns->GetRunsAsFileName()).Data()), 261 "Pixels with valid BlindPixel calibration"); 262 MHCamera disp14(geomcam, Form("%s%s","PINdiodeValid",(fRuns->GetRunsAsFileName()).Data()), 263 "Pixels with valid PINDiode calibration"); 264 MHCamera disp15(geomcam, Form("%s%s","CombinedValid",(fRuns->GetRunsAsFileName()).Data()), 265 "Pixels with valid Combined calibration"); 266 MHCamera disp16(geomcam, Form("%s%s","Saturation",(fRuns->GetRunsAsFileName()).Data()), 267 "Pixels with saturated Hi Gain"); 268 MHCamera disp17(geomcam, Form("%s%s","ConversionMeans",(fRuns->GetRunsAsFileName()).Data()), 269 "Conversion HiGain.vs.LoGain Means"); 270 MHCamera disp18(geomcam, Form("%s%s","ConversionSigmas",(fRuns->GetRunsAsFileName()).Data()), 271 "Conversion HiGain.vs.LoGain Sigmas"); 272 MHCamera disp19(geomcam, Form("%s%s","HiGainPickup",(fRuns->GetRunsAsFileName()).Data()), 273 "Number Pickup events Hi Gain"); 274 MHCamera disp20(geomcam, Form("%s%s","LoGainPickup",(fRuns->GetRunsAsFileName()).Data()), 275 "Number Pickup events Lo Gain"); 276 MHCamera disp21(geomcam, Form("%s%s","HiGainBlackout",(fRuns->GetRunsAsFileName()).Data()), 277 "Number Blackout events Hi Gain"); 278 MHCamera disp22(geomcam, Form("%s%s","LoGainBlackout",(fRuns->GetRunsAsFileName()).Data()), 279 "Number Blackout events Lo Gain"); 280 MHCamera disp23(geomcam, Form("%s%s","Excluded",(fRuns->GetRunsAsFileName()).Data()), 281 "Pixels previously excluded"); 282 MHCamera disp24(geomcam, Form("%s%s","UnSuitable",(fRuns->GetRunsAsFileName()).Data()), 283 "Pixels not suited for further analysis"); 284 MHCamera disp25(geomcam, Form("%s%s","UnReliable",(fRuns->GetRunsAsFileName()).Data()), 285 "Pixels not reliable for further analysis"); 286 MHCamera disp26(geomcam, Form("%s%s","HiGainOscillating",(fRuns->GetRunsAsFileName()).Data()), 287 "Oscillating Pixels High Gain"); 288 MHCamera disp27(geomcam, Form("%s%s","LoGainOscillating",(fRuns->GetRunsAsFileName()).Data()), 289 "Oscillating Pixels Low Gain"); 290 MHCamera disp28(geomcam, Form("%s%s","AbsTimeMean",(fRuns->GetRunsAsFileName()).Data()), 291 "Abs. Arrival Times"); 292 MHCamera disp29(geomcam, Form("%s%s","AbsTimeRms",(fRuns->GetRunsAsFileName()).Data()), 293 "RMS of Arrival Times"); 294 MHCamera disp30(geomcam, Form("%s%s","MeanTime",(fRuns->GetRunsAsFileName()).Data()), 295 "Mean Rel. Arrival Times"); 296 MHCamera disp31(geomcam, Form("%s%s","SigmaTime",(fRuns->GetRunsAsFileName()).Data()), 297 "Sigma Rel. Arrival Times"); 298 MHCamera disp32(geomcam, Form("%s%s","TimeProb",(fRuns->GetRunsAsFileName()).Data()), 299 "Probability of Time Fit"); 300 MHCamera disp33(geomcam, Form("%s%s","TimeNotFitValid",(fRuns->GetRunsAsFileName()).Data()), 301 "Pixels with not valid fit results"); 302 MHCamera disp34(geomcam, Form("%s%s","TimeOscillating",(fRuns->GetRunsAsFileName()).Data()), 303 "Oscillating Pixels"); 244 MHCamera disp1 (geomcam, "Charge", "Fitted Mean Charges"); 245 MHCamera disp2 (geomcam, "SigmaCharge", "Sigma of Fitted Charges"); 246 MHCamera disp3 (geomcam, "RSigma", "Reduced Sigmas"); 247 MHCamera disp4 (geomcam, "RSigmaPerCharge", "Reduced Sigma per Charge"); 248 MHCamera disp5 (geomcam, "NumPhes", "Nr. of Phe's (F-Factor Method)"); 249 MHCamera disp6 (geomcam, "ConvFADC2Phes", "Conversion Factor (F-Factor Method)"); 250 MHCamera disp7 (geomcam, "TotalFFactor", "Total F-Factor (F-Factor Method)"); 251 MHCamera disp8 (geomcam, "CascadesQEFFactor", "Cascades QE (F-Factor Method)"); 252 MHCamera disp9 (geomcam, "CascadesQEBlindPix","Cascades QE (Blind Pixel Method)"); 253 MHCamera disp10(geomcam, "CascadesQEPINDiode","Cascades QE (PIN Diode Method)"); 254 MHCamera disp11(geomcam, "CascadesQECombined","Cascades QE (Combined Method)"); 255 MHCamera disp12(geomcam, "FFactorValid", "Pixels with valid F-Factor calibration"); 256 MHCamera disp13(geomcam, "BlindPixelValid", "Pixels with valid BlindPixel calibration"); 257 MHCamera disp14(geomcam, "PINdiodeValid", "Pixels with valid PINDiode calibration"); 258 MHCamera disp15(geomcam, "CombinedValid", "Pixels with valid Combined calibration"); 259 MHCamera disp16(geomcam, "Saturation", "Pixels with saturated Hi Gain"); 260 MHCamera disp17(geomcam, "ConversionMeans", "Conversion HiGain.vs.LoGain Means"); 261 MHCamera disp18(geomcam, "ConversionSigmas", "Conversion HiGain.vs.LoGain Sigmas"); 262 MHCamera disp19(geomcam, "HiGainPickup", "Number Pickup events Hi Gain"); 263 MHCamera disp20(geomcam, "LoGainPickup", "Number Pickup events Lo Gain"); 264 MHCamera disp21(geomcam, "HiGainBlackout", "Number Blackout events Hi Gain"); 265 MHCamera disp22(geomcam, "LoGainBlackout", "Number Blackout events Lo Gain"); 266 MHCamera disp23(geomcam, "Excluded", "Pixels previously excluded"); 267 MHCamera disp24(geomcam, "UnSuitable", "Pixels not suited for further analysis"); 268 MHCamera disp25(geomcam, "UnReliable", "Pixels not reliable for further analysis"); 269 MHCamera disp26(geomcam, "HiGainOscillating", "Oscillating Pixels High Gain"); 270 MHCamera disp27(geomcam, "LoGainOscillating", "Oscillating Pixels Low Gain"); 271 MHCamera disp28(geomcam, "AbsTimeMean", "Abs. Arrival Times"); 272 MHCamera disp29(geomcam, "AbsTimeRms", "RMS of Arrival Times"); 273 MHCamera disp30(geomcam, "MeanTime", "Mean Rel. Arrival Times"); 274 MHCamera disp31(geomcam, "SigmaTime", "Sigma Rel. Arrival Times"); 275 MHCamera disp32(geomcam, "TimeProb", "Probability of Time Fit"); 276 MHCamera disp33(geomcam, "TimeNotFitValid", "Pixels with not valid fit results"); 277 MHCamera disp34(geomcam, "TimeOscillating", "Oscillating Pixels"); 304 278 305 279 // Fitted charge means and sigmas … … 665 639 Bool_t MJCalibration::FindColor() 666 640 { 667 668 const UInt_t nruns = fRuns->GetNumRuns(); 641 if (fSequence) 642 { 643 fColor = MCalibrationCam::kCT1; 644 return kTRUE; 645 } 646 647 const UInt_t nruns = fRuns->GetNumRuns(); 669 648 670 649 if (nruns == 0) … … 880 859 } 881 860 882 return kTRUE; 883 } 884 885 886 861 862 return kTRUE; 863 } 887 864 888 865 // -------------------------------------------------------------------------- … … 892 869 const char* MJCalibration::GetOutputFile() const 893 870 { 894 895 if (!fRuns)896 return "";897 898 return Form("%s/%s-F1.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName()); 899 } 900 871 if (fSequence) 872 return Form("%s/calib%06d.root", (const char*)fOutputPath, fSequence->GetSequence()); 873 if (!fRuns) 874 return ""; 875 876 return Form("%s/%s-F1.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName()); 877 } 901 878 902 879 Bool_t MJCalibration::IsUseBlindPixel() const 903 880 { 904 return TESTBIT(fDevices,kUseBlindPixel); 905 } 906 881 return TESTBIT(fDevices,kUseBlindPixel); 882 } 907 883 908 884 Bool_t MJCalibration::IsUsePINDiode() const 909 885 { 910 return TESTBIT(fDevices,kUsePINDiode); 911 } 912 913 914 915 886 return TESTBIT(fDevices,kUsePINDiode); 887 } 888 889 void MJCalibration::SetEnv(const char *env) 890 { 891 if (fEnv) 892 delete fEnv; 893 fEnv = new TEnv(env); 894 } 895 896 void MJCalibration::CheckEnv() 897 { 898 if (!fEnv) 899 return; 900 901 TString e1 = fEnv->GetValue("MJCalibration.OutputPath", ""); 902 if (!e1.IsNull()) 903 { 904 e1.ReplaceAll("\015", ""); 905 SetOutputPath(e1); 906 } 907 } 916 908 917 909 // -------------------------------------------------------------------------- … … 925 917 926 918 return kTRUE; 919 } 920 921 void MJCalibration::InitBlindPixel(MExtractBlindPixel &blindext, 922 MHCalibrationChargeBlindCam &blindcam) 923 { 924 Int_t run = fSequence ? fSequence->GetLastRun() : fRuns->GetRuns()[fRuns->GetNumRuns()-1]; 925 926 // 927 // Initialize the blind pixel. Unfortunately, there is a hardware difference 928 // in the first blind pixel until run "gkSecondBlindPixelInstallation" and the 929 // later setup. The first needs to use a filter because of the length of 930 // spurious NSB photon signals. The latter get better along extracting the amplitude 931 // from a small window. 932 // 933 if (run < gkSecondBlindPixelInstallation) 934 { 935 blindext.SetModified(kFALSE); 936 blindext.SetExtractionType(MExtractBlindPixel::kIntegral); 937 blindext.SetExtractionType(MExtractBlindPixel::kFilter); 938 blindext.SetRange(10,19,0,6); 939 blindext.SetNSBFilterLimit(70); 940 blindcam.SetFitFunc( MHCalibrationChargeBlindPix::kEPoisson5 ); 941 } 942 else 943 { 944 blindext.SetModified(kTRUE); 945 blindext.SetExtractionType(MExtractBlindPixel::kAmplitude); 946 blindext.SetExtractionType(MExtractBlindPixel::kFilter); 947 blindext.SetRange(5,8,0,2); 948 blindext.SetNSBFilterLimit(38); 949 950 if (run < gkThirdBlindPixelInstallation) 951 blindext.SetNumBlindPixels(2); 952 else 953 blindext.SetNumBlindPixels(3); 954 } 927 955 } 928 956 … … 965 993 Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam) 966 994 { 967 if (!fRuns) 968 { 969 *fLog << err << "No Runs choosen... abort." << endl; 970 return kFALSE; 971 } 995 if (!fRuns && !fSequence) 996 { 997 *fLog << err << "No Runs choosen... abort." << endl; 998 return kFALSE; 999 } 1000 1001 if (!fSequence && fRuns->GetNumRuns() != fRuns->GetNumEntries()) 1002 { 1003 *fLog << err << "Number of files found doesn't match number of runs... abort." 1004 << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl; 1005 return kFALSE; 1006 } 1007 1008 *fLog << inf; 1009 fLog->Separator(GetDescriptor()); 1010 1011 if (!FindColor()) 1012 return kFALSE; 1013 1014 *fLog << "Calculate MCalibrationCam from "; 1015 if (fSequence) 1016 *fLog << "Sequence #" << fSequence->GetSequence() << endl; 1017 else 1018 *fLog << "Runs " << fRuns->GetRunsAsString() << endl; 1019 *fLog << endl; 1020 1021 // Setup Tasklist 1022 MParList plist; 1023 MTaskList tlist; 1024 plist.AddToList(&tlist); 1025 1026 MReadMarsFile read("Events"); 1027 MRawFileRead rawread(NULL); 1028 1029 MDirIter iter; 1030 if (fSequence) 1031 fSequence->SetupCalRuns(iter); 1032 1033 if (fDataCheck) 1034 { 1035 rawread.AddFiles(fSequence ? iter : *fRuns); 1036 tlist.AddToList(&rawread); 1037 } 1038 else 1039 { 1040 read.DisableAutoScheme(); 1041 static_cast<MRead&>(read).AddFiles(fSequence ? iter : *fRuns); 1042 tlist.AddToList(&read); 1043 } 1044 1045 MHCalibrationChargeCam chargecam; 1046 MHCalibrationChargeBlindCam blindcam; 1047 1048 plist.AddToList(&pedcam); 1049 plist.AddToList(&chargecam); 1050 plist.AddToList(&blindcam); 1051 plist.AddToList(&fBadPixels); 1052 plist.AddToList(&fQECam); 1053 plist.AddToList(&fCalibrationCam); 1054 plist.AddToList(&fCalibrationBlindCam); 1055 plist.AddToList(&fCalibrationPINDiode); 1056 plist.AddToList(&fRelTimeCam); 1057 1058 MGeomApply apply; 1059 MBadPixelsMerge merge(&fBadPixels); 1060 MExtractPINDiode pinext; 1061 MExtractBlindPixel blindext; 1062 InitBlindPixel(blindext, blindcam); 1063 MExtractSlidingWindow extract2; 1064 MExtractTimeFastSpline timespline; 1065 MCalibrationChargeCalc calcalc; 1066 if (!fSequence) 1067 { 1068 calcalc.SetOutputPath(fOutputPath); 1069 calcalc.SetOutputFile(Form("%s-ChargeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName())); 1070 } 1071 1072 if (fDebug) 1073 { 1074 chargecam.SetDebug(); 1075 calcalc.SetDebug(); 1076 } 1077 1078 // 1079 // As long as there are no DM's, have to colour by hand 1080 // 1081 calcalc.SetPulserColor(fColor); 1082 1083 MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode"); 1084 MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel"); 1085 MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam"); 1086 MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam"); 1087 fillpin.SetNameTab("PINDiode"); 1088 fillbnd.SetNameTab("BlindPix"); 1089 fillcam.SetNameTab("Charge"); 1090 filltme.SetNameTab("RelTimes"); 972 1091 973 if (fRuns->GetNumRuns() != fRuns->GetNumEntries()) 974 { 975 *fLog << err << "Number of files found doesn't match number of runs... abort." 976 << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl; 977 return kFALSE; 978 } 979 980 *fLog << inf; 981 fLog->Separator(GetDescriptor()); 982 983 if (!FindColor()) 984 return kFALSE; 985 986 *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl; 987 *fLog << endl; 988 989 // Setup Tasklist 990 MParList plist; 991 MTaskList tlist; 992 plist.AddToList(&tlist); 993 994 MReadMarsFile read("Events"); 995 MRawFileRead rawread(NULL); 996 997 if (fDataCheck) 998 { 999 rawread.AddFiles(*fRuns); 1000 tlist.AddToList(&rawread); 1001 } 1002 else 1003 { 1004 read.DisableAutoScheme(); 1005 static_cast<MRead&>(read).AddFiles(*fRuns); 1006 tlist.AddToList(&read); 1007 } 1008 1009 MHCalibrationChargeCam chargecam; 1010 MHCalibrationChargeBlindCam blindcam; 1011 1012 plist.AddToList(&pedcam); 1013 plist.AddToList(&chargecam); 1014 plist.AddToList(&blindcam); 1015 plist.AddToList(&fBadPixels); 1016 plist.AddToList(&fQECam); 1017 plist.AddToList(&fCalibrationCam); 1018 plist.AddToList(&fCalibrationBlindCam); 1019 plist.AddToList(&fCalibrationPINDiode); 1020 plist.AddToList(&fRelTimeCam); 1021 1022 MGeomApply apply; 1023 MExtractPINDiode pinext; 1024 MExtractBlindPixel blindext; 1025 1026 // 1027 // Initialize the blind pixel. Unfortunately, there is a hardware difference 1028 // in the first blind pixel until run "gkSecondBlindPixelInstallation" and the 1029 // later setup. The first needs to use a filter because of the length of 1030 // spurious NSB photon signals. The latter get better along extracting the amplitude 1031 // from a small window. 1032 // 1033 TArrayI arr = fRuns->GetRuns(); 1034 if (arr[fRuns->GetNumRuns()-1] < gkSecondBlindPixelInstallation) 1035 { 1036 blindext.SetModified(kFALSE); 1037 blindext.SetExtractionType(MExtractBlindPixel::kIntegral); 1038 blindext.SetExtractionType(MExtractBlindPixel::kFilter); 1039 blindext.SetRange(10,19,0,6); 1040 blindext.SetNSBFilterLimit(70); 1041 blindcam.SetFitFunc( MHCalibrationChargeBlindPix::kEPoisson5 ); 1042 } 1043 else 1044 { 1045 blindext.SetModified(kTRUE); 1046 blindext.SetExtractionType(MExtractBlindPixel::kAmplitude); 1047 blindext.SetExtractionType(MExtractBlindPixel::kFilter); 1048 blindext.SetRange(5,8,0,2); 1049 blindext.SetNSBFilterLimit(38); 1050 if (arr[fRuns->GetNumRuns()-1] < gkThirdBlindPixelInstallation) 1051 blindext.SetNumBlindPixels(2); 1052 else 1053 blindext.SetNumBlindPixels(3); 1054 } 1055 1056 MExtractSlidingWindow extract2; 1057 MExtractTimeFastSpline timespline; 1058 MCalibrationChargeCalc calcalc; 1059 calcalc.SetOutputPath(fOutputPath); 1060 calcalc.SetOutputFile(Form("%s-ChargeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName())); 1061 1062 if (fDebug) 1063 { 1064 chargecam.SetDebug(); 1065 calcalc.SetDebug(); 1066 } 1067 1068 MCalibrationRelTimeCalc timecalc; 1069 timecalc.SetOutputPath(fOutputPath); 1070 timecalc.SetOutputFile(Form("%s-TimeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName())); 1071 1072 // 1073 // As long as there are no DM's, have to colour by hand 1074 // 1075 calcalc.SetPulserColor(fColor); 1076 1077 MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode"); 1078 MFillH fillbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel"); 1079 MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam"); 1080 MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam"); 1081 fillpin.SetNameTab("PINDiode"); 1082 fillbnd.SetNameTab("BlindPix"); 1083 fillcam.SetNameTab("Charge"); 1084 filltme.SetNameTab("RelTimes"); 1085 1086 TString drawoption; 1087 1088 if (fDisplayType == kDataCheckDisplay) 1089 drawoption += "datacheck"; 1090 if (fDisplayType == kFullDisplay) 1091 drawoption += " all"; 1092 1093 fillcam.SetDrawOption(drawoption.Data()); 1094 fillbnd.SetDrawOption(drawoption.Data()); 1095 fillpin.SetDrawOption(drawoption.Data()); 1096 filltme.SetDrawOption(drawoption.Data()); 1097 // 1098 // Apply a filter against cosmics 1099 // (will have to be needed in the future 1100 // when the calibration hardware-trigger is working) 1101 // 1102 MFCosmics cosmics; 1103 MContinue cont(&cosmics); 1104 1105 // tlist.AddToList(&merge); 1106 tlist.AddToList(&apply); 1107 1108 if (fExtractor) 1109 tlist.AddToList(fExtractor); 1110 else 1111 { 1112 *fLog << warn << GetDescriptor() 1113 << ": No extractor has been chosen, take default MExtractSlidingWindow " << endl; 1114 tlist.AddToList(&extract2); 1115 } 1116 1117 tlist.AddToList(&pinext); 1118 tlist.AddToList(&blindext); 1119 1120 if (fRelTimes) 1121 { 1122 if (fTimeExtractor) 1123 tlist.AddToList(fTimeExtractor); 1124 else 1092 TString drawoption; 1093 1094 if (fDisplayType == kDataCheckDisplay) 1095 drawoption += "datacheck"; 1096 if (fDisplayType == kFullDisplay) 1097 drawoption += " all"; 1098 1099 fillcam.SetDrawOption(drawoption.Data()); 1100 fillbnd.SetDrawOption(drawoption.Data()); 1101 fillpin.SetDrawOption(drawoption.Data()); 1102 filltme.SetDrawOption(drawoption.Data()); 1103 1104 // 1105 // Apply a filter against cosmics 1106 // (will have to be needed in the future 1107 // when the calibration hardware-trigger is working) 1108 // 1109 MFCosmics cosmics; 1110 MContinue cont(&cosmics); 1111 1112 tlist.AddToList(&merge); 1113 tlist.AddToList(&apply); 1114 1115 MTaskEnv taskenv("ExtractSignal"); 1116 taskenv.SetDefault(fExtractor ? fExtractor : &extract2); 1117 1118 tlist.AddToList(&taskenv); 1119 tlist.AddToList(&pinext); 1120 tlist.AddToList(&blindext); 1121 1122 MTaskEnv taskenv2("ExtractTime"); 1123 taskenv2.SetDefault(fTimeExtractor ? fTimeExtractor : ×pline); 1124 1125 if (fRelTimes) 1126 tlist.AddToList(&taskenv2); 1127 1128 if (fColor == MCalibrationCam::kCT1) 1129 tlist.AddToList(&cont); 1130 1131 tlist.AddToList(&fillcam); 1132 tlist.AddToList(&calcalc); 1133 1134 MCalibrationRelTimeCalc timecalc; 1135 if (fRelTimes) 1136 { 1137 tlist.AddToList(&filltme); 1138 tlist.AddToList(&timecalc); 1139 } 1140 1141 1142 // Create and setup the eventloop 1143 MEvtLoop evtloop(fName); 1144 evtloop.SetParList(&plist); 1145 evtloop.SetDisplay(fDisplay); 1146 evtloop.SetLogStream(fLog); 1147 if (fEnv) 1148 evtloop.ReadEnv(*fEnv); 1149 1150 // Execute first analysis 1151 if (!evtloop.Eventloop()) 1152 { 1153 *fLog << err << GetDescriptor() << ": Failed." << endl; 1154 return kFALSE; 1155 } 1156 1157 tlist.PrintStatistics(); 1158 1159 // 1160 // The next lines are necessary in order to avoid that 1161 // the last entry drawn by MFillH gets deleted again from 1162 // the display. No idea where this comes from... 1163 // 1164 /* 1165 if (fDisplay) 1166 { 1167 if (IsUsePINDiode()) 1125 1168 { 1126 *fLog << warn << GetDescriptor()1127 << ": No extractor has been chosen, take default MTimeExtractSpline " << endl;1128 tlist.AddToList(×pline);1169 MHCalibrationChargePINDiode *pin = 1170 (MHCalibrationChargePINDiode*)plist.FindObject("MHCalibrationChargePINDiode"); 1171 pin->DrawClone(Form("nonew %s",drawoption.Data())); 1129 1172 } 1130 } 1131 1132 if (fColor == MCalibrationCam::kCT1) 1133 tlist.AddToList(&cont); 1134 1135 tlist.AddToList(&fillcam); 1136 1137 if (fRelTimes) 1138 { 1139 tlist.AddToList(&filltme); 1140 tlist.AddToList(&timecalc); 1141 } 1142 1143 if (IsUseBlindPixel()) 1144 tlist.AddToList(&fillbnd); 1145 if (IsUsePINDiode()) 1146 tlist.AddToList(&fillpin); 1147 1148 tlist.AddToList(&calcalc); 1149 1150 // Create and setup the eventloop 1151 MEvtLoop evtloop(fName); 1152 evtloop.SetParList(&plist); 1153 evtloop.SetDisplay(fDisplay); 1154 evtloop.SetLogStream(fLog); 1155 1156 // Execute first analysis 1157 if (!evtloop.Eventloop()) 1158 { 1159 *fLog << err << GetDescriptor() << ": Failed." << endl; 1160 return kFALSE; 1161 } 1162 1163 tlist.PrintStatistics(); 1164 1165 // 1166 // The next lines are necessary in order to avoid that 1167 // the last entry drawn by MFillH gets deleted again from 1168 // the display. No idea where this comes from... 1169 // 1170 if (fDisplay) 1171 { 1172 if (IsUsePINDiode()) 1173 else if (IsUseBlindPixel()) 1173 1174 { 1174 MHCalibrationChargePINDiode *pin =1175 (MHCalibrationChargePINDiode*)plist.FindObject("MHCalibrationChargePINDiode");1176 pin->DrawClone(Form("nonew %s",drawoption.Data()));1175 MHCalibrationChargeBlindCam *cam = 1176 (MHCalibrationChargeBlindCam*)plist.FindObject("MHCalibrationChargeBlindCam"); 1177 cam->DrawClone(Form("nonew %s",drawoption.Data())); 1177 1178 } 1178 else if (IsUseBlindPixel())1179 else if (fRelTimes) 1179 1180 { 1180 MHCalibrationChargeBlindCam *cam =1181 (MHCalibrationChargeBlindCam*)plist.FindObject("MHCalibrationChargeBlindCam");1182 cam->DrawClone(Form("nonew %s",drawoption.Data()));1181 MHCalibrationRelTimeCam *cam = 1182 (MHCalibrationRelTimeCam*)plist.FindObject("MHCalibrationRelTimeCam"); 1183 cam->DrawClone(Form("nonew %s",drawoption.Data())); 1183 1184 } 1184 else if (fRelTimes)1185 else 1185 1186 { 1186 MHCalibrationRelTimeCam *cam =1187 (MHCalibrationRelTimeCam*)plist.FindObject("MHCalibrationRelTimeCam");1188 cam->DrawClone(Form("nonew %s",drawoption.Data()));1187 MHCalibrationChargeCam *cam = 1188 (MHCalibrationChargeCam*)plist.FindObject("MHCalibrationChargeCam"); 1189 cam->DrawClone(Form("nonew %s",drawoption.Data())); 1189 1190 } 1190 else 1191 { 1192 MHCalibrationChargeCam *cam = 1193 (MHCalibrationChargeCam*)plist.FindObject("MHCalibrationChargeCam"); 1194 cam->DrawClone(Form("nonew %s",drawoption.Data())); 1195 } 1196 } 1197 1198 DisplayResult(plist); 1199 1200 if (!WriteResult()) 1201 return kFALSE; 1202 1203 *fLog << inf << GetDescriptor() << ": Done." << endl; 1204 1205 return kTRUE; 1191 } 1192 */ 1193 1194 DisplayResult(plist); 1195 1196 if (!WriteResult()) 1197 return kFALSE; 1198 1199 *fLog << inf << GetDescriptor() << ": Done." << endl; 1200 1201 return kTRUE; 1206 1202 } 1207 1203 -
TabularUnified trunk/MagicSoft/Mars/mjobs/MJCalibration.h ¶
r4604 r4609 21 21 #endif 22 22 23 class TEnv; 23 24 class MRunIter; 25 class MSequence; 24 26 class MParList; 25 27 class MPedestalCam; 26 28 class MExtractor; 27 29 class MExtractTime; 30 31 class MExtractBlindPixel; 32 class MHCalibrationChargeBlindCam; 33 28 34 class MJCalibration : public MParContainer 29 35 { 30 36 private: 37 static const Int_t gkIFAEBoxInaugurationRun; // Run number of first IFAE box calibration 38 static const Int_t gkSecondBlindPixelInstallation; // Run number upon which second blind pixel was installed 39 static const Int_t gkThirdBlindPixelInstallation; // Run number upon which third blind pixel was installed 31 40 32 static const Int_t gkIFAEBoxInaugurationRun; // Run number of first IFAE box calibration 33 static const Int_t gkSecondBlindPixelInstallation; // Run number upon which second blind pixel was installed 34 static const Int_t gkThirdBlindPixelInstallation; // Run number upon which third blind pixel was installed 41 TString fOutputPath; // Path to the output files 35 42 36 TString fOutputPath; // Path to the output files 43 TEnv *fEnv; 44 MRunIter *fRuns; // Calibration files 45 MSequence *fSequence; // Sequence 46 47 MExtractor *fExtractor; // Signal extractor 48 MExtractTime *fTimeExtractor; // Arrival Time extractor 49 50 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs 51 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe 52 MCalibrationChargeBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s) 53 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode 54 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs 55 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times 56 57 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs 58 59 enum Display_t // Possible Display types 60 { 61 kFullDisplay, 62 kDataCheckDisplay, 63 kNormalDisplay 64 }; 65 66 Display_t fDisplayType; // Chosen Display type 67 68 enum Device_t // Possible devices for calibration 69 { 70 kUseBlindPixel, 71 kUsePINDiode 72 }; 73 74 Byte_t fDevices; // Bit-field for used devices for calibration 75 76 Bool_t fRelTimes; // Flag if relative times have to be calibrated 77 Bool_t fDataCheck; // Flag if the data check is run on raw data 78 Bool_t fDebug; 79 80 void DisplayResult(MParList &plist); 81 Bool_t WriteResult(); 82 void CheckEnv(); 83 84 // WORKAROUNDS!!! 85 Bool_t FindColor(); 86 void InitBlindPixel(MExtractBlindPixel &blindext, 87 MHCalibrationChargeBlindCam &blindcam); 88 89 public: 90 MJCalibration(const char *name=NULL, const char *title=NULL); 91 ~MJCalibration(); 37 92 38 MRunIter *fRuns; // Calibration files 39 MExtractor *fExtractor; // Signal extractor 40 MExtractTime *fTimeExtractor; // Arrival Time extractor 93 const char* GetOutputFile() const; 94 void SetEnv(const char *env); 95 96 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; } 97 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; } 98 MCalibrationQECam &GetQECam() { return fQECam; } 99 MBadPixelsCam &GetBadPixels() { return fBadPixels; } 100 101 Bool_t IsUseBlindPixel() const; 102 Bool_t IsUsePINDiode() const; 103 104 void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 105 void SetExtractor(MExtractor* ext) { fExtractor = ext; } 106 void SetTimeExtractor(MExtractTime* ext) { fTimeExtractor = ext; } 107 void SetQECam(const MCalibrationQECam &qe) { qe.Copy(fQECam); } 108 void SetColor(const MCalibrationCam::PulserColor_t color) { fColor = color; } 109 110 void SetInput(MRunIter *iter) { fRuns=iter; } 111 void SetSequence(MSequence *seq) { fSequence=seq; } 112 void SetOutputPath(const char *path="."); 113 114 // Displays 115 void SetFullDisplay() { fDisplayType = kFullDisplay; } 116 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; } 117 void SetNormalDisplay() { fDisplayType = kNormalDisplay; } 118 119 // Rel. Time 120 void SetRelTimeCalibration(const Bool_t b=kTRUE) { fRelTimes = b; } 121 122 // Data Check 123 void SetDataCheck(const Bool_t b=kTRUE) { fDataCheck = b; SetDataCheckDisplay(); } 124 125 // Debug 126 void SetDebug(const Bool_t b=kTRUE) { fDebug = b; } 127 128 // Devices 129 void SetUseBlindPixel(const Bool_t b=kTRUE); 130 void SetUsePINDiode(const Bool_t b=kTRUE); 41 131 42 MBadPixelsCam fBadPixels; // Bad Pixels cam, can be set from previous runs 43 MCalibrationChargeCam fCalibrationCam; // Calibration conversion factors FADC2Phe 44 MCalibrationChargeBlindCam fCalibrationBlindCam; // Calibration from Blind Pixel(s) 45 MCalibrationChargePINDiode fCalibrationPINDiode; // Calibration from PIN Diode 46 MCalibrationQECam fQECam; // Quantum efficiency, can be set from previous runs 47 MCalibrationRelTimeCam fRelTimeCam; // Calibration constants rel. times 132 Bool_t ReadCalibrationCam(); 133 Bool_t ProcessFile(MPedestalCam &pedcam); 134 Bool_t Process(MPedestalCam &pedcam); 48 135 49 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs 50 51 enum Display_t { kFullDisplay, kDataCheckDisplay, kNormalDisplay }; // Possible Display types 52 53 Display_t fDisplayType; // Chosen Display type 54 55 enum Device_t { kUseBlindPixel, kUsePINDiode }; // Possible devices for calibration 56 57 Byte_t fDevices; // Bit-field for used devices for calibration 58 59 Bool_t fRelTimes; // Flag if relative times have to be calibrated 60 Bool_t fDataCheck; // Flag if the data check is run on raw data 61 Bool_t fDebug; 62 63 void DisplayResult(MParList &plist); 64 Bool_t WriteResult(); 65 Bool_t FindColor(); 66 67 public: 68 69 MJCalibration(const char *name=NULL, const char *title=NULL); 70 ~MJCalibration() {} 71 72 const char* GetOutputFile() const; 73 74 MCalibrationChargeCam &GetCalibrationCam() { return fCalibrationCam; } 75 MCalibrationRelTimeCam &GetRelTimeCam() { return fRelTimeCam; } 76 MCalibrationQECam &GetQECam() { return fQECam; } 77 MBadPixelsCam &GetBadPixels() { return fBadPixels; } 78 79 Bool_t IsUseBlindPixel() const; 80 Bool_t IsUsePINDiode() const; 81 82 void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 83 void SetExtractor(MExtractor* ext) { fExtractor = ext; } 84 void SetTimeExtractor(MExtractTime* ext) { fTimeExtractor = ext; } 85 void SetQECam (const MCalibrationQECam &qe) { qe.Copy(fQECam); } 86 void SetColor (const MCalibrationCam::PulserColor_t color) { fColor = color; } 87 88 void SetInput(MRunIter *iter) { fRuns=iter; } 89 void SetOutputPath(const char *path="."); 90 91 // Displays 92 void SetFullDisplay() { fDisplayType = kFullDisplay; } 93 void SetDataCheckDisplay() { fDisplayType = kDataCheckDisplay; } 94 void SetNormalDisplay() { fDisplayType = kNormalDisplay; } 95 96 // Rel. Time 97 void SetRelTimeCalibration(const Bool_t b=kTRUE) { fRelTimes = b; } 98 99 // Data Check 100 void SetDataCheck (const Bool_t b=kTRUE) { fDataCheck = b; SetDataCheckDisplay(); } 101 102 // Debug 103 void SetDebug (const Bool_t b=kTRUE) { fDebug = b; } 104 105 // Devices 106 void SetUseBlindPixel( const Bool_t b=kTRUE ); 107 void SetUsePINDiode ( const Bool_t b=kTRUE ); 108 109 Bool_t ReadCalibrationCam(); 110 Bool_t ProcessFile( MPedestalCam &pedcam ); 111 Bool_t Process ( MPedestalCam &pedcam ); 112 113 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity 136 ClassDef(MJCalibration, 0) // Tool to run a calibration per pulser colour and intensity 114 137 }; 115 138 -
TabularUnified trunk/MagicSoft/Mars/mjobs/MJPedestal.cc ¶
r4601 r4609 104 104 { 105 105 if (fSequence) 106 return Form("%s/calped%0 5d", (const char*)fOutputPath, fSequence->GetSequence());106 return Form("%s/calped%06d.root", (const char*)fOutputPath, fSequence->GetSequence()); 107 107 108 108 if (!fRuns) … … 422 422 423 423 return kTRUE; 424 } 425 426 void MJPedestal::CheckEnv() 427 { 428 if (!fEnv) 429 return; 430 431 TString e1 = fEnv->GetValue("MJPedestal.OutputPath", ""); 432 if (!e1.IsNull()) 433 { 434 e1.ReplaceAll("\015", ""); 435 SetOutputPath(e1); 436 } 424 437 } 425 438 … … 449 462 *fLog << endl; 450 463 464 CheckEnv(); 465 451 466 MParList plist; 452 467 MTaskList tlist; … … 493 508 pedcalc.SetRange(fExtractor->GetHiGainFirst(), fExtractor->GetHiGainLast()); 494 509 } 510 /* 495 511 else 496 512 { … … 498 514 *fLog << ": No extractor has been chosen, take default number of FADC samples " << endl; 499 515 } 516 */ 500 517 501 518 tlist.AddToList(&geomapl); -
TabularUnified trunk/MagicSoft/Mars/mjobs/MJPedestal.h ¶
r4601 r4609 58 58 void DisplayOutliers(TH1D *hist) const; 59 59 60 void CheckEnv(); 61 60 62 public: 61 63 MJPedestal(const char *name=NULL, const char *title=NULL); -
TabularUnified trunk/MagicSoft/Mars/mjobs/MSequence.h ¶
r4601 r4609 50 50 // Getter 51 51 UInt_t GetSequence() const { return fSequence; } 52 UInt_t GetLastRun() const { return fLastRun; } 52 53 53 54 ClassDef(MSequence, 0)
Note:
See TracChangeset
for help on using the changeset viewer.