Ignore:
Timestamp:
12/21/12 15:33:51 (12 years ago)
Author:
Jens Buss
Message:
risetime function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/PulseTemplates/pulse.C

    r14755 r14762  
    148148    mAmplitude.second   = 0;
    149149    mPhE.second         = 0;
     150    mRisetime.first     = 0;
     151    mRisetime.second    = 0;
    150152    mOrder              = 0;
    151153    mType               = 0;
     
    154156    mFitNdf             = 0;
    155157    mChi2               = 0;
     158    mTimeResolution     = 0.5;
    156159}
    157160
     
    275278    mAmplitude.first    = mModel->GetMaximum() - mBsl.first;
    276279//    mAmplitude.second   = mModel->GetMaximum() - mBsl.first;
     280    mRisetime.first     = mTimeResolution*CalculateHistEdgeRisetime();
    277281    mFitProb            = mFitResultPtr->Prob();
    278282    mFitNCalls          = mFitResultPtr->NCalls();
     
    281285}
    282286
     287double
     288Pulse::CalculateHistEdgeRisetime() // in bins
     289{
     290    //rise-tim for pulse for pulse height from 10% to 90%
     291    double riseTime = 0;
     292
     293    // Get Pulse Maximum value and bin
     294    int maxBin = mHisto->GetMaximumBin();
     295    double max = mHisto->GetBinContent(maxBin);
     296
     297    // values of bin with 10% and 90%
     298    int tenPctBin       = 0;
     299    int ninetyPctBin    = 0;
     300
     301    // flag points
     302    bool finishedLow    = false;
     303    bool finishedHigh   = false;
     304
     305    //2nd runvariable
     306    int j = maxBin;
     307
     308    //loop over from 20 bins bevore max to maximum
     309    for (int i = maxBin - 20; i<maxBin; i++){
     310        j--;
     311        if (j<0) break;
     312
     313        if (mHisto->GetBinContent(i) >= 0.1*max && !finishedLow)
     314        {
     315            tenPctBin = i;
     316            finishedLow = true;
     317        }
     318
     319
     320        if (mHisto->GetBinContent(j) <= 0.9*max && !finishedHigh)
     321        {
     322            ninetyPctBin = j;
     323            finishedHigh = true;
     324        }
     325
     326        if (finishedLow && finishedHigh)
     327        {
     328            break;
     329        }
     330    }
     331
     332    riseTime = mHisto->GetBinLowEdge(ninetyPctBin) - mHisto->GetBinLowEdge(tenPctBin);
     333    return riseTime;
     334}
     335
     336
     337
     338
    283339// ===========================================================================
    284340// ACCESS
     
    287343TString Pulse::GetName(){ return mName;}
    288344double  Pulse::GetBsl(){ return mBsl.first;}
     345double  Pulse::GetBslErr(){ return mBsl.second;}
    289346double  Pulse::GetHeight(){ return mHeight.first;}
     347double  Pulse::GetHeightErr(){ return mHeight.second;}
    290348double  Pulse::GetT0(){ return mT0.first;}
     349double  Pulse::GetT0Err(){ return mT0.second;}
    291350double  Pulse::GetT1(){ return mT1.first;}
     351double  Pulse::GetT1Err(){ return mT1.second;}
    292352double  Pulse::GetTau1(){ return mTau1.first;}
     353double  Pulse::GetTau1Err(){ return mTau1.second;}
    293354double  Pulse::GetTau2(){ return mTau2.first;}
     355double  Pulse::GetTau2Err(){ return mTau2.second;}
    294356double  Pulse::GetIntegral(){ return mIntegral.first;}
     357double  Pulse::GetIntegralErr(){ return mIntegral.second;}
    295358double  Pulse::GetAmplitude(){ return mAmplitude.first;}
     359double  Pulse::GetAmplitudeErr(){ return mAmplitude.second;}
    296360int     Pulse::GetPhE(){ return mPhE.first;}
    297 double  Pulse::GetBslErr(){ return mBsl.second;}
    298 double  Pulse::GetHeightErr(){ return mHeight.second;}
    299 double  Pulse::GetT0Err(){ return mT0.second;}
    300 double  Pulse::GetT1Err(){ return mT1.second;}
    301 double  Pulse::GetTau1Err(){ return mTau1.second;}
    302 double  Pulse::GetTau2Err(){ return mTau2.second;}
    303 double  Pulse::GetIntegralErr(){ return mIntegral.second;}
    304 double  Pulse::GetAmplitudeErr(){ return mAmplitude.second;}
    305361int     Pulse::GetPhEErr(){ return mPhE.second;}
     362double  Pulse::GetRiseTime(){ return mRisetime.first; }
     363double  Pulse::GetRiseTimeErr(){ return mRisetime.second;}
    306364int     Pulse::GetOrder(){ return mOrder;}
    307365int     Pulse::GetType(){return mType;}
     
    312370double  Pulse::GetFitNdf(){return mFitNdf;}
    313371double  Pulse::GetChi2(){return mChi2;}
     372double  Pulse::GetTimeResolution(){return mTimeResolution;}
     373void    Pulse::SetTimeResolution(double timeResolution){mTimeResolution = timeResolution;}
    314374
    315375
Note: See TracChangeset for help on using the changeset viewer.