Changeset 8192 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 11/01/06 15:48:31 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc
r8171 r8192 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.5 7 2006-10-27 13:49:42tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.58 2006-11-01 15:48:31 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 167 167 // -------------------------------------------------------------------------- 168 168 // 169 // Return the x-value lower than sat0 at which the signal has been 170 // fallen bwlow maxcont/2. This time is determined using a simple second 171 // order polynomial interpolation. 172 // 173 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxcont) const 174 { 175 const Int_t p = sat0>1 ? sat0-2 : sat0-1; 176 if (sat0<=0) 177 return 0; 178 179 // Find the place at which the signal is maxcont/2 180 const TVector3 vx(sig[p], sig[p+1], sig[p+2]); 181 const TVector3 vy(p, p+1, p+2); 182 183 return MMath::InterpolParabLin(vx, vy, maxcont/2); 184 } 185 186 // -------------------------------------------------------------------------- 187 // 169 188 // Calculate the integral of the FADC time slices and store them as a new 170 189 // pixel in the MArrivalTimeCam container. … … 199 218 // Do not even try to extract the hi-gain if we have 200 219 // more than one saturating slice 220 const Int_t rangehi = fHiGainLast - fHiGainFirst + 1; 221 201 222 if (numsathi<2) 202 {203 const Int_t rangehi = fHiGainLast - fHiGainFirst + 1;204 223 FindTimeAndChargeHiGain2(sig+fHiGainFirst, rangehi, 205 224 sumhi, deltasumhi, timehi, deltatimehi, 206 225 numsathi, maxposhi); 207 208 209 // Make sure that in cases the time couldn't be correctly determined210 // more meaningfull default values are assigned211 //if (timehi<fHiGainFirst || timehi>=fHiGainLast-1)212 if (deltatimehi>-0.5 && (timehi<0 || timehi>=fHiGainLast-fHiGainFirst+1))213 timehi = gRandom->Uniform(fHiGainLast-fHiGainFirst+1);214 215 timehi += fHiGainFirst;216 }217 226 218 227 // If we have saturating slices try to get a better estimate … … 221 230 if (numsathi>1) 222 231 { 223 const Int_t p = sathi0>1 ? sathi0-2 : sathi0-1; 224 if (sathi0>0) 225 { 226 // Find the place at which the signal is maxcont/2 227 const TVector3 vx(sig[p], sig[p+1], sig[p+2]); 228 const TVector3 vy(p, p+1, p+2); 229 timehi=MMath::InterpolParabLin(vx, vy, maxcont/2); 230 } 231 else 232 timehi=0; 232 timehi = GetSaturationTime(sathi0, sig, maxcont)-fHiGainFirst; 233 deltatimehi = 0; 233 234 } 235 236 // Make sure that in cases the time couldn't be correctly determined 237 // more meaningfull default values are assigned. 238 // For extractors like the digital filter and the spline 239 // we allow extracpolation by one slice. 240 if (deltatimehi>-0.5 && (timehi<-1 || timehi>=rangehi)) 241 { 242 // Flag this as unreliable! 243 timehi = gRandom->Uniform(rangehi+1)-1; 244 // deltatimehi=-1; 245 } 246 247 timehi += fHiGainFirst; 234 248 235 249 Float_t sumlo =0, deltasumlo =-1; // invalidate logain of MExtractedSignalPix … … 280 294 // 281 295 // The jitter in the hi-/lo-gain offset ssems to be around +/-0.5 282 first = TMath::FloorNint(timehi+numh+fOffsetLoGain+fLoGainStartShift); 296 if (deltatimehi>-0.5) 297 first = TMath::FloorNint(timehi+numh+fOffsetLoGain+fLoGainStartShift); 298 //else ??? 299 283 300 if (first<0) 284 301 first = 0; … … 302 319 numsatlo = fSignal->GetSaturation(pixidx, fSaturationLimit, satlo0, satlo1); 303 320 304 FindTimeAndChargeLoGain2(sig+first, last-first+1, 321 const Int_t rangelo = last-first+1; 322 FindTimeAndChargeLoGain2(sig+first, rangelo, 305 323 sumlo, deltasumlo, timelo, deltatimelo, 306 324 numsatlo, maxposlo); 307 325 326 // If we have saturating slices try to get a better estimate 327 // of the arrival time than timehi or sathi0. This is 328 // usefull to know where to start lo-gain extraction. 329 if (numsatlo>1) 330 { 331 timelo = GetSaturationTime(satlo0, sig, maxlo)-numh-first; 332 deltatimelo = 0; 333 } 334 308 335 // Make sure that in cases the time couldn't be correctly determined 309 336 // more meaningfull default values are assigned 310 //if (timehi<fHiGainFirst || timehi>=fHiGainLast-1) 311 if (deltatimelo>-0.5 && (timelo<0 || timelo>=last-first+1)) 312 timelo = gRandom->Uniform(last-first+1); 337 // For extractors like the digital filter and the spline 338 // we allow extracpolation by one slice. 339 if (deltatimelo>-0.5 && (timelo<-1 || timelo>=rangelo)) 340 { 341 // Flag this as unreliable! 342 timelo = gRandom->Uniform(rangelo+1)-1; 343 //deltatimelo=-1; 344 } 313 345 314 346 timelo += first-numh; … … 323 355 // deltatimelo = -1; 324 356 } 357 325 358 326 359 // Now store the result in the corresponding containers -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h
r8165 r8192 24 24 Int_t Process(); 25 25 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 26 27 Double_t GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxcont) const; 26 28 27 29 public:
Note:
See TracChangeset
for help on using the changeset viewer.