source: trunk/MagicSoft/Mars/mtemp/mifae/macros/hvnotnominal.C@ 5673

Last change on this file since 5673 was 4429, checked in by jlopez, 20 years ago
*** empty log message ***
File size: 4.1 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
26Bool_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
49void hvnotnominal(const TString filename="20040319_20821_D_Mrk421_S.root", const TString directory="/nfs/magic/CaCodata/2004_03_19/", Float_t percent = 0.01)
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 MBadPixelsCam badcam;
64 MCameraHV hvcam;
65
66 // this line is needed because the CC rep rootified file don't have run header,
67 // then the MGeomApply can not initialitaze the containers with the number of
68 // pixels because this is done in the reinit().
69 badcam.InitSize(geomcam.GetNumPixels());
70
71 plist.AddToList(&geomcam);
72 plist.AddToList(&badcam);
73 plist.AddToList(&hvcam);
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("Camera");
83 read.AddFile(directory+filename); // after the reading of the trees!!!
84 read.AddToBranchList("MReportCamera.*");
85
86 MGeomApply geomapl;
87 MFHVNotNominal fHVNominal;
88 TString hvnominal = "/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf";
89 fHVNominal.SetHVNominalValues(hvnominal);
90 // fHVNominal.SetMaxNumPixelsDeviated(10);
91 MContinue cont_hv(&fHVNominal);
92
93 tlist.AddToList(&read);
94 tlist.AddToList(&geomapl);
95 tlist.AddToList(&cont_hv);
96
97 //
98 // Create and setup the eventloop
99 //
100 MEvtLoop evtloop;
101 evtloop.SetParList(&plist);
102
103 //
104 // Execute your analysis
105 //
106
107 MHCamera hvnotnominal(geomcam);
108 MHCamera lowhvnotnominal(geomcam);
109 MHCamera uphvnotnominal(geomcam);
110
111 if (!evtloop.PreProcess())
112 return;
113
114 TArrayD nominal = fHVNominal.GetHVNominal();
115 TArrayD lownominal = nominal;
116 TArrayD upnominal = nominal;
117
118 for (UInt_t pix=0; pix<nominal.GetSize(); pix++)
119 {
120 lownominal[pix] *= (1-percent);
121 upnominal[pix] *= (1+percent);
122 }
123
124
125 while(tlist.Process())
126 {
127
128 hvnotnominal.CntCamContent(hvcam,lownominal,0,kFALSE);
129 hvnotnominal.CntCamContent(hvcam,upnominal,0,kTRUE);
130
131 lowhvnotnominal.CntCamContent(hvcam,lownominal,0,kFALSE);
132 uphvnotnominal.CntCamContent(hvcam,upnominal,0,kTRUE);
133 }
134
135
136 evtloop.PostProcess();
137
138 tlist.PrintStatistics();
139
140 TCanvas c1;
141 c1.Divide(2,1);
142 c1.cd(1);
143 lowhvnotnominal.SetPrettyPalette();
144 lowhvnotnominal.Draw();
145 gPad->cd(1);
146 gPad->Modified();
147 gPad->Update();
148 c1.cd(2);
149 uphvnotnominal.SetPrettyPalette();
150 uphvnotnominal.Draw();
151 gPad->cd(2);
152 gPad->Modified();
153 gPad->Update();
154
155 TCanvas c2;
156 hvnotnominal.SetPrettyPalette();
157 hvnotnominal.Draw();
158 gPad->cd(1);
159 gPad->Modified();
160 gPad->Update();
161
162 if (!HandleInput())
163 break;
164
165}
166
167
Note: See TracBrowser for help on using the repository browser.