source: branches/AddingGoogleTestEnvironment/macros/tutorials/readIPR.C@ 18170

Last change on this file since 18170 was 7161, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 3.7 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 if (!evtloop.Eventloop())
72 return;
73
74 //-----------------------------------
75 // Now display the result of the loop
76 //
77
78 // create a MHCamera histo where the sum off all events is filled
79 MHCamera &h = *(MHCamera*)IPRhist.GetHistByName("sum");
80
81 TCanvas *c = MH::MakeDefCanvas();
82 c->Divide(2, 2);
83
84 MHCamera *disp1=h.Clone();
85 MHCamera *disp2=h.Clone();
86 //MHCamera *disp3=h.Clone();
87 disp2->SetCamContent(h, 1);
88 //disp3->SetCamContent(h, 2);
89
90 disp1->SetYTitle("Rate [Hz]");
91 disp2->SetYTitle("\\sigma_{Rate} [Hz]");
92 //disp3->SetYTitle("\\sigma_{Rate} [%]");
93 disp1->SetName("IPRs;avg");
94 disp2->SetName("IPRs;err");
95 //disp3->SetName("IPRs;rel");
96 disp1->SetTitle("IPRs Average");
97 disp2->SetTitle("IPRs error");
98 //disp3->SetTitle("IPRs relative error");
99
100 c->cd(1);
101 TText text(0.1, 0.95, &fname[fname.Last('/')+1]);
102 text.SetTextSize(0.03);
103 text.DrawClone();
104 gPad->SetBorderMode(0);
105 gPad->Divide(1,1);
106 gPad->cd(1);
107 gPad->SetLogy();
108 disp1->Draw();
109 disp1->SetBit(kCanDelete);
110 c->cd(2);
111 gPad->SetBorderMode(0);
112 gPad->Divide(1,1);
113 gPad->cd(1);
114 gPad->SetLogy();
115 disp2->Draw();
116 disp2->SetBit(kCanDelete);
117 //c->cd(3);
118 //gPad->SetBorderMode(0);
119 //gPad->Divide(1,1);
120 //gPad->cd(1);
121 //gPad->SetLogy();
122 //disp3->Draw();
123 //disp3->SetBit(kCanDelete);
124 c->cd(3);
125 gPad->SetBorderMode(0);
126 disp1->Draw("EPhist");
127 c->cd(4);
128 gPad->SetBorderMode(0);
129 gPad->SetLogy();
130 disp2->Draw("Phist");
131 //c->cd(6);
132 //gPad->SetBorderMode(0);
133 //gPad->SetLogy();
134 //disp3->Draw("Phist");
135
136 c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
137 //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
138}
139
Note: See TracBrowser for help on using the repository browser.