source: trunk/MagicSoft/Mars/macros/MagicHillas.C@ 915

Last change on this file since 915 was 895, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.4 KB
Line 
1void MagicHillas()
2{
3 //
4 // This is a demonstration program which calculates the Hillas
5 // parameter out of a Magic root file.
6
7 //
8 // Create a empty Parameter List and an empty Task List
9 // The tasklist is identified in the eventloop by its name
10 //
11 MParList plist;
12
13 MTaskList tlist;
14 plist->AddToList(&tlist);
15
16 //
17 // The geometry container must be created by yourself to make sure
18 // that you don't choos a wrong geometry by chance
19 //
20 MGeomCamMagic geomcam;
21 plist->AddToList(&geomcam);
22
23 MPedestalCam pedest;
24 plist->AddToList(&pedest);
25
26 //
27 // The Hillas histograms (MHHillas) could be created automatically
28 // but to make sure, that they are not deleted when the macro is
29 // finished you must create them yourself and add it to the list
30 //
31 MHHillas *hists = new MHHillas;
32 plist->AddToList(hists);
33
34 MHStarMap *smap = new MHStarMap;
35 plist->AddToList(smap);
36
37 //
38 // Now setup the tasks and tasklist:
39 //
40 // 1) read in the data from a magic root file MReadTree
41 // 2) calculate number of cerenkov photons MCerPhotCalc
42 // 3) clean the image MImgCleanStd
43 // 4) calculate hillas MHillasCalc
44 // 5) fill the hillas into the histograms MFillHHillas
45 //
46
47 //
48 // The first argument is the tree you want to read.
49 // Events: Cosmic ray events
50 // PedEvents: Pedestal Events
51 // CalEvents: Calibration Events
52 //
53 MReadTree read("Events", "data/cer000020.root");
54 // read.AddFile("data/cer000019.root");
55
56 MCerPhotCalc ncalc;
57 MImgCleanStd clean;
58 MHillasCalc hcalc;
59 MFillH hfill("MHillas", "MHHillas");
60 MFillHStarMap sfill("MHillas", "MHStarMap");
61 MWriteRootFile write("hillas.root");
62 write.AddContainer("MHillas");
63 write.AddContainer("MHHillas");
64 write.AddContainer(smap);
65
66 tlist.AddToList(&read);
67 tlist.AddToList(&ncalc);
68 tlist.AddToList(&clean);
69 tlist.AddToList(&hcalc);
70 tlist.AddToList(&hfill);
71 tlist.AddToList(&sfill);
72 tlist.AddToList(&write);
73
74 //
75 // Create and setup the eventloop
76 //
77 MEvtLoop evtloop;
78 evtloop.SetParList(&plist);
79
80 //
81 // Execute your analysis
82 //
83 if (!evtloop.Eventloop())
84 return;
85
86 //
87 // After the analysis is finished we can display the histograms
88 //
89 hists->Draw();
90 smap->Draw();
91}
92
Note: See TracBrowser for help on using the repository browser.