source: trunk/MagicSoft/Mars/macros/merpp.C@ 2381

Last change on this file since 2381 was 2222, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.0 KB
Line 
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/2000 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// This is an easy implementation of the Merging process (as root Macro)
29//
30// at the moment it reads a binary file ("rawtest.bin") which was written
31// in the DAQ raw format.
32//
33// The data are stored in root container objects (classes derived from
34// TObject like MRawRunHeader)
35//
36// This containers are written to a root file ("rawtest.root")
37//
38/////////////////////////////////////////////////////////////////////////////
39
40void ProcessFile(TString fname)
41{
42 //
43 // create a (empty) list of parameters which can be used by the tasks
44 // and an (empty) list of tasks which should be executed
45 //
46 MTaskList tasks;
47 MParList plist;
48
49 plist.AddToList(&tasks);
50
51 //
52 // create the tasks which should be executed and add them to the list
53 // in the case you don't need parameter containers, all of them can
54 // be created by MRawFileRead::PreProcess
55 //
56 // REMARK: Don't change the order of the two instantiations.
57 // I don't have an idea why, but here it crashes the
58 // Interpreter.
59 // (Using root 2.25/03, with Cint 5.14.50 on OSF1)
60 //
61 MRawFileRead reader(fname);
62 MRawFileWrite writer(fname(0, fname.Last('.')+1) + "root", "RECREATE", fname, 1);
63 tasks.AddToList(&reader);
64 tasks.AddToList(&writer);
65
66 //
67 // create the looping object and thell it about the parameters to use
68 // and the tasks to execute
69 //
70 MEvtLoop magic;
71
72 magic.SetParList(&plist);
73
74 //
75 // Start the eventloop which reads the raw file (MRawFileRead) and
76 // write all the information into a root file (MRawFileWrite)
77 //
78 // between reading and writing we can do, transformations, checks, etc.
79 // (I'm think of a task like MRawDataCheck)
80 //
81 magic.Eventloop();
82}
83
84void merpp(const char *dirname="/home/MAGIC/online_data/rawdata/")
85{
86 MDirIter Next;
87 Next.AddDirectory(dirname, "*.raw", -1);
88
89 while (1)
90 {
91 TString fname = Next();
92 if (fname.IsNull())
93 break;
94
95 ProcessFile(fname);
96 }
97}
98
Note: See TracBrowser for help on using the repository browser.