Changeset 9462 for trunk/MagicSoft/Mars/melectronics
- Timestamp:
- 06/20/09 10:14:33 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/melectronics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/melectronics/MAvalanchePhotoDiode.cc
r9261 r9462 77 77 APD::APD(Int_t n, Float_t prob, Float_t dt, Float_t rt) 78 78 : fHist("APD", "", n, 0.5, n+0.5, n, 0.5, n+0.5), 79 fCrosstalkProb(prob), fDeadTime(dt), fRecoveryTime(rt) 79 fCrosstalkProb(prob), fDeadTime(dt), fRecoveryTime(rt), fTime(-1) 80 80 { 81 81 fHist.SetDirectory(0); 82 } 83 84 // -------------------------------------------------------------------------- 85 // 86 // This is the time the cell needs after a hit until less than threshold 87 // (0.001 == one permille) of the signal is lost. 88 // 89 // If all cells of a G-APD have fired simultaneously and they are fired 90 // once more after the relaxation time (with the defaultthreshold of 0.001) 91 // the chip will show a signal which is one permille too small. 92 // 93 Float_t APD::GetRelaxationTime(Float_t threshold) const 94 { 95 return fDeadTime-TMath::Log(threshold)*fRecoveryTime; 82 96 } 83 97 … … 197 211 // The default time is 0. 198 212 // 213 // If you want t w.r.t. fTime use HitRandomCellRelative istead. 214 // 199 215 Float_t APD::HitRandomCell(Float_t t) 200 216 { … … 219 235 // If deadtime and recovery time are 0 then t-1 is set. 220 236 // 237 // Sets fTime to t 238 // 221 239 // The default time is 0. 222 240 // … … 231 249 232 250 fHist.SetEntries(1); 251 252 fTime = t; 233 253 } 234 254 … … 238 258 // by calling HitCellImp with time t-gRandom->Exp(n/rate) with n being 239 259 // the total number of cells. 260 // 261 // Sets fTime to t 262 // 240 263 // The default time is 0. 241 264 // … … 253 276 for (int x=1; x<=nx; x++) 254 277 for (int y=1; y<=ny; y++) 255 {256 278 HitCellImp(x, y, t-MMath::RndmExp(f)); 257 } 279 280 fTime = t; 281 } 282 283 // -------------------------------------------------------------------------- 284 // 285 // Evolve the chip from fTime to fTime+dt if it with a given frequency 286 // freq. Returns the total signal "recorded". 287 // 288 // fTime is set to the fTime+dt 289 // 290 // If you want to evolve over a default relaxation time (relax the chip 291 // from a signal) use Relax instead. 292 // 293 Float_t APD::Evolve(Double_t freq, Double_t dt) 294 { 295 const Double_t avglen = 1./freq; 296 297 const Double_t end = fTime+dt; 298 299 Float_t hits = 0; 300 301 Double_t time = fTime; 302 while (1) 303 { 304 time += MMath::RndmExp(avglen); 305 if (time>end) 306 break; 307 308 hits += HitRandomCell(time); 309 } 310 311 fTime = end; 312 313 return hits; 258 314 } 259 315 -
trunk/MagicSoft/Mars/melectronics/MAvalanchePhotoDiode.h
r9261 r9462 15 15 Float_t fRecoveryTime; // Recoverytime after Deadtime (1-exp(-t/fRecoveryTime) 16 16 17 Float_t fTime; // A user settable time of the system 18 17 19 Float_t HitCellImp(Int_t x, Int_t y, Float_t t=0); 18 20 … … 22 24 Float_t HitCell(Int_t x, Int_t y, Float_t t=0); 23 25 Float_t HitRandomCell(Float_t t=0); 26 Float_t HitRandomCellRelative(Float_t t=0) { return HitRandomCell(fTime+t); } 24 27 25 28 void FillEmpty(Float_t t=0); 26 29 void FillRandom(Float_t rate, Float_t t=0); 30 31 void Init(Float_t rate) { if (fTime<0) FillRandom(rate); else Relax(rate); } 27 32 28 33 Int_t CountDeadCells(Float_t t=0) const; … … 35 40 Float_t GetDeadTime() const { return fDeadTime; } 36 41 Float_t GetRecoveryTime() const { return fRecoveryTime; } 42 Float_t GetTime() const { return fTime; } 43 44 Float_t GetRelaxationTime(Float_t threshold=0.001) const; 45 46 Float_t GetLastHit() const { return fHist.GetMaximum(); } 47 48 void SetTime(Float_t tm) { fTime=tm; } 49 void IncreaseTime(Float_t dt) { fTime += dt; } 50 51 Float_t Evolve(Double_t freq, Double_t dt); 52 Float_t Relax(Double_t freq, Float_t threshold=0.001) { return Evolve(freq, GetRelaxationTime(threshold)); } 37 53 38 54 void Draw(Option_t *o="") { fHist.Draw(o); }
Note:
See TracChangeset
for help on using the changeset viewer.