Changeset 4703


Ignore:
Timestamp:
08/23/04 11:50:26 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhvstime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc

    r3858 r4703  
    1818!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2727// MHVsTime
    2828//
    29 // Preliminary: the docu may be wrong!
     29// Use this class if you want to display any rule vs time (or event number)
     30//
     31// eg.
     32//       MHVsTime hist("MHillas.fAlpha");
     33//       MHVsTime hist("MPointintPos.GetAbsErr");
     34//       MHVsTime hist("MPointintPos.GetAbsErr*kRad2Deg");
     35//
     36// To set a maximum number of data-points (eg. to display the last 20min
     37// only) call SetMaxPts(200)
     38//
     39// SetMaxPts(-1) disables this feature.
    3040//
    3141/////////////////////////////////////////////////////////////////////////////
     
    5868// --------------------------------------------------------------------------
    5969//
    60 // Default constructor.
     70// Default constructor. For more informations about a valid rule
     71// see MDataChain.
    6172//
    6273MHVsTime::MHVsTime(const char *rule)
    63     : fGraph(NULL), fData(NULL), fScale(1), fUseEventNumber(0)
     74    : fGraph(NULL), fData(NULL), fScale(1), fMaxPts(-1), fUseEventNumber(0)
    6475
    6576    fName  = gsDefName;
     
    98109// --------------------------------------------------------------------------
    99110//
    100 // Setup the Binning for the histograms automatically if the correct
    101 // instances of MBinning are found in the parameter list
    102 // For a more detailed description see class description above.
     111// PreProcess the MDataChain. Create a new TGraph. Delete an old one if
     112// already allocated.
    103113//
    104114Bool_t MHVsTime::SetupFill(const MParList *plist)
     
    127137// --------------------------------------------------------------------------
    128138//
    129 // Set the name of the histogram ant the MHVsTime container
     139// Set the name of the TGraph and the MHVsTime container
    130140//
    131141void MHVsTime::SetName(const char *name)
     
    137147// --------------------------------------------------------------------------
    138148//
    139 // Set the title of the histogram ant the MHVsTime container
     149// Set the title of the TGraph and the MHVsTime container
    140150//
    141151void MHVsTime::SetTitle(const char *title)
     
    147157// --------------------------------------------------------------------------
    148158//
    149 // Fills the one, two or three data members into our histogram
     159// Set the next data point. If the graph exceeds fMaxPts remove the first
    150160//
    151161Bool_t MHVsTime::Fill(const MParContainer *par, const Stat_t w)
     
    165175            return kFALSE;
    166176        }
     177        // If the time is not valid skip this entry
    167178        if (!*tm)
    168179            return kTRUE;
     
    172183    const Double_t v = fData->GetValue()*fScale;
    173184
     185    if (fMaxPts>0 && fGraph->GetN()>fMaxPts)
     186        fGraph->RemovePoint(0);
     187
    174188    fGraph->SetPoint(fGraph->GetN(), t, v);
    175189
     
    179193// --------------------------------------------------------------------------
    180194//
    181 // Creates a new canvas and draws the histogram into it.
    182 //
    183 // Possible options are:
    184 //   PROFX: Draw a x-profile into the histogram (for 2D histograms only)
    185 //   PROFY: Draw a y-profile into the histogram (for 2D histograms only)
    186 //   ONLY:  Draw the profile histogram only (for 2D histograms only)
    187 //
    188 // If the kIsLog?-Bit is set the axis is displayed lkogarithmically.
    189 // eg this is set when applying a logarithmic MBinning
    190 //
    191 // Be careful: The histogram belongs to this object and won't get deleted
    192 // together with the canvas.
     195// This displays the TGraph like you expect it to be (eg. time on the axis)
     196// It should also make sure, that the displayed time always is UTC and
     197// not local time...
    193198//
    194199void MHVsTime::Draw(Option_t *opt)
     
    245250    if (fUseEventNumber)
    246251        h->SetUseEventNumber();
     252    h->SetMaxPts(fMaxPts);
    247253    return h;
    248254}
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.h

    r3394 r4703  
    1414    // Could be const but root < 3.02/06 doesn't like this...
    1515    TGraph     *fGraph;  // Histogram to fill
    16     MDataChain *fData;  // Object from which the data is filled
    17     Double_t    fScale; // Scale for axis (eg unit)
     16    MDataChain *fData;   // Object from which the data is filled
     17    Double_t    fScale;  // Scale for axis (eg unit)
     18    Int_t       fMaxPts; // Maximum number of data points
    1819
    1920    enum {
    20         kIsLogy = BIT(18),
     21        kIsLogy         = BIT(18),
    2122        kUseEventNumber = BIT(20)
    2223    };
     
    4243
    4344    /*
    44 //    const TH1 *GetHist() const;
    45 //    TH1 *GetHist();
    46 //    TH1 *GetHistByName(const TString name="");
    47 */
     45     const TH1 *GetHist() const;
     46     TH1 *GetHist();
     47     TH1 *GetHistByName(const TString name="");
     48     */
    4849    const TGraph *GetGraph() const { return fGraph; }
    4950    TGraph *GetGraph() { return fGraph; }
     
    5556    MParContainer *New() const;
    5657
     58    void SetMaxPts(Int_t n) { fMaxPts=n; }
     59
    5760    ClassDef(MHVsTime, 1) // Generalized 1/2/3D-histogram for Mars variables
    5861};
Note: See TracChangeset for help on using the changeset viewer.