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

Last change on this file since 6724 was 6668, checked in by moralejo, 20 years ago
*** empty log message ***
File size: 3.2 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("MSrcPosCam", "Events", kFALSE);
45 write.AddContainer("MConcentration", "Events", kFALSE);
46 write.AddContainer("MPointingPos", "Events", kFALSE);
47
48
49 write.AddContainer("MGeomCam", "RunHeaders");
50 write.AddContainer("MMcConfigRunHeader", "RunHeaders");
51 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
52 write.AddContainer("MMcFadcHeader", "RunHeaders");
53 write.AddContainer("MMcTrigHeader", "RunHeaders");
54
55 write.AddContainer("MRawRunHeader", "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 // For MC calibrated in photons:
71 // TH1F hist("probability", "", 20, 2., 4.);
72
73 // For MC calibrated in phe-:
74 TH1F hist("probability", "", 20, 1.2552725, 3.2552725);
75
76 hist.SetXTitle("log10(MHillas.fSize)");
77 for (Int_t i = 0; i < 20; i++)
78 hist.SetBinContent(i+1, frac[i]);
79
80 MH3 mh(hist);
81 MFEventSelector2 fsize(mh);
82 fsize.SetHistIsProbability(kTRUE);
83
84 write.SetFilter(&fsize);
85
86 tlist.AddToList(&fsize);
87 tlist.AddToList(&write);
88
89 MEvtLoop evtloop;
90 evtloop.SetParList(&plist);
91
92 MProgressBar *bar = new MProgressBar;
93 evtloop.SetProgressBar(bar);
94
95 //
96 // Execute your analysis
97 //
98 if (!evtloop.Eventloop())
99 return;
100
101 tlist.PrintStatistics();
102
103 bar->DestroyWindow();
104
105 return;
106}
Note: See TracBrowser for help on using the repository browser.