Ignore:
Timestamp:
04/06/04 13:41:56 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r3568 r3666  
    333333
    334334    //
    335     // Update current speed each second
    336     //
    337     if (fDisplay && t0-t2>(TTime)1000)
    338     {
    339         const Int_t speed = 1000*(num-start)/(long int)(t0-t2);
     335    // Update current speed each 1.5 second
     336    //
     337    if (fDisplay && t0-t2>(TTime)1500)
     338    {
     339        const Float_t speed = 1000.*(num-start)/(long int)(t0-t2);
    340340        TString txt = "Processing...";
    341341        if (speed>0)
    342342        {
    343343            txt += " (";
    344             txt += speed;
     344            txt += (Int_t)speed;
    345345            txt += "Evts/s";
    346346            if (fNumEvents>0)
    347347            {
    348348                txt += ", est: ";
    349                 txt += (int)((long int)(t0-t2)*fNumEvents/(60000.*(num-start)));
    350                 txt += "m";
     349                txt += (int)((fNumEvents-num)/speed/60)+1;
     350                txt += "min";
    351351            }
    352352            //txt += (int)fmod(entries/(1000.*(num-start)/(long int)(t0-t2)), 60);
     
    356356        fDisplay->SetStatusLine1(txt);
    357357        start = num;
    358         t2 = t1;
     358        t2 = t0;
    359359    }
    360360
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r3597 r3666  
    5252// --------------------------------------------------------------------------
    5353//
     54// Symmetrized significance - this is somehow analog to
     55// SignificanceLiMaSigned
     56//
     57// Returns Significance(s,b) if s>b otherwise -Significance(b, s);
     58//
     59Double_t MMath::SignificanceSym(Double_t s, Double_t b)
     60{
     61    return s>b ? Significance(s, b) : -Significance(b, s);
     62}
     63
     64// --------------------------------------------------------------------------
     65//
    5466//  calculates the significance according to Li & Ma
    5567//  ApJ 272 (1983) 317, Formula 17
     
    5870//  b                    // b: number of off events
    5971//  alpha = t_on/t_off;  // t: observation time
     72//
     73//  The significance has the same (positive!) value for s>b and b>s.
    6074//
    6175//  Returns -1 if sum<0 or alpha<0 or the argument of sqrt<0
     
    7791    return l+m<0 ? -1 : TMath::Sqrt((l+m)*2);
    7892}
     93
     94// --------------------------------------------------------------------------
     95//
     96// Calculates MMath::SignificanceLiMa(s, b, alpha). Returns 0 if the
     97// calculation has failed. Otherwise the Li/Ma significance which was
     98// calculated. If s<b a negative value is returned.
     99//
     100Double_t MMath::SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha)
     101{
     102    const Double_t sig = SignificanceLiMa(s, b, alpha);
     103    if (sig<=0)
     104        return 0;
     105
     106    return TMath::Sign(sig, s-b);
     107}
  • trunk/MagicSoft/Mars/mbase/MMath.h

    r3582 r3666  
    1010public:
    1111    static Double_t Significance(Double_t s, Double_t b);
     12    static Double_t SignificanceSym(Double_t s, Double_t b);
    1213    static Double_t SignificanceLiMa(Double_t s, Double_t b, Double_t alpha=1);
     14    static Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1);
    1315
    1416    ClassDef(MMath, 0)
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r3574 r3666  
    407407TMethodCall *MParContainer::GetterMethod(const char *name) const
    408408{
    409     TClass *cls = IsA()->GetBaseDataMember(name);
     409    const TString n(name);
     410    const Int_t pos1 = n.First('.');
     411
     412    const TString part1 = pos1<0 ? n : n(0, pos1);
     413    const TString part2 = pos1<0 ? TString("") : n(pos1+1, n.Length());
     414
     415    TClass *cls = IsA()->GetBaseDataMember(part1);
    410416    if (cls)
    411417    {
    412         TDataMember *member = cls->GetDataMember(name);
     418        TDataMember *member = cls->GetDataMember(part1);
    413419        if (!member)
    414420        {
    415             *fLog << err << "Datamember '" << name << "' not in " << GetDescriptor() << endl;
     421            *fLog << err << "Datamember '" << part1 << "' not in " << GetDescriptor() << endl;
    416422            return NULL;
     423        }
     424
     425        // This handles returning references of contained objects, eg
     426        // class X { TObject fO; TObject &GetO() { return fO; } };
     427        if (!member->IsBasic() && !part2.IsNull())
     428        {
     429            cls = gROOT->GetClass(member->GetTypeName());
     430            if (!cls)
     431            {
     432                *fLog << err << "Datamember " << part1 << " [";
     433                *fLog << member->GetTypeName() << "] not in dictionary." << endl;
     434                return NULL;
     435            }
     436            if (!cls->InheritsFrom(MParContainer::Class()))
     437            {
     438                *fLog << err << "Datamember " << part1 << " [";
     439                *fLog << member->GetTypeName() << "] does not inherit from ";
     440                *fLog << "MParContainer." << endl;
     441                return NULL;
     442            }
     443
     444            const MParContainer *sub = (MParContainer*)((ULong_t)this+member->GetOffset());
     445            return sub->GetterMethod(part2);
     446        }
     447
     448        if (member->IsaPointer())
     449        {
     450            *fLog << warn << "Data-member " << part1 << " is a pointer..." << endl;
     451            *fLog << dbginf << "Not yet implemented!" << endl;
     452            //TClass *test = gROOT->GetClass(member->GetTypeName());
     453            return 0;
    417454        }
    418455
     
    422459    }
    423460
    424     *fLog << warn << "No standard access for '" << name << "' in ";
     461    *fLog << warn << "No standard access for '" << part1 << "' in ";
    425462    *fLog << GetDescriptor() << " or one of its base classes." << endl;
    426463
     
    428465
    429466    *fLog << warn << "Trying to find MethodCall '" << ClassName();
    430     *fLog << "::Get" << name << "' instead <LEAKS MEMORY>" << endl;
    431     call = new TMethodCall(IsA(), (TString)"Get"+name, "");
     467    *fLog << "::Get" << part1 << "' instead <LEAKS MEMORY>" << endl;
     468    call = new TMethodCall(IsA(), (TString)"Get"+part1, "");
    432469    if (call->GetMethod())
    433470        return call;
     
    436473
    437474    *fLog << warn << "Trying to find MethodCall '" << ClassName();
    438     *fLog << "::" << name << "' instead <LEAKS MEMORY>" << endl;
    439     call = new TMethodCall(IsA(), name, "");
     475    *fLog << "::" << part1 << "' instead <LEAKS MEMORY>" << endl;
     476    call = new TMethodCall(IsA(), part1, "");
    440477    if (call->GetMethod())
    441478        return call;
     
    443480    delete call;
    444481
    445     *fLog << err << "Sorry, no getter method found for " << name << endl;
     482    *fLog << err << "Sorry, no getter method found for " << part1 << endl;
    446483    return NULL;
    447484}
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r3512 r3666  
    14331433    //        where (eg Eventloop) first!
    14341434
    1435     gLog << dbg << fName << " is on heap: " << (int)IsOnHeap() << endl;
     1435    //gLog << dbg << fName << " is on heap: " << (int)IsOnHeap() << endl;
    14361436
    14371437    if (TestBit(kExitLoopOnExit) || TestBit(kExitLoopOnClose))
     
    14431443    if (fIsLocked<=0 && IsOnHeap())
    14441444    {
    1445         gLog << dbg << "delete " << fName << ";" << endl;
     1445        //gLog << dbg << "delete " << fName << ";" << endl;
    14461446        delete this;
    14471447    }
    14481448    fStatus = kFileExit;
    1449     gLog << dbg << fName << ".fStatus=kFileExit;" << endl;
     1449    //gLog << dbg << fName << ".fStatus=kFileExit;" << endl;
    14501450}
    14511451
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r3497 r3666  
    106106MTask::MTask(const char *name, const char *title)
    107107    : fFilter(NULL), fSerialNumber(0), fIsPreprocessed(kFALSE),
    108     fNumExecutions(0), fStopwatch(0)
     108    fStopwatch(0)
    109109{
    110110    fName  = name  ? name  : "MTask";
     
    194194Int_t MTask::CallPreProcess(MParList *plist)
    195195{
    196     fNumExecutions = 0;
    197196    fStopwatch->Reset();
    198197
     
    240239        return kTRUE;
    241240
    242     fNumExecutions++;
    243 
    244241    fStopwatch->Start(kFALSE);
    245242    const Int_t rc = Process();
     
    346343// --------------------------------------------------------------------------
    347344//
    348 //  Return total CPU execution time of task
     345//  Return the total number of calls to Process(). If Process() was not
     346//  called due to a set filter this is not counted.
     347//
     348UInt_t MTask::GetNumExecutions() const
     349{
     350    return (UInt_t)fStopwatch->Counter();
     351}
     352
     353// --------------------------------------------------------------------------
     354//
     355//  Return total CPU execution time in seconds of calls to Process().
     356//  If Process() was not called due to a set filter this is not counted.
    349357//
    350358Double_t MTask::GetCpuTime() const
     
    355363// --------------------------------------------------------------------------
    356364//
    357 //  Return total real execution time of task
     365//  Return total real execution time in seconds of calls to Process().
     366//  If Process() was not called due to a set filter this is not counted.
    358367//
    359368Double_t MTask::GetRealTime() const
     
    366375//  Prints the relative time spent in Process() (relative means relative to
    367376//  its parent Tasklist) and the number of times Process() was executed.
     377//  Don't wonder if the sum of the tasks in a tasklist is not 100%,
     378//  because only the call to Process() of the task is measured. The
     379//  time of the support structure is ignored. The faster your analysis is
     380//  the more time is 'wasted' in the support structure.
     381//  Only the CPU time is displayed. This means that exspecially task
     382//  which have a huge part of file i/o will be underestimated in their
     383//  relative wasted time.
    368384//  For convinience the lvl argument results in a number of spaces at the
    369385//  beginning of the line. So that the structur of a tasklist can be
     
    379395
    380396    *fLog << all << setfill(' ') << setw(lvl) << " ";
    381     if (fStopwatch->CpuTime()>0 && time>0)
    382         *fLog << setw(3) << (Int_t)(fStopwatch->CpuTime()/time*100+.5) << "% ";
     397
     398    if (GetCpuTime()>0 && time>0 && GetCpuTime()>=0.001*time)
     399        *fLog << Form("%5.1f", GetCpuTime()/time*100) << "% ";
    383400    else
    384         *fLog << "     ";
     401        *fLog << "       ";
    385402    *fLog << GetDescriptor() << "\t";
    386     *fLog << dec << fNumExecutions;
     403    *fLog << dec << GetNumExecutions();
    387404    if (fFilter)
    388405        *fLog << " <" << fFilter->GetName() << ">";
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r3497 r3666  
    2929
    3030    Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
    31     UInt_t fNumExecutions;  //! Number of Excutions
    3231
    33     TStopwatch *fStopwatch; //!
     32    TStopwatch *fStopwatch; //! Count the execution time and number of executions
    3433
    3534    virtual Int_t PreProcess(MParList *pList);
     
    7473    // Filter functions
    7574    virtual void SetFilter(MFilter *filter) { fFilter=filter; }
    76     const MFilter *GetFilter() const      { return fFilter; }
    77     MFilter *GetFilter()  { return fFilter; } // for MContinue only
     75    const MFilter *GetFilter() const        { return fFilter; }
     76    MFilter *GetFilter()                    { return fFilter; } // for MContinue only
    7877
    7978    // Display functions
     
    8685    TString AddSerialNumber(const TString &str) const { return AddSerialNumber(str, fSerialNumber); }
    8786
    88     virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; }
    89     Byte_t  GetSerialNumber() const { return fSerialNumber; }
     87    virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num;  }
     88    Byte_t GetSerialNumber() const          { return fSerialNumber; }
    9089
    9190    const char *GetDescriptor() const;
    9291
    9392    // Task execution statistics
    94     UInt_t GetNumExecutions() const { return fNumExecutions; }
     93    UInt_t   GetNumExecutions() const;
    9594    Double_t GetCpuTime() const;
    9695    Double_t GetRealTime() const;
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r3497 r3666  
    635635        if (title)
    636636            *fLog << "\t" << fTitle;
     637        if (time>=0)
     638            *fLog << Form(" %5.1f", GetCpuTime()/time*100) << "%";
     639        else
     640            *fLog << " 100.0%";
    637641        *fLog << endl;
    638642    }
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r3497 r3666  
    7070
    7171    void Print(Option_t *opt = "") const;
    72     void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=0) const;
     72    void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=-1) const;
    7373    void SetOwner(Bool_t enable=kTRUE);
    7474
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r3371 r3666  
    362362    const Double_t sum = (r1+r2)/(24*3600);
    363363
    364     return fmod(sum, 1)*TMath::TwoPi()+TMath::TwoPi();
     364    return fmod(sum, 1)*TMath::TwoPi();//+TMath::TwoPi();
    365365}
    366366
Note: See TracChangeset for help on using the changeset viewer.