Changeset 18448 for trunk


Ignore:
Timestamp:
03/08/16 13:15:49 (9 years ago)
Author:
ftemme
Message:
Added an if statement, to not initialize the cells with random hits, if the rate is 0
File:
1 edited

Legend:

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

    r17769 r18448  
    352352    FillEmpty(t);
    353353
    354     const Int_t nx = fHist.GetNbinsX();
    355     const Int_t ny = fHist.GetNbinsY();
    356 
    357     const Double_t f = (nx*ny)/rate;
    358 
    359     // FIXME: Dead time is not taken into account,
    360     //        possible earlier afterpulses are not produced.
    361 
    362     for (int x=1; x<=nx; x++)
    363         for (int y=1; y<=ny; y++)
    364             HitCellImp(x, y, t-MMath::RndmExp(f));
     354    // If the rate is 0, we don't need to initiatize the cells, because there
     355    // won't be any hitted cells.
     356    if (rate > 0.)
     357    {
     358
     359        const Int_t nx = fHist.GetNbinsX();
     360        const Int_t ny = fHist.GetNbinsY();
     361
     362        const Double_t f = (nx*ny)/rate;
     363
     364        // FIXME: Dead time is not taken into account,
     365        //        possible earlier afterpulses are not produced.
     366
     367        for (int x=1; x<=nx; x++)
     368            for (int y=1; y<=ny; y++)
     369                HitCellImp(x, y, t-MMath::RndmExp(f));
     370
     371    }
    365372
    366373    // Deleting of the afterpulses before fHist.GetMinimum() won't
Note: See TracChangeset for help on using the changeset viewer.