]>
Commit | Line | Data |
---|---|---|
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 "AliTRDqaGuiEnergyDeposit.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 | ||
39 | ClassImp(AliTRDqaGuiEnergyDeposit) | |
40 | ||
41 | ////////////////////////////////////////////////////////////////////////////////// | |
42 | ||
43 | AliTRDqaGuiEnergyDeposit::AliTRDqaGuiEnergyDeposit() | |
44 | : fIdx(0), | |
821ef0a9 | 45 | fFileName(0), |
8e2f611a | 46 | fGPanel(0), |
47 | fGCanvas(0), | |
48 | fGSelect(0), | |
49 | fGPrev(0), | |
50 | fGNext(0) | |
51 | { | |
02f3bfcc | 52 | // |
53 | // Default constructor | |
54 | // | |
55 | ||
56 | for (Int_t i = 0; i < 6; i++) { | |
57 | fNameList[i] = 0x0; | |
58 | fCanvasList[i] = 0x0; | |
59 | fHistList[i] = 0x0; | |
60 | } | |
61 | ||
821ef0a9 | 62 | //strncpy(fFileName,"",256); |
02f3bfcc | 63 | |
8e2f611a | 64 | } |
65 | ||
66 | ////////////////////////////////////////////////////////////////////////////////// | |
67 | ||
68 | AliTRDqaGuiEnergyDeposit::AliTRDqaGuiEnergyDeposit(TGWindow *parent) | |
69 | : TGCompositeFrame(parent, 720, 500), | |
70 | fIdx(0), | |
821ef0a9 | 71 | fFileName(0x0), |
8e2f611a | 72 | fGPanel(0), |
73 | fGCanvas(0), | |
74 | fGSelect(0), | |
75 | fGPrev(0), | |
76 | fGNext(0) | |
77 | { | |
78 | // | |
79 | // Main constructor | |
80 | // | |
81 | ||
82 | fIdx = 0; | |
83 | ||
84 | // steering panel | |
85 | ||
86 | SetLayoutManager(new TGVerticalLayout(this)); | |
87 | ||
88 | fGPanel = new TGHorizontalFrame(this); | |
89 | ||
90 | // fGLabel = new TGLabel(fGPanel, "Current Type: "); | |
91 | fGPrev = new TGTextButton(fGPanel, "Prev Type"); | |
92 | fGNext = new TGTextButton(fGPanel, "Next Type"); | |
93 | ||
94 | const char *types[5] = {"electron", "muon", "pion", "kaon", "proton"}; | |
95 | fGSelect = new TGComboBox(fGPanel); | |
96 | for(int i=0; i<5; i++) fGSelect->AddEntry(types[i], i); //Form("Type %d", i), i); | |
97 | fGSelect->Resize(100, fGPrev->GetHeight()); | |
98 | fGSelect->Select(fIdx); | |
99 | ||
100 | TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5); | |
101 | ||
102 | // fGPanel->AddFrame(fGLabel, hint); | |
103 | fGPanel->AddFrame(fGPrev, hint); | |
104 | fGPanel->AddFrame(fGSelect, hint); | |
105 | fGPanel->AddFrame(fGNext, hint); | |
106 | ||
107 | AddFrame(fGPanel); | |
108 | ||
109 | // panel logic | |
110 | fGPrev->Connect("Clicked()", "AliTRDqaGuiEnergyDeposit", this, "PreviusType()"); | |
111 | fGNext->Connect("Clicked()", "AliTRDqaGuiEnergyDeposit", this, "NextType()"); | |
112 | fGSelect->Connect("Selected(Int_t", "AliTRDqaGuiEnergyDeposit", this, "SelectType(Int_t)"); | |
113 | ||
114 | // histograms | |
115 | /**/ | |
116 | fGCanvas = new TGCompositeFrame(this); | |
117 | fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,3,1,1)); | |
118 | ||
119 | fNameList[0] = "probNeg"; | |
120 | fNameList[1] = "ptSigNeg"; | |
121 | fNameList[2] = "ptSigPureNeg"; | |
122 | fNameList[3] = "probPos"; | |
123 | fNameList[4] = "ptSigPos"; | |
124 | fNameList[5] = "ptSigPurePos"; | |
125 | ||
126 | for(Int_t i=0; i<6; i++) { | |
127 | fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], fGCanvas, 320, 300); | |
128 | fGCanvas->AddFrame(fCanvasList[i]); | |
129 | fCanvasList[i]->GetCanvas()->SetRightMargin(0.05); | |
130 | } | |
131 | ||
132 | for(Int_t i=0; i<4; i++) { | |
133 | fHistList[i] = 0; | |
134 | } | |
135 | ||
136 | AddFrame(fGCanvas); | |
137 | /**/ | |
138 | } | |
139 | ||
140 | ////////////////////////////////////////////////////////////////////////////////// | |
141 | ||
142 | void AliTRDqaGuiEnergyDeposit::SetQAFile(const char *filename) { | |
143 | // | |
144 | // Ste file with histograms | |
145 | // | |
146 | ||
821ef0a9 | 147 | //strncpy(fFileName,filename,256); |
148 | fFileName = filename; | |
8e2f611a | 149 | |
150 | for(Int_t i=0; i<6; i++) { | |
151 | if (fHistList[i]) delete fHistList[i]; | |
152 | } | |
153 | ||
154 | const Int_t logy[] = {1, 0, 0, 1, 0, 0}; | |
155 | const Int_t logx[] = {0, 1, 1, 0, 1, 1}; | |
156 | const char *opt[] = {"", "colz", "colz", "", "colz", "cloz"}; | |
157 | ||
158 | TFile *file = new TFile(filename); | |
159 | ||
160 | for(Int_t i=0; i<6; i++) { | |
161 | fHistList[i] = (TH1D*)gDirectory->Get(Form("%s%d", fNameList[i], fIdx)); | |
162 | if (fHistList[i]) fHistList[i]->SetDirectory(0); | |
163 | fCanvasList[i]->GetCanvas()->cd(); | |
164 | if (fHistList[i]) fHistList[i]->Draw(opt[i]); | |
165 | gPad->SetLogy(logy[i]); | |
166 | gPad->SetLogx(logx[i]); | |
167 | fCanvasList[i]->GetCanvas()->Update(); | |
168 | } | |
169 | ||
170 | file->Close(); | |
171 | delete file; | |
172 | ||
173 | } | |
174 | ||
175 | ////////////////////////////////////////////////////////////////////////////////// | |
176 | ||
177 | void AliTRDqaGuiEnergyDeposit::SetType(Int_t idx) { | |
178 | // | |
179 | // Sets active supermodule | |
180 | // | |
181 | ||
182 | fIdx = idx; | |
183 | fGSelect->Select(fIdx, 0); | |
184 | SetQAFile(fFileName); | |
185 | } | |
186 | ||
187 | ////////////////////////////////////////////////////////////////////////////////// | |
188 |