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 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
18 | !
|
---|
19 | !
|
---|
20 | \* ======================================================================== */
|
---|
21 |
|
---|
22 |
|
---|
23 | void resize()
|
---|
24 | {
|
---|
25 | MParList plist;
|
---|
26 | MTaskList tlist;
|
---|
27 |
|
---|
28 | plist.AddToList(&tlist);
|
---|
29 |
|
---|
30 | MReadMarsFile read("Events", "star_gamma_train.root");
|
---|
31 |
|
---|
32 | read.DisableAutoScheme();
|
---|
33 | tlist.AddToList(&read);
|
---|
34 |
|
---|
35 | MWriteRootFile write("star_gamma_train_new.root", "recreate");
|
---|
36 |
|
---|
37 | write.AddContainer("MMcEvt", "Events");
|
---|
38 | write.AddContainer("MHillas", "Events");
|
---|
39 | write.AddContainer("MHillasExt", "Events");
|
---|
40 | write.AddContainer("MImagePar", "Events");
|
---|
41 | write.AddContainer("MNewImagePar", "Events");
|
---|
42 | write.AddContainer("MHillasSrc", "Events");
|
---|
43 | write.AddContainer("MConcentration", "Events", kFALSE);
|
---|
44 | write.AddContainer("MPointingPos", "Events", kFALSE);
|
---|
45 |
|
---|
46 |
|
---|
47 | write.AddContainer("MGeomCam", "RunHeaders");
|
---|
48 | write.AddContainer("MMcConfigRunHeader", "RunHeaders");
|
---|
49 | write.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
|
---|
50 | write.AddContainer("MMcFadcHeader", "RunHeaders");
|
---|
51 | write.AddContainer("MMcTrigHeader", "RunHeaders");
|
---|
52 |
|
---|
53 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
---|
54 | write.AddContainer("MSrcPosCam", "RunHeaders");
|
---|
55 | write.AddContainer("MMcRunHeader", "RunHeaders");
|
---|
56 |
|
---|
57 | //
|
---|
58 | // Histogram: event acceptance probability vs log10(Size). Binning
|
---|
59 | // and range are completely free. Beyond the histogram limits all
|
---|
60 | // events are accepted
|
---|
61 | //
|
---|
62 |
|
---|
63 | Float_t frac[20] = {0.180451, 0.236564, 0.253332, 0.282566, 0.355083,
|
---|
64 | 0.424058, 0.566892, 0.657478, 0.753713, 0.738402,
|
---|
65 | 0.789239, 0.762777, 0.857609, 0.833747, 0.923706,
|
---|
66 | 1.04348, 0.978622, 0.875537, 0.971831, 1.};
|
---|
67 |
|
---|
68 |
|
---|
69 | TH1F hist("probability", "", 20, 2., 4.);
|
---|
70 | hist.SetXTitle("log10(MHillas.fSize)");
|
---|
71 | for (Int_t i = 0; i < 20; i++)
|
---|
72 | hist.SetBinContent(i+1, frac[i]);
|
---|
73 |
|
---|
74 | MH3 mh(hist);
|
---|
75 | MFEventSelector2 fsize(mh);
|
---|
76 | fsize.SetHistIsProbability(kTRUE);
|
---|
77 |
|
---|
78 | write.SetFilter(&fsize);
|
---|
79 |
|
---|
80 | tlist.AddToList(&fsize);
|
---|
81 | tlist.AddToList(&write);
|
---|
82 |
|
---|
83 | MEvtLoop evtloop;
|
---|
84 | evtloop.SetParList(&plist);
|
---|
85 |
|
---|
86 | MProgressBar *bar = new MProgressBar;
|
---|
87 | evtloop.SetProgressBar(bar);
|
---|
88 |
|
---|
89 | //
|
---|
90 | // Execute your analysis
|
---|
91 | //
|
---|
92 | if (!evtloop.Eventloop())
|
---|
93 | return;
|
---|
94 |
|
---|
95 | tlist.PrintStatistics();
|
---|
96 |
|
---|
97 | bar->DestroyWindow();
|
---|
98 |
|
---|
99 | return;
|
---|
100 | }
|
---|