source: branches/Mars_McMismatchStudy/macros/tutorials/pixsatrate.C@ 18086

Last change on this file since 18086 was 7159, checked in by tbretz, 19 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): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
19! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// pixfirerate.C
29// =============
30//
31// This macro can help to find "hot" pixels firing too often
32// or pixels firing too rarely. It plots camera displays showing how many
33// times the FADC integral of each pixel has been found to be above pedestal
34// by 10, 20, 50, 100 or 200 ADC counts. As "pedestal" we now use simply
35// the signal in the first ADC slice, which seemed reasonable from a first
36// look at the available test data.
37//
38/////////////////////////////////////////////////////////////////////////////
39
40void pixsatrate(TString filename="rawfile.root")
41{
42 //
43 // Update frequency by default = 1Hz
44 //
45 MStatusDisplay *d = new MStatusDisplay;
46
47 // Set update time to 5s
48 // d->SetUpdateTime(5000);
49
50 // Disable online update
51 // d->SetUpdateTime(-1);
52
53 d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
54 gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
55 //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
56
57 //
58 // Create a empty Parameter List and an empty Task List
59 // The tasklist is identified in the eventloop by its name
60 //
61 MTaskList tlist;
62 MParList plist;
63 plist.AddToList(&tlist);
64
65 //
66 // Now setup the tasks and tasklist:
67 // ---------------------------------
68 //
69 MReadMarsFile read("Events");
70 read.DisableAutoScheme();
71 read.AddFile(filename);
72 tlist.AddToList(&read);
73
74 MGeomApply geomapl;
75 tlist.AddToList(&geomapl);
76
77 // Create histograms with saturation limits at 254
78 MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains");
79 MHTriggerLvl0 triglo(254, "SaturationLo", "Saturation Rate of Lo Gains");
80 trighi.SetType(1);
81 triglo.SetType(2);
82
83 // craete fill tasks to fill the histogarms
84 MFillH fillhi(&trighi, "MRawEvtData");
85 MFillH filllo(&triglo, "MRawEvtData");
86 tlist.AddToList(&fillhi);
87 tlist.AddToList(&filllo);
88
89 // create eventloop
90 MEvtLoop evtloop;
91 evtloop.SetParList(&plist);
92 evtloop.SetDisplay(d);
93
94 //
95 // Execute your analysis
96 //
97 if (!evtloop.Eventloop())
98 return;
99
100 tlist.PrintStatistics();
101
102 //
103 // Make sure the display hasn't been deleted by the user while the
104 // eventloop was running.
105 //
106 if ((d = evtloop.GetDisplay()))
107 {
108 // Save data in a postscriptfile (status.ps)
109 d->SaveAsPS();
110 /*
111 * ----------- Write status to a root file ------------
112 *
113 TFile file("status.root", "RECREATE");
114 d->Write();
115 file.Close();
116 delete d;
117 */
118 }
119
120}
Note: See TracBrowser for help on using the repository browser.