Changeset 8584 for trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc
- Timestamp:
- 06/19/07 12:01:35 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc
r8519 r8584 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.6 5 2007-05-16 13:56:17tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.66 2007-06-19 11:01:34 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 189 189 // order polynomial interpolation. 190 190 // 191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t max pos) const191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxconthalf) const 192 192 { 193 193 const Int_t p = sat0>1 ? sat0-2 : sat0-1; … … 195 195 return 0; 196 196 197 const Float_t &maxcont = sig[maxpos];198 197 if (sat0==1) 199 return sig[0]>maxcont /2? 0 : 0.5;198 return sig[0]>maxconthalf ? 0 : 0.5; 200 199 201 200 if (sig[p]>sig[p+1] || sig[p+1]>sig[p+2]) 202 return sig[p+1]>maxcont /2? sat0-1 : sat0-0.5;201 return sig[p+1]>maxconthalf ? sat0-1 : sat0-0.5; 203 202 204 203 // Find the place at which the signal is maxcont/2 … … 206 205 const TVector3 vy(p, p+1, p+2); 207 206 208 return MMath::InterpolParabLin(vx, vy, maxcont /2);207 return MMath::InterpolParabLin(vx, vy, maxconthalf); 209 208 } 210 209 … … 223 222 const Int_t numl = fRunHeader->GetNumSamplesLoGain(); 224 223 224 const UInt_t satlim = fSaturationLimit*fRunHeader->GetMax(); 225 225 226 MRawEvtPixelIter pixel(fRawEvt); 226 227 while (pixel.Next()) … … 230 231 const Float_t *sig = fSignal->GetSamples(pixidx); 231 232 232 const UInt_t maxcont = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);233 const Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);234 235 233 // Would it be better to take lastsat-firstsat? 236 234 Int_t sathi0 = fHiGainFirst; // First slice to extract and first saturating slice 237 235 Int_t sathi1 = fHiGainLast; // Last slice to extract and last saturating slice 238 Int_t numsathi = fSignal->GetSaturation(pixidx, fSaturationLimit, sathi0, sathi1);236 Int_t numsathi = fSignal->GetSaturation(pixidx, satlim, sathi0, sathi1); 239 237 240 238 Float_t sumhi =0., deltasumhi =-1; // Set hi-gain of MExtractedSignalPix valid … … 246 244 247 245 if (numsathi<2) 246 { 247 const Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast); 248 248 FindTimeAndChargeHiGain2(sig+fHiGainFirst, rangehi, 249 249 sumhi, deltasumhi, timehi, deltatimehi, 250 250 numsathi, maxposhi); 251 } 251 252 252 253 // If we have saturating slices try to get a better estimate 253 254 // of the arrival time than timehi or sathi0. This is 254 255 // usefull to know where to start lo-gain extraction. 256 const UInt_t maxcont = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast); 255 257 if (numsathi>1) 256 258 { 257 timehi = GetSaturationTime(sathi0, sig, fHiGainFirst+maxposhi)-fHiGainFirst;259 timehi = GetSaturationTime(sathi0, sig, maxcont/2)-fHiGainFirst; 258 260 deltatimehi = 0; 259 261 } … … 338 340 */ 339 341 // Would it be better to take lastsat-firstsat? 340 const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last);341 342 342 Int_t satlo0 = first; // First slice to extract and first saturating slice 343 343 Int_t satlo1 = last; // Last slice to extract and last saturating slice 344 numsatlo = fSignal->GetSaturation(pixidx, fSaturationLimit, satlo0, satlo1);344 numsatlo = fSignal->GetSaturation(pixidx, satlim, satlo0, satlo1); 345 345 346 346 //if (satlo0>first && satlo1<last && numsatlo>2) … … 350 350 //} 351 351 352 const Int_t rangelo = last-first+1; 352 const Int_t rangelo = last-first+1; 353 const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last); 353 354 FindTimeAndChargeLoGain2(sig+first, rangelo, 354 355 sumlo, deltasumlo, timelo, deltatimelo, … … 360 361 if (numsatlo>1) 361 362 { 362 timelo = GetSaturationTime(satlo0, sig, first+maxposlo)-numh-first; 363 const UInt_t maxrawlo = fSignal->GetRawMaxPos(pixidx, fHiGainFirst, fHiGainLast); 364 timelo = GetSaturationTime(satlo0, sig, first+maxrawlo)-numh-first; 363 365 deltatimelo = 0; 364 366 }
Note:
See TracChangeset
for help on using the changeset viewer.