source: trunk/MagicSoft/Mars/macros/collarea.C@ 5489

Last change on this file since 5489 was 2098, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.4 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-2003
21!
22!
23\* ======================================================================== */
24
25
26void collarea(TString filename="camera.root", TString outname="")
27{
28 MStatusDisplay *d = new MStatusDisplay;
29 // redirect logging output to GUI, kFALSE to disable stream to stdout
30 d->SetLogStream(&gLog, kTRUE);
31
32 //
33 // first we have to create our empty lists
34 //
35 MParList parlist;
36 MTaskList tasklist;
37
38 parlist.AddToList(&tasklist);
39
40 //
41 // Setup out tasks:
42 // - First we have to read the events
43 // - Then we can fill the efficiency histograms
44 //
45 MReadMarsFile reader("Events", filename);
46 MMcCollectionAreaCalc effi;
47
48 tasklist.AddToList(&reader);
49 tasklist.AddToList(&effi);
50
51 //
52 // set up the loop for the processing
53 //
54 MEvtLoop magic;
55 magic.SetParList(&parlist);
56
57 //
58 // Start to loop over all events
59 //
60 magic.SetDisplay(d);
61 if (!magic.Eventloop())
62 return;
63
64 tasklist.PrintStatistics();
65
66 //
67 // Now the histogram we wanted to get out of the data is
68 // filled and can be displayed
69 //
70 if ((d = magic.GetDisplay()))
71 d->AddTab("Collection Area");
72 else
73 new TCanvas("CollArea", "Result of the collection area calculation");
74
75 parlist.FindObject("MHMcCollectionArea")->DrawClone("nonew");
76
77
78 //
79 // Write histogram to a file in case an output
80 // filename has been supplied
81 //
82 if (outname.IsNull())
83 return;
84
85 TFile f(outname, "recreate");
86 if (!f)
87 return;
88
89 parlist.FindObject("MHMcCollectionArea")->Write();
90}
Note: See TracBrowser for help on using the repository browser.