Changeset 3957 for trunk/MagicSoft/Mars/macros/evtrate.C
- Timestamp:
- 05/04/04 15:27:25 (21 years ago)
- 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 1 38 void evtrate() 2 39 { 40 // Setup parameter- and tasklist 3 41 MParList plist; 4 42 MTaskList tlist; 5 43 plist.AddToList(&tlist); 6 44 45 // Setup reading task 7 46 MReadMarsFile read("Events"); 8 47 read.DisableAutoScheme(); 9 48 read.AddFile("test-time.root"); 10 49 50 // Setup event rate calculator 11 51 MEventRateCalc calc; 52 // Setup number of events to be averaged 12 53 calc.SetNumEvents(200); 13 54 55 // Setup histogram to be filles with rate 14 56 MHVsTime rate("MEventRate.fRate"); 15 57 58 // Setup task to fill the histogram 16 59 MFillH fill(&rate, "MTime"); 17 60 61 // Setup tasklist 18 62 tlist.AddToList(&read); 19 63 tlist.AddToList(&calc); 20 64 tlist.AddToList(&fill); 21 65 66 // Execute your eventloop 22 67 MEvtLoop loop; 23 68 loop.SetParList(&plist); 24 69 25 loop.Eventloop(); 70 if (!loop.Eventloop()) 71 return; 26 72 73 // print some execution statistics 74 tlist.PrintStatistics(); 75 76 // Draw result 27 77 rate.DrawClone(); 28 78 }
Note:
See TracChangeset
for help on using the changeset viewer.