Ignore:
Timestamp:
08/03/18 13:52:08 (6 years ago)
Author:
tbretz
Message:
Added a member function to return the total charge in the sensor.
Location:
trunk/Mars/melectronics
Files:
2 edited

Legend:

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

    r18448 r19130  
    457457// --------------------------------------------------------------------------
    458458//
    459 // Retunrs the number of cells which have a time t<=fDeadTime, i.e. which are
     459// Returns the number of cells which have a time t<=fDeadTime, i.e. which are
    460460// dead.
    461461// The default time is 0.
    462462//
    463 // Note that if you want to get a correct measure of teh number of dead cells
     463// Note that if you want to get a correct measure of the number of dead cells
    464464// at the time t, this function will only produce a valid count if the
    465465// afterpulses have been processed up to this time.
     
    481481// --------------------------------------------------------------------------
    482482//
    483 // Returs the number of cells which have a time t<=fDeadTime+fRecoveryTime.
     483// Returns the number of cells which have a time t<=fDeadTime+fRecoveryTime.
    484484// The default time is 0.
    485485//
     
    506506// --------------------------------------------------------------------------
    507507//
     508// Returns the fraction of charge, the sensor can still release.
     509// The default time is 0.
     510//
     511// Note that if you want to get a correct measure at the time t,
     512// this function will only produce a valid count if the
     513// afterpulses have been processed up to this time.
     514//
     515Float_t APD::GetChargeState(Float_t t) const
     516{
     517    const Int_t nx = fHist.GetNbinsX();
     518    const Int_t ny = fHist.GetNbinsY();
     519
     520    Double_t tot = 0;
     521
     522    for (int x=1; x<=nx; x++)
     523        for (int y=1; y<=ny; y++)
     524        {
     525            // Number of the x/y cell in the one dimensional array
     526            // const Int_t cell = fHist.GetBin(x, y);
     527            const Int_t cell = x + (fHist.GetNbinsX()+2)*y;
     528
     529            // Getting a reference to the float is the fastes way to
     530            // access the bin-contents in fArray
     531            const Float_t &cont = fHist.GetArray()[cell];
     532
     533            // Calculate the time since the last breakdown
     534            const Float_t dt = t-cont-fDeadTime;
     535
     536            // The signal height (in units of one photon) produced after dead time
     537            // depends on the recovery of the cell - described by an exponential.
     538            if (dt>0)
     539                tot += fRecoveryTime<=0 ? 1. : 1-TMath::Exp(-dt/fRecoveryTime);
     540        }
     541
     542    return tot / (nx*ny);
     543}
     544
     545// --------------------------------------------------------------------------
     546//
    508547// Generate an afterpulse originating from the given cell and a pulse with
    509548// charge. The afterpulse distribution to use is specified by
  • trunk/Mars/melectronics/MAvalanchePhotoDiode.h

    r17202 r19130  
    6565    Int_t CountDeadCells(Float_t t=0) const;
    6666    Int_t CountRecoveringCells(Float_t t=0) const;
     67    Float_t GetChargeState(Float_t t=0) const;
    6768
    6869    // --- Lower level user interface ---
Note: See TracChangeset for help on using the changeset viewer.