source: branches/AddingGoogleTestEnvironment/macros/tutorials/testenv.C@ 19779

Last change on this file since 19779 was 7159, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 3.7 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 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25///////////////////////////////////////////////////////////////////////////
26//
27// testenv.C
28// =========
29//
30// This example reads an config-file (steering card, input card, ...)
31// The contents of the file a forwarded to the apropriate eventloop
32// setup in your file.
33//
34// All tasks and containers in an eventloop should implement the
35// ReadEnv/WriteEnv function (for an example see the tasks used below).
36//
37// The functions gets the corresponding setup data from the file as an
38// argument and can change their behaviour and setup on this information.
39//
40///////////////////////////////////////////////////////////////////////////
41
42void testenv()
43{
44 // Setup for all MHMatrix objects is done by:
45 // MHMatrix.Column0: ...
46 //
47 // This can be overwritten for a MHMatrix called MatrixGammas by:
48 // MatrixGammas.Column0;
49 //
50 // This can be overwritten for all MHMatrix in one Job by:
51 // Job1.MHMatrix.Column0;
52 //
53 // This can be overwritten for a MHMatrix called MatrixGammas in one Job by:
54 // Job1.MatrixGammas.Column0;
55 //
56 TEnv env(".marsrc");
57
58 //
59 // For developers: Set this to kTRUE to see how the TEnv file
60 // entries are checked.
61 //
62 Bool_t print = kFALSE;
63
64 // ------------ Job 1 -------------------
65 if (env.GetValue("Job1", kFALSE))
66 {
67 cout << "++++++++++++++++++ Job 1 +++++++++++++++++++" << endl;
68 MParList plist1;
69 MTaskList tlist1;
70
71 plist1.AddToList(&tlist1);
72
73 MReadMarsFile read1("Events");
74
75 MHMatrix matrix1("MatrixGammas");
76
77 MFillH fillm1(&matrix1);
78 plist1.AddToList(&matrix1);
79
80 tlist1.AddToList(&read1);
81 tlist1.AddToList(&fillm1);
82
83 MEvtLoop evtloop1("Job1");
84 evtloop1.SetParList(&plist1);
85 cout << "--------------------------------------------" << endl;
86 evtloop1.ReadEnv(env, "", print);
87 cout << "--------------------------------------------" << endl;
88 evtloop1.Eventloop();
89 cout << endl;
90 }
91
92 // ------------ Job 2 -------------------
93
94 if (env.GetValue("Job2", kTRUE))
95 {
96 cout << "++++++++++++++++++ Job 2 +++++++++++++++++++" << endl;
97 MParList plist2;
98 MTaskList tlist2;
99
100 plist2.AddToList(&tlist2);
101
102 MReadMarsFile read2("Events");
103
104 MHMatrix matrix2("MatrixGammas");
105
106 MFillH fillm2(&matrix2);
107 plist2.AddToList(&matrix2);
108
109 tlist2.AddToList(&read2);
110 tlist2.AddToList(&fillm2);
111
112 MEvtLoop evtloop2("Job2");
113 evtloop2.SetParList(&plist2);
114 cout << "--------------------------------------------" << endl;
115 evtloop2.ReadEnv(env, "", print);
116 cout << "--------------------------------------------" << endl;
117 evtloop2.Eventloop();
118 cout << endl;
119 }
120}
Note: See TracBrowser for help on using the repository browser.