source: trunk/MagicSoft/Mars/mtemp/mpadova/macros/resize.C@ 6028

Last change on this file since 6028 was 6021, checked in by moralejo, 20 years ago
*** empty log message ***
File size: 3.0 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! Copyright: MAGIC Software Development, 2000-2003
18!
19!
20\* ======================================================================== */
21
22
23void 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("MRawEvtHeader", "Events");
38 write.AddContainer("MMcEvt", "Events");
39 write.AddContainer("MHillas", "Events");
40 write.AddContainer("MHillasExt", "Events");
41 write.AddContainer("MImagePar", "Events");
42 write.AddContainer("MNewImagePar", "Events");
43 write.AddContainer("MHillasSrc", "Events");
44 write.AddContainer("MConcentration", "Events", kFALSE);
45 write.AddContainer("MPointingPos", "Events", kFALSE);
46
47
48 write.AddContainer("MGeomCam", "RunHeaders");
49 write.AddContainer("MMcConfigRunHeader", "RunHeaders");
50 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
51 write.AddContainer("MMcFadcHeader", "RunHeaders");
52 write.AddContainer("MMcTrigHeader", "RunHeaders");
53
54 write.AddContainer("MRawRunHeader", "RunHeaders");
55 write.AddContainer("MSrcPosCam", "RunHeaders");
56 write.AddContainer("MMcRunHeader", "RunHeaders");
57
58 //
59 // Histogram: event acceptance probability vs log10(Size). Binning
60 // and range are completely free. Beyond the histogram limits all
61 // events are accepted
62 //
63
64 Float_t frac[20] = {0.180451, 0.236564, 0.253332, 0.282566, 0.355083,
65 0.424058, 0.566892, 0.657478, 0.753713, 0.738402,
66 0.789239, 0.762777, 0.857609, 0.833747, 0.923706,
67 1.04348, 0.978622, 0.875537, 0.971831, 1.};
68
69
70 TH1F hist("probability", "", 20, 2., 4.);
71 hist.SetXTitle("log10(MHillas.fSize)");
72 for (Int_t i = 0; i < 20; i++)
73 hist.SetBinContent(i+1, frac[i]);
74
75 MH3 mh(hist);
76 MFEventSelector2 fsize(mh);
77 fsize.SetHistIsProbability(kTRUE);
78
79 write.SetFilter(&fsize);
80
81 tlist.AddToList(&fsize);
82 tlist.AddToList(&write);
83
84 MEvtLoop evtloop;
85 evtloop.SetParList(&plist);
86
87 MProgressBar *bar = new MProgressBar;
88 evtloop.SetProgressBar(bar);
89
90 //
91 // Execute your analysis
92 //
93 if (!evtloop.Eventloop())
94 return;
95
96 tlist.PrintStatistics();
97
98 bar->DestroyWindow();
99
100 return;
101}
Note: See TracBrowser for help on using the repository browser.