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