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, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | ! Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2002
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | void plot2()
|
---|
27 | {
|
---|
28 | //
|
---|
29 | // This is a demonstration program which calculates the Hillas
|
---|
30 | // parameter out of a Magic root file.
|
---|
31 |
|
---|
32 | //
|
---|
33 | // Create a empty Parameter List and an empty Task List
|
---|
34 | // The tasklist is identified in the eventloop by its name
|
---|
35 | //
|
---|
36 | MParList plist;
|
---|
37 |
|
---|
38 | MTaskList tlist;
|
---|
39 | plist.AddToList(&tlist);
|
---|
40 |
|
---|
41 | //
|
---|
42 | // Now setup the tasks and tasklist:
|
---|
43 | // ---------------------------------
|
---|
44 | //
|
---|
45 | // The first argument is the tree you want to read.
|
---|
46 | // Events: Cosmic ray events
|
---|
47 | // PedEvents: Pedestal Events
|
---|
48 | // CalEvents: Calibration Events
|
---|
49 | //
|
---|
50 | MReadMarsFile read("Events", "star.root");
|
---|
51 | read.DisableAutoScheme();
|
---|
52 | tlist.AddToList(&read);
|
---|
53 |
|
---|
54 | MFParticleId fgamma("MMcEvt", '=', kGAMMA);
|
---|
55 | tlist.AddToList(&fgamma);
|
---|
56 |
|
---|
57 | MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
|
---|
58 | tlist.AddToList(&fhadrons);
|
---|
59 |
|
---|
60 | // -------------------------------------------------------
|
---|
61 | //
|
---|
62 | // set the name of the variable to plot and the binning
|
---|
63 | //
|
---|
64 | MGeomCamMagic cam;
|
---|
65 | plist.AddToList(&cam);
|
---|
66 |
|
---|
67 | TString vary("MHillas.fWidth*MGeomCam.fConvMm2Deg");
|
---|
68 | TString varx("MHillas.fLength*MGeomCam.fConvMm2Deg");
|
---|
69 |
|
---|
70 | MBinning binsy("BinningMH3Y");
|
---|
71 | MBinning binsx("BinningMH3X");
|
---|
72 | binsy.SetEdges(11, 0, 0.3);
|
---|
73 | binsx.SetEdges(11, 0, 0.6);
|
---|
74 |
|
---|
75 | //
|
---|
76 | // -------------------------------------------------
|
---|
77 |
|
---|
78 | MH3 h3g(varx, vary);
|
---|
79 | MH3 h3h(varx, vary);
|
---|
80 |
|
---|
81 | plist.AddToList(&h3g);
|
---|
82 | plist.AddToList(&h3h);
|
---|
83 |
|
---|
84 | plist.AddToList(&binsx);
|
---|
85 | plist.AddToList(&binsy);
|
---|
86 |
|
---|
87 | MFillH fillg(&h3g);
|
---|
88 | fillg.SetFilter(&fgamma);
|
---|
89 | tlist.AddToList(&fillg);
|
---|
90 |
|
---|
91 | MFillH fillh(&h3h);
|
---|
92 | fillh.SetFilter(&fhadrons);
|
---|
93 | tlist.AddToList(&fillh);
|
---|
94 |
|
---|
95 | //
|
---|
96 | // Create and setup the eventloop
|
---|
97 | //
|
---|
98 | MEvtLoop evtloop;
|
---|
99 | evtloop.SetParList(&plist);
|
---|
100 |
|
---|
101 | //
|
---|
102 | // Execute your analysis
|
---|
103 | //
|
---|
104 | if (!evtloop.Eventloop())
|
---|
105 | return;
|
---|
106 |
|
---|
107 | tlist.PrintStatistics();
|
---|
108 |
|
---|
109 | MH::MakeDefCanvas("Plot");
|
---|
110 | h3h.GetHist().SetMarkerColor(kRed);
|
---|
111 | h3h.GetHist().SetLineColor(kRed);
|
---|
112 | h3h.GetHist().SetFillStyle(4000);
|
---|
113 | h3h.GetHist().DrawCopy("cont3");
|
---|
114 | h3g.GetHist().DrawCopy("cont3same");
|
---|
115 |
|
---|
116 | return;
|
---|
117 |
|
---|
118 | TProfile *p = ((TH2&)h3g.GetHist()).ProfileX();
|
---|
119 | p->Draw("same");
|
---|
120 | p->SetBit(kCanDelete);
|
---|
121 |
|
---|
122 | TProfile *p = ((TH2&)h3h.GetHist()).ProfileX();
|
---|
123 | p->SetLineColor(kRed);
|
---|
124 | p->SetFillStyle(4000);
|
---|
125 | p->Draw("same");
|
---|
126 | p->SetBit(kCanDelete);
|
---|
127 | }
|
---|