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): Javier López, 04/2004 <mailto:jlopez@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | #include <iostream>
|
---|
26 | #include <stdlib.h>
|
---|
27 |
|
---|
28 | #include <TString.h>
|
---|
29 | #include <TArrayS.h>
|
---|
30 |
|
---|
31 | #include "MParList.h"
|
---|
32 | #include "MTaskList.h"
|
---|
33 | #include "MGeomCamMagic.h"
|
---|
34 | #include "MCameraDC.h"
|
---|
35 | #include "MPSFFit.h"
|
---|
36 |
|
---|
37 | #include "MReadReports.h"
|
---|
38 | #include "MGeomApply.h"
|
---|
39 | #include "MPSFFitCalc.h"
|
---|
40 | #include "MEvtLoop.h"
|
---|
41 |
|
---|
42 | using namespace std;
|
---|
43 |
|
---|
44 | int main(int argc, char *argv[])
|
---|
45 | {
|
---|
46 | if(argc!=2 && argc!=3)
|
---|
47 | {
|
---|
48 | printf("\n usage: %s filename numberEnvents \n\n",argv[0]);
|
---|
49 | return 1;
|
---|
50 | }
|
---|
51 |
|
---|
52 | UInt_t len=strlen(argv[1]);
|
---|
53 |
|
---|
54 | if(argv[1][len] == '/')
|
---|
55 | {
|
---|
56 | argv[1][len]='\0';
|
---|
57 | }
|
---|
58 |
|
---|
59 | TString filename;
|
---|
60 | filename=argv[1];
|
---|
61 |
|
---|
62 | UInt_t numEvents = 1000000;
|
---|
63 | if(argc == 3)
|
---|
64 | {
|
---|
65 | len=strlen(argv[2]);
|
---|
66 |
|
---|
67 | if(argv[2][len] == '/')
|
---|
68 | {
|
---|
69 | argv[2][len]='\0';
|
---|
70 | }
|
---|
71 |
|
---|
72 | numEvents=atoi(argv[2]);
|
---|
73 | }
|
---|
74 |
|
---|
75 | //
|
---|
76 | // Create a empty Parameter List and an empty Task List
|
---|
77 | // The tasklist is identified in the eventloop by its name
|
---|
78 | //
|
---|
79 | MParList plist;
|
---|
80 |
|
---|
81 | MTaskList tlist;
|
---|
82 | plist.AddToList(&tlist);
|
---|
83 |
|
---|
84 |
|
---|
85 | MGeomCamMagic geomcam;
|
---|
86 | MCameraDC dccam;
|
---|
87 | MPSFFit psffit;
|
---|
88 |
|
---|
89 | plist.AddToList(&geomcam);
|
---|
90 | plist.AddToList(&dccam);
|
---|
91 | plist.AddToList(&psffit);
|
---|
92 |
|
---|
93 | //
|
---|
94 | // Now setup the tasks and tasklist:
|
---|
95 | // ---------------------------------
|
---|
96 | //
|
---|
97 |
|
---|
98 | // Reads the trees of the root file and the analysed branches
|
---|
99 | MReadReports read;
|
---|
100 | read.AddTree("Currents");
|
---|
101 | read.AddFile(filename); // after the reading of the trees!!!
|
---|
102 | read.AddToBranchList("MReportCurrents.*");
|
---|
103 |
|
---|
104 | MGeomApply geomapl;
|
---|
105 |
|
---|
106 | const Int_t numrings = 3;
|
---|
107 | const Int_t numblind = 23;
|
---|
108 | const Short_t x[numblind] = { 8, 27, 224, 279, 339,
|
---|
109 | 507, 508, 509, 510, 511, 512, 513, 514,
|
---|
110 | 543,
|
---|
111 | 559, 560, 561, 562, 563, 564, 565, 566, 567};
|
---|
112 |
|
---|
113 | // 2004_02_15
|
---|
114 | /* const Int_t numblind = 28;
|
---|
115 | const Short_t x[numblind] = { 8, 224, 279, 339,
|
---|
116 | 433, 434, 435, 436, 437, 438, 439,
|
---|
117 | 475, 476, 477, 478, 479, 480, 481, 482,
|
---|
118 | 523, 524, 525, 526, 527, 528, 529, 530, 531};
|
---|
119 | */
|
---|
120 | const TArrayS blindpixels(numblind,(Short_t*)x);
|
---|
121 | MPSFFitCalc psfcalc;
|
---|
122 | //psfcalc.SetImgCleanMode(MPSFFitCalc::kRing);
|
---|
123 | psfcalc.SetImgCleanMode(MPSFFitCalc::kCombined);
|
---|
124 | psfcalc.SetNumRings(numrings);
|
---|
125 | psfcalc.SetBlindPixels(blindpixels);
|
---|
126 |
|
---|
127 |
|
---|
128 | tlist.AddToList(&geomapl);
|
---|
129 | tlist.AddToList(&read);
|
---|
130 | tlist.AddToList(&psfcalc, "Currents");
|
---|
131 |
|
---|
132 | //
|
---|
133 | // Create and setup the eventloop
|
---|
134 | //
|
---|
135 | MEvtLoop evtloop;
|
---|
136 | evtloop.SetParList(&plist);
|
---|
137 |
|
---|
138 | //
|
---|
139 | // Execute your analysis
|
---|
140 | //
|
---|
141 |
|
---|
142 | if (!evtloop.Eventloop(numEvents))
|
---|
143 | return kFALSE;
|
---|
144 |
|
---|
145 | // tlist.PrintStatistics();
|
---|
146 |
|
---|
147 | cout << "RUN " << psffit.GetMeanMinorAxis() << ' ' << psffit.GetSigmaMinorAxis() << ' ' << psffit.GetMeanMajorAxis() << ' ' << psffit.GetSigmaMajorAxis() << ' ' << psffit.GetChisquare() << endl;
|
---|
148 |
|
---|
149 | }
|
---|
150 |
|
---|
151 |
|
---|