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

Last change on this file since 6577 was 4328, checked in by rico, 20 years ago
*** empty log message ***
File size: 4.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!
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#include "MCalibrateDC.h"
42
43using namespace std;
44
45int main(int argc, char *argv[])
46{
47 if(argc!=2 && argc!=3)
48 {
49 printf("\n usage: %s filename numberEnvents \n\n",argv[0]);
50 return 1;
51 }
52
53 UInt_t len=strlen(argv[1]);
54
55 if(argv[1][len] == '/')
56 {
57 argv[1][len]='\0';
58 }
59
60 TString filename;
61 filename=argv[1];
62
63 UInt_t numEvents = 1000000;
64 if(argc == 3)
65 {
66 len=strlen(argv[2]);
67
68 if(argv[2][len] == '/')
69 {
70 argv[2][len]='\0';
71 }
72
73 numEvents=atoi(argv[2]);
74 }
75
76 //
77 // Create a empty Parameter List and an empty Task List
78 // The tasklist is identified in the eventloop by its name
79 //
80 MParList plist;
81
82 MTaskList tlist;
83 plist.AddToList(&tlist);
84
85
86 MGeomCamMagic geomcam;
87 MCameraDC dccam;
88 MPSFFit psffit;
89
90 plist.AddToList(&geomcam);
91 plist.AddToList(&dccam);
92 plist.AddToList(&psffit);
93
94 //
95 // Now setup the tasks and tasklist:
96 // ---------------------------------
97 //
98
99 // Reads the trees of the root file and the analysed branches
100 MReadReports read;
101 read.AddTree("Currents");
102 read.AddFile(filename); // after the reading of the trees!!!
103 read.AddToBranchList("MReportCurrents.*");
104
105 MGeomApply geomapl;
106
107 TString continuoslightfile =
108 "/nfs/magic/CaCodata/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
109 MCalibrateDC dccal;
110 dccal.SetFileName(continuoslightfile);
111
112 const Int_t numrings = 3;
113 // const Int_t numblind = 187;
114
115
116 // 2004_02_15
117 /* const Int_t numblind = 28;
118 const Short_t x[numblind] = { 8, 224, 279, 339,
119 433, 434, 435, 436, 437, 438, 439,
120 475, 476, 477, 478, 479, 480, 481, 482,
121 523, 524, 525, 526, 527, 528, 529, 530, 531};
122 */
123 const Int_t numblind = 260;
124 Short_t x[numblind];
125
126 for (int i=0;i<246;i++)
127 x[i+14]=i+331;
128 x[0]=124;
129 x[1]=123;
130 x[2]=125;
131 x[3]=166;
132 x[4]=165;
133 x[5]=88;
134 x[6]=89;
135 x[7]=282;
136 x[8]=283;
137 x[9]=226;
138 x[10]=227;
139 x[11]=228;
140 x[12]=177;
141 x[13]=178;
142
143 const TArrayS blindpixels(numblind,(Short_t*)x);
144 MPSFFitCalc psfcalc;
145 //psfcalc.SetImgCleanMode(MPSFFitCalc::kRing);
146 psfcalc.SetImgCleanMode(MPSFFitCalc::kCombined);
147 psfcalc.SetNumRings(numrings);
148 psfcalc.SetBlindPixels(blindpixels);
149
150
151 tlist.AddToList(&geomapl);
152 tlist.AddToList(&read);
153 tlist.AddToList(&dccal, "Currents");
154 tlist.AddToList(&psfcalc, "Currents");
155
156 //
157 // Create and setup the eventloop
158 //
159 MEvtLoop evtloop;
160 evtloop.SetParList(&plist);
161
162 //
163 // Execute your analysis
164 //
165
166 if (!evtloop.Eventloop(numEvents))
167 return kFALSE;
168
169 // tlist.PrintStatistics();
170
171 cout << "RUN " << psffit.GetMeanMinorAxis() << ' ' << psffit.GetSigmaMinorAxis() << ' ' << psffit.GetMeanMajorAxis() << ' ' << psffit.GetSigmaMajorAxis() << ' ' << psffit.GetChisquare() << endl;
172
173}
174
175
Note: See TracBrowser for help on using the repository browser.