source: trunk/MagicSoft/Mars/macros/readIPR.C@ 8357

Last change on this file since 8357 was 4993, checked in by stamerra, 20 years ago
*** empty log message ***
File size: 3.8 KB
Line 
1///////////////////////////////////////////////////////////////////////////
2//
3// readIPR.C
4//
5// This macro shows how to read the Individual Pixel Rates from
6// a CC report file.
7//
8// Input:
9// - root file obtained merpping a .rep CC file
10// container: MTriggerIPR
11//
12// Output:
13// - a camera display showing the IPRs
14// - Some histos for checking purposes
15//
16// Note:
17// a similar macro can be used to read the following trigger containers:
18// - MTriggerIPR (Individual Pixel Rates)
19// - MTriggerCell (Rate of trigger cells)
20// - MTriggerBit (Output Bits from prescaler (before/after presc.)
21// - MTriggerPrescFact (Prescaling factors for each bit)
22// - MTriggerLiveTime (Values of counters for dead/livetime)
23//
24// Author(s): Antonio Stamerra. 09/04 <antonio.stamerra@pi.infn.it>
25//
26////////////////////////////////////////////////////////////////////////////
27void readIPR(TString fname)
28{
29 //
30 // Create a empty Parameter List and an empty Task List
31 // The tasklist is identified in the eventloop by its name
32 //
33 MParList plist;
34
35 MTaskList tlist;
36 plist.AddToList(&tlist);
37
38 //
39 // Now setup the tasks and tasklist:
40 // ---------------------------------
41 //
42
43 // Create the magic geometry
44 MGeomCamMagic geom;
45 plist.AddToList(&geom);
46
47 // First Task: Read ROOT file with Trigger-REPORT data
48 MReadTree read("Trigger", fname);
49 read.DisableAutoScheme();
50
51 tlist.AddToList(&read);
52
53 // Create the container for the IPRs
54 MTriggerIPR ipr;
55 plist.AddToList(&ipr);
56
57 // Create the histo to display the IPRs
58 MHCamEvent IPRhist("IPRhist","IPRs");
59 plist.AddToList(&IPRhist);
60
61 // create a task to fill a histogram from the container
62 MFillH fillIPR(&IPRhist, "MTriggerIPR");
63 tlist.AddToList(&fillIPR);
64
65 //
66 // Create and setup the eventloop
67 //
68 MEvtLoop evtloop;
69 evtloop.SetParList(&plist);
70
71 //
72 // Execute the analysis
73 //
74 if (!evtloop.PreProcess())
75 return;
76
77 if (!evtloop.Eventloop())
78 return;
79
80 tlist.PrintStatistics();
81
82 //-----------------------------------
83 // Now display the result of the loop
84 //
85
86 // create a MHCamera histo where the sum off all events is filled
87 MHCamera &h = *(MHCamera*)IPRhist.GetHistByName("sum");
88
89 TCanvas *c = MH::MakeDefCanvas();
90 c->Divide(2, 2);
91
92 MHCamera *disp1=h.Clone();
93 MHCamera *disp2=h.Clone();
94 //MHCamera *disp3=h.Clone();
95 disp2->SetCamContent(h, 1);
96 //disp3->SetCamContent(h, 2);
97
98 disp1->SetYTitle("Rate [Hz]");
99 disp2->SetYTitle("\\sigma_{Rate} [Hz]");
100 //disp3->SetYTitle("\\sigma_{Rate} [%]");
101 disp1->SetName("IPRs;avg");
102 disp2->SetName("IPRs;err");
103 //disp3->SetName("IPRs;rel");
104 disp1->SetTitle("IPRs Average");
105 disp2->SetTitle("IPRs error");
106 //disp3->SetTitle("IPRs relative error");
107
108 c->cd(1);
109 TText text(0.1, 0.95, &fname[fname.Last('/')+1]);
110 text.SetTextSize(0.03);
111 text.DrawClone();
112 gPad->SetBorderMode(0);
113 gPad->Divide(1,1);
114 gPad->cd(1);
115 gPad->SetLogy();
116 disp1->Draw();
117 disp1->SetBit(kCanDelete);
118 c->cd(2);
119 gPad->SetBorderMode(0);
120 gPad->Divide(1,1);
121 gPad->cd(1);
122 gPad->SetLogy();
123 disp2->Draw();
124 disp2->SetBit(kCanDelete);
125 //c->cd(3);
126 //gPad->SetBorderMode(0);
127 //gPad->Divide(1,1);
128 //gPad->cd(1);
129 //gPad->SetLogy();
130 //disp3->Draw();
131 //disp3->SetBit(kCanDelete);
132 c->cd(3);
133 gPad->SetBorderMode(0);
134 disp1->Draw("EPhist");
135 c->cd(4);
136 gPad->SetBorderMode(0);
137 gPad->SetLogy();
138 disp2->Draw("Phist");
139 //c->cd(6);
140 //gPad->SetBorderMode(0);
141 //gPad->SetLogy();
142 //disp3->Draw("Phist");
143
144 c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
145 //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
146}
147
Note: See TracBrowser for help on using the repository browser.