TRD module
[u/mrichter/AliRoot.git] / TRD / TRDgui / AliTRDqaGuiClustersSM.cxx
CommitLineData
36f55715 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id: AliTRDqaGuiClustersSM.cxx 23871 2008-02-12 11:48:20Z hristov $ */
17
18//////////////////////////////////////////////////////////////////////////////////
19//
20// This class is a Graphical User Interface for the Quality Monitorig
21// of clusters. It lets display and browse throu histograms created by
22// the AliTRDQADataMakerRec run during the reconstruction
23//
24// S. Radomski
25// Uni-Heidelberg
26// Feb. 2008
27//
28//////////////////////////////////////////////////////////////////////////////////
29
30#include "AliTRDqaGuiClustersSM.h"
31
32#include "TH1D.h"
33#include "TFile.h"
34#include "TCanvas.h"
35#include "TString.h"
36#include "TSystem.h"
37
38#include "TGLabel.h"
39#include "TGComboBox.h"
40#include "TGButton.h"
41#include "TRootEmbeddedCanvas.h"
42
43ClassImp(AliTRDqaGuiClustersSM)
44
45const Int_t AliTRDqaGuiClustersSM::fgkLogList[4] = {0,0,0,0};
46
47//////////////////////////////////////////////////////////////////////////////////
48
49AliTRDqaGuiClustersSM::AliTRDqaGuiClustersSM()
50 : fIdx(0),
821ef0a9 51 fFileName(0x0),
36f55715 52 fGPanel(0),
53 fGCanvas(0),
54 fGSelect(0),
55 fGPrev(0),
56 fGNext(0),
57 fGPlay(0)
58{
02f3bfcc 59 //
60 // Default constructor
61 //
36f55715 62
02f3bfcc 63 for (Int_t i = 0; i < 4; i++) {
64 fNameList[i] = 0x0;
65 fCanvasList[i] = 0x0;
66 fHistList[i] = 0x0;
67 }
68
821ef0a9 69 //strncpy(fFileName,"",256);
02f3bfcc 70
36f55715 71}
72
73//////////////////////////////////////////////////////////////////////////////////
74
75AliTRDqaGuiClustersSM::AliTRDqaGuiClustersSM(TGWindow *parent)
76 : TGCompositeFrame(parent, 720, 500),
77 fIdx(0),
821ef0a9 78 fFileName(0x0),
36f55715 79 fGPanel(0),
80 fGCanvas(0),
81 fGSelect(0),
82 fGPrev(0),
83 fGNext(0),
84 fGPlay(0)
85{
86 //
87 // Main constructor
88 //
89
90 fIdx = 0;
91
92 // steering panel
93
94 SetLayoutManager(new TGVerticalLayout(this));
95
96 fGPanel = new TGHorizontalFrame(this);
97
98 // fGLabel = new TGLabel(fGPanel, "Current SM: ");
99 fGPrev = new TGTextButton(fGPanel, "Prev SM");
100 fGNext = new TGTextButton(fGPanel, "Next SM");
101
102 fGSelect = new TGComboBox(fGPanel);
103 for(int i=0; i<18; i++) fGSelect->AddEntry(Form("SM %d", i), i);
a73a87be 104 fGSelect->Resize(100, (Int_t)(1.4*fGPrev->GetHeight()));
36f55715 105 fGSelect->Select(fIdx);
106
107 fGPlay = new TGTextButton(fGPanel, "PLAY");
108
109 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
110
111 // fGPanel->AddFrame(fGLabel, hint);
112 fGPanel->AddFrame(fGPrev, hint);
113 fGPanel->AddFrame(fGSelect, hint);
114 fGPanel->AddFrame(fGNext, hint);
115 fGPanel->AddFrame(fGPlay, hint);
116
117 AddFrame(fGPanel);
118
119 // panel logic
120 fGPrev->Connect("Clicked()", "AliTRDqaGuiClustersSM", this, "PreviusSM()");
121 fGNext->Connect("Clicked()", "AliTRDqaGuiClustersSM", this, "NextSM()");
122 fGSelect->Connect("Selected(Int_t", "AliTRDqaGuiClustersSM", this, "SelectSM(Int_t)");
123 fGPlay->Connect("Clicked()", "AliTRDqaGuiClustersSM", this, "Play()");
124
125 // histograms
126 /**/
127 fGCanvas = new TGCompositeFrame(this);
128 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,1,1));
129
130 fNameList[0] = "sigTimeShape";
131 fNameList[1] = "sigTime";
8e2f611a 132 fNameList[2] = "totalCharge";
133 fNameList[3] = "nCls";
36f55715 134
135 for(Int_t i=0; i<4; i++) {
136 fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], fGCanvas, 480, 300);
137 fGCanvas->AddFrame(fCanvasList[i]);
138 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
139 }
140
141 for(Int_t i=0; i<4; i++) {
142 fHistList[i] = 0;
143 }
144
145 AddFrame(fGCanvas);
146 /**/
147}
148
149//////////////////////////////////////////////////////////////////////////////////
150
151void AliTRDqaGuiClustersSM::SetQAFile(const char *filename) {
152 //
153 // Ste file with histograms
154 //
155
821ef0a9 156 //strncpy(fFileName,filename,256);
157 fFileName = filename;
36f55715 158
159 for(Int_t i=0; i<4; i++) {
160 if (fHistList[i]) delete fHistList[i];
161 }
162
163 TFile *file = new TFile(filename);
164 file->cd("TRD/RecPoints");
165
166 const char *opt[4] = {"", "colz", "", ""};
167
168 for(int i=0; i<4; i++) {
169 fHistList[i] = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s_sm%d", fNameList[i], fIdx));
170 fCanvasList[i]->GetCanvas()->cd();
171 gPad->SetLogy(fgkLogList[i]);
172 if (fHistList[i]) fHistList[i]->Draw(opt[i]);
173 fCanvasList[i]->GetCanvas()->Update();
174 }
175}
176
177//////////////////////////////////////////////////////////////////////////////////
178
179void AliTRDqaGuiClustersSM::SetSM(Int_t idx) {
180 //
181 // Sets active supermodule
182 //
183
184 fIdx = idx;
185 fGSelect->Select(fIdx, 0);
186 SetQAFile(fFileName);
187}
188
189//////////////////////////////////////////////////////////////////////////////////
190
191void AliTRDqaGuiClustersSM::Play() {
192 //
193 // Loop throught suermodules
194 //
195
196 SetSM(0);
197 for(Int_t i=0; i<18; i++) {
198 gSystem->Sleep(1 * 1000);
199 NextSM();
200 }
201}
202
203//////////////////////////////////////////////////////////////////////////////////
204