Ignore:
Timestamp:
09/07/04 18:31:53 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r4841 r4887  
    4040#pragma link C++ class MParameterI+;
    4141#pragma link C++ class MParameterD+;
     42#pragma link C++ class MParameterDerr+;
    4243//#pragma link C++ class MParameters+;
    4344
  • trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc

    r4833 r4887  
    8888const TString MEventRateCalc::gsNameEventRate = "MEventRate";
    8989const TString MEventRateCalc::gsNameTimeDiff  = "MTimeDiff";
     90const TString MEventRateCalc::gsNameTimeRate  = "MTimeRate";
    9091
    9192const Int_t MEventRateCalc::gsNumEvents = 1000;
     
    9697//
    9798MEventRateCalc::MEventRateCalc(const char *name, const char *title)
    98     : fNameTime(gsNameTime), fNameEventRate(gsNameEventRate),
    99     fNameTimeDiff(gsNameTimeDiff), fTimes(gsNumEvents)
     99    : fNameEventRate(gsNameEventRate), fNameTime(gsNameTime),
     100    fNameTimeRate(gsNameTimeRate), fNameTimeDiff(gsNameTimeDiff),
     101    fTimes(gsNumEvents)
    100102{
    101103    fName  = name  ? name  : gsDefName.Data();
     
    118120    if (!fTime)
    119121    {
    120         *fLog << err << "MTime not found... aborting." << endl;
     122        *fLog << err << AddSerialNumber(fNameTime) << " [MTime] not found... aborting." << endl;
    121123        return kFALSE;
    122124    }
     
    124126    fRate = (MEventRate*)pList->FindCreateObj("MEventRate", AddSerialNumber(fNameEventRate));
    125127    if (!fRate)
     128        return kFALSE;
     129
     130    fTimeRate = (MTime*)pList->FindCreateObj("MTime", AddSerialNumber(fNameTimeRate));
     131    if (!fTimeRate)
    126132        return kFALSE;
    127133
     
    145151    const ULong_t exec = GetNumExecutions()-1;
    146152
     153    // Calculate the rate
    147154    const UInt_t n = fTimes.GetSize();
    148155
     156    // Get the positon in the ring-buffer
    149157    const UInt_t n1 = exec;
    150158    const UInt_t n2 = exec>=n ? exec+1 : 0;
    151159
     160    // Store the current event time
    152161    fTimes[n1%n] = *fTime;
    153162
     163    // Get the number of events
    154164    const UInt_t cnt = n1<n2 ? n : n1-n2;
    155165
     166    // Calculate the rate
    156167    const Double_t rate = (Double_t)cnt/(fTimes[n1%n]-fTimes[n2%n]);
    157168
     169    // Store the time difference between two consecutive events
     170    fTimeDiff->SetVal(exec==0 ? -1 : fTimes[n1%n] - fTimes[(n1+n-1)%n]);
     171    fTimeDiff->SetReadyToSave();
     172
     173    // Store the rate
    158174    fRate->SetRate(exec>1?rate:0, cnt);
    159175    fRate->SetReadyToSave();
    160176
    161     fTimeDiff->SetVal(exec==0 ? -1 : fTimes[n1%n] - fTimes[(n1+n-1)%n]);
    162     fTimeDiff->SetReadyToSave();
     177    // Store the corresponding time
     178    fTimeRate->SetMean(fTimes[n1%n], fTimes[n2%n]);
    163179
    164180    return kTRUE;
  • trunk/MagicSoft/Mars/manalysis/MEventRateCalc.h

    r4833 r4887  
    1919    static const TString gsDefTitle;      //! Default title of container
    2020
     21    static const TString gsNameEventRate; //! default name of rate container
    2122    static const TString gsNameTime;      //! Default name of time container
    22     static const TString gsNameEventRate; //! default name of rate container
    2323    static const TString gsNameTimeDiff;  //! default name of time-diff container
     24    static const TString gsNameTimeRate;  //! default name of time-rate container
    2425
    2526    static const Int_t gsNumEvents;       //! Default number of events
     
    2728
    2829    MTime       *fTime;       //! pointer to event time
     30    MTime       *fTimeRate;   //! pointer to time of event rate
    2931    MEventRate  *fRate;       //! pointer to rate storage container
    3032    MParameterD *fTimeDiff;   //! Difference of time between two consecutive events
    3133
     34    TString fNameEventRate;  // name of event rate container
    3235    TString fNameTime;       // name of time container
    33     TString fNameEventRate;  // name of event rate container
     36    TString fNameTimeRate;   // name of event rate time container
    3437    TString fNameTimeDiff;   // name of time-diff container
    3538
    3639    TArrayD  fTimes;         //! internal array to store the last n event times
    37 
    3840
    3941    Int_t PreProcess(MParList *pList);
     
    4850    void SetNumEvents(ULong_t num) { fTimes.Set(num); }
    4951
     52    void SetNameEventRate(const char *name) { fNameEventRate = name; }
    5053    void SetNameTime(const char *name)      { fNameTime = name; }
    51     void SetNameEventRate(const char *name) { fNameEventRate = name; }
    5254    void SetNameTimeDiff(const char *name)  { fNameTimeDiff = name; }
     55    void SetNameTimeRate(const char *name)  { fNameTimeRate = name; }
    5356
    5457    ClassDef(MEventRateCalc, 1)// Task to calculate event rates
  • trunk/MagicSoft/Mars/manalysis/MParameters.cc

    r2173 r4887  
    1818!   Author(s): Thomas Bretz 03/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    4242ClassImp(MParameterD);
    4343ClassImp(MParameterI);
     44ClassImp(MParameterDerr);
    4445//ClassImp(MParameter);
    4546
     
    6061// Default constructor.
    6162//
     63MParameterDerr::MParameterDerr(const char *name, const char *title)
     64{
     65    fName  = name  ? name  : "MParameterDerr";
     66    fTitle = title ? title : "Storgare container for general parameters (double) and its error";
     67}
     68
     69// --------------------------------------------------------------------------
     70//
     71// Default constructor.
     72//
    6273MParameterI::MParameterI(const char *name, const char *title)
    6374{
  • trunk/MagicSoft/Mars/manalysis/MParameters.h

    r1951 r4887  
    1818
    1919    ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
     20};
     21
     22class MParameterDerr : public MParContainer
     23{
     24private:
     25    Double_t fVal;
     26    Double_t fErr;
     27
     28public:
     29    MParameterDerr(const char *name=NULL, const char *title=NULL);
     30
     31    void SetVal(Double_t v, Double_t e) { fVal = v; fErr = e; }
     32    Double_t GetVal() const { return fVal; }
     33    Double_t GetErr() const { return fErr; }
     34
     35    ClassDef(MParameterDerr, 1) // Container to hold a generalized parameters (double) and its Error
    2036};
    2137
Note: See TracChangeset for help on using the changeset viewer.