Ignore:
Timestamp:
05/04/04 15:27:25 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/evtrate.C

    r2626 r3957  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
     21!
     22!
     23\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// evtrate.C
     28// =========
     29//
     30// Example macro how to calulate the eventrate (per event) and display
     31// the result versus time.
     32//
     33// As an input you need a merpped raw-data file containing correct times.
     34// The output is the plot: Eventrate vs. time.
     35//
     36///////////////////////////////////////////////////////////////////////////
     37
    138void evtrate()
    239{
     40    // Setup parameter- and tasklist
    341    MParList plist;
    442    MTaskList tlist;
    543    plist.AddToList(&tlist);
    644
     45    // Setup reading task
    746    MReadMarsFile read("Events");
    847    read.DisableAutoScheme();
    948    read.AddFile("test-time.root");
    1049
     50    // Setup event rate calculator
    1151    MEventRateCalc calc;
     52    // Setup number of events to be averaged
    1253    calc.SetNumEvents(200);
    1354
     55    // Setup histogram to be filles with rate
    1456    MHVsTime rate("MEventRate.fRate");
    1557
     58    // Setup task to fill the histogram
    1659    MFillH fill(&rate, "MTime");
    1760
     61    // Setup tasklist
    1862    tlist.AddToList(&read);
    1963    tlist.AddToList(&calc);
    2064    tlist.AddToList(&fill);
    2165
     66    // Execute your eventloop
    2267    MEvtLoop loop;
    2368    loop.SetParList(&plist);
    2469
    25     loop.Eventloop();
     70    if (!loop.Eventloop())
     71        return;
    2672
     73    // print some execution statistics
     74    tlist.PrintStatistics();
     75
     76    // Draw result
    2777    rate.DrawClone();
    2878}
Note: See TracChangeset for help on using the changeset viewer.