Changeset 7043 for trunk/MagicSoft/Mars
- Timestamp:
- 05/17/05 12:08:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7042 r7043 21 21 22 22 -*-*- END OF LINE -*-*- 23 2005/05/17 Thomas Bretz 24 25 * callisto.rc, callisto_Dec04Jan05.rc: 26 - added new comments diescribing setup of MFCosmics 27 28 * mfilter/MFCosmics.[h,cc]: 29 - skip bad pixels using MBadPixelsCam 30 - implemented a check in PostProcess about the fraction 31 of events which survived or were rejected 32 - added ReadEnv for setup 33 34 * mfilter/Makefile: 35 - added mbadpixels 36 - removed mmain and manalysis 37 38 * mhcalib/MHCalibrationChargeCam.h: 39 - removed numbers from data member descrition -- too much 40 to maintain 41 42 * mhcalib/MHCalibrationChargePINDiode.h: 43 - incremented version number (undocumented from bcn) 44 45 * mjobs/MJCalibration.cc: 46 - reorganized some TText output (undocumented from bcn) 47 - overwrite the default of MaxNumberEmptyPixels by 0.05 48 (undocumented from bcn) 49 50 * msignal/MExtractTimeAndChargeDigitalFilter.cc: 51 - changed fgLoGainStartShift from -2.8 to -1.8 52 (undocumented from bcn) 53 54 * msignal/MExtractTimeAndChargeSlidingWindow.h: 55 - increased version number from 0 to 1 (undocumented from bcn) 56 57 58 59 2005/05/17 Markus Gaug (2005/05/16) 60 61 * msignal/MExtractor.[h,cc] 62 - introduce two new variables: fResolutionPerPheHiGain and 63 fResolutionPerPheLoGain, to be set by deriving extractors. 64 - set version number one higher. 65 66 * msignal/MExtractFixedWindow.[h,cc] 67 * msignal/MExtractTimeAndChargeSlidingWindow.[h,cc] 68 * msignal/MExtractTimeAndChargeSpline.[h,cc] 69 * msignal/MExtractTimeAndChargeDigitalFilter.[h,cc] 70 - set the variables fResolutionPerPheHiGain and 71 fResolutionPerPheLoGain 72 73 * msignal/MExtractPINDiode.[h,cc] 74 - adapt to current PIN Diode signal, fit signal with Gaussian 75 - set version number up by one. 76 77 * msignal/MExtractedSignalPINDiode.[h,cc] 78 - set new data member fExtractedChi2 79 - set version number up by one. 80 81 * mhcalib/MHCalibrationChargePINDiode.cc 82 - adapt one function to newly used names. 83 - adapt signal tests. 84 85 * mjobs/MJPedestal.[h,cc] 86 - read MBadPixelsCam together with extractor, if exisiting 87 (necessary for bad pixels exclusion in pulse position search). 88 89 * mjobs/MJCalibration.[h,cc] 90 - use MFCosmics in any case (not only for CT1-pulses) and apply 91 a quality criteria depending on number of rejected events: 92 MaxExcludedEvents (default: 50%). 93 94 95 23 96 2005/05/17 Daniela Dorner 24 97 -
trunk/MagicSoft/Mars/callisto.rc
r7035 r7043 112 112 # Configure MJCalibration 113 113 # ------------------------------------------------------------------------- 114 114 115 # Switch on relative time calibration 115 116 #MJCalibration.RelTimeCalibration: Yes 116 117 # Switch on intensity calibration 117 118 #MJCalibration.IntensityCalibration: Yes 118 # Set color to be used119 #MJCalibration.Color:120 119 # Type of used data format: raw, root, mc 121 120 #MJCalibration.DataType: Root … … 131 130 #MJCalibration.PixelCheck: Yes 132 131 #MJCalibTest.PixelCheck: Yes 132 133 # ------------------------------------------------------------------------- 134 # Individual events check for calibration results 135 # ------------------------------------------------------------------------- 136 137 #ContCosmics.MaxEmptyPixels: 0.2 138 #ContCosmics.MaxExcludedFraction: 1 139 #ContCosmics.MinAcceptedFraction: 0 133 140 134 141 # ------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc
r7035 r7043 122 122 # Configure MJCalibration 123 123 # ------------------------------------------------------------------------- 124 124 125 # Switch on relative time calibration 125 126 #MJCalibration.RelTimeCalibration: Yes … … 143 144 144 145 # ------------------------------------------------------------------------- 146 # Individual events check for calibration results 147 # ------------------------------------------------------------------------- 148 149 #ContCosmics.MaxEmptyPixels: 0.2 150 #ContCosmics.MaxExcludedFraction: 1 151 #ContCosmics.MinAcceptedFraction: 0 152 153 # ------------------------------------------------------------------------- 145 154 # In case of MOON DATA, uncomment the following lines: 146 155 # (better: call callisto with option "-moon") -
trunk/MagicSoft/Mars/mfilter/MFCosmics.cc
r5803 r7043 17 17 ! 18 18 ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 19 ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de> 20 ! 21 ! Copyright: MAGIC Software Development, 2000-2005 21 22 ! 22 23 ! … … 33 34 // the outer pixels have some defect). 34 35 // 36 // In the PostProcess we... 37 // a) check the ratio of events which were accepted against 38 // fMinAcceptedFraction. 39 // b) check the ratio of events which were rejected against 40 // fMaxExcludedFraction. 41 // 35 42 // Input Containers: 36 43 // MRawEvtData 37 44 // MPedestalCam 45 // MBadPixelsCam 38 46 // MExtractedSignalCam 39 47 // … … 55 63 #include "MPedestalPix.h" 56 64 65 #include "MBadPixelsCam.h" 66 #include "MBadPixelsPix.h" 67 57 68 #include "MExtractedSignalCam.h" 58 69 #include "MExtractedSignalPix.h" … … 69 80 // 70 81 MFCosmics::MFCosmics(const char *name, const char *title) 71 : fPedestals(NULL), fSignals(NULL), fRawEvt(NULL), 72 fNamePedestalCam(fgNamePedestalCam), fMaxEmptyPixels(0.2) 82 : fPedestals(NULL), fSignals(NULL), fBadPixels(NULL), fRawEvt(NULL), 83 fNamePedestalCam(fgNamePedestalCam), fMaxEmptyPixels(0.2), 84 fMinAcceptedFraction(0), fMaxExcludedFraction(1) 73 85 { 74 86 fName = name ? name : "MFCosmics"; … … 99 111 } 100 112 113 fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam"); 114 if (!fBadPixels) 115 { 116 *fLog << err << "MBadPixelsCam not found... aborting." << endl; 117 return kFALSE; 118 } 119 101 120 fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 102 121 if (!fSignals) … … 133 152 { 134 153 fResult = CosmicsRejection(); 135 136 154 fCut[fResult ? 0 : 1]++; 155 137 156 return kTRUE; 138 157 } … … 163 182 const UInt_t idx = pixel.GetPixelId(); 164 183 165 MExtractedSignalPix &sig = (*fSignals)[idx]; 166 MPedestalPix &ped = (*fPedestals)[idx]; 184 if ((*fBadPixels)[idx].IsUnsuitable()) 185 continue; 186 187 const MExtractedSignalPix &sig = (*fSignals)[idx]; 188 const MPedestalPix &ped = (*fPedestals)[idx]; 167 189 168 190 const Float_t pedrms = ped.GetPedestalRms()*fSqrtHiGainSamples; … … 186 208 } 187 209 210 // --------------------------------------------------------- 211 // 212 // In the PostProcess we... 213 // a) check the ratio of events which were accepted against 214 // fMinAcceptedFraction. 215 // b) check the ratio of events which were rejected against 216 // fMaxExcludedFraction. 217 // 218 // return failure (kFALSE) if condition is not fullfilled. 219 // 188 220 Int_t MFCosmics::PostProcess() 189 221 { 190 if (GetNumExecutions()==0) 222 const UInt_t n = GetNumExecutions(); 223 if (n==0) 191 224 return kTRUE; 192 225 … … 196 229 197 230 *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ; 198 *fLog << (int)(fCut[0]*100/ GetNumExecutions());231 *fLog << (int)(fCut[0]*100/n); 199 232 *fLog << "%) Detected cosmics " ; 200 233 *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels*100 << "%)" << endl; 201 234 202 235 *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ; 203 *fLog << (int)(fCut[1]*100/ GetNumExecutions());236 *fLog << (int)(fCut[1]*100/n); 204 237 *fLog << "%) No cosmics!" << endl; 205 238 *fLog << endl; 206 239 207 return kTRUE; 208 } 209 240 const Float_t min = fMinAcceptedFraction*n; 241 const Float_t max = fMaxExcludedFraction*n; 242 if (fCut[0]<min) 243 { 244 *fLog << err << "ERROR - Fraction of accepted events " << min*100; 245 *fLog << "% underrun " << fMinAcceptedFraction*100 << "%... abort." << endl; 246 return kFALSE; 247 } 248 if (fCut[1]>max) 249 { 250 *fLog << err << "ERROR - Fraction of excluded events " << max*100; 251 *fLog << "% exceeded " << fMaxExcludedFraction*100 << "%... abort." << endl; 252 return kFALSE; 253 } 254 255 return kTRUE; 256 } 257 258 // -------------------------------------------------------------------------- 259 // 260 // Read the setup from a TEnv, eg: 261 // MFCosmics.MaxEmptyPixels: 0.2 262 // MFCosmics.MaxExcludedFraction: 1 263 // MFCosmics.MinAcceptedFraction: 0 264 // 265 Int_t MFCosmics::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 266 { 267 Bool_t rc = kFALSE; 268 if (IsEnvDefined(env, prefix, "MaxEmptyPixels", print)) 269 { 270 rc = kTRUE; 271 SetMaxEmptyPixels(GetEnvValue(env, prefix, "MaxEmptyPixels", fMaxEmptyPixels)); 272 } 273 if (IsEnvDefined(env, prefix, "MaxExcludedFraction", print)) 274 { 275 rc = kTRUE; 276 SetMaxExcludedFraction(GetEnvValue(env, prefix, "MaxExcludedFraction", fMaxExcludedFraction)); 277 } 278 if (IsEnvDefined(env, prefix, "MinAcceptedFraction", print)) 279 { 280 rc = kTRUE; 281 fMinAcceptedFraction = GetEnvValue(env, prefix, "MinAcceptedFraction", fMinAcceptedFraction); 282 } 283 return rc; 284 } -
trunk/MagicSoft/Mars/mfilter/MFCosmics.h
r5803 r7043 9 9 10 10 class MPedestalCam; 11 class MBadPixelsCam; 11 12 class MExtractedSignalCam; 12 13 … … 18 19 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 19 20 MExtractedSignalCam *fSignals; // Calibration events of all pixels in the camera 21 MBadPixelsCam *fBadPixels; // Bad pixel used for exclusions 20 22 21 23 MRawEvtData *fRawEvt; // raw event data (time slices) … … 29 31 Float_t fSqrtHiGainSamples; // Square root of the number of used Hi-Gain Samples 30 32 33 Float_t fMinAcceptedFraction; // return error if exceeded 34 Float_t fMaxExcludedFraction; // return error if exceeded 35 36 // MFCosmics 37 Bool_t CosmicsRejection() const; 38 39 // MTask 31 40 Bool_t ReInit(MParList *pList); 32 41 Int_t PreProcess(MParList *pList); 33 42 Int_t Process(); 34 43 Int_t PostProcess(); 44 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 35 45 36 Bool_t CosmicsRejection() const; 37 46 // MFilter 38 47 Bool_t IsExpressionTrue() const { return fResult; } 39 48 … … 44 53 Float_t GetMaxEmptyPixels() const { return fMaxEmptyPixels; } 45 54 46 void SetNamePedestalCam(const char *name) { fNamePedestalCam = name; } 55 void SetMaxExcludedFraction(const Float_t n) { fMaxExcludedFraction = n; } 56 void SetMinAcceptedFraction(const Float_t n) { fMinAcceptedFraction = n; } 57 58 void SetNamePedestalCam(const char *name) { fNamePedestalCam = name; } 47 59 48 60 ClassDef(MFCosmics, 0) // Filter to perform a cosmics rejection -
trunk/MagicSoft/Mars/mfilter/Makefile
r6897 r7043 11 11 #------------------------------------------------------------------------------ 12 12 13 INCLUDES = -I. -I../mbase -I../mfbase -I../mraw -I../mmc -I../mdata \ 14 -I../manalysis -I../mfileio -I../mgeom -I../mimage \ 15 -I../mhbase -I../mmain -I../mgui -I../msignal -I../mpointing \ 16 -I../mpedestal 13 INCLUDES = -I. -I../mbase -I../mfbase -I../mraw -I../mdata \ 14 -I../mfileio -I../mgeom -I../mimage -I../mgui \ 15 -I../mhbase -I../msignal -I../mpedestal -I../mbadpixels 17 16 18 17 CINT = Filter -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.h
r6385 r7043 24 24 private: 25 25 26 static const Int_t fgChargeHiGainNbins; //! Nr. bins of HiGain Histograms (now set to: 550 )27 static const Axis_t fgChargeHiGainFirst; //! First Bin of HiGain Histograms (now set to: -100.5)28 static const Axis_t fgChargeHiGainLast; //! Last Bin of HiGain Histograms (now set to: 999.5)29 static const Int_t fgChargeLoGainNbins; //! First Bin of LoGain Histograms (now set to: 325 )30 static const Axis_t fgChargeLoGainFirst; //! First Bin of LoGain Histograms (now set to: -150.5)31 static const Axis_t fgChargeLoGainLast; //! Last Bin of LoGain Histograms (now set to: 499.5)32 static const Float_t fgProbLimit; //! The default for fProbLimit (now set to: 0.00001)26 static const Int_t fgChargeHiGainNbins; //! Nr. bins of HiGain Histograms 27 static const Axis_t fgChargeHiGainFirst; //! First Bin of HiGain Histograms 28 static const Axis_t fgChargeHiGainLast; //! Last Bin of HiGain Histograms 29 static const Int_t fgChargeLoGainNbins; //! First Bin of LoGain Histograms 30 static const Axis_t fgChargeLoGainFirst; //! First Bin of LoGain Histograms 31 static const Axis_t fgChargeLoGainLast; //! Last Bin of LoGain Histograms 32 static const Float_t fgProbLimit; //! The default for fProbLimit 33 33 34 static const TString fgReferenceFile; //! default for fReferenceFile ("mjobs/calibrationref.rc")34 static const TString fgReferenceFile; //! default for fReferenceFile 35 35 36 36 static const TString gsHistName; //! Default Histogram names … … 44 44 static const TString gsAbsHistYTitle; //! Default Histogram y-axis titles abs.times 45 45 46 static const Float_t fgNumHiGainSaturationLimit; //! The default for fNumHiGainSaturationLimit (now at: 0.01)47 static const Float_t fgNumLoGainSaturationLimit; //! The default for fNumLoGainSaturationLimit (now at: 0.005)46 static const Float_t fgNumHiGainSaturationLimit; //! The default for fNumHiGainSaturationLimit 47 static const Float_t fgNumLoGainSaturationLimit; //! The default for fNumLoGainSaturationLimit 48 48 49 static const Float_t fgTimeLowerLimit; //! Default for fTimeLowerLimit (now set to: 1.)50 static const Float_t fgTimeUpperLimit; //! Default for fTimeUpperLimit (now set to: 2.)49 static const Float_t fgTimeLowerLimit; //! Default for fTimeLowerLimit 50 static const Float_t fgTimeUpperLimit; //! Default for fTimeUpperLimit 51 51 52 Int_t fLoGainNbins; // Number of LoGain bins 52 Int_t fLoGainNbins; // Number of LoGain bins 53 53 Axis_t fLoGainFirst; // Lower histogram limit low gain 54 Axis_t fLoGainLast; // Upper histogram limit low gain 54 Axis_t fLoGainLast; // Upper histogram limit low gain 55 55 56 56 TString fAbsHistName; // Histogram names abs.times -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargePINDiode.cc
r6528 r7043 191 191 fHRmsCharge.SetBins(fRmsChargeNbins,fRmsChargeFirst,fRmsChargeLast); 192 192 193 fExclusionMean = 0; 194 fExclusionSigma = 0; 195 fExclusionChi2 = 0; 196 193 197 return kTRUE; 194 198 … … 250 254 const Float_t signal = (float)extractor->GetExtractedSignal(); 251 255 const Float_t time = extractor->GetExtractedTime(); 252 const Float_t rms = extractor->GetExtractedRms(); 253 256 const Float_t sigma = extractor->GetExtractedSigma(); 257 const Float_t chi2 = extractor->GetExtractedChi2(); 258 259 if (time < 3. || time > 24.) 260 { 261 fExclusionMean++; 262 return kTRUE; 263 } 264 265 if (sigma < 5. || sigma > 18.) 266 { 267 fExclusionSigma++; 268 return kTRUE; 269 } 270 271 if (chi2 > 0.35) 272 { 273 fExclusionChi2++; 274 return kTRUE; 275 } 276 254 277 FillHistAndArray(signal); 255 278 FillAbsTime(time); 256 FillRmsCharge( rms);279 FillRmsCharge(sigma); 257 280 258 281 return kTRUE; … … 293 316 FitRmsCharge(); 294 317 295 CreateFourierSpectrum();296 fPINDiode->SetOscillating ( !IsFourierSpectrumOK() );297 298 318 fPINDiode->SetMean ( fMean ); 299 319 fPINDiode->SetMeanVar ( fMeanErr * fMeanErr ); … … 311 331 312 332 fPINDiode->SetValid(kTRUE); 313 314 const Byte_t loweredge = fSigPIN->GetFirstUsedSlice();315 const Byte_t upperedge = fSigPIN->GetLastUsedSlice();316 const Float_t lowerlimit = (Float_t)loweredge + fTimeLowerLimit;317 const Float_t upperlimit = (Float_t)upperedge + fTimeUpperLimit;318 319 if (GetAbsTimeMean() < lowerlimit)320 {321 *fLog << warn << GetDescriptor()322 << Form("%s%3.1f%s%2.1f%s",": Mean ArrivalTime: ",GetAbsTimeMean()," smaller than ",323 lowerlimit," FADC slices from lower edge in PIN Diode") << endl;324 *fLog << warn << GetDescriptor() << ": No PIN Diode calibration!! " << endl;325 fPINDiode->SetValid(kFALSE);326 }327 328 if ( GetAbsTimeMean() > upperlimit )329 {330 *fLog << warn << GetDescriptor()331 << Form("%s%3.1f%s%2.1f%s",": Mean ArrivalTime: ",GetAbsTimeMean()," bigger than ",332 upperlimit," FADC slices from upper edge in PIN Diode") << endl;333 *fLog << warn << GetDescriptor() << ": No PIN Diode calibration!! " << endl;334 fPINDiode->SetValid(kFALSE);335 }336 333 337 334 return kTRUE; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargePINDiode.h
r5098 r7043 60 60 Float_t fTimeLowerLimit; // Limit dist. to first signal slice (units: FADC slices) 61 61 Float_t fTimeUpperLimit; // Limit dist. to last signal slice (units: FADC slices) 62 63 Int_t fExclusionMean; // Number of events excluded by deviating mean 64 Int_t fExclusionSigma; // Number of events excluded by deviating sigma 65 Int_t fExclusionChi2; // Number of events excluded by deviating chi2 62 66 63 67 public: … … 77 81 TH1F *GetHRmsCharge() { return &fHRmsCharge; } 78 82 const TH1F *GetHRmsCharge() const { return &fHRmsCharge; } 79 Float_t GetRmsChargeMean() 80 Float_t GetRmsChargeMeanErr() 81 Float_t GetRmsChargeSigma() 82 Float_t GetRmsChargeSigmaErr() 83 Float_t GetRmsChargeMean() const { return fRmsChargeMean; } 84 Float_t GetRmsChargeMeanErr() const { return fRmsChargeMeanErr; } 85 Float_t GetRmsChargeSigma() const { return fRmsChargeSigma; } 86 Float_t GetRmsChargeSigmaErr() const { return fRmsChargeSigmaErr; } 83 87 88 Int_t GetExclusionMean() const { return fExclusionMean; } 89 Int_t GetExclusionSigma() const { return fExclusionSigma; } 90 Int_t GetExclusionChi2() const { return fExclusionChi2; } 91 92 84 93 // Fill histos 85 94 Bool_t FillRmsCharge(const Float_t q); … … 108 117 void SetHistYTitle( const char *name ) { fHistYTitle = name; } 109 118 110 ClassDef(MHCalibrationChargePINDiode, 1) // Histogram class for Charge PIN Diode Calibration119 ClassDef(MHCalibrationChargePINDiode, 2) // Histogram class for Charge PIN Diode Calibration 111 120 }; 112 121 -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r7028 r7043 943 943 TText *t3 = pave2->AddText(Form("Signal Sigma smaller Pedestal RMS: %3i pixels", 944 944 CountBadPixels(&disp25,1))); 945 t3->SetTextColor(gStyle->GetColorPalette(Int_t(1./max2*numcol + 1.)));945 t3->SetTextColor(gStyle->GetColorPalette(Int_t(1./max2*numcol))); 946 946 t3->SetTextAlign(12); 947 948 TText *t7 = pave2->AddText(Form("Deviating Number of Photo-electrons: %3i pixels", 949 CountBadPixels(&disp25,2))); 950 t7->SetTextColor(gStyle->GetColorPalette(Int_t(2./max*numcol + 1.))); 951 t7->SetTextAlign(12); 952 953 TText *tt1 = pave2->AddText(Form("High Gain Signals could not be fitted: %3i pixels", 947 TText *tt1 = pave2->AddText(Form("High Gain Signals could not be fitted: %3i pixels", 954 948 CountBadPixels(&disp25,3))); 955 tt1->SetTextColor(gStyle->GetColorPalette(Int_t(3./max2*numcol + 1.)));949 tt1->SetTextColor(gStyle->GetColorPalette(Int_t(3./max2*numcol))); 956 950 tt1->SetTextAlign(12); 957 TText *tt2 = pave2->AddText(Form("Low Gain Signals could not be fitted: %3i pixels",951 TText *tt2 = pave2->AddText(Form("Low Gain Signals could not be fitted: %3i pixels", 958 952 CountBadPixels(&disp25,4))); 959 tt2->SetTextColor(gStyle->GetColorPalette(Int_t(4./max2*numcol + 1.)));953 tt2->SetTextColor(gStyle->GetColorPalette(Int_t(4./max2*numcol))); 960 954 tt2->SetTextAlign(12); 961 TText *tt3 = pave2->AddText(Form("Relative Arr. Times could not be fitted: %3i pixels",955 TText *tt3 = pave2->AddText(Form("Relative Arr. Times could not be fitted: %3i pixels", 962 956 CountBadPixels(&disp25,5))); 963 tt3->SetTextColor(gStyle->GetColorPalette(Int_t(5./max2*numcol + 1.)));957 tt3->SetTextColor(gStyle->GetColorPalette(Int_t(5./max2*numcol))); 964 958 tt3->SetTextAlign(12); 965 TText *tt4 = pave2->AddText(Form("High Gain Signals Oscillation: %3i pixels",959 TText *tt4 = pave2->AddText(Form("High Gain Signals Oscillation: %3i pixels", 966 960 CountBadPixels(&disp25,6))); 967 tt4->SetTextColor(gStyle->GetColorPalette(Int_t(6./max2*numcol + 1.)));961 tt4->SetTextColor(gStyle->GetColorPalette(Int_t(6./max2*numcol))); 968 962 tt4->SetTextAlign(12); 969 963 TText *tt5 = pave2->AddText(Form("Low Gain Signals Oscillation: %3i pixels", 970 964 CountBadPixels(&disp25,7))); 971 tt5->SetTextColor(gStyle->GetColorPalette(Int_t(7./max2*numcol + 1.)));965 tt5->SetTextColor(gStyle->GetColorPalette(Int_t(7./max2*numcol))); 972 966 tt5->SetTextAlign(12); 973 967 TText *tt6 = pave2->AddText(Form("Relative Arr. Times Oscillation: %3i pixels", 974 968 CountBadPixels(&disp25,8))); 975 tt6->SetTextColor(gStyle->GetColorPalette(Int_t(8./max2*numcol + 1.)));969 tt6->SetTextColor(gStyle->GetColorPalette(Int_t(8./max2*numcol))); 976 970 tt6->SetTextAlign(12); 977 TText *tt8 = pave2->AddText(Form("Deviating global F-Factor: 971 TText *tt8 = pave2->AddText(Form("Deviating global F-Factor: %3i pixels", 978 972 CountBadPixels(&disp25,9))); 979 tt8->SetTextColor(gStyle->GetColorPalette(Int_t(9./max2*numcol + 1.)));973 tt8->SetTextColor(gStyle->GetColorPalette(Int_t(9./max2*numcol))); 980 974 tt8->SetTextAlign(12); 981 975 pave2->Draw(); … … 1561 1555 Bool_t MJCalibration::CheckEnvLocal() 1562 1556 { 1563 1564 1557 TString dis = GetEnv("Display", ""); 1565 1558 if (dis.BeginsWith("Full", TString::kIgnoreCase)) … … 1935 1928 // 1936 1929 MFCosmics cosmics; 1937 MContinue cont(&cosmics); 1938 1939 if (fColor == MCalibrationCam::kCT1) 1940 tlist.AddToList(&cont); 1930 cosmics.SetMaxEmptyPixels(0.05); 1931 cosmics.SetMinAcceptedFraction(0.5); 1932 1933 MContinue cont(&cosmics, "ContCosmics"); 1934 tlist.AddToList(&cont); 1941 1935 1942 1936 MCalibColorSteer steer; -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r7029 r7043 154 154 } 155 155 156 MExtractor *MJPedestal::ReadCalibration() const156 MExtractor *MJPedestal::ReadCalibration() 157 157 { 158 158 const TString fname = Form("%s/calib%08d.root", fPathIn.Data(), fSequence.GetSequence()); … … 172 172 *fLog << err << dbginf << "ERROR - ExtractSignal read from " << fname << " doesn't inherit from MExtractor!" << endl; 173 173 return NULL; 174 } 175 176 if (file.FindKey("MBadPixelsCam")) 177 { 178 MBadPixelsCam bad; 179 if (bad.Read()<=0) 180 *fLog << warn << "Unable to read MBadPixelsCam from " << fname << endl; 181 else 182 fBadPixels.Merge(bad); 174 183 } 175 184 -
trunk/MagicSoft/Mars/mjobs/MJPedestal.h
r6979 r7043 74 74 Bool_t fIsUseHists; // Switch on histogramming or not 75 75 76 MExtractor *ReadCalibration() const;76 MExtractor *ReadCalibration(); 77 77 Bool_t ReadPedestalCam(); 78 78 Bool_t WriteResult(); -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc
r4984 r7043 150 150 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples); 151 151 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 152 152 153 const Int_t wshigain = fHiGainLast-fHiGainFirst+1; 154 const Int_t wslogain = fLoGainLast-fLoGainFirst+1; 155 156 switch (wshigain) 157 { 158 case 2: 159 SetResolutionPerPheHiGain(0.021); 160 break; 161 case 4: 162 case 6: 163 case 8: 164 case 10: 165 case 12: 166 case 14: 167 SetResolutionPerPheHiGain(0.011); 168 break; 169 default: 170 *fLog << warn << GetDescriptor() << ": Could not set the hi-gain extractor resolution/phe for window size " << wshigain << endl; 171 } 172 173 switch (wslogain) 174 { 175 case 4: 176 SetResolutionPerPheLoGain(0.063); 177 break; 178 case 6: 179 SetResolutionPerPheLoGain(0.017); 180 break; 181 case 8: 182 case 10: 183 SetResolutionPerPheLoGain(0.011); 184 break; 185 default: 186 *fLog << warn << GetDescriptor() << ": Could not set the lo-gain extractor resolution/phe for window size " << wslogain << endl; 187 } 153 188 } 154 189 -
trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc
r4896 r7043 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // 27 // 27 // MExtractPINDiode 28 28 // 29 29 // Extracts the signal from a fixed window in a given range. 30 30 // 31 31 // Call: SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast) 32 // to modify the ranges. Ranges have to be an even number. In case of odd33 // ranges, the last slice will be reduced by one.32 // to modify the ranges. 33 // 34 34 // Defaults are: 35 35 // 36 // fHiGainFirst = fgHiGainFirst = 3 37 // fHiGainLast = fgHiGainLast = 14 38 // fLoGainFirst = fgLoGainFirst = 3 39 // fLoGainLast = fgLoGainLast = 14 36 // fHiGainFirst = fgHiGainFirst = 0 37 // fHiGainLast = fgHiGainLast = 29 38 // fLoGainFirst = fgLoGainFirst = 0 39 // fLoGainLast = fgLoGainLast = 0 40 // 41 // The FADC slices are fit by a Gaussian around the pulse maximum. 42 // The following figures show two typical (high-intensity and low-intensity) 43 // pulses together with the applied fit: 44 // 45 //Begin_Html 46 /* 47 <img src="images/PINDiode_pulse_high.gif"> 48 <img src="images/PINDiode_pulse_low.gif"> 49 */ 50 //End_Html 51 // 52 // The fit ranges can be modified with the functions: 53 // - SetLowerFitLimit() 54 // - SetUpperFitLimit() 55 // 56 // Defaults are: 57 // - fLowerFitLimit: 2 58 // - fUpperFitLimit: 5 40 59 // 41 60 ////////////////////////////////////////////////////////////////////////////// … … 44 63 #include <fstream> 45 64 65 #include <TF1.h> 66 #include <TH1.h> 67 #include <TPad.h> 68 46 69 #include "MLog.h" 47 70 #include "MLogManip.h" … … 61 84 using namespace std; 62 85 63 const UInt_t MExtractPINDiode::fgPINDiodeIdx = 100; 64 const Byte_t MExtractPINDiode::fgHiGainFirst = 0; 65 const Byte_t MExtractPINDiode::fgHiGainLast = 14; 66 const Byte_t MExtractPINDiode::fgLoGainFirst = 0; 67 const Byte_t MExtractPINDiode::fgLoGainLast = 14; 86 const UInt_t MExtractPINDiode::fgPINDiodeIdx = 3; 87 const Byte_t MExtractPINDiode::fgHiGainFirst = 0; 88 const Byte_t MExtractPINDiode::fgHiGainLast = 29; 89 const Byte_t MExtractPINDiode::fgLoGainFirst = 0; 90 const Byte_t MExtractPINDiode::fgLoGainLast = 0; 91 const Byte_t MExtractPINDiode::fgLowerFitLimit = 2; 92 const Byte_t MExtractPINDiode::fgUpperFitLimit = 5; 93 68 94 // -------------------------------------------------------------------------- 69 95 // … … 72 98 // Calls: 73 99 // - SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast) 74 // - SetPINDiodeIdx() 100 // 101 // - Set fPINDiodeIdx to fgPINDiodeIdx 102 // - Set fLowerFitLimit to fgLowerFitLimit 103 // - Set fUpperFitLimit to fgUpperFitLimit 75 104 // 76 105 MExtractPINDiode::MExtractPINDiode(const char *name, const char *title) 77 { 78 106 : fSlices(NULL) 107 { 108 79 109 fName = name ? name : "MExtractPINDiode"; 80 110 fTitle = title ? title : "Task to extract the signal from the FADC slices"; … … 82 112 SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast); 83 113 SetPINDiodeIdx(); 114 115 SetLowerFitLimit(); 116 SetUpperFitLimit(); 117 118 fPedMean.Set(2); 119 } 120 121 // -------------------------------------------------------------------------- 122 // 123 // - delete the histogram fSlices, if it exists 124 // 125 MExtractPINDiode::~MExtractPINDiode() 126 { 127 if (fSlices) 128 delete fSlices; 84 129 } 85 130 … … 89 134 // 90 135 // Checks: 91 // - if the window defined by (fHiGainLast-fHiGainFirst-1) are odd, subtract one 92 // - if the window defined by (fLoGainLast-fLoGainFirst-1) are odd, subtract one 93 // - if the Hi Gain window is smaller than 2, set fHiGainLast to fHiGainFirst+1 94 // - if the Lo Gain window is smaller than 2, set fLoGainLast to fLoGainFirst+1 136 // - if the Hi Gain window is smaller than 4, set fHiGainLast to fHiGainFirst+3 95 137 // 96 138 // Calls: … … 99 141 // Sets: 100 142 // - fNumHiGainSamples to: (Float_t)(fHiGainLast-fHiGainFirst+1) 101 // - fNumLoGainSamples to: (Float_t)(fLoGainLast-fLoGainFirst+1)143 // - fNumLoGainSamples to: 0. 102 144 // - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples) 103 // - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples)145 // - fSqrtLoGainSamples to: 0. 104 146 // 105 147 void MExtractPINDiode::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast) 106 148 { 107 149 108 const Byte_t window = hilast-hifirst+1+lolast-lofirst+1; 109 const Byte_t weven = window & ~1; 110 111 if (weven != window) 150 lofirst = 0; 151 lolast = 0; 152 153 const Byte_t window = hilast-hifirst+1; 154 155 if (window<4) 112 156 { 113 157 *fLog << warn << GetDescriptor() 114 << Form("%s%2i%s%2i",": Total window size has to be even, set last slice from " 115 ,(int)lolast," to ",(int)(lolast-1)) << endl; 116 lolast -= 1; 117 } 118 119 if (window<2) 120 { 121 *fLog << warn << GetDescriptor() 122 << Form("%s%2i%s%2i",": Total window is smaller than 2 FADC sampes, set last slice from" 123 ,(int)lolast," to ",(int)(lofirst+1)) << endl; 124 hilast = hifirst+1; 125 } 126 158 << Form("%s%2i%s%2i",": Total window is smaller than 4 FADC sampes, set last slice from" 159 ,(int)lolast," to ",(int)(lofirst+3)) << endl; 160 hilast = hifirst+3; 161 } 127 162 128 163 MExtractor::SetRange(hifirst,hilast,lofirst,lolast); 129 164 130 165 fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1); 131 fNumLoGainSamples = (fLoGainLast == 0) ? 0. : (Float_t)(fLoGainLast-fLoGainFirst+1);166 fNumLoGainSamples = 0.; 132 167 133 168 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples); 134 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 135 136 fNumSamples = (fLoGainLast == 0) 137 ? fHiGainLast-fHiGainFirst+1 138 : fHiGainLast-fHiGainFirst+1+fLoGainLast-fLoGainFirst+1; 139 fSqrtSamples = TMath::Sqrt((Float_t)fNumSamples); 169 fSqrtLoGainSamples = 0.; 140 170 141 171 } … … 149 179 // they were not found: 150 180 // 181 // - MRawEvtData2 151 182 // - MExtractedPINDiode 183 // 184 // Initializes fPedMean to: 185 // - fPedMean[0]: pedestal + AB-offset 186 // - fPedMean[1]: pedestal - AB-offset 187 // 188 // Initializes TH1F fSlices to [fHiGainFirst-0.5,fHiGainLast+0.5] 152 189 // 153 190 Int_t MExtractPINDiode::PreProcess(MParList *pList) … … 157 194 return kFALSE; 158 195 196 fRawEvt = NULL; 197 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData2")); 198 if (!fRawEvt) 199 { 200 *fLog << err << AddSerialNumber("MRawEvtData2") << " not found... aborting." << endl; 201 return kFALSE; 202 } 203 159 204 fPINDiode = (MExtractedSignalPINDiode*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalPINDiode")); 160 205 if (!fPINDiode) 161 206 return kFALSE; 162 207 208 fPedMean.Reset(); 209 163 210 const MPedestalPix &ped = (*fPedestals)[fPINDiodeIdx]; 164 211 165 166 167 fPedestal = ped.GetPedestal();168 fPedRms = ped.GetPedestalRms();169 170 171 172 173 212 if (&ped) 213 { 214 fPedMean[0] = ped.GetPedestal() + ped.GetPedestalABoffset(); 215 fPedMean[1] = ped.GetPedestal() - ped.GetPedestalABoffset(); 216 } 217 else 218 { 219 *fLog << err << " Cannot find MPedestalPix of the PIN Diode (idx=" 220 << fPINDiodeIdx << ")" << endl; 174 221 return kFALSE; 175 } 176 177 return kTRUE; 222 } 223 224 if (fSlices) 225 delete fSlices; 226 227 fSlices = new TH1F("PINDiode","PIN Diode fitted slices",(Int_t)(fHiGainLast-fHiGainFirst+1), 228 fHiGainFirst-0.5,fHiGainLast+0.5); 229 fSlices->SetDirectory(NULL); 230 231 return kTRUE; 178 232 } 179 233 … … 190 244 191 245 fPINDiode->SetUsedFADCSlices(fHiGainFirst, fLoGainLast); 192 246 247 *fLog << endl; 248 *fLog << inf << "Taking " << fNumHiGainSamples 249 << " HiGain samples from slice " << (Int_t)fHiGainFirst 250 << " to " << (Int_t)(fHiGainLast+fHiLoLast) << " incl" << endl; 251 193 252 return kTRUE; 194 195 } 196 197 198 199 void MExtractPINDiode::FindSignalandVarianceHiGain(Byte_t *ptr, Int_t &sum, Int_t &sum2, Byte_t &sat) const 200 { 201 202 Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; 203 253 } 254 255 256 257 258 // ---------------------------------------------------------------------------------- 259 // 260 // Extracts the (pedestal-subtracted) FADC slices between fHiGainFirst and fHiGainLast 261 // and fills them into the histogram fSlices. Memorizes the position of maximum at 262 // maxpos. 263 // 264 // Checks for saturation 265 // 266 // Fits fSlices to a Gaussian in the ranges: maxpos-fLowerFitLimit, maxpos+fUpperFitLimit 267 // 268 // Writes fit results into MExtractedSignalPINDiode 269 // 270 Int_t MExtractPINDiode::Process() 271 { 272 273 274 MRawEvtPixelIter pixel(fRawEvt); 275 276 fPINDiode->Clear(); 277 fSlices->Reset(); 278 279 pixel.Jump(fPINDiodeIdx); 280 281 Byte_t sat = 0; 282 283 Int_t higainsamples = pixel.GetNumHiGainSamples(); 284 Int_t logainsamples = pixel.GetNumLoGainSamples(); 285 286 const Bool_t higainabflag = pixel.HasABFlag(); 287 Byte_t *ptr = pixel.GetHiGainSamples()+fHiGainFirst; 288 Byte_t *end = ptr+higainsamples; 289 290 Int_t cnt=0; 291 292 Float_t max = 0.; 293 Int_t maxpos = 0; 294 204 295 while (ptr<end) 205 296 { 206 sum += *ptr;207 sum2 += *ptr * *ptr;208 209 if (*ptr++ >= fSaturationLimit)210 sat++;211 }212 }213 214 void MExtractPINDiode::FindSignalandVarianceLoGain(Byte_t *ptr, Int_t &sum, Int_t &sum2, Byte_t &sat) const215 {216 217 Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1;218 219 while (ptr<end)220 {221 sum += *ptr;222 sum2 += *ptr * *ptr;223 297 224 if (*ptr++ >= fSaturationLimit) 225 sat++; 226 } 227 } 228 229 230 231 // -------------------------------------------------------------------------- 232 // 233 // Calculate the integral of the FADC time slices and store them as a new 234 // pixel in the MExtractedPINDiode container. 235 // 236 Int_t MExtractPINDiode::Process() 237 { 238 239 240 MRawEvtPixelIter pixel(fRawEvt); 241 242 fPINDiode->Clear(); 243 244 pixel.Jump(fPINDiodeIdx); 245 246 Int_t sum = 0; 247 Int_t sum2 = 0; 248 Byte_t sat = 0; 249 Int_t max = 0; 250 251 // 252 // Calculate first the time: 253 // 254 const Int_t maxhi = pixel.GetIdxMaxHiGainSample(); 255 const Int_t maxlo = pixel.GetIdxMaxLoGainSample(); 256 257 if (maxhi > maxlo) 258 max = maxhi; 259 else 260 max = maxlo + pixel.GetNumHiGainSamples(); 261 262 FindSignalandVarianceHiGain(pixel.GetHiGainSamples()+fHiGainFirst,sum,sum2,sat); 263 if (pixel.HasLoGain()) 264 FindSignalandVarianceLoGain(pixel.GetLoGainSamples()+fLoGainFirst,sum,sum2,sat); 265 266 const Float_t var = ((Float_t)sum2 - (Float_t)sum*sum/fNumSamples)/(fNumSamples-1); 267 const Float_t rms = TMath::Sqrt(var); 268 269 // 270 // FIXME: The following formulae have to be revised!! 271 // 272 fPINDiode->SetExtractedSignal(sum - fPedestal*fNumSamples, fPedRms*fSqrtSamples); 273 fPINDiode->SetExtractedRms (rms, rms/2./fSqrtSamples); 274 fPINDiode->SetExtractedTime (max, rms/fSqrtSamples); 275 fPINDiode->SetSaturation(sat); 298 if (*ptr >= fSaturationLimit) 299 { 300 sat++; 301 break; 302 } 303 304 const Float_t cont = (Float_t)*ptr - fPedMean[(cnt + higainabflag) & 0x1]; 305 fSlices->Fill(cnt,cont); 306 307 if (cont > max) 308 { 309 max = cont; 310 maxpos = cnt; 311 } 312 313 ptr++; 314 cnt++; 315 } 316 317 cnt = 0; 318 319 if (pixel.HasLoGain() && !sat) 320 { 321 322 ptr = pixel.GetLoGainSamples(); 323 end = ptr+logainsamples; 324 325 const Bool_t logainabflag = (higainabflag + pixel.GetNumHiGainSamples()) & 0x1; 326 327 while (ptr<end) 328 { 329 330 if (*ptr >= fSaturationLimit) 331 { 332 sat++; 333 break; 334 } 335 336 const Float_t cont = (Float_t)*ptr - fPedMean[(cnt + logainabflag) & 0x1]; 337 338 fSlices->Fill(cnt+ higainsamples,cont); 339 340 if (cont > max) 341 { 342 max = cont; 343 maxpos = cnt+higainsamples; 344 } 345 ptr++; 346 cnt++; 347 } 348 } 349 350 if (sat) 351 { 352 fPINDiode->SetSaturation(1); 353 return kTRUE; 354 } 355 356 fSlices->Fit("gaus", "RQ", "", maxpos-fLowerFitLimit,maxpos+fUpperFitLimit); 357 358 TF1 *gausfunc = fSlices->GetFunction("gaus"); 359 360 fPINDiode->SetExtractedSignal(gausfunc->GetParameter(0), gausfunc->GetParError(0)); 361 fPINDiode->SetExtractedTime (gausfunc->GetParameter(1), gausfunc->GetParError(1)); 362 fPINDiode->SetExtractedSigma (gausfunc->GetParameter(2), gausfunc->GetParError(2)); 363 fPINDiode->SetExtractedChi2 (gausfunc->GetChisquare()); 276 364 fPINDiode->SetReadyToSave(); 277 365 278 366 return kTRUE; 279 367 } 280 368 369 // ---------------------------------------------------------------------------------- 370 // 371 // deletes fSlices and sets pointer to NULL 372 // 373 Int_t MExtractPINDiode::PostProcess() 374 { 375 376 delete fSlices; 377 fSlices = NULL; 378 379 return kTRUE; 380 } -
trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h
r3962 r7043 15 15 #endif 16 16 17 #ifndef MARS_MArrayF 18 #include "MArrayF.h" 19 #endif 20 21 class TH1F; 17 22 class MExtractedSignalPINDiode; 23 18 24 class MExtractPINDiode : public MExtractor 19 25 { … … 21 27 22 28 static const UInt_t fgPINDiodeIdx; 23 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain ( currentlyset to: 3)24 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (currentlyset to: 14)25 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain ( currentlyset to: 3)26 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currentlyset to: 14)29 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain (now set to: 3) 30 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (now set to: 14) 31 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain (now set to: 3) 32 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (now set to: 14) 27 33 28 MExtractedSignalPINDiode *fPINDiode; // Extracted signal of the PIN Diode 34 static const Byte_t fgLowerFitLimit; // Default for fLowerFitLimit (now set to: 2) 35 static const Byte_t fgUpperFitLimit; // Default for fUpperFitLimit (now set to: 5) 29 36 30 UInt_t fPINDiodeIdx; 31 Float_t fPedestal; 32 Float_t fPedRms; 33 Int_t fNumSamples; 34 Float_t fSqrtSamples; 37 Byte_t fLowerFitLimit; // Number of FADC slices before maximum to start fit 38 Byte_t fUpperFitLimit; // Number of FADC slices after maximum to end fit 35 39 36 void FindSignalandVarianceHiGain(Byte_t *ptr, Int_t &sum, Int_t &sum2, Byte_t &sat) const; 37 void FindSignalandVarianceLoGain(Byte_t *ptr, Int_t &sum, Int_t &sum2, Byte_t &sat) const; 38 39 Int_t PreProcess(MParList *pList); 40 Bool_t ReInit(MParList *pList); 41 Int_t Process(); 40 MExtractedSignalPINDiode *fPINDiode; // Extracted signal of the PIN Diode 41 TH1F *fSlices; // Histogram to fit the slices 42 43 UInt_t fPINDiodeIdx; // PIN Diode pixel ID 44 45 MArrayF fPedMean; // The used pedestals (0: ped+AB, 1: ped-AB) 46 47 Int_t PreProcess( MParList *pList ); 48 Bool_t ReInit ( MParList *pList ); 49 Int_t Process (); 50 Int_t PostProcess(); 42 51 43 52 public: 44 53 45 54 MExtractPINDiode(const char *name=NULL, const char *title=NULL); 55 ~MExtractPINDiode(); 46 56 47 57 // Setters 48 58 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 49 void SetPINDiodeIdx( const UInt_t idx=fgPINDiodeIdx ) { fPINDiodeIdx = idx; } 59 void SetPINDiodeIdx ( const UInt_t idx=fgPINDiodeIdx ) { fPINDiodeIdx = idx; } 60 void SetLowerFitLimit( const Byte_t lim=fgLowerFitLimit ) { fLowerFitLimit = lim; } 61 void SetUpperFitLimit( const Byte_t lim=fgUpperFitLimit ) { fUpperFitLimit = lim; } 50 62 51 ClassDef(MExtractPINDiode, 0) // Signal Extractor for the PIN Diode63 ClassDef(MExtractPINDiode, 1) // Signal Extractor for the PIN Diode 52 64 }; 53 65 -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc
r7028 r7043 78 78 const Int_t MExtractTimeAndChargeDigitalFilter::fgSignalStartBinHiGain = 4; 79 79 const Int_t MExtractTimeAndChargeDigitalFilter::fgSignalStartBinLoGain = 4; 80 const TString MExtractTimeAndChargeDigitalFilter::fgNameWeightsFile = "msignal/cosmics_weights 46.dat";80 const TString MExtractTimeAndChargeDigitalFilter::fgNameWeightsFile = "msignal/cosmics_weights.dat"; 81 81 const Float_t MExtractTimeAndChargeDigitalFilter::fgOffsetLoGain = 1.7; // 5 ns 82 const Float_t MExtractTimeAndChargeDigitalFilter::fgLoGainStartShift = - 2.8;82 const Float_t MExtractTimeAndChargeDigitalFilter::fgLoGainStartShift = -1.8; 83 83 84 84 // -------------------------------------------------------------------------- … … 753 753 754 754 CalcBinningResArrays(); 755 756 switch (fWindowSizeHiGain) 757 { 758 case 4: 759 SetResolutionPerPheHiGain(0.036); 760 break; 761 case 6: 762 SetResolutionPerPheHiGain(0.021); 763 break; 764 default: 765 *fLog << warn << "Could not set the high-gain extractor resolution per phe for window size " 766 << fWindowSizeHiGain << endl; 767 } 768 769 switch (fWindowSizeLoGain) 770 { 771 case 4: 772 SetResolutionPerPheLoGain(0.005); 773 break; 774 case 6: 775 SetResolutionPerPheLoGain(0.004); 776 break; 777 default: 778 *fLog << warn << "Could not set the low-gain extractor resolution per phe for window size " 779 << fWindowSizeLoGain << endl; 780 } 755 781 756 782 fWeightsSet = kTRUE; -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSlidingWindow.cc
r6840 r7043 76 76 const Byte_t MExtractTimeAndChargeSlidingWindow::fgHiGainWindowSize = 6; 77 77 const Byte_t MExtractTimeAndChargeSlidingWindow::fgLoGainWindowSize = 6; 78 78 79 // -------------------------------------------------------------------------- 79 80 // … … 176 177 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 177 178 179 switch (fWindowSizeHiGain) 180 { 181 case 2: 182 SetResolutionPerPheHiGain(0.050); 183 break; 184 case 4: 185 SetResolutionPerPheHiGain(0.039); 186 break; 187 case 6: 188 case 8: 189 SetResolutionPerPheHiGain(0.011); 190 break; 191 case 14: 192 SetResolutionPerPheHiGain(0.009); 193 break; 194 default: 195 *fLog << warn << GetDescriptor() << ": Could not set the high-gain extractor resolution per phe for window size " 196 << fWindowSizeHiGain << endl; 197 } 198 199 switch (fWindowSizeLoGain) 200 { 201 case 2: 202 SetResolutionPerPheLoGain(0.028); 203 break; 204 case 4: 205 SetResolutionPerPheLoGain(0.013); 206 break; 207 case 6: 208 SetResolutionPerPheLoGain(0.008); 209 break; 210 case 8: 211 case 10: 212 SetResolutionPerPheLoGain(0.005); 213 break; 214 default: 215 *fLog << warn << GetDescriptor() << ": Could not set the low-gain extractor resolution per phe for window size " 216 << fWindowSizeLoGain << endl; 217 } 178 218 } 179 219 -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSlidingWindow.h
r5511 r7043 11 11 12 12 class MPedestalPix; 13 13 14 class MExtractTimeAndChargeSlidingWindow : public MExtractTimeAndCharge 14 15 { 15 16 16 private: 17 18 17 static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 2) 19 18 static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to: 14) … … 49 48 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag); 50 49 51 ClassDef(MExtractTimeAndChargeSlidingWindow, 0) // Task to Extract Times and Charges using a Sliding Window50 ClassDef(MExtractTimeAndChargeSlidingWindow, 1) // Task to Extract Times and Charges using a Sliding Window 52 51 }; 53 52 -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc
r7034 r7043 233 233 fWindowSizeLoGain = 1; 234 234 fRiseTimeHiGain = 0.5; 235 236 SetResolutionPerPheHiGain(0.053); 237 SetResolutionPerPheLoGain(0.016); 235 238 236 239 return; … … 242 245 fNumHiGainSamples = fRiseTimeHiGain + fFallTimeHiGain; 243 246 fNumLoGainSamples = fLoGainLast ? fRiseTimeLoGain + fFallTimeLoGain : 0.; 244 // fNumLoGainSamples *= 0.75;245 247 246 248 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples); 247 249 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 248 fWindowSizeHiGain = (Int_t)(fRiseTimeHiGain + fFallTimeHiGain); 249 fWindowSizeLoGain = (Int_t)((fRiseTimeLoGain + fFallTimeLoGain)*fLoGainStretch); 250 // fNumLoGainSamples *= 0.75; 251 } 250 fWindowSizeHiGain = TMath::Nint(fRiseTimeHiGain + fFallTimeHiGain); 251 // to ensure that for the case: 1.5, the window size becomes: 2 (at any compiler) 252 fWindowSizeLoGain = TMath::Nint(TMath::Ceil((fRiseTimeLoGain + fFallTimeLoGain)*fLoGainStretch)); 253 } 254 255 switch (fWindowSizeHiGain) 256 { 257 case 1: 258 SetResolutionPerPheHiGain(0.041); 259 break; 260 case 2: 261 SetResolutionPerPheHiGain(0.064); 262 break; 263 case 3: 264 case 4: 265 SetResolutionPerPheHiGain(0.050); 266 break; 267 case 5: 268 case 6: 269 SetResolutionPerPheHiGain(0.030); 270 break; 271 default: 272 *fLog << warn << GetDescriptor() << ": Could not set the high-gain extractor resolution per phe for window size " 273 << fWindowSizeHiGain << endl; 274 break; 275 } 276 277 switch (fWindowSizeLoGain) 278 { 279 case 1: 280 case 2: 281 SetResolutionPerPheLoGain(0.005); 282 break; 283 case 3: 284 case 4: 285 SetResolutionPerPheLoGain(0.017); 286 break; 287 case 5: 288 case 6: 289 case 7: 290 SetResolutionPerPheLoGain(0.005); 291 break; 292 case 8: 293 case 9: 294 SetResolutionPerPheLoGain(0.005); 295 break; 296 default: 297 *fLog << warn << "Could not set the low-gain extractor resolution per phe for window size " 298 << fWindowSizeLoGain << endl; 299 break; 300 } 252 301 } 253 302 -
trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.cc
r3322 r7043 39 39 40 40 using namespace std; 41 42 static const Float_t gkSignalInitializer = 99999.9;43 44 41 // ------------------------------------------------------------------------ 45 42 // … … 49 46 // Additionally, the number of saturated Slices are stored. 50 47 // 51 // Default values for the extracted signals are: 99999.948 // Default values for the extracted signals are: -1. 52 49 // 53 50 MExtractedSignalPINDiode::MExtractedSignalPINDiode(const char* name, const char* title) … … 62 59 // ------------------------------------------------------------------------ 63 60 // 64 // Invalidate values 61 // Invalidate values to -1. 65 62 // 66 63 void MExtractedSignalPINDiode::Clear(Option_t *o) 67 64 { 68 fExtractedSignal = gkSignalInitializer;69 fExtractedSignalErr = gkSignalInitializer;70 fExtractedTime = gkSignalInitializer;71 fExtractedTimeErr = gkSignalInitializer;72 fExtractedRms = gkSignalInitializer;73 fExtractedRmsErr = gkSignalInitializer;74 65 75 fNumSaturated = 0; 66 fExtractedSignal = -1.; 67 fExtractedSignalErr = -1.; 68 fExtractedTime = -1.; 69 fExtractedTimeErr = -1.; 70 fExtractedSigma = -1.; 71 fExtractedSigmaErr = -1.; 72 fExtractedChi2 = -1.; 73 74 fSaturated = kFALSE; 75 76 76 } 77 77 … … 85 85 void MExtractedSignalPINDiode::SetExtractedSignal(const Float_t sig, const Float_t sigerr) 86 86 { 87 fExtractedSignal 87 fExtractedSignal = sig; 88 88 fExtractedSignalErr = sigerr; 89 89 } 90 90 91 void MExtractedSignalPINDiode::SetExtracted Rms(const Float_t sig, const Float_t sigerr)91 void MExtractedSignalPINDiode::SetExtractedSigma(const Float_t sig, const Float_t sigerr) 92 92 { 93 fExtracted Rms= sig;94 fExtracted RmsErr = sigerr;93 fExtractedSigma = sig; 94 fExtractedSigmaErr = sigerr; 95 95 } 96 96 97 97 void MExtractedSignalPINDiode::SetExtractedTime(const Float_t sig, const Float_t sigerr) 98 98 { 99 fExtractedTime 99 fExtractedTime = sig; 100 100 fExtractedTimeErr = sigerr; 101 101 } 102 102 103 104 103 Bool_t MExtractedSignalPINDiode::IsValid() const 105 104 { 106 return fExtractedSignal >= 0. || fExtractedSignalErr >= 0.; 107 } 108 109 void MExtractedSignalPINDiode::SetSaturation(const Byte_t numsat) 110 { 111 fNumSaturated = numsat; 105 if (fSaturated) 106 return kFALSE; 107 108 return fExtractedSignal >= 0. || fExtractedSignalErr >= 0.; 112 109 } 113 110 114 111 void MExtractedSignalPINDiode::Print(Option_t *o) const 115 112 { 116 *fLog << " Signal: " << fExtractedSignal 117 << " +- " << fExtractedSignalErr 118 << " Nr. Saturation: " << fNumSaturated 113 *fLog << Form(" Signal: %4.2f+-%4.2f",fExtractedSignal,fExtractedSignalErr) 114 << Form(" Arr.Time: %4.2f+-%4.2f",fExtractedTime,fExtractedTimeErr) 115 << Form(" Sigma: %4.2f+-%4.2f",fExtractedSigma,fExtractedSigmaErr) 116 << Form(" Chi2: %5.2f",fExtractedChi2) 117 << Form(" Saturation: %s",fSaturated ? "yes" : "no") 119 118 << endl; 120 119 } -
trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.h
r4274 r7043 10 10 private: 11 11 12 Float_t fExtractedSignal; // mean value of the extracted signal 13 Float_t fExtractedSignalErr; // error of the mean value of the extracted signal 14 Float_t fExtractedTime; 15 Float_t fExtractedTimeErr; 16 Float_t fExtractedRms; 17 Float_t fExtractedRmsErr; 18 19 Byte_t fFirst; 20 Byte_t fNumFADCSamples; 21 Byte_t fNumSaturated; 12 Float_t fExtractedSignal; // Extracted signal amplitude 13 Float_t fExtractedSignalErr; // Error extracted signal amplitude 14 Float_t fExtractedTime; // Position of signal amplitude 15 Float_t fExtractedTimeErr; // Error position of signal amplitude 16 Float_t fExtractedSigma; // Width Gauss fit 17 Float_t fExtractedSigmaErr; // Error of width 18 Float_t fExtractedChi2; // Chi2 Gauss fit 19 20 Byte_t fNumFADCSamples; // Number of used FADC slices 21 Byte_t fFirst; // First FADC slice to start extraction 22 23 Bool_t fSaturated; // FADC saturation occurrance flag 22 24 23 25 public: 24 MExtractedSignalPINDiode(const char* name=NULL, const char* title=NULL);25 26 26 void Clear(Option_t *o=""); 27 void Print(Option_t *o="") const; 27 MExtractedSignalPINDiode(const char* name=NULL, const char* title=NULL); 28 29 void Clear(Option_t *o=""); 30 31 // Getter 32 Float_t GetExtractedSignal() const { return fExtractedSignal; } 33 Float_t GetExtractedSignalErr() const { return fExtractedSignalErr; } 34 Float_t GetExtractedTime() const { return fExtractedTime; } 35 Float_t GetExtractedTimeErr() const { return fExtractedTimeErr; } 36 Float_t GetExtractedSigma() const { return fExtractedSigma; } 37 Float_t GetExtractedSigmaErr() const { return fExtractedSigmaErr; } 38 Float_t GetExtractedChi2() const { return fExtractedChi2; } 39 Byte_t GetNumFADCSamples() const { return fNumFADCSamples; } 40 41 Bool_t IsValid() const; 42 43 // Print 44 void Print(Option_t *o="") const; 28 45 29 // Setter 30 void SetExtractedSignal(const Float_t sig, const Float_t sigerr); 31 void SetExtractedRms( const Float_t sig, const Float_t sigerr); 32 void SetExtractedTime( const Float_t sig, const Float_t sigerr); 33 void SetSaturation( const Byte_t numsat); 34 void SetUsedFADCSlices( const Byte_t first, const Byte_t num); 35 36 // Getter 37 Float_t GetExtractedSignal() const { return fExtractedSignal; } 38 Float_t GetExtractedSignalErr() const { return fExtractedSignalErr; } 39 Float_t GetExtractedTime() const { return fExtractedTime; } 40 Float_t GetExtractedTimeErr() const { return fExtractedTimeErr; } 41 Float_t GetExtractedRms() const { return fExtractedRms; } 42 Float_t GetExtractedRmsErr() const { return fExtractedRmsErr; } 43 Byte_t GetNumFADCSamples() const { return fNumFADCSamples; } 44 Byte_t GetFirstUsedSlice() const { return fFirst; } 45 Byte_t GetLastUsedSlice() const { return fFirst+fNumFADCSamples; } 46 47 Bool_t IsValid() const; 46 // Setter 47 void SetExtractedSignal(const Float_t sig, const Float_t sigerr); 48 void SetExtractedSigma( const Float_t sig, const Float_t sigerr); 49 void SetExtractedTime( const Float_t sig, const Float_t sigerr); 50 void SetExtractedChi2( const Float_t chi ) { fExtractedChi2 = chi; } 51 void SetSaturation ( const Bool_t b=kTRUE) { fSaturated = b; } 52 void SetUsedFADCSlices( const Byte_t first, const Byte_t num); 48 53 49 ClassDef(MExtractedSignalPINDiode, 1) // Storage Container for Extracted Signal information of one pixel54 ClassDef(MExtractedSignalPINDiode, 2) // Storage Container for Extracted Signal information of one pixel 50 55 }; 51 56 -
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r6820 r7043 64 64 //End_Html 65 65 // 66 // Class Version 6: 67 // +Float_t fResolutionPerPheHiGain; // Extractor-dependent charge resolution per phe for high-gain (see TDAS-0502). 68 // +Float_t fResolutionPerPheLoGain; // Extractor-dependent charge resolution per phe for low-gain (see TDAS-0502). 69 // 70 // 66 71 // Input Containers: 67 72 // MRawEvtData … … 100 105 const TString MExtractor::fgNameSignalCam = "MExtractedSignalCam"; 101 106 const Float_t MExtractor::fgOffsetLoGain = 1.51; // 5 ns 107 102 108 // -------------------------------------------------------------------------- 103 109 // … … 116 122 // 117 123 MExtractor::MExtractor(const char *name, const char *title) 118 : fPedestals(NULL), fSignals(NULL), fRawEvt(NULL), fRunHeader(NULL), 119 fHiLoLast(0), fNumHiGainSamples(0.), fNumLoGainSamples(0.) 124 : fResolutionPerPheHiGain(0), fResolutionPerPheLoGain(0), 125 fPedestals(NULL), fSignals(NULL), fRawEvt(NULL), fRunHeader(NULL), 126 fHiLoLast(0), fNumHiGainSamples(0), fNumLoGainSamples(0) 120 127 { 121 128 fName = name ? name : "MExtractor"; -
trunk/MagicSoft/Mars/msignal/MExtractor.h
r6820 r7043 23 23 { 24 24 private: 25 26 25 static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.51 (= 5ns) 27 26 28 27 Bool_t fNoiseCalculation; //! Flag if extractor determines noise contribution from pedestal file. 28 29 Float_t fResolutionPerPheHiGain; // Extractor-dependent charge resolution per phe for high-gain (see TDAS-0502). 30 Float_t fResolutionPerPheLoGain; // Extractor-dependent charge resolution per phe for low-gain (see TDAS-0502). 29 31 30 32 protected: 31 32 33 static const Byte_t fgSaturationLimit; //! Default for fSaturationLimit (now set to: 254) 33 34 static const TString fgNamePedestalCam; //! "MPedestalCam" … … 54 55 Float_t fSqrtHiGainSamples; // Sqrt. nr. High Gain FADC slices used to extract the signal 55 56 Float_t fSqrtLoGainSamples; // Sqrt. nr. Low Gain FADC slices used to extract the signal 56 57 57 58 Byte_t fSaturationLimit; // Highest FADC slice value until being declared saturated 59 58 60 TString fNamePedestalCam; // Name of the 'MPedestalCam' container 59 61 TString fNameSignalCam; // Name of the 'MExtractedSignalCam' container 60 62 63 // MExtractor 61 64 virtual void FindSignalHiGain(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const { } 62 65 virtual void FindSignalLoGain(Byte_t *firstused, Float_t &sum, Byte_t &sat) const { } 63 66 67 void SetResolutionPerPheHiGain(Float_t f) { fResolutionPerPheHiGain=f; } 68 void SetResolutionPerPheLoGain(Float_t f) { fResolutionPerPheLoGain=f; } 69 64 70 Int_t PreProcessStd(MParList *pList); 71 72 // MTask 65 73 Int_t PreProcess( MParList *pList ); 66 74 Bool_t ReInit ( MParList *pList ); … … 69 77 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 70 78 79 71 80 public: 72 81 MExtractor(const char *name=NULL, const char *title=NULL); 73 82 74 void Clear(Option_t *o="") 75 { 76 fHiGainFirst = fHiGainLast = fLoGainFirst = fLoGainLast = fHiLoLast = 0; 77 } 78 83 // getter 79 84 Byte_t GetHiGainFirst() const { return fHiGainFirst; } 80 85 Byte_t GetHiGainLast () const { return fHiGainLast ; } … … 86 91 87 92 Bool_t IsNoiseCalculation () const { return fNoiseCalculation; } 88 93 94 // Setter 95 Float_t SetResolutionPerPheHiGain() const { return fResolutionPerPheHiGain; } 96 Float_t SetResolutionPerPheLoGain() const { return fResolutionPerPheLoGain; } 97 89 98 virtual void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 90 99 … … 97 106 void SetPedestals (MPedestalCam *pedcam) { fPedestals = pedcam; } 98 107 108 // TObject 109 void Clear(Option_t *o="") 110 { 111 fHiGainFirst = fHiGainLast = fLoGainFirst = fLoGainLast = fHiLoLast = 0; 112 } 113 99 114 void Print(Option_t *o="") const; 100 115 101 ClassDef(MExtractor, 5) // Signal Extractor Base Class116 ClassDef(MExtractor, 6) // Signal Extractor Base Class 102 117 }; 103 118
Note:
See TracChangeset
for help on using the changeset viewer.