]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/qaGui/AliTRDqaGuiClusters.cxx
- fix cluster ownership problems in time bin container
[u/mrichter/AliRoot.git] / TRD / qaGui / AliTRDqaGuiClusters.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: AliTRDqaGuiClusters.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 on the full detector level.
22 // It displays histograms created by the AliTRDQADataMakerRec 
23 // run during the reconstruction 
24 //
25 // S. Radomski 
26 // Uni-Heidelberg
27 // Feb. 2008
28 // 
29 //////////////////////////////////////////////////////////////////////////////////
30
31 #include "AliTRDqaGuiClusters.h"
32
33 #include "TH1D.h"
34 #include "TH2D.h"
35 #include "TFile.h"
36 #include "TCanvas.h"
37 #include "TRootEmbeddedCanvas.h"
38
39 ClassImp(AliTRDqaGuiClusters)
40
41 const Int_t AliTRDqaGuiClusters::fgkLogList[4] = {0,1,0,1};
42
43 //////////////////////////////////////////////////////////////////////////////////
44 AliTRDqaGuiClusters::AliTRDqaGuiClusters(TGWindow *parent) 
45   : TGCompositeFrame(parent, 720, 400) {
46   //
47   // main constructor
48   //
49   
50   SetLayoutManager(new TGMatrixLayout(this,2,2,1,1));
51
52   fNameList[0] = "detMap";
53   fNameList[1] = "nCls";
54   fNameList[2] = "signal";
55   fNameList[3] = "ampMPV";
56
57   for(Int_t i=0; i<4; i++) {
58     fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], this, 480, 320);
59     AddFrame(fCanvasList[i]);
60   }
61   
62   for(Int_t i=0; i<4; i++) {
63     fHistList[i] = 0;
64   }
65
66 }
67
68 //////////////////////////////////////////////////////////////////////////////////
69
70 void AliTRDqaGuiClusters::SetQAFile(const char *filename) {
71   //
72   // sets the file with histograms
73   //
74
75   for(Int_t i=0; i<4; i++) {
76     if (fHistList[i]) delete fHistList[i];
77     for(Int_t j=0; j<3; j++) 
78       if (fHistRefs[i][j]) delete fHistRefs[i][j];
79   }
80   
81   const char *opt[4] = {"colz", "", "", ""};
82
83   TFile *file = new TFile(filename);
84   file->cd("TRD/RecPoints");
85   
86   for(int i=0; i<4; i++) {
87
88     fCanvasList[i]->GetCanvas()->cd();
89     gPad->SetLogy(fgkLogList[i]);
90
91     fHistList[i] = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s", fNameList[i]));
92     if (fHistList[i]) fHistList[i]->Draw(opt[i]);
93     // if (fgkLogList[i]) fHistList[i]->SetMinimum(0.1);
94     
95     TH1D *refHist = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s_%s", fNameList[i], "ref"));
96     
97     if (refHist) {
98       BuildColor(i, refHist);
99       for(Int_t j=0; j<3; j++) fHistRefs[i][j]->Draw("SAME");
100       delete refHist;
101     }
102     
103     fCanvasList[i]->GetCanvas()->Update();
104   }
105 }
106
107 //////////////////////////////////////////////////////////////////////////////////
108 /*
109 TH2D *AliTRDqaGuiClusters::BuildHisto(TH1D *ref, TH1D *data) {
110   
111   Int_t nbinsx = ref->GetNbinsX();
112   Double_t minx = ref->GetXaxis()->GetXmin();
113   Double_t maxx = ref->GetXaxis()->GetXmax();
114   Double_t min  = data->GetMinimum(); 
115   Double_t max  = data->GetMaximum();
116   
117   TH2D *pad = new TH2D("pad", "", nbinsx, minx, maxx, 1, 0.7, 0.9);
118
119   // rewriting
120   for(Int_t i=0; i<nbinsx; i++) {
121     Double_t x = ref->GetBinCenter(i+1);
122     pad->Fill(x, 0.8, ref->GetBinContent(i+1));
123   }
124   
125   pad->SetMinimum(-1);
126   return pad;
127 }
128 */
129
130 //////////////////////////////////////////////////////////////////////////////////
131
132 void AliTRDqaGuiClusters::BuildColor(Int_t i, TH1D *ref) {
133   
134   const Int_t nHist = 3;
135   const Int_t clr[nHist] = {3, 5, 2};
136
137   for(Int_t j=0; j<nHist; j++) {
138     fHistRefs[i][j] = (TH1D*)fHistList[i]->Clone(Form("%s_%d", fHistList[i]->GetName(), j));
139     fHistRefs[i][j]->SetFillColor(clr[j]);
140     fHistRefs[i][j]->SetLineColor(clr[j]);   
141   }
142   
143   for(Int_t k=0; k<ref->GetNbinsX(); k++) {
144     Double_t v = ref->GetBinContent(k+1);
145     if (v < 0.3) fHistRefs[i][1]->SetBinContent(k+1, 0);
146     if (v < 0.7) fHistRefs[i][2]->SetBinContent(k+1, 0);
147   }
148   
149 }
150
151 //////////////////////////////////////////////////////////////////////////////////