]>
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 "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 | ||
39 | ClassImp(AliTRDqaGuiJPsi) | |
40 | ||
41 | ////////////////////////////////////////////////////////////////////////////////// | |
42 | ||
43 | AliTRDqaGuiJPsi::AliTRDqaGuiJPsi() | |
44 | : fIdx(0), | |
45 | fGPanel(0), | |
46 | fGCanvas(0), | |
47 | fGSelect(0), | |
48 | fGPrev(0), | |
49 | fGNext(0) | |
50 | { | |
51 | ||
52 | } | |
53 | ||
54 | ////////////////////////////////////////////////////////////////////////////////// | |
55 | ||
56 | AliTRDqaGuiJPsi::AliTRDqaGuiJPsi(TGWindow *parent) | |
57 | : TGCompositeFrame(parent, 720, 500), | |
58 | fIdx(0), | |
59 | fGPanel(0), | |
60 | fGCanvas(0), | |
61 | fGSelect(0), | |
62 | fGPrev(0), | |
63 | fGNext(0) | |
64 | { | |
65 | // | |
66 | // Main constructor | |
67 | // | |
68 | ||
69 | fIdx = 0; | |
70 | ||
71 | // steering panel | |
72 | ||
73 | SetLayoutManager(new TGVerticalLayout(this)); | |
74 | ||
75 | fGPanel = new TGHorizontalFrame(this); | |
76 | ||
77 | // fGLabel = new TGLabel(fGPanel, "Current Step: "); | |
78 | fGPrev = new TGTextButton(fGPanel, "Prev Step"); | |
79 | fGNext = new TGTextButton(fGPanel, "Next Step"); | |
80 | ||
81 | fGSelect = new TGComboBox(fGPanel); | |
82 | for(int i=0; i<5; i++) fGSelect->AddEntry(Form("Step %d", i), i); | |
83 | fGSelect->Resize(100, fGPrev->GetHeight()); | |
84 | fGSelect->Select(fIdx); | |
85 | ||
86 | TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5); | |
87 | ||
88 | // fGPanel->AddFrame(fGLabel, hint); | |
89 | fGPanel->AddFrame(fGPrev, hint); | |
90 | fGPanel->AddFrame(fGSelect, hint); | |
91 | fGPanel->AddFrame(fGNext, hint); | |
92 | ||
93 | AddFrame(fGPanel); | |
94 | ||
95 | // panel logic | |
96 | fGPrev->Connect("Clicked()", "AliTRDqaGuiJPsi", this, "PreviusStep()"); | |
97 | fGNext->Connect("Clicked()", "AliTRDqaGuiJPsi", this, "NextStep()"); | |
98 | fGSelect->Connect("Selected(Int_t", "AliTRDqaGuiJPsi", this, "SelectStep(Int_t)"); | |
99 | ||
100 | // histograms | |
101 | /**/ | |
102 | fGCanvas = new TGCompositeFrame(this); | |
103 | fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,3,1,1)); | |
104 | ||
105 | fNameList[0] = "mass"; | |
106 | fNameList[1] = "nTracksNeg"; | |
107 | fNameList[2] = "ptNeg"; | |
108 | fNameList[3] = "pidNeg"; | |
109 | //fNameList[3] = "ptAngle"; | |
110 | fNameList[4] = "nTracksPos"; | |
111 | fNameList[5] = "ptPos"; | |
112 | ||
113 | for(Int_t i=0; i<6; i++) { | |
114 | fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], fGCanvas, 320, 300); | |
115 | fGCanvas->AddFrame(fCanvasList[i]); | |
116 | fCanvasList[i]->GetCanvas()->SetRightMargin(0.05); | |
117 | } | |
118 | ||
119 | for(Int_t i=0; i<4; i++) { | |
120 | fHistList[i] = 0; | |
121 | } | |
122 | ||
123 | AddFrame(fGCanvas); | |
124 | /**/ | |
125 | } | |
126 | ||
127 | ////////////////////////////////////////////////////////////////////////////////// | |
128 | ||
129 | void AliTRDqaGuiJPsi::SetQAFile(const char *filename) { | |
130 | // | |
131 | // Ste file with histograms | |
132 | // | |
133 | ||
134 | strcpy(fFileName, filename); | |
135 | ||
136 | for(Int_t i=0; i<6; i++) { | |
137 | if (fHistList[i]) delete fHistList[i]; | |
138 | } | |
139 | ||
140 | const Int_t logy[6] = {0, 1, 1, 1, 1, 1}; | |
141 | const Int_t logz[6] = {0, 0, 0, 1, 0, 0}; | |
142 | const char *opt[6] = {"", "", "", "", "", ""}; | |
143 | ||
144 | TFile *file = new TFile(filename); | |
145 | ||
146 | for(Int_t i=0; i<6; i++) { | |
147 | fHistList[i] = (TH1D*)gDirectory->Get(Form("%s_%d", fNameList[i], fIdx)); | |
148 | if (fHistList[i]) fHistList[i]->SetDirectory(0); | |
149 | fCanvasList[i]->GetCanvas()->cd(); | |
150 | if (fHistList[i]) fHistList[i]->Draw(opt[i]); | |
151 | gPad->SetLogy(logy[i]); | |
152 | gPad->SetLogz(logz[i]); | |
153 | fCanvasList[i]->GetCanvas()->Update(); | |
154 | } | |
155 | ||
156 | file->Close(); | |
157 | delete file; | |
158 | } | |
159 | ||
160 | ////////////////////////////////////////////////////////////////////////////////// | |
161 | ||
162 | void AliTRDqaGuiJPsi::SetStep(Int_t idx) { | |
163 | // | |
164 | // Sets active supermodule | |
165 | // | |
166 | ||
167 | fIdx = idx; | |
168 | fGSelect->Select(fIdx, 0); | |
169 | SetQAFile(fFileName); | |
170 | } | |
171 | ||
172 | ////////////////////////////////////////////////////////////////////////////////// | |
173 |