source: trunk/MagicSoft/Mars/mtemp/mifae/programs/psffit.cc@ 4019

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