TRD module
[u/mrichter/AliRoot.git] / TRD / TRDgui / AliTRDqaGuiClusters.cxx
CommitLineData
36f55715 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"
a73a87be 34#include "TH2D.h"
36f55715 35#include "TFile.h"
36#include "TCanvas.h"
37#include "TRootEmbeddedCanvas.h"
38
39ClassImp(AliTRDqaGuiClusters)
40
41const Int_t AliTRDqaGuiClusters::fgkLogList[4] = {0,1,0,1};
42
43//////////////////////////////////////////////////////////////////////////////////
02f3bfcc 44AliTRDqaGuiClusters::AliTRDqaGuiClusters()
45 : TGCompositeFrame() {
46 //
47 // Default constructor
48 //
49
50 for (Int_t i = 0; i < 4; i++) {
51 fNameList[i] = 0x0;
52 fHistList[i] = 0x0;
53 fCanvasList[i] = 0x0;
54 for (Int_t j = 0; j < 3; j++) {
55 fHistRefs[i][j] = 0x0;
56 }
57 }
58
59}
60
61//////////////////////////////////////////////////////////////////////////////////
36f55715 62AliTRDqaGuiClusters::AliTRDqaGuiClusters(TGWindow *parent)
63 : TGCompositeFrame(parent, 720, 400) {
64 //
65 // main constructor
66 //
67
68 SetLayoutManager(new TGMatrixLayout(this,2,2,1,1));
69
70 fNameList[0] = "detMap";
71 fNameList[1] = "nCls";
72 fNameList[2] = "signal";
73 fNameList[3] = "ampMPV";
74
75 for(Int_t i=0; i<4; i++) {
76 fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], this, 480, 320);
77 AddFrame(fCanvasList[i]);
78 }
79
80 for(Int_t i=0; i<4; i++) {
81 fHistList[i] = 0;
82 }
83
84}
85
86//////////////////////////////////////////////////////////////////////////////////
36f55715 87void AliTRDqaGuiClusters::SetQAFile(const char *filename) {
88 //
89 // sets the file with histograms
90 //
91
92 for(Int_t i=0; i<4; i++) {
93 if (fHistList[i]) delete fHistList[i];
a73a87be 94 for(Int_t j=0; j<3; j++)
95 if (fHistRefs[i][j]) delete fHistRefs[i][j];
36f55715 96 }
97
98 const char *opt[4] = {"colz", "", "", ""};
99
100 TFile *file = new TFile(filename);
101 file->cd("TRD/RecPoints");
102
103 for(int i=0; i<4; i++) {
a73a87be 104
36f55715 105 fCanvasList[i]->GetCanvas()->cd();
106 gPad->SetLogy(fgkLogList[i]);
a73a87be 107
108 fHistList[i] = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s", fNameList[i]));
36f55715 109 if (fHistList[i]) fHistList[i]->Draw(opt[i]);
a73a87be 110 // if (fgkLogList[i]) fHistList[i]->SetMinimum(0.1);
111
112 TH1D *refHist = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s_%s", fNameList[i], "ref"));
113
114 if (refHist) {
115 BuildColor(i, refHist);
116 for(Int_t j=0; j<3; j++) fHistRefs[i][j]->Draw("SAME");
117 delete refHist;
118 }
119
36f55715 120 fCanvasList[i]->GetCanvas()->Update();
121 }
122}
123
124//////////////////////////////////////////////////////////////////////////////////
a73a87be 125/*
126TH2D *AliTRDqaGuiClusters::BuildHisto(TH1D *ref, TH1D *data) {
127
128 Int_t nbinsx = ref->GetNbinsX();
129 Double_t minx = ref->GetXaxis()->GetXmin();
130 Double_t maxx = ref->GetXaxis()->GetXmax();
131 Double_t min = data->GetMinimum();
132 Double_t max = data->GetMaximum();
133
134 TH2D *pad = new TH2D("pad", "", nbinsx, minx, maxx, 1, 0.7, 0.9);
135
136 // rewriting
137 for(Int_t i=0; i<nbinsx; i++) {
138 Double_t x = ref->GetBinCenter(i+1);
139 pad->Fill(x, 0.8, ref->GetBinContent(i+1));
140 }
141
142 pad->SetMinimum(-1);
143 return pad;
144}
145*/
146
147//////////////////////////////////////////////////////////////////////////////////
148
149void AliTRDqaGuiClusters::BuildColor(Int_t i, TH1D *ref) {
150
151 const Int_t nHist = 3;
152 const Int_t clr[nHist] = {3, 5, 2};
153
154 for(Int_t j=0; j<nHist; j++) {
155 fHistRefs[i][j] = (TH1D*)fHistList[i]->Clone(Form("%s_%d", fHistList[i]->GetName(), j));
156 fHistRefs[i][j]->SetFillColor(clr[j]);
157 fHistRefs[i][j]->SetLineColor(clr[j]);
158 }
159
160 for(Int_t k=0; k<ref->GetNbinsX(); k++) {
161 Double_t v = ref->GetBinContent(k+1);
162 if (v < 0.3) fHistRefs[i][1]->SetBinContent(k+1, 0);
163 if (v < 0.7) fHistRefs[i][2]->SetBinContent(k+1, 0);
164 }
165
166}
167
168//////////////////////////////////////////////////////////////////////////////////