]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/qaGui/AliTRDqaGuiJPsi.cxx
Coverity, again ...
[u/mrichter/AliRoot.git] / TRD / qaGui / AliTRDqaGuiJPsi.cxx
CommitLineData
8e2f611a 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//////////////////////////////////////////////////////////////////////////////////
17//
18// This class is a Graphical User Interface for the Quality Monitorig
19//
20// S. Radomski
21// Uni-Heidelberg
22// April 2008
23//
24//////////////////////////////////////////////////////////////////////////////////
25
26#include "AliTRDqaGuiJPsi.h"
27
28#include "TH1D.h"
29#include "TFile.h"
30#include "TCanvas.h"
31#include "TString.h"
32#include "TSystem.h"
33
34#include "TGLabel.h"
35#include "TGComboBox.h"
36#include "TGButton.h"
37#include "TRootEmbeddedCanvas.h"
38
39ClassImp(AliTRDqaGuiJPsi)
40
41//////////////////////////////////////////////////////////////////////////////////
42
43AliTRDqaGuiJPsi::AliTRDqaGuiJPsi()
44 : fIdx(0),
45 fGPanel(0),
46 fGCanvas(0),
47 fGSelect(0),
48 fGPrev(0),
49 fGNext(0)
50{
02f3bfcc 51 //
52 // Default constructor
53 //
54
55 for (Int_t i = 0; i < 6; i++) {
56 fNameList[i] = 0x0;
57 fCanvasList[i] = 0x0;
58 fHistList[i] = 0x0;
59 }
60
61 strncpy(fFileName,"",256);
62
8e2f611a 63}
64
65//////////////////////////////////////////////////////////////////////////////////
66
67AliTRDqaGuiJPsi::AliTRDqaGuiJPsi(TGWindow *parent)
68 : TGCompositeFrame(parent, 720, 500),
69 fIdx(0),
70 fGPanel(0),
71 fGCanvas(0),
72 fGSelect(0),
73 fGPrev(0),
74 fGNext(0)
75{
76 //
77 // Main constructor
78 //
79
80 fIdx = 0;
81
82 // steering panel
83
84 SetLayoutManager(new TGVerticalLayout(this));
85
86 fGPanel = new TGHorizontalFrame(this);
87
88 // fGLabel = new TGLabel(fGPanel, "Current Step: ");
89 fGPrev = new TGTextButton(fGPanel, "Prev Step");
90 fGNext = new TGTextButton(fGPanel, "Next Step");
91
92 fGSelect = new TGComboBox(fGPanel);
93 for(int i=0; i<5; i++) fGSelect->AddEntry(Form("Step %d", i), i);
94 fGSelect->Resize(100, fGPrev->GetHeight());
95 fGSelect->Select(fIdx);
96
97 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
98
99 // fGPanel->AddFrame(fGLabel, hint);
100 fGPanel->AddFrame(fGPrev, hint);
101 fGPanel->AddFrame(fGSelect, hint);
102 fGPanel->AddFrame(fGNext, hint);
103
104 AddFrame(fGPanel);
105
106 // panel logic
107 fGPrev->Connect("Clicked()", "AliTRDqaGuiJPsi", this, "PreviusStep()");
108 fGNext->Connect("Clicked()", "AliTRDqaGuiJPsi", this, "NextStep()");
109 fGSelect->Connect("Selected(Int_t", "AliTRDqaGuiJPsi", this, "SelectStep(Int_t)");
110
111 // histograms
112 /**/
113 fGCanvas = new TGCompositeFrame(this);
114 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,3,1,1));
115
116 fNameList[0] = "mass";
117 fNameList[1] = "nTracksNeg";
118 fNameList[2] = "ptNeg";
119 fNameList[3] = "pidNeg";
120 //fNameList[3] = "ptAngle";
121 fNameList[4] = "nTracksPos";
122 fNameList[5] = "ptPos";
123
124 for(Int_t i=0; i<6; i++) {
125 fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], fGCanvas, 320, 300);
126 fGCanvas->AddFrame(fCanvasList[i]);
127 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
128 }
129
130 for(Int_t i=0; i<4; i++) {
131 fHistList[i] = 0;
132 }
133
134 AddFrame(fGCanvas);
135 /**/
136}
137
138//////////////////////////////////////////////////////////////////////////////////
139
140void AliTRDqaGuiJPsi::SetQAFile(const char *filename) {
141 //
142 // Ste file with histograms
143 //
144
02f3bfcc 145 strncpy(fFileName,filename,256);
8e2f611a 146
147 for(Int_t i=0; i<6; i++) {
148 if (fHistList[i]) delete fHistList[i];
149 }
150
151 const Int_t logy[6] = {0, 1, 1, 1, 1, 1};
152 const Int_t logz[6] = {0, 0, 0, 1, 0, 0};
153 const char *opt[6] = {"", "", "", "", "", ""};
154
155 TFile *file = new TFile(filename);
156
157 for(Int_t i=0; i<6; i++) {
158 fHistList[i] = (TH1D*)gDirectory->Get(Form("%s_%d", fNameList[i], fIdx));
159 if (fHistList[i]) fHistList[i]->SetDirectory(0);
160 fCanvasList[i]->GetCanvas()->cd();
161 if (fHistList[i]) fHistList[i]->Draw(opt[i]);
162 gPad->SetLogy(logy[i]);
163 gPad->SetLogz(logz[i]);
164 fCanvasList[i]->GetCanvas()->Update();
165 }
166
167 file->Close();
168 delete file;
169}
170
171//////////////////////////////////////////////////////////////////////////////////
172
173void AliTRDqaGuiJPsi::SetStep(Int_t idx) {
174 //
175 // Sets active supermodule
176 //
177
178 fIdx = idx;
179 fGSelect->Select(fIdx, 0);
180 SetQAFile(fFileName);
181}
182
183//////////////////////////////////////////////////////////////////////////////////
184