]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.cxx
- configure adapted to the new directory structure of the HOMER module in PubSub
[u/mrichter/AliRoot.git] / HLT / TPCLib / OnlineDisplay / AliHLTTPCDisplayPad.cxx
... / ...
CommitLineData
1// $Id$
2
3/** \class AliHLTTPCDisplayPad
4<pre>
5//_____________________________________________________________
6// AliHLTTPCDisplayPad
7//
8// Display class for the HLT TPC-Pad events.
9</pre>
10*/
11// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
12//*-- Copyright &copy ALICE HLT Group
13
14#include <TH2.h>
15#include <TFile.h>
16#include <TStyle.h>
17#include <TAttText.h>
18#include <TAxis.h>
19#include <TCanvas.h>
20
21#ifdef use_aliroot
22#include <TClonesArray.h>
23#include <AliRun.h>
24#include <AliSimDigits.h>
25#include <AliTPCParam.h>
26#endif
27
28#include "AliHLTStdIncludes.h"
29#include "AliHLTTPCDefinitions.h"
30#include "AliHLTDataTypes.h"
31#include "AliHLTTPCSpacePointData.h"
32#include "AliHLTTPCClusterDataFormat.h"
33#include "AliHLTTPCLogging.h"
34#include "AliHLTTPCTransform.h"
35
36#include "AliHLTTPCDisplayMain.h"
37#include "AliHLTTPCDisplayPad.h"
38
39#if __GNUC__ >= 3
40using namespace std;
41#endif
42
43ClassImp(AliHLTTPCDisplayPad)
44
45//____________________________________________________________________________________________________
46AliHLTTPCDisplayPad::AliHLTTPCDisplayPad(AliHLTTPCDisplayMain* display) {
47 // constructor
48 fDisplay = display;
49
50 fNTimes = AliHLTTPCTransform::GetNTimeBins();
51
52 fBinX[0] = 0;
53 fBinX[1] = fNTimes -1;
54 fTmpEvent = 0;
55
56 fHistpad1 = new TH1F ("fHistpad1","Selected Pad -1;Timebin #",fNTimes,0,fNTimes-1);
57 fHistpad2 = new TH1F ("fHistpad2","Selected Pad;Timebin #",fNTimes,0,fNTimes-1);
58 fHistpad3 = new TH1F ("fHistpad3","Selected Pad +1;Timebin #",fNTimes,0,fNTimes-1);
59
60 fHistpad1->SetTitleSize(0.03);
61 fHistpad1->GetXaxis()->SetLabelSize(0.03);
62 fHistpad1->GetXaxis()->SetTitleSize(0.03);
63 fHistpad1->GetYaxis()->SetLabelSize(0.03);
64 fHistpad1->GetYaxis()->SetTitleSize(0.03);
65
66 fHistpad2->SetTitleSize(0.03);
67 fHistpad2->GetXaxis()->SetLabelSize(0.03);
68 fHistpad2->GetXaxis()->SetTitleSize(0.03);
69 fHistpad2->GetYaxis()->SetLabelSize(0.03);
70 fHistpad2->GetYaxis()->SetTitleSize(0.03);
71
72 fHistpad3->SetTitleSize(0.03);
73 fHistpad3->GetXaxis()->SetLabelSize(0.03);
74 fHistpad3->GetXaxis()->SetTitleSize(0.03);
75 fHistpad3->GetYaxis()->SetLabelSize(0.03);
76 fHistpad3->GetYaxis()->SetTitleSize(0.03);
77}
78
79//____________________________________________________________________________________________________
80AliHLTTPCDisplayPad::~AliHLTTPCDisplayPad() {
81 // destructor
82 if ( fHistpad1 ){
83 delete fHistpad1;
84 fHistpad1 = NULL;
85 }
86
87 if ( fHistpad2 ){
88 delete fHistpad2;
89 fHistpad2 = NULL;
90 }
91
92 if ( fHistpad3 ){
93 delete fHistpad3;
94 fHistpad3 = NULL;
95 }
96}
97
98//____________________________________________________________________________________________________
99void AliHLTTPCDisplayPad::Reset(){
100 fHistpad1->Reset();
101 fHistpad2->Reset();
102 fHistpad3->Reset();
103}
104
105//____________________________________________________________________________________________________
106void AliHLTTPCDisplayPad::Save(){
107 fDisplay->GetCanvasPad()->SaveAs("HLT-PadView.eps");
108}
109
110//____________________________________________________________________________________________________
111void AliHLTTPCDisplayPad::Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen){
112 // Fill Pad Histogram
113
114 Int_t padRow = fDisplay->GetPadRow();
115 Int_t pad = fDisplay->GetPad();
116 Int_t nextPad = pad + 1;
117 Int_t prevPad = pad - 1;
118
119 // !!
120 // !! DO unrolling because of cache effects (avoid cache trashing) !!
121 // !!
122
123 if ( fDisplay->GetZeroSuppression() ){
124 for (Int_t timeBin=0; timeBin <= fDisplay->GetNTimeBins(); timeBin++){
125 fHistpad1->Fill( timeBin, fDisplay->fRawDataZeroSuppressed[padRow][prevPad][timeBin] );
126 } // end time
127
128 for (Int_t timeBin=0; timeBin <= fDisplay->GetNTimeBins(); timeBin++){
129 fHistpad2->Fill( timeBin, fDisplay->fRawDataZeroSuppressed[padRow][pad][timeBin] );
130 } // end time
131
132 for (Int_t timeBin=0; timeBin <= fDisplay->GetNTimeBins(); timeBin++){
133 fHistpad3->Fill( timeBin, fDisplay->fRawDataZeroSuppressed[padRow][nextPad][timeBin] );
134 } // end time
135
136 } // end - if ( fDisplay->GetZeroSuppression() ){
137
138 else {
139 for (Int_t timeBin=0; timeBin <= fDisplay->GetNTimeBins(); timeBin++){
140 fHistpad1->Fill( timeBin, fDisplay->fRawData[padRow][prevPad][timeBin] );
141 } // end time
142
143 for (Int_t timeBin=0; timeBin <= fDisplay->GetNTimeBins(); timeBin++){
144 fHistpad2->Fill( timeBin, fDisplay->fRawData[padRow][pad][timeBin] );
145 } // end time
146
147 for (Int_t timeBin=0; timeBin <= fDisplay->GetNTimeBins(); timeBin++){
148 fHistpad3->Fill( timeBin, fDisplay->fRawData[padRow][nextPad][timeBin] );
149 } // end time
150
151 } // end - else of if ( fDisplay->GetZeroSuppression() ){
152}
153
154//____________________________________________________________________________________________________
155void AliHLTTPCDisplayPad::Draw(){
156 Char_t title[256];
157
158 fDisplay->GetCanvasPad()->cd();
159 fDisplay->GetCanvasPad()->Clear();
160 fDisplay->GetCanvasPad()->Divide(1,3);
161
162 // Keep Zoom
163 if (!fDisplay->GetKeepView() || (fBinX[1]>fNTimes)){
164 fBinX[0] = 0;
165 fBinX[1] = fNTimes -1;
166 }
167
168 fHistpad1->SetAxisRange(fBinX[0],fBinX[1]);
169 fHistpad2->SetAxisRange(fBinX[0],fBinX[1]);
170 fHistpad3->SetAxisRange(fBinX[0],fBinX[1]);
171
172
173 fDisplay->GetCanvasPad()->cd(1);
174 sprintf(title,"Selected Pad %d",fDisplay->GetPad() -1);
175 fHistpad1->SetStats(kFALSE);
176 fHistpad1->SetTitle(title);
177 fHistpad1->Draw();
178
179 fDisplay->GetCanvasPad()->cd(2);
180 sprintf(title,"Selected Pad %d",fDisplay->GetPad() );
181 fHistpad2->SetStats(kFALSE);
182 fHistpad2->SetTitle(title);
183 fHistpad2->Draw();
184
185 fDisplay->GetCanvasPad()->cd(3);
186 sprintf(title,"Selected Pad %d",fDisplay->GetPad() +1);
187 fHistpad3->SetStats(kFALSE);
188 fHistpad3->SetTitle(title);
189 fHistpad3->Draw();
190
191 fDisplay->GetCanvasPad()->Modified();
192 fDisplay->GetCanvasPad()->Update();
193
194 // Keep Zoom
195 fDisplay->GetCanvasPad()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayPad",(void*) this,"ExecEvent(Int_t,Int_t,Int_t,TObject*)");
196}
197
198//____________________________________________________________________________________________________
199void AliHLTTPCDisplayPad::ExecEvent(Int_t event, Int_t px, Int_t py, TObject *selected){
200 // Saves the Zoom Position of the Histogram
201
202 // - Mouse down on Axis : StartPoint of Range
203 if (event == 1 && selected->InheritsFrom("TAxis"))
204 fTmpEvent = 1;
205
206 // - Mouse pressed on Axis : Real Zoom process not only click
207 else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 1)
208 fTmpEvent = 21;
209
210 // - Mouse pressed on Axis : Still pressed
211 else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 21)
212 return;
213
214 // - Mouse up on Axis : End Point of Rangex
215 else if (event == 11 && selected->InheritsFrom("TAxis") && fTmpEvent == 21){
216 TAxis * axis = (TAxis*) selected;
217
218 if (selected == fHistpad1->GetXaxis() || selected == fHistpad2->GetXaxis() || selected == fHistpad3->GetXaxis()){
219 fBinX[0] = axis->GetFirst() -1;
220 fBinX[1] = axis->GetLast() -1;
221 }
222
223 fTmpEvent = 0;
224 }
225 else fTmpEvent = 0;
226}