Changeset 3497


Ignore:
Timestamp:
03/15/04 12:04:09 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3496 r3497  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2004/03/15: Thomas Bretz
     21
     22   * mastro/MObservatory.[h,cc]:
     23     - implemented RotationAngle(ra, dec, time)
     24
     25   * mbase/MTask.[h,cc]:
     26     - implemented usage of a TStopwatch to retriev time consumtion
     27       informations
     28     - changed PrintStatistics not to print classes having no
     29       Process() function
     30
     31   * mbase/MTaskList.[h,cc], mfileio/MReadReports.[h,cc]:
     32     - changed PrintStatistics according to changes in MTask
     33
     34   * mraw/MRawEvtHeader.cc:
     35     - added a comment to Fill member function
     36
     37   * manalysis/MCerPhotEvt.[h,cc]:
     38     - added fLut.Set to FixSize and resize fLut by a factor of 2
     39       instead of +1 which acelerates creation of all pixels a lot
     40
     41
     42
    2043 2004/03/13: Markus Gaug
    2144
    22    * mcalib/MCalibrationChargeCalc.cc
    23    * mcalib/MCalibrationChargePix.[h,cc]
    24    * mcalib/MCalibrationChargeCam.cc
    25    * mcalib/MHCalibrationChargeCam.cc
    26    * mcalib/MHCalibrationChargeLoGainPix.cc
     45   * mcalib/MCalibrationChargeCalc.cc, mcalib/MCalibrationChargeCam.cc,
     46     mcalib/MCalibrationChargePix.[h,cc],
     47     mcalib/MHCalibrationChargeCam.cc,
     48     mcalib/MHCalibrationChargeLoGainPix.cc:
    2749     - fixed Low Gain calibration
    2850
    29 
    30    * mcalib/MHGausEvents.cc
     51   * mcalib/MHGausEvents.cc:
    3152     - changed default fit prob. limit from 0.005 to 0.001
    3253
    33    * mbadpixels/MBadPixelsPix.h
     54   * mbadpixels/MBadPixelsPix.h :
    3455     - IsCalibrationResultOK does not ask for FitOK any more
    3556
    36    * mcalib/MHCalibrationChargeCam.cc
     57   * mcalib/MHCalibrationChargeCam.cc:
    3758     - replaced Rel. Err. Limit for outliers in Phe's from 5 sigma to 7
    3859
    39    * mraw/MRawEvtPixelIter.[h,cc]
     60   * mraw/MRawEvtPixelIter.[h,cc]:
    4061     - function GetIdxMaxLoGainSamples can be called optionally with
    4162       offset (because first "loGain" samples are often in reality
     
    4364
    4465
     66
    4567 2004/03/12: Sebastian Raducci
    4668
    4769   * manalysis/Makefile
    4870     - added mastro in the include directories
     71
     72
    4973
    5074 2004/03/12: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc

    r3378 r3497  
    103103void MCerPhotEvt::FixSize()
    104104{
     105    fLut.Set(fNumPixels);
     106
    105107    if (fPixels->GetEntriesFast() == (Int_t)fNumPixels)
    106108        return;
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r3237 r3497  
    4343        {
    4444            const Int_t n = fLut.GetSize();
    45             fLut.Set(idx+1);
    46             for (int i=n; i<idx; i++)
     45            fLut.Set(idx*2+1); //idx+1 is slower than idx*2+1
     46            for (int i=n; i<idx*2+1; i++)
    4747                fLut[i] = -1;
    4848        }
  • trunk/MagicSoft/Mars/mastro/MObservatory.cc

    r3366 r3497  
    3434#include "MObservatory.h"
    3535
     36#include <TVector3.h>
     37
     38#include "MTime.h"
    3639#include "MAstro.h"
    3740
     
    169172    return TMath::ASin((fCosLatitude*sinp) / denom);
    170173}
     174
     175// --------------------------------------------------------------------------
     176//
     177// RotationAngle
     178//
     179// calculates the angle for the rotation of the sky image in the camera;
     180// this angle is a function of the sky coordinates, the observatory
     181// location and the time
     182//
     183//  ra  [rad]: Right ascension
     184//  dec [rad]: Declination
     185//
     186// Return RotationAngle in rad
     187//
     188Double_t MObservatory::RotationAngle(Double_t ra, Double_t dec, const MTime &t) const
     189{
     190    const Double_t alpha = t.GetGmst() + GetElong();
     191
     192    TVector3 v;
     193    v.SetMagThetaPhi(1, TMath::Pi()/2-dec, alpha-ra);
     194    v.RotateY(GetPhi()-TMath::Pi()/2);
     195
     196    return RotationAngle(v.Theta(), v.Phi());
     197}
  • trunk/MagicSoft/Mars/mastro/MObservatory.h

    r3366 r3497  
    55#include "MParContainer.h"
    66#endif
     7
     8class MTime;
    79
    810class MObservatory : public MParContainer
     
    5658    void RotationAngle(Double_t theta, Double_t phi, Double_t &sin, Double_t &cos) const;
    5759    Double_t RotationAngle(Double_t theta, Double_t phi) const;
     60    Double_t RotationAngle(Double_t ra, Double_t dec, const MTime &t) const;
    5861
    5962    LocationName_t GetObservatoryKey() const { return fObservatoryKey; }
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r2858 r3497  
    9090
    9191#include <fstream>
    92 #include <TBaseClass.h>
     92
     93#include <TBaseClass.h> // OverwritesProcess
     94#include <TStopwatch.h> // TStopwatch
    9395
    9496#include "MLog.h"
     
    103105
    104106MTask::MTask(const char *name, const char *title)
    105     : fFilter(NULL), fSerialNumber(0), fIsPreprocessed(kFALSE), fNumExecutions(0)
     107    : fFilter(NULL), fSerialNumber(0), fIsPreprocessed(kFALSE),
     108    fNumExecutions(0), fStopwatch(0)
    106109{
    107110    fName  = name  ? name  : "MTask";
     
    110113    fListOfBranches = new TList;
    111114    fListOfBranches->SetOwner();
     115
     116    fStopwatch = new TStopwatch;
    112117}
    113118
    114119MTask::~MTask()
    115120{
     121    delete fStopwatch;
    116122    delete fListOfBranches;
    117123}
     
    184190// Mapper function for PreProcess.
    185191// Sets the preprocessed flag dependend on the return value of PreProcess.
     192// Resets number of executions and cpu consumtion timer.
    186193//
    187194Int_t MTask::CallPreProcess(MParList *plist)
    188195{
    189196    fNumExecutions = 0;
     197    fStopwatch->Reset();
    190198
    191199    *fLog << all << fName << "... " << flush;
     
    218226// return value.
    219227// If Process is executed, the execution counter is increased.
     228// Count cpu consumtion time.
    220229//
    221230Int_t MTask::CallProcess()
     
    232241
    233242    fNumExecutions++;
    234     return Process();
     243
     244    fStopwatch->Start(kFALSE);
     245    const Int_t rc = Process();
     246    fStopwatch->Stop();
     247
     248    return rc;
    235249}
    236250
     
    332346// --------------------------------------------------------------------------
    333347//
    334 //  Prints the number of times all the tasks in the list has been.
     348//  Return total CPU execution time of task
     349//
     350Double_t MTask::GetCpuTime() const
     351{
     352    return fStopwatch->CpuTime();
     353}
     354
     355// --------------------------------------------------------------------------
     356//
     357//  Return total real execution time of task
     358//
     359Double_t MTask::GetRealTime() const
     360{
     361    return fStopwatch->RealTime();
     362}
     363
     364// --------------------------------------------------------------------------
     365//
     366//  Prints the relative time spent in Process() (relative means relative to
     367//  its parent Tasklist) and the number of times Process() was executed.
    335368//  For convinience the lvl argument results in a number of spaces at the
    336369//  beginning of the line. So that the structur of a tasklist can be
     
    338371//  filter is printer in <>-brackets behind the number of executions.
    339372//  Use MTaskList::PrintStatistics without an argument.
    340 //
    341 void MTask::PrintStatistics(const Int_t lvl, Bool_t title) const
    342 {
    343     *fLog << all << setfill(' ') << setw(lvl) << " " << GetDescriptor() << "\t";
     373//  For tasks which don't overwrite Process() no action is perfomed.
     374//
     375void MTask::PrintStatistics(const Int_t lvl, Bool_t title, Double_t time) const
     376{
     377    if (!OverwritesProcess())
     378        return;
     379
     380    *fLog << all << setfill(' ') << setw(lvl) << " ";
     381    if (fStopwatch->CpuTime()>0 && time>0)
     382        *fLog << setw(3) << (Int_t)(fStopwatch->CpuTime()/time*100+.5) << "% ";
     383    else
     384        *fLog << "     ";
     385    *fLog << GetDescriptor() << "\t";
    344386    *fLog << dec << fNumExecutions;
    345387    if (fFilter)
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r2589 r3497  
    1515
    1616class TList;
     17class TStopwatch;
    1718
    1819class MFilter;
     
    2930    Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
    3031    UInt_t fNumExecutions;  //! Number of Excutions
     32
     33    TStopwatch *fStopwatch; //!
    3134
    3235    virtual Int_t PreProcess(MParList *pList);
     
    6669    virtual ~MTask();
    6770
     71    const TList *GetListOfBranches() const { return fListOfBranches; }
     72    Bool_t OverwritesProcess(TClass *cls=NULL) const;
     73
     74    // Filter functions
    6875    virtual void SetFilter(MFilter *filter) { fFilter=filter; }
    6976    const MFilter *GetFilter() const      { return fFilter; }
    7077    MFilter *GetFilter()  { return fFilter; } // for MContinue only
    7178
     79    // Display functions
    7280    void SetDisplay(MStatusDisplay *d);
    73     virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
    7481
     82    // Function for parallel executions
    7583    static TString AddSerialNumber(const char *str, UInt_t num) { TString s(str); if (num==0) return s; s += ";"; s += num; return s; }
    7684    static TString AddSerialNumber(const TString &str, UInt_t num) { return AddSerialNumber((const char*)str, num); }
     
    8391    const char *GetDescriptor() const;
    8492
     93    // Task execution statistics
    8594    UInt_t GetNumExecutions() const { return fNumExecutions; }
     95    Double_t GetCpuTime() const;
     96    Double_t GetRealTime() const;
     97    virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=0) const;
    8698
     99    // Task overwrite functions
    87100    virtual Bool_t ReInit(MParList *pList);
    88101
     
    90103    virtual Int_t CallProcess();
    91104    virtual Int_t CallPostProcess();
    92 
    93     const TList *GetListOfBranches() const { return fListOfBranches; }
    94 
    95     Bool_t OverwritesProcess(TClass *cls=NULL) const;
    96105
    97106    void SavePrimitive(ofstream &out, Option_t *o="");
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r2958 r3497  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 // MTaskList                                                               //
    28 //                                                                         //
    29 // Collection of tasks.                                                    //
    30 //                                                                         //
    31 // A tasklist is necessary to run the eventloop. It contains the scheduled //
    32 // tasks, which should be executed in your program.                        //
    33 //                                                                         //
    34 // To add a task use AddToList.                                            //
    35 //                                                                         //
    36 // The tasklist itself is a task, too. You can add a tasklist to another   //
    37 // tasklist. This makes sense, if you want to filter the execution of      //
    38 // more than one task of your tasklist using the same filter.              //
    39 //                                                                         //
    40 // The tasks in the list are idetified by their names. If more than one    //
    41 // task has the same name, the tasklist will still work correctly, but     //
    42 // you might run into trouble trying to get a pointer to a task by name    //
    43 // from the list.                                                          //
    44 //                                                                         //
    45 // Warning:                                                                //
    46 //  Be carefull if you are writing your tasklist                           //
    47 //  (eg. MWriteRootFile("file.root", "MTaskList")) to a file. You may      //
    48 //  not be able to initialize a new working tasklist from a file if        //
    49 //   a) Two Paramerer containers with the same names are existing in the   //
    50 //      MParList.                                                          //
    51 //   b) You used a container somewhere which is not part of MParList.      //
    52 //      (eg. You specified a pointer to a MH container in MFillH which is  //
    53 //      not added to the parameter list.                                   //
    54 //                                                                         //
     26//
     27// MTaskList
     28//
     29// Collection of tasks.
     30//
     31// A tasklist is necessary to run the eventloop. It contains the scheduled
     32// tasks, which should be executed in your program.
     33//
     34// To add a task use AddToList.
     35//
     36// The tasklist itself is a task, too. You can add a tasklist to another
     37// tasklist. This makes sense, if you want to filter the execution of
     38// more than one task of your tasklist using the same filter.
     39//
     40// The tasks in the list are idetified by their names. If more than one
     41// task has the same name, the tasklist will still work correctly, but
     42// you might run into trouble trying to get a pointer to a task by name
     43// from the list.
     44//
     45// Warning:
     46//  Be carefull if you are writing your tasklist
     47//  (eg. MWriteRootFile("file.root", "MTaskList")) to a file. You may
     48//  not be able to initialize a new working tasklist from a file if
     49//   a) Two Paramerer containers with the same names are existing in the
     50//      MParList.
     51//   b) You used a container somewhere which is not part of MParList.
     52//      (eg. You specified a pointer to a MH container in MFillH which is
     53//      not added to the parameter list.
     54//
    5555/////////////////////////////////////////////////////////////////////////////
    56 
    5756#include "MTaskList.h"
    5857
    59 #include <fstream>        // ofstream, SavePrimitive
    60 
    61 #include <TClass.h>
    62 #include <TSystem.h>        // gSystem
    63 #include <TOrdCollection.h>
     58#include <fstream>           // ofstream, SavePrimitive
     59
     60#include <TSystem.h>         // gSystem
     61#include <TOrdCollection.h>  // TOrdCollection
    6462
    6563#include "MLog.h"
     
    627625//  Use MTaskList::PrintStatistics without an argument.
    628626//
    629 void MTaskList::PrintStatistics(const Int_t lvl, Bool_t title) const
     627void MTaskList::PrintStatistics(const Int_t lvl, Bool_t title, Double_t time) const
    630628{
    631629    if (lvl==0)
    632630    {
    633         *fLog << all << underline << "Execution Statistics:" << endl;
     631        *fLog << all << underline << "Process execution Statistics:" << endl;
    634632        *fLog << GetDescriptor();
    635633        if (GetFilter())
     
    640638    }
    641639    else
    642         MTask::PrintStatistics(lvl, title);
     640        MTask::PrintStatistics(lvl, title, time);
    643641
    644642    //
    645643    //  create the Iterator for the TaskList
    646644    //
    647     fTasks->ForEach(MTask, PrintStatistics)(lvl+1, title);
     645    fTasks->ForEach(MTask, PrintStatistics)(lvl+1, title, GetCpuTime());
    648646
    649647    if (lvl==0)
     
    651649}
    652650
    653 
    654 // --------------------------------------------------------------------------
     651// --------------------------------------------------------------------------
     652//
     653// Call 'Print()' of all tasks
     654//
    655655void MTaskList::Print(Option_t *t) const
    656656{
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

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

    r3226 r3497  
    375375// PrintStatistics of this task and of the MReadTree tasks in fTress
    376376//
    377 void MReadReports::PrintStatistics(const Int_t lvl, Bool_t title) const
    378 {
    379     MRead::PrintStatistics(lvl, title);
    380     fTrees->PrintStatistics(lvl, title);
    381 }
     377void MReadReports::PrintStatistics(const Int_t lvl, Bool_t title, Double_t time) const
     378{
     379    MRead::PrintStatistics(lvl, title, time);
     380    fTrees->PrintStatistics(lvl, title, GetCpuTime());
     381}
  • trunk/MagicSoft/Mars/mfileio/MReadReports.h

    r2607 r3497  
    5555    void  AddToBranchList(const char *name);
    5656
    57     void  PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
     57    void  PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=0) const;
    5858
    5959    void  EnableAutoScheme(Bool_t e=kTRUE) { fEnableAutoScheme = e; } // Must be called BEFORE AddTree!
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc

    r3483 r3497  
    227227// --------------------------------------------------------------------------
    228228//
    229 // used to set the header information (eg. from MC)
     229// Used to set the header information. This is for MC only. NEVER, NEVER
     230// use this somewhere else!
    230231//
    231232void MRawEvtHeader::FillHeader(UInt_t uiN, Float_t ulTP)
Note: See TracChangeset for help on using the changeset viewer.