Ignore:
Timestamp:
03/30/10 14:47:27 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r9462 r9565  
    123123    //            return 0;
    124124
     125    // Number of the x/y cell in the one dimensional array
    125126    // const Int_t cell = fHist.GetBin(x, y);
    126127    const Int_t cell = x + (fHist.GetNbinsX()+2)*y;
    127128
    128     // This is the fastes way to access the bin-contents in fArray
     129    // Getting a reference to the float is the fastes way to
     130    // access the bin-contents in fArray
    129131    Float_t &cont = fHist.GetArray()[cell];
    130132
     133    // Calculate the time since the last breakdown
    131134    // const Double_t dt = t-fHist.GetBinContent(x, y)-fDeadTime; //
    132135    const Float_t dt = t-cont-fDeadTime;
     
    136139        return 0;
    137140
    138     // Signal height (in units of one photon) produced after dead time
    139     const Float_t weight = fRecoveryTime<=0 ? 1 : 1.-exp(-dt/fRecoveryTime);
    140 
     141    // The signal height (in units of one photon) produced after dead time
     142    // depends on the recovery of the cell - described by an exponential.
     143    const Float_t weight = fRecoveryTime<=0 ? 1. : 1-TMath::Exp(-dt/fRecoveryTime);
     144
     145    // The probability that the cell emits a photon causing crosstalk
     146    // scales as the signal height.
     147    const Float_t prob = weight*fCrosstalkProb;
     148
     149    // Set the contents to the time of the last breakdown (now)
    141150    cont = t; // fHist.SetBinContent(x, y, t)
    142151
     
    161170     */
    162171
     172
    163173    //for (int i=0; i<1; i++)
    164174    while (1)
    165175    {
    166176        const Double_t rndm = gRandom->Rndm();
    167         if (rndm>=fCrosstalkProb)
     177        if (rndm>=prob/*fCrosstalkProb*/)
    168178            break;
    169179
    170         // We can re-use the random number becuase it is uniformely
     180        // We can re-use the random number because it is uniformely
    171181        // distributed. This saves cpu power
    172         const Int_t dir = TMath::FloorNint(4*rndm/fCrosstalkProb);
     182        const Int_t dir = TMath::FloorNint(4*rndm/prob/*fCrosstalkProb*/);
    173183
    174184        // Get a random neighbor which is hit.
Note: See TracChangeset for help on using the changeset viewer.