Changeset 7043 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 05/17/05 12:08:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
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.