]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/qaGui/AliTRDqaGuiEnergyDeposit.cxx
Adding multiplicity cut (Marek)
[u/mrichter/AliRoot.git] / TRD / qaGui / AliTRDqaGuiEnergyDeposit.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 //////////////////////////////////////////////////////////////////////////////////
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),
45     fGPanel(0),
46     fGCanvas(0),
47     fGSelect(0),
48     fGPrev(0),
49     fGNext(0)
50 {
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
63 }
64
65 //////////////////////////////////////////////////////////////////////////////////
66
67 AliTRDqaGuiEnergyDeposit::AliTRDqaGuiEnergyDeposit(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 Type: ");
89   fGPrev = new TGTextButton(fGPanel, "Prev Type");
90   fGNext = new TGTextButton(fGPanel, "Next Type");
91
92   const char *types[5] = {"electron", "muon", "pion", "kaon", "proton"};
93   fGSelect = new TGComboBox(fGPanel);
94   for(int i=0; i<5; i++) fGSelect->AddEntry(types[i], i); //Form("Type %d", i), i);
95   fGSelect->Resize(100, fGPrev->GetHeight());
96   fGSelect->Select(fIdx);
97   
98   TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
99   
100   // fGPanel->AddFrame(fGLabel, hint);
101   fGPanel->AddFrame(fGPrev, hint);
102   fGPanel->AddFrame(fGSelect, hint);
103   fGPanel->AddFrame(fGNext, hint);
104
105   AddFrame(fGPanel);
106
107   // panel logic
108   fGPrev->Connect("Clicked()", "AliTRDqaGuiEnergyDeposit", this, "PreviusType()");
109   fGNext->Connect("Clicked()", "AliTRDqaGuiEnergyDeposit", this, "NextType()");
110   fGSelect->Connect("Selected(Int_t", "AliTRDqaGuiEnergyDeposit", this, "SelectType(Int_t)");
111  
112   // histograms
113   /**/
114   fGCanvas = new TGCompositeFrame(this);
115   fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,3,1,1));
116
117   fNameList[0] = "probNeg";
118   fNameList[1] = "ptSigNeg";
119   fNameList[2] = "ptSigPureNeg";
120   fNameList[3] = "probPos";
121   fNameList[4] = "ptSigPos";
122   fNameList[5] = "ptSigPurePos";
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
140 void AliTRDqaGuiEnergyDeposit::SetQAFile(const char *filename) {
141   //
142   // Ste file with histograms
143   //
144
145   strncpy(fFileName,filename,256);
146
147   for(Int_t i=0; i<6; i++) {
148     if (fHistList[i]) delete fHistList[i];
149   }
150   
151   const Int_t logy[] = {1, 0, 0, 1, 0, 0};
152   const Int_t logx[] = {0, 1, 1, 0, 1, 1};
153   const char *opt[] = {"", "colz", "colz", "", "colz", "cloz"}; 
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->SetLogx(logx[i]);
164     fCanvasList[i]->GetCanvas()->Update();
165   }
166
167   file->Close();
168   delete file;
169   
170 }
171
172 //////////////////////////////////////////////////////////////////////////////////
173
174 void AliTRDqaGuiEnergyDeposit::SetType(Int_t idx) {
175   //
176   // Sets active supermodule 
177   //
178
179   fIdx = idx; 
180   fGSelect->Select(fIdx, 0); 
181   SetQAFile(fFileName);
182 }
183
184 //////////////////////////////////////////////////////////////////////////////////
185