Changeset 7099 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 05/27/05 16:33:19 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r7053 r7099 135 135 using namespace std; 136 136 137 const Float_t MCalibrateData::fgCalibConvMinLimit = 0.01; 138 const Float_t MCalibrateData::fgCalibConvMaxLimit = 5.; 137 const Float_t MCalibrateData::gkCalibConvMinLimit = 0.01; 138 const Float_t MCalibrateData::gkCalibConvMaxLimit = 5.; 139 140 const MCalibrateData::CalibrationMode_t MCalibrateData::gkDefault = kFfactor; 141 139 142 // -------------------------------------------------------------------------- 140 143 // … … 441 444 { 442 445 443 *fLog << inf << GetDescriptor() 444 << ": Updating Conversion Factors... " << endl; 446 *fLog << inf << GetDescriptor() << ": Updating Conversion Factors... " << endl; 445 447 446 448 fCalibConsts.Reset(); … … 495 497 if (updatecam) 496 498 { 497 MCalibrationChargePix &upix = (MCalibrationChargePix&)(*updatecam)[pixidx]; 499 const MCalibrationChargePix &upix = (MCalibrationChargePix&)(*updatecam)[pixidx]; 500 498 501 // 499 502 // Correct for the possible change in amplification of the individual pixels chain 500 503 // 501 504 const Float_t pixmean = upix.GetConvertedMean(); 502 calibUpdate = (pixmean == 0.) ? 1. : pix.GetConvertedMean() / pixmean; 505 calibUpdate = pixmean==0 ? 1 : pix.GetConvertedMean()/pixmean; 506 503 507 // 504 508 // Correct for global shifts in light emission 505 509 // 506 MCalibrationChargePix &ugpix = (MCalibrationChargePix&)updatecam->GetAverageArea(0);510 const MCalibrationChargePix &ugpix = (MCalibrationChargePix&)updatecam->GetAverageArea(0); 507 511 508 512 const Float_t globmean = avpix.GetConvertedMean(); 509 calibUpdate = (globmean == 0.) ? 1. : ugpix.GetConvertedMean() /globmean;510 511 MBadPixelsPix &ubad = (MBadPixelsPix&)updatecam->GetAverageBadArea(0);513 calibUpdate = globmean==0 ? 1 : ugpix.GetConvertedMean()/globmean; 514 515 MBadPixelsPix &ubad = (MBadPixelsPix&)updatecam->GetAverageBadArea(0); 512 516 if (ubad.IsUncalibrated(MBadPixelsPix::kChargeIsPedestal)) 513 517 { … … 581 585 calibUpdate = 1.; 582 586 break; 587 588 default: 589 break; 583 590 } /* switch calibration mode */ 584 591 } /* if(fCalibrationMode!=kNone) */ … … 755 762 out << " " << GetUniqueName() << ".EnablePedestalType(MCalibrateData::kRun)" << endl; 756 763 757 if (fCalibrationMode != kDefault)764 if (fCalibrationMode != gkDefault) 758 765 { 759 766 out << " " << GetUniqueName() << ".SetCalibrationMode(MCalibrateData::"; … … 865 872 { 866 873 *fLog << all 867 << Form("%s%3i","Pixel:",pixidx)868 << Form("%s%4.2f"," CalibConst:",fCalibConsts[pixidx])869 << Form("%s%4.2f"," F-Factor:",fCalibFFactors[pixidx])870 << Form("%s%4.2f"," HiLoConv:",fHiLoConv[pixidx])874 << "Pixel: " << Form("%3i",pixidx) 875 << " CalibConst: " << Form("%4.2f",fCalibConsts[pixidx]) 876 << " F-Factor: " << Form("%4.2f",fCalibFFactors[pixidx]) 877 << " HiLoConv: " << Form("%4.2f",fHiLoConv[pixidx]) 871 878 << endl; 872 879 } -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r6855 r7099 23 23 class MCalibrateData : public MTask 24 24 { 25 public: 26 enum CalibrationMode_t 27 { 28 kSkip = 0, 29 kNone = 1, 30 kFlatCharge = 2, 31 kBlindPixel = 3, 32 kFfactor = 4, 33 kPinDiode = 5, 34 kCombined = 6, 35 kDummy = 7 36 }; 37 38 enum PedestalType_t 39 { 40 kNo = BIT(0), 41 kRun = BIT(1), 42 kEvent = BIT(2) 43 }; 44 45 enum SignalType_t 46 { 47 kPhe, 48 kPhot 49 }; 50 51 static const CalibrationMode_t gkDefault; 52 25 53 private: 26 27 static const Float_t fgCalibConvMinLimit; //! Minimum limit for conv. factor 28 static const Float_t fgCalibConvMaxLimit; //! Maximum limit for conv. factor 54 static const Float_t gkCalibConvMinLimit; //! Minimum limit for conv. factor 55 static const Float_t gkCalibConvMaxLimit; //! Maximum limit for conv. factor 29 56 30 57 Float_t fCalibConvMinLimit; // Minimum limit for conv. factor … … 39 66 MCalibConstCam *fCalibConstCam; //! Temporary calib consts storage 40 67 41 UShort_t fCalibrationMode;// Flag defining the calibration mode (CalibrationMode_t)68 CalibrationMode_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t) 42 69 Byte_t fPedestalFlag; // Flags defining to calibrate the pedestal each event or each run 43 70 Byte_t fSignalType; // Flag defining the signal type (kphot or kphe) … … 63 90 64 91 public: 65 66 enum CalibrationMode_t 67 { 68 kSkip = 0, 69 kNone = 1, 70 kFlatCharge = 2, 71 kBlindPixel = 3, 72 kFfactor = 4, 73 kPinDiode = 5, 74 kCombined = 6, 75 kDummy = 7 76 }; 77 78 static const CalibrationMode_t kDefault = kFfactor; 79 80 enum PedestalType_t 81 { 82 kNo = BIT(0), 83 kRun = BIT(1), 84 kEvent = BIT(2) 85 }; 86 87 enum SignalType_t 88 { 89 kPhe, 90 kPhot 91 }; 92 93 MCalibrateData(CalibrationMode_t calmode=kDefault, 94 const char *name=NULL, const char *title=NULL); 92 MCalibrateData(CalibrationMode_t calmode=gkDefault, 93 const char *name=NULL, const char *title=NULL); 95 94 96 95 void AddPedestal(const char *name="Cam"); … … 106 105 Bool_t TestPedestalFlag(PedestalType_t i) const { return fPedestalFlag&i ? kTRUE : kFALSE; } 107 106 108 void SetCalibrationMode ( CalibrationMode_t calmode= kDefault) { fCalibrationMode=calmode; }107 void SetCalibrationMode ( CalibrationMode_t calmode=gkDefault) { fCalibrationMode=calmode; } 109 108 void SetSignalType ( SignalType_t sigtype=kPhe ) { fSignalType =sigtype; } 110 109 111 void SetCalibConvMinLimit( const Float_t f= fgCalibConvMinLimit ) { fCalibConvMinLimit = f; }112 void SetCalibConvMaxLimit( const Float_t f= fgCalibConvMaxLimit ) { fCalibConvMaxLimit = f; }110 void SetCalibConvMinLimit( const Float_t f=gkCalibConvMinLimit ) { fCalibConvMinLimit = f; } 111 void SetCalibConvMaxLimit( const Float_t f=gkCalibConvMaxLimit ) { fCalibConvMaxLimit = f; } 113 112 114 113 Bool_t UpdateConversionFactors( const MCalibrationChargeCam *updatecam=NULL); … … 118 117 119 118 #endif /* MCalibrateData */ 120 121 122 123 124 125 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r7069 r7099 181 181 // ClassVersion 2: 182 182 // - Float_t fPheErrLimit; 183 // + Float_t fPheErrLowerLimit; // Lower limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 184 // + Float_t fPheErrUpperLimit; // Upper limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 183 // + Float_t fPheErrLowerLimit; // Lower limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 184 // + Float_t fPheErrUpperLimit; // Upper limit acceptance nr. phe's w.r.t. area idx mean (in sigmas) 185 // 186 // ClassVersion 3: 187 // + Bool_t fUseExtractorRes; // Include extractor resolution in F-Factor method 185 188 // 186 189 ////////////////////////////////////////////////////////////////////////////// … … 280 283 // 281 284 MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title) 282 : fGeom(NULL), fSignal(NULL), fCalibPattern(NULL) 285 : fUseExtractorRes(kFALSE), 286 fGeom(NULL), fSignal(NULL), fCalibPattern(NULL), fExtractor(NULL) 283 287 { 284 288 … … 661 665 return kTRUE; 662 666 } 663 667 664 668 if (fNumProcessed == 0) 665 669 return kTRUE; … … 1017 1021 << endl; 1018 1022 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes); 1023 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 1024 return kFALSE; 1025 } 1026 1027 if (cal.GetPheFFactorMethod() < 0.) 1028 { 1029 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes); 1030 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 1031 cal.SetFFactorMethodValid(kFALSE); 1032 return kFALSE; 1033 } 1034 1035 if (!cal.CalcConvFFactor()) 1036 { 1037 *fLog << warn << "Could not calculate the Conv. FADC counts to Phes in "; 1038 *fLog << what << ": " << Form("%4i", cal.GetPixId()) << endl; 1039 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes); 1040 return kFALSE; 1041 } 1042 1043 if (!fUseExtractorRes) 1044 return kTRUE; 1045 1046 if (!fExtractor) 1047 { 1048 *fLog << err << "Extractor resolution has been chosen, but not extractor is set. Cannot calibrate" << endl; 1049 return kFALSE; 1050 } 1051 1052 const Float_t resinphes = cal.IsHiGainSaturation() 1053 ? cal.GetPheFFactorMethod()*fExtractor->GetResolutionPerPheLoGain() 1054 : cal.GetPheFFactorMethod()*fExtractor->GetResolutionPerPheHiGain(); 1055 1056 Float_t resinfadc = cal.IsHiGainSaturation() 1057 ? resinphes/cal.GetMeanConvFADC2Phe()/cal.GetConversionHiLo() 1058 : resinphes/cal.GetMeanConvFADC2Phe(); 1059 1060 if (resinfadc > 1.5*cal.GetPedRms() ) 1061 { 1062 *fLog << warn << " Extractor Resolution: " << resinfadc << " bigger than Pedestal RMS " << cal.GetPedRms() << endl; 1063 resinfadc = cal.GetPedRms(); 1064 } 1065 1066 if (!cal.CalcReducedSigma(resinfadc)) 1067 { 1068 *fLog << warn << "Could not calculate the reduced sigma in " << what; 1069 *fLog << ": " << Form("%4i",cal.GetPixId()) << endl; 1070 bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ); 1071 return kFALSE; 1072 } 1073 1074 if (!cal.CalcFFactor()) 1075 { 1076 *fLog << warn << "Could not calculate the F-Factor in " << what; 1077 *fLog << ": " << Form("%4i",cal.GetPixId()) << endl; 1078 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes); 1079 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 1019 1080 return kFALSE; 1020 1081 } … … 2299 2360 rc = kTRUE; 2300 2361 } 2362 if (IsEnvDefined(env, prefix, "UseExtractorRes", print)) 2363 { 2364 SetUseExtractorRes(GetEnvValue(env, prefix, "UseExtractorRes", fUseExtractorRes)); 2365 rc = kTRUE; 2366 } 2301 2367 2302 2368 return rc; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r7028 r7099 2 2 #define MARS_MCalibrationChargeCalc 3 3 4 /////////////////////////////////////////////////////////////////////////////5 // //6 // MCalibrationChargeCalc //7 // //8 // Integrates the time slices of the all pixels of a calibration event //9 // and substract the pedestal value //10 // //11 /////////////////////////////////////////////////////////////////////////////12 13 4 #ifndef MARS_MTask 14 5 #include "MTask.h" 15 6 #endif 16 7 8 #ifndef ROOT_TArrayC 9 #include <TArrayC.h> 10 #endif 11 17 12 #ifndef MARS_MBadPixelsPix 18 13 #include "MBadPixelsPix.h" … … 21 16 #ifndef MARS_MCalibrationCam 22 17 #include "MCalibrationCam.h" 23 #endif24 25 #ifndef ROOT_TArrayC26 #include <TArrayC.h>27 18 #endif 28 19 … … 44 35 class MBadPixelsIntensityCam; 45 36 class MBadPixelsCam; 37 class MExtractor; 46 38 47 39 class MCalibrationChargeCalc : public MTask … … 91 83 92 84 Int_t fNumProcessed; // Number of processed events (for Intensity calibration) 85 Bool_t fUseExtractorRes; // Include extractor resolution in F-Factor method 93 86 94 87 // Pointers … … 108 101 MCalibrationPattern *fCalibPattern; //! Calibration DM pattern 109 102 MPedestalCam *fPedestals; //! Pedestals all pixels (calculated previously from ped.file) 103 MExtractor *fExtractor; //! Signal Extractor 110 104 111 105 // enums … … 211 205 : CLRBIT(fFlags, kDebug); } 212 206 207 void SetExtractor(MExtractor *ext) { fExtractor=ext; } 213 208 void SetPedestals(MPedestalCam *cam) { fPedestals=cam; } 214 209 … … 223 218 void SetPheErrUpperLimit ( const Float_t f=fgPheErrUpperLimit ) { fPheErrUpperLimit = f; } 224 219 void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; } 225 226 ClassDef(MCalibrationChargeCalc, 2) // Task calculating Calibration Containers and Quantum Efficiencies 220 void SetUseExtractorRes(Bool_t b=kTRUE) { fUseExtractorRes = b; } 221 222 ClassDef(MCalibrationChargeCalc, 3) // Task calculating Calibration Containers and Quantum Efficiencies 227 223 }; 228 224 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
r7013 r7099 674 674 // in GetRSigma() and GetRSigmaErr() 675 675 // 676 Bool_t MCalibrationChargePix::CalcReducedSigma( )676 Bool_t MCalibrationChargePix::CalcReducedSigma(const Float_t extractorres) 677 677 { 678 678 … … 687 687 const Float_t pedRmsSquare = IsHiGainSaturation() ? fLoGainPedRmsSquare : fPedRms*fPedRms; 688 688 const Float_t pedRmsSquareVar = IsHiGainSaturation() ? fLoGainPedRmsSquareVar : 0.25*fPedVar*pedRmsSquare; 689 const Float_t extractorresVar = extractorres * extractorres; 689 690 690 691 if (IsDebug()) … … 696 697 << " PedRmsSquare: " << pedRmsSquare 697 698 << " pedRmsSquareVar: " << pedRmsSquareVar 699 << " extractorresVar: " << extractorresVar 698 700 << endl; 699 701 } … … 705 707 // Calculate the reduced sigmas 706 708 // 707 fRSigmaSquare = sigmaSquare - pedRmsSquare ;709 fRSigmaSquare = sigmaSquare - pedRmsSquare - extractorresVar; 708 710 709 711 if (IsDebug()) … … 764 766 Bool_t MCalibrationChargePix::CalcFFactor() 765 767 { 766 767 if (fRSigmaSquare < 0.) 768 return kFALSE; 768 SetFFactorMethodValid(kFALSE); 769 770 if (fRSigmaSquare < 0.) 771 return kFALSE; 769 772 770 773 // -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r7013 r7099 53 53 54 54 MCalibrationChargePix(const char *name=NULL, const char *title=NULL); 55 ~MCalibrationChargePix() {}56 55 57 56 void Clear(Option_t *o=""); … … 111 110 112 111 // Calculations 113 void CalcLoGainPedestal (const Float_t logainsamples);114 Bool_t CalcReducedSigma ();115 Bool_t CalcFFactor ();116 Bool_t CalcConvFFactor ( );117 Bool_t CalcMeanFFactor ( const Float_t nphotons, const Float_t nphotonsrelvar);112 void CalcLoGainPedestal(const Float_t logainsamples); 113 Bool_t CalcReducedSigma(const Float_t extractorres=0); 114 Bool_t CalcFFactor(); 115 Bool_t CalcConvFFactor(); 116 Bool_t CalcMeanFFactor(const Float_t nphotons, const Float_t nphotonsrelvar); 118 117 119 118 ClassDef(MCalibrationChargePix, 3) // Container Charge Calibration Results Pixel
Note:
See TracChangeset
for help on using the changeset viewer.