]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/qaGui/AliTRDqaGuiBlackError.cxx
811142491c3be73e84d8eb7a175d1eaba53cea51
[u/mrichter/AliRoot.git] / TRD / qaGui / AliTRDqaGuiBlackError.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: AliTRDqaGuiBlackError.cxx 23387 2008-01-17 17:25:16Z cblume $ */
17
18 //////////////////////////////////////////////////////////////////////////////////
19 //
20 // This class is a Graphical User Interface for the Quality Monitorig 
21 // of black (non zero zuppresed) events from TRD. 
22 // It lets display and browse throu histograms created by the class 
23 // AliTRDqaBlackEvents.
24 // The class works in cooperation with AliTRDqaGuiMainBlack.
25 //
26 // S. Radomski 
27 // Uni-Heidelberg
28 // June 2008
29 // 
30 //////////////////////////////////////////////////////////////////////////////////
31
32 #include "AliTRDqaGuiBlackError.h"
33
34 #include "TH1D.h"
35 #include "TGraph.h"
36 #include "TFile.h"
37 #include "TCanvas.h"
38 #include "TString.h"
39 #include "TSystem.h"
40 #include "TGaxis.h"
41
42 #include "TRootEmbeddedCanvas.h"
43
44 ClassImp(AliTRDqaGuiBlackError)
45
46 //////////////////////////////////////////////////////////////////////////////////
47
48 AliTRDqaGuiBlackError::AliTRDqaGuiBlackError() 
49 {
50   //
51   // Default constructor
52   //
53
54   for (Int_t i = 0; i < 3; i++) {
55     fHistList[i]   = 0x0;
56     fGraphList[i]  = 0x0;
57     fHistListSM[i] = 0x0;
58   }
59
60   for (Int_t i = 0; i < 9; i++) {
61     fCanvasList[i] = 0x0;
62   }
63
64   strncpy(fFileName,"",265);
65
66 }
67
68 //////////////////////////////////////////////////////////////////////////////////
69
70 AliTRDqaGuiBlackError::AliTRDqaGuiBlackError(TGWindow *parent) 
71   : TGCompositeFrame(parent, 720, 500)
72 {
73   //
74   // Main constructor
75   //
76     
77   SetLayoutManager(new TGMatrixLayout(this,3,3,0,0));
78
79   for(Int_t i=0; i<9; i++) {
80     fCanvasList[i] = new TRootEmbeddedCanvas(Form("pos_%d", i), this, 333, 245);
81     AddFrame(fCanvasList[i]);
82   }
83   
84   for(Int_t i=0; i<3; i++) {
85     fHistList[i] = 0;
86     fGraphList[i] = 0;
87     fHistListSM[i] = 0;
88   }
89
90   //AddFrame(fGCanvas);
91   /**/
92 }
93
94 //////////////////////////////////////////////////////////////////////////////////
95
96 void AliTRDqaGuiBlackError::SetQAFile(const char *filename) {
97   //
98   // Set the file with histograms
99   //
100
101   TGaxis::SetMaxDigits(3);
102   
103   const char *names[9] = {
104     "errorHC", "errorMCM", "errorADC",
105     "trendErrorHC", "trendErrorMCM", "trendErrorADC",
106     "errorSM_HC", "errorSM_MCM", "errorSM_ADC"
107   };  
108
109   const char *title[9] = {
110     "half-chamber;HC error ID", "MCM;MCM error ID", "ADC;ADC error ID",
111     "fraction with HC error (%);event number",
112     "fraction with MCM error (%);event number",
113     "fraction with ADC error (%);event number",    
114     ";sm id;number of errors",
115     ";sm id;number of errors",
116     ";sm id;number of errors"
117   };
118
119
120   strncpy(fFileName,filename,256);
121  
122   for(int i=0; i<3; i++) {
123
124     if (fHistList[i]) delete fHistList[i];
125     if (fGraphList[i]) delete fGraphList[i];
126     if (fHistListSM[i]) delete fHistListSM[i];
127
128     fHistList[i] = 0;
129     fGraphList[i] = 0;
130     fHistListSM[i] = 0;
131   }
132   
133   TFile *file = new TFile(filename);
134   
135   for(Int_t i=0; i<3; i++) {
136
137     fHistList[i] = (TH1D*)file->Get(names[i]);
138     if (fHistList[i]) {
139       fCanvasList[i]->GetCanvas()->cd();
140       fCanvasList[i]->GetCanvas()->SetLogy(1);
141       
142       fHistList[i]->Draw();
143       fHistList[i]->SetTitle(title[i]);
144     }
145     
146     fGraphList[i] = (TGraph*)file->Get(names[i+3]);
147     if (fGraphList[i]) {
148       fCanvasList[i+3]->GetCanvas()->cd();
149       fGraphList[i]->Draw("apl");
150       fGraphList[i]->SetMarkerStyle(7);
151       fGraphList[i]->GetHistogram()->SetTitle(title[i+3]);
152     }
153
154     fHistListSM[i] = (TH1D*)file->Get(names[i+6]);
155     if (fHistListSM[i]) {
156       fCanvasList[i+6]->GetCanvas()->cd();
157       //fCanvasList[i]->GetCanvas()->SetLogy(1);
158       
159       fHistListSM[i]->Draw();
160       fHistListSM[i]->SetTitle(title[i+6]);
161     }
162   }
163
164   
165   /*
166
167
168       fHistList[i]->SetMinimum(fRangePed[0]);
169       fHistList[i]->SetMaximum(fRangePed[1]);
170     }
171     
172     if ( fHistList[i] && (fIdxType == 1) && fSetRangeNoise) {
173       fHistList[i]->SetMinimum(fRangeNoise[0]);
174       fHistList[i]->SetMaximum(fRangeNoise[1]);
175     }
176
177     fCanvasList[pos]->GetCanvas()->Update();
178   }
179   */
180 }
181
182 //////////////////////////////////////////////////////////////////////////////////