Ignore:
Timestamp:
06/20/09 10:14:33 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.