Ignore:
Timestamp:
09/06/13 15:20:01 (11 years ago)
Author:
ftemme
Message:
Added FudgeFactor and Timeconstant for the calculation of the accoupling
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Mars_MC/msimcamera/MSimCamera.cc

    r17044 r17083  
    4343#include <TF1.h>
    4444#include <TRandom.h>
     45#include <TRandom3.h>
    4546
    4647#include "MLog.h"
     
    6364#include "MMcEvt.hxx"            // To be replaced by a CheObs class
    6465#include "MRawRunHeader.h"
     66
     67#include "math.h"
    6568
    6669ClassImp(MSimCamera);
     
    7578    : fEvt(0), fStat(0), fRunHeader(0), fElectronicNoise(0), fGain(0),
    7679    fCamera(0), fMcEvt(0), fSpline(0), fBaselineGain(kFALSE),
    77     fDefaultOffset(-1), fDefaultNoise(-1), fDefaultGain(-1)
     80      fDefaultOffset(-1), fDefaultNoise(-1), fDefaultGain(-1), fACFudgeFactor(0),
     81      fACTimeConstant(0)
    7882
    7983{
     
    260264        MPedestalPix &accPhoPix         = (*fAccidentalPhotons)[i];
    261265        accidentalPhotonRate            = accPhoPix.GetPedestal() * 1E3;
     266        Double_t currentAccidentalPhotonRate = accidentalPhotonRate;
     267
     268        if(fACTimeConstant!=0)
     269        {
     270            Double_t accidentalPhotons      = fACTimeConstant * accidentalPhotonRate;
     271            Double_t sigmaAccidentalPhotons = sqrt(accidentalPhotons);
     272
     273            TRandom3 *random = new TRandom3(0);
     274            Double_t gaus = random->Gaus(accidentalPhotons,sigmaAccidentalPhotons);
     275            currentAccidentalPhotonRate = gaus / timeconst;
     276        }
    262277
    263278        // I don't know how to get the variable fCrosstalkProb from
     
    277292        samplingRate                    = fRunHeader->GetFreqSampling();
    278293
    279         Double_t accouplingPerSlice = accidentalPhotonRate  * (1 + crossTalkProb)
     294        Double_t accouplingPerSlice = currentAccidentalPhotonRate
     295                * (1 + crossTalkProb + fACFudgeFactor)
    280296                * areaOfOnePulse / samplingRate;
    281297
     
    369385        fDefaultGain = GetEnvValue(env, prefix, "DefaultGain", fDefaultGain);
    370386    }
     387    if (IsEnvDefined(env, prefix, "fACFudgeFactor", print))
     388    {
     389        rc = kTRUE;
     390        fACFudgeFactor = GetEnvValue(env, prefix, "fACFudgeFactor", fACFudgeFactor);
     391    }
     392    if (IsEnvDefined(env, prefix, "fACTimeConstant", print))
     393    {
     394        rc = kTRUE;
     395        fACTimeConstant = GetEnvValue(env, prefix, "fACTimeConstant", fACTimeConstant);
     396    }
    371397
    372398    return rc;
Note: See TracChangeset for help on using the changeset viewer.