minor coverity corrections
[u/mrichter/AliRoot.git] / TRD / qaGui / 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),
51 fGPanel(0),
52 fGCanvas(0),
53 fGSelect(0),
54 fGPrev(0),
55 fGNext(0),
56 fGPlay(0)
57{
02f3bfcc 58 //
59 // Default constructor
60 //
36f55715 61
02f3bfcc 62 for (Int_t i = 0; i < 4; i++) {
63 fNameList[i] = 0x0;
64 fCanvasList[i] = 0x0;
65 fHistList[i] = 0x0;
66 }
67
68 strncpy(fFileName,"",256);
69
36f55715 70}
71
72//////////////////////////////////////////////////////////////////////////////////
73
74AliTRDqaGuiClustersSM::AliTRDqaGuiClustersSM(TGWindow *parent)
75 : TGCompositeFrame(parent, 720, 500),
76 fIdx(0),
77 fGPanel(0),
78 fGCanvas(0),
79 fGSelect(0),
80 fGPrev(0),
81 fGNext(0),
82 fGPlay(0)
83{
84 //
85 // Main constructor
86 //
87
88 fIdx = 0;
89
90 // steering panel
91
92 SetLayoutManager(new TGVerticalLayout(this));
93
94 fGPanel = new TGHorizontalFrame(this);
95
96 // fGLabel = new TGLabel(fGPanel, "Current SM: ");
97 fGPrev = new TGTextButton(fGPanel, "Prev SM");
98 fGNext = new TGTextButton(fGPanel, "Next SM");
99
100 fGSelect = new TGComboBox(fGPanel);
101 for(int i=0; i<18; i++) fGSelect->AddEntry(Form("SM %d", i), i);
a73a87be 102 fGSelect->Resize(100, (Int_t)(1.4*fGPrev->GetHeight()));
36f55715 103 fGSelect->Select(fIdx);
104
105 fGPlay = new TGTextButton(fGPanel, "PLAY");
106
107 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
108
109 // fGPanel->AddFrame(fGLabel, hint);
110 fGPanel->AddFrame(fGPrev, hint);
111 fGPanel->AddFrame(fGSelect, hint);
112 fGPanel->AddFrame(fGNext, hint);
113 fGPanel->AddFrame(fGPlay, hint);
114
115 AddFrame(fGPanel);
116
117 // panel logic
118 fGPrev->Connect("Clicked()", "AliTRDqaGuiClustersSM", this, "PreviusSM()");
119 fGNext->Connect("Clicked()", "AliTRDqaGuiClustersSM", this, "NextSM()");
120 fGSelect->Connect("Selected(Int_t", "AliTRDqaGuiClustersSM", this, "SelectSM(Int_t)");
121 fGPlay->Connect("Clicked()", "AliTRDqaGuiClustersSM", this, "Play()");
122
123 // histograms
124 /**/
125 fGCanvas = new TGCompositeFrame(this);
126 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,1,1));
127
128 fNameList[0] = "sigTimeShape";
129 fNameList[1] = "sigTime";
8e2f611a 130 fNameList[2] = "totalCharge";
131 fNameList[3] = "nCls";
36f55715 132
133 for(Int_t i=0; i<4; i++) {
134 fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], fGCanvas, 480, 300);
135 fGCanvas->AddFrame(fCanvasList[i]);
136 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
137 }
138
139 for(Int_t i=0; i<4; i++) {
140 fHistList[i] = 0;
141 }
142
143 AddFrame(fGCanvas);
144 /**/
145}
146
147//////////////////////////////////////////////////////////////////////////////////
148
149void AliTRDqaGuiClustersSM::SetQAFile(const char *filename) {
150 //
151 // Ste file with histograms
152 //
153
02f3bfcc 154 strncpy(fFileName,filename,256);
36f55715 155
156 for(Int_t i=0; i<4; i++) {
157 if (fHistList[i]) delete fHistList[i];
158 }
159
160 TFile *file = new TFile(filename);
161 file->cd("TRD/RecPoints");
162
163 const char *opt[4] = {"", "colz", "", ""};
164
165 for(int i=0; i<4; i++) {
166 fHistList[i] = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s_sm%d", fNameList[i], fIdx));
167 fCanvasList[i]->GetCanvas()->cd();
168 gPad->SetLogy(fgkLogList[i]);
169 if (fHistList[i]) fHistList[i]->Draw(opt[i]);
170 fCanvasList[i]->GetCanvas()->Update();
171 }
172}
173
174//////////////////////////////////////////////////////////////////////////////////
175
176void AliTRDqaGuiClustersSM::SetSM(Int_t idx) {
177 //
178 // Sets active supermodule
179 //
180
181 fIdx = idx;
182 fGSelect->Select(fIdx, 0);
183 SetQAFile(fFileName);
184}
185
186//////////////////////////////////////////////////////////////////////////////////
187
188void AliTRDqaGuiClustersSM::Play() {
189 //
190 // Loop throught suermodules
191 //
192
193 SetSM(0);
194 for(Int_t i=0; i<18; i++) {
195 gSystem->Sleep(1 * 1000);
196 NextSM();
197 }
198}
199
200//////////////////////////////////////////////////////////////////////////////////
201