source: branches/AddingGoogleTestEnvironment/mtemp/mifae/macros/psffromstars.C

Last change on this file was 4297, checked in by jlopez, 21 years ago
*** empty log message ***
File size: 4.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!
18! Author(s): Javier López, 05/2004 <mailto:jlopez@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25Bool_t HandleInput()
26{
27 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
28 while (1)
29 {
30 //
31 // While reading the input process gui events asynchronously
32 //
33 timer.TurnOn();
34 TString input = Getline("Type 'q' to exit, <return> to go on: ");
35 timer.TurnOff();
36
37 if (input=="q\n")
38 return kFALSE;
39
40 if (input=="\n")
41 return kTRUE;
42 };
43
44 return kFALSE;
45}
46
47Double_t fitfunc(Double_t *x, Double_t *par);
48
49
50void psffromstars(const TString filename="dc_*.root", const TString directory="/nfs/magic/CaCodata/online_data/Period015/cacadata/2004_03_21/", const UInt_t numEvents = 100000000)
51{
52
53 gStyle->SetOptFit(1);
54
55 //
56 // Create a empty Parameter List and an empty Task List
57 // The tasklist is identified in the eventloop by its name
58 //
59 MParList plist;
60
61 MTaskList tlist;
62 plist.AddToList(&tlist);
63
64
65 MGeomCamMagic geomcam;
66 MCameraDC dccam;
67 MStarLocalCam starcam;
68 MHPSFFromStars mhpsf;
69
70 plist.AddToList(&geomcam);
71 plist.AddToList(&dccam);
72 plist.AddToList(&starcam);
73 plist.AddToList(&mhpsf);
74
75 //
76 // Now setup the tasks and tasklist:
77 // ---------------------------------
78 //
79
80 // Reads the trees of the root file and the analysed branches
81 MReadReports read;
82 read.AddTree("Currents");
83 read.AddFile(directory+filename); // after the reading of the trees!!!
84 read.AddToBranchList("MReportCurrents.*");
85
86 MGeomApply geomapl;
87 TString continuoslightfile =
88 // "/home/Javi/mnt_magic_data/CaCo/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
89 "/nfs/magic/CaCodata/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
90
91 Float_t mindc = 0.7; //[uA]
92 MCalibrateDC dccal;
93 dccal.SetFileName(continuoslightfile);
94 dccal.SetMinDCAllowed(mindc);
95
96 const Int_t numblind = 1;
97 const Short_t x[numblind] = { 124};
98 const TArrayS blindpixels(numblind,(Short_t*)x);
99 Float_t ringinterest = 100; //[mm]
100 Float_t tailcut = 3.5;
101 UInt_t integratedevents = 10;
102
103 MFindStars findstars;
104 findstars.SetBlindPixels(blindpixels);
105 findstars.SetRingInterest(ringinterest);
106 findstars.SetDCTailCut(tailcut);
107 findstars.SetNumIntegratedEvents(integratedevents);
108 findstars.SetMinuitPrintOutLevel(-1);
109
110 MFillH fpsf("MHPSFFromStars","MStarLocalCam");
111
112 tlist.AddToList(&geomapl);
113 tlist.AddToList(&read);
114 tlist.AddToList(&dccal);
115 tlist.AddToList(&findstars, "Currents");
116 tlist.AddToList(&fpsf, "Currents");
117
118 //
119 // Create and setup the eventloop
120 //
121 MEvtLoop evtloop;
122 evtloop.SetParList(&plist);
123
124// MProgressBar bar;
125// evtloop.SetProgressBar(&bar);
126
127 //
128 // Execute your analysis
129 //
130
131 if (!evtloop.Eventloop(numEvents))
132 return;
133
134 tlist.PrintStatistics();
135
136 //Draw results
137
138 MStatusDisplay *d = new MStatusDisplay;
139 d->SetTitle(Form("- %s -",filename));
140 d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
141
142 // Create a default canvas
143 TCanvas &c1 = d.AddTab("Star spot Position");
144 mhpsf.Draw("mean");
145 TCanvas &c2 = d.AddTab("Star's Path");
146 mhpsf.Draw("camera");
147 TCanvas &c3 = d.AddTab("Star spot Size");
148 mhpsf.Draw("sigma");
149 TCanvas &c4 = d.AddTab("Star XY Projection");
150 mhpsf.Draw("projection");
151
152 d->Print("./psf.ps");
153
154 // if (!HandleInput()) {}
155
156}
157
Note: See TracBrowser for help on using the repository browser.