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 |
|
---|
25 |
|
---|
26 | Bool_t HandleInput()
|
---|
27 | {
|
---|
28 | TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
|
---|
29 | while (1)
|
---|
30 | {
|
---|
31 | //
|
---|
32 | // While reading the input process gui events asynchronously
|
---|
33 | //
|
---|
34 | timer.TurnOn();
|
---|
35 | TString input = Getline("Type 'q' to exit, <return> to go on: ");
|
---|
36 | timer.TurnOff();
|
---|
37 |
|
---|
38 | if (input=="q\n")
|
---|
39 | return kFALSE;
|
---|
40 |
|
---|
41 | if (input=="\n")
|
---|
42 | return kTRUE;
|
---|
43 | };
|
---|
44 |
|
---|
45 | return kFALSE;
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 | void findstars(const TString filename="dc_2004_03_17_01_16_51_20440_Mrk421.root", const TString directory="/nfs/magic/CaCodata/rootdata/Mrk421/Period015/2004_03_17/", const UInt_t numEvents = 0)
|
---|
50 | {
|
---|
51 |
|
---|
52 | //
|
---|
53 | // Create a empty Parameter List and an empty Task List
|
---|
54 | // The tasklist is identified in the eventloop by its name
|
---|
55 | //
|
---|
56 | MParList plist;
|
---|
57 |
|
---|
58 | MTaskList tlist;
|
---|
59 | plist.AddToList(&tlist);
|
---|
60 |
|
---|
61 |
|
---|
62 | MGeomCamMagic geomcam;
|
---|
63 | MCameraDC dccam;
|
---|
64 | MStarLocalCam starcam;
|
---|
65 |
|
---|
66 | plist.AddToList(&geomcam);
|
---|
67 | plist.AddToList(&dccam);
|
---|
68 | plist.AddToList(&starcam);
|
---|
69 |
|
---|
70 | //
|
---|
71 | // Now setup the tasks and tasklist:
|
---|
72 | // ---------------------------------
|
---|
73 | //
|
---|
74 |
|
---|
75 | // Reads the trees of the root file and the analysed branches
|
---|
76 | MReadReports read;
|
---|
77 | read.AddTree("Currents");
|
---|
78 | read.AddFile(directory+filename); // after the reading of the trees!!!
|
---|
79 | read.AddToBranchList("MReportCurrents.*");
|
---|
80 |
|
---|
81 | MGeomApply geomapl;
|
---|
82 | TString continuoslightfile =
|
---|
83 | // "/home/Javi/mnt_magic_data/CaCo/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
|
---|
84 | "/nfs/magic/CaCodata/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
|
---|
85 |
|
---|
86 | Float_t mindc = 0.9; //[uA]
|
---|
87 | MCalibrateDC dccal;
|
---|
88 | dccal.SetFileName(continuoslightfile);
|
---|
89 | dccal.SetMinDCAllowed(mindc);
|
---|
90 |
|
---|
91 | const Int_t numblind = 5;
|
---|
92 | const Short_t x[numblind] = { 47, 124, 470, 475, 571};
|
---|
93 | const TArrayS blindpixels(numblind,(Short_t*)x);
|
---|
94 | Float_t ringinterest = 100; //[mm]
|
---|
95 | Float_t tailcut = 2.5;
|
---|
96 | UInt_t integratedevents = 1;
|
---|
97 |
|
---|
98 | MFindStars findstars;
|
---|
99 | findstars.SetBlindPixels(blindpixels);
|
---|
100 | findstars.SetRingInterest(ringinterest);
|
---|
101 | findstars.SetDCTailCut(tailcut);
|
---|
102 | findstars.SetNumIntegratedEvents(integratedevents);
|
---|
103 | findstars.SetMinuitPrintOutLevel(-1);
|
---|
104 |
|
---|
105 |
|
---|
106 | tlist.AddToList(&geomapl);
|
---|
107 | tlist.AddToList(&read);
|
---|
108 | tlist.AddToList(&dccal);
|
---|
109 | tlist.AddToList(&findstars, "Currents");
|
---|
110 |
|
---|
111 | //
|
---|
112 | // Create and setup the eventloop
|
---|
113 | //
|
---|
114 | MEvtLoop evtloop;
|
---|
115 | evtloop.SetParList(&plist);
|
---|
116 |
|
---|
117 | //
|
---|
118 | // Execute your analysis
|
---|
119 | //
|
---|
120 |
|
---|
121 | if (numEvents > 0)
|
---|
122 | {
|
---|
123 | if (!evtloop.Eventloop(numEvents))
|
---|
124 | return;
|
---|
125 | }
|
---|
126 | else
|
---|
127 | {
|
---|
128 | if (!evtloop.PreProcess())
|
---|
129 | return;
|
---|
130 |
|
---|
131 | // MHCamera display0(geomcam);
|
---|
132 | // display0.SetPrettyPalette();
|
---|
133 | // display0.Draw();
|
---|
134 | // // display0.SetCamContent(dccal.GetDisplay());
|
---|
135 | // display0.SetCamContent(dccal.GetDCCalibrationFactor());
|
---|
136 | // gPad->Modified();
|
---|
137 | // gPad->Update();
|
---|
138 |
|
---|
139 | // // Remove the comments if you want to go through the file
|
---|
140 | // // event-by-event:
|
---|
141 | // if (!HandleInput())
|
---|
142 | // break;
|
---|
143 |
|
---|
144 | MHCamera display(geomcam);
|
---|
145 | display.SetPrettyPalette();
|
---|
146 | display.Draw();
|
---|
147 | gPad->cd(1);
|
---|
148 | starcam.Draw();
|
---|
149 |
|
---|
150 | UInt_t numevents=0;
|
---|
151 |
|
---|
152 | while (tlist.Process())
|
---|
153 | {
|
---|
154 | numevents++;
|
---|
155 | if (numevents%integratedevents==0)
|
---|
156 | {
|
---|
157 | // display.SetCamContent(dccam);
|
---|
158 | display.SetCamContent(findstars.GetDisplay());
|
---|
159 | gPad->Modified();
|
---|
160 | gPad->Update();
|
---|
161 | starcam.Print("maxpossizechi");
|
---|
162 | // Remove the comments if you want to go through the file
|
---|
163 | // event-by-event:
|
---|
164 | if (!HandleInput())
|
---|
165 | break;
|
---|
166 | }
|
---|
167 | }
|
---|
168 |
|
---|
169 | evtloop.PostProcess();
|
---|
170 | }
|
---|
171 |
|
---|
172 | tlist.PrintStatistics();
|
---|
173 |
|
---|
174 | }
|
---|
175 |
|
---|
176 |
|
---|