Ignore:
Timestamp:
06/20/09 10:14:33 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/melectronics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/melectronics/MAvalanchePhotoDiode.cc

    r9261 r9462  
    7777APD::APD(Int_t n, Float_t prob, Float_t dt, Float_t rt)
    7878    : 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)
    8080{
    8181    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//
     93Float_t APD::GetRelaxationTime(Float_t threshold) const
     94{
     95    return fDeadTime-TMath::Log(threshold)*fRecoveryTime;
    8296}
    8397
     
    197211// The default time is 0.
    198212//
     213// If you want t w.r.t. fTime use HitRandomCellRelative istead.
     214//
    199215Float_t APD::HitRandomCell(Float_t t)
    200216{
     
    219235// If deadtime and recovery time are 0 then t-1 is set.
    220236//
     237// Sets fTime to t
     238//
    221239// The default time is 0.
    222240//
     
    231249
    232250    fHist.SetEntries(1);
     251
     252    fTime = t;
    233253}
    234254
     
    238258// by calling HitCellImp with time t-gRandom->Exp(n/rate) with n being
    239259// the total number of cells.
     260//
     261// Sets fTime to t
     262//
    240263// The default time is 0.
    241264//
     
    253276    for (int x=1; x<=nx; x++)
    254277        for (int y=1; y<=ny; y++)
    255         {
    256278            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//
     293Float_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;
    258314}
    259315
  • trunk/MagicSoft/Mars/melectronics/MAvalanchePhotoDiode.h

    r9261 r9462  
    1515    Float_t fRecoveryTime;   // Recoverytime after Deadtime (1-exp(-t/fRecoveryTime)
    1616
     17    Float_t fTime;           // A user settable time of the system
     18
    1719    Float_t HitCellImp(Int_t x, Int_t y, Float_t t=0);
    1820
     
    2224    Float_t HitCell(Int_t x, Int_t y, Float_t t=0);
    2325    Float_t HitRandomCell(Float_t t=0);
     26    Float_t HitRandomCellRelative(Float_t t=0) { return HitRandomCell(fTime+t); }
    2427
    2528    void FillEmpty(Float_t t=0);
    2629    void FillRandom(Float_t rate, Float_t t=0);
     30
     31    void Init(Float_t rate) { if (fTime<0) FillRandom(rate); else Relax(rate); }
    2732
    2833    Int_t CountDeadCells(Float_t t=0) const;
     
    3540    Float_t GetDeadTime() const { return fDeadTime; }
    3641    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)); }
    3753
    3854    void Draw(Option_t *o="") { fHist.Draw(o); }
Note: See TracChangeset for help on using the changeset viewer.