source: trunk/MagicSoft/Mars/macros/pixfirerate.C@ 5757

Last change on this file since 5757 was 3957, checked in by tbretz, 21 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): 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 pixfirerate(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 // A list of threshold which should be displayed. The last entry
78 // MUST be -1.
79 Double_t threshold[] = { 10, 20, 100, 200, -1 };
80
81 Int_t cnt = 0;
82 while (threshold[cnt]>0) cnt++;
83
84 // Create the corresponding fill tasks and containers
85 for (int i=0; i<cnt; i++)
86 {
87 TString name = "Above ";
88 TString num;
89 num += threshold[i];
90 name += num.Strip(TString::kBoth);
91 TString title = "Firerate [%] of pixels with signal > ";
92 title += num.Strip(TString::kBoth);
93
94 MHTriggerLvl0 *trigmap = new MHTriggerLvl0(threshold[i], name, title);
95 MFillH *fillh = new MFillH(trigmap, "MRawEvtData");
96 trigmap->SetBit(kCanDelete);
97 fillh->SetBit(kCanDelete);
98 plist.AddToList(trigmap);
99 tlist.AddToList(fillh);
100 }
101
102 // create the eventloop
103 MEvtLoop evtloop;
104 evtloop.SetParList(&plist);
105 evtloop.SetDisplay(d);
106
107 //
108 // Execute your analysis
109 //
110 if (!evtloop.Eventloop())
111 return;
112
113 tlist.PrintStatistics();
114
115 //
116 // Make sure the display hasn't been deleted by the user while the
117 // eventloop was running.
118 //
119 if ((d = evtloop.GetDisplay()))
120 {
121 // Save data in a postscriptfile (status.ps)
122 d->SaveAsPS();
123 /*
124 * ----------- Write status to a root file ------------
125 *
126 TFile file("status.root", "RECREATE");
127 d->Write();
128 file.Close();
129 delete d;
130 */
131 }
132
133}
Note: See TracBrowser for help on using the repository browser.