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

Last change on this file since 2765 was 2377, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.7 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!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// pixfirerate.C
28//
29// This macro can help to find "hot" pixels firing too often
30// or pixels firing too rarely. It plots camera displays showing how many
31// times the FADC integral of each pixel has been found to be above pedestal
32// by 10, 20, 50, 100 or 200 ADC counts. As "pedestal" we now use simply
33// the signal in the first ADC slice, which seemed reasonable from a first
34// look at the available test data.
35//
36/////////////////////////////////////////////////////////////////////////////
37
38void pixfirerate(TString filename="rawfile.root")
39{
40 //
41 // Update frequency by default = 1Hz
42 //
43 MStatusDisplay *d = new MStatusDisplay;
44
45 // Set update time to 5s
46 // d->SetUpdateTime(5000);
47
48 // Disable online update
49 // d->SetUpdateTime(-1);
50
51 d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
52 gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
53 //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
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 MTaskList tlist;
60 MParList plist;
61 plist.AddToList(&tlist);
62
63 //
64 // Now setup the tasks and tasklist:
65 // ---------------------------------
66 //
67 MReadMarsFile read("Events");
68 read.DisableAutoScheme();
69 read.AddFile(filename);
70 tlist.AddToList(&read);
71
72 MGeomApply geomapl;
73 tlist.AddToList(&geomapl);
74
75 Double_t threshold[] = { 10, 20, 100, 200, -1 };
76
77 Int_t cnt = 0;
78 while (threshold[cnt]>0) cnt++;
79
80 for (int i=0; i<cnt; i++)
81 {
82 TString name = "Above ";
83 TString num;
84 num += threshold[i];
85 name += num.Strip(TString::kBoth);
86 TString title = "Firerate [%] of pixels with signal > ";
87 title += num.Strip(TString::kBoth);
88
89 MHTriggerLvl0 *trigmap = new MHTriggerLvl0(threshold[i], name, title);
90 MFillH *fillh = new MFillH(trigmap, "MRawEvtData");
91 trigmap->SetBit(kCanDelete);
92 fillh->SetBit(kCanDelete);
93 plist.AddToList(trigmap);
94 tlist.AddToList(fillh);
95 }
96
97 MEvtLoop evtloop;
98 evtloop.SetParList(&plist);
99 evtloop.SetDisplay(d);
100
101 //
102 // Execute your analysis
103 //
104 if (!evtloop.Eventloop())
105 return;
106
107 tlist.PrintStatistics();
108
109 //
110 // Make sure the display hasn't been deleted by the user while the
111 // eventloop was running.
112 //
113 if ((d = evtloop.GetDisplay()))
114 {
115 // Save data in a postscriptfile (status.ps)
116 d->SaveAsPS();
117 /*
118 * ----------- Write status to a root file ------------
119 *
120 TFile file("status.root", "RECREATE");
121 d->Write();
122 file.Close();
123 delete d;
124 */
125 }
126
127}
Note: See TracBrowser for help on using the repository browser.