1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliTRDqaGuiClusters.cxx 23871 2008-02-12 11:48:20Z hristov $ */
18 //////////////////////////////////////////////////////////////////////////////////
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
29 //////////////////////////////////////////////////////////////////////////////////
31 #include "AliTRDqaGuiClusters.h"
37 #include "TRootEmbeddedCanvas.h"
39 ClassImp(AliTRDqaGuiClusters)
41 const Int_t AliTRDqaGuiClusters::fgkLogList[4] = {0,1,0,1};
43 //////////////////////////////////////////////////////////////////////////////////
44 AliTRDqaGuiClusters::AliTRDqaGuiClusters()
45 : TGCompositeFrame() {
47 // Default constructor
50 for (Int_t i = 0; i < 4; i++) {
54 for (Int_t j = 0; j < 3; j++) {
55 fHistRefs[i][j] = 0x0;
61 //////////////////////////////////////////////////////////////////////////////////
62 AliTRDqaGuiClusters::AliTRDqaGuiClusters(TGWindow *parent)
63 : TGCompositeFrame(parent, 720, 400) {
68 SetLayoutManager(new TGMatrixLayout(this,2,2,1,1));
70 fNameList[0] = "detMap";
71 fNameList[1] = "nCls";
72 fNameList[2] = "signal";
73 fNameList[3] = "ampMPV";
75 for(Int_t i=0; i<4; i++) {
76 fCanvasList[i] = new TRootEmbeddedCanvas(fNameList[i], this, 480, 320);
77 AddFrame(fCanvasList[i]);
80 for(Int_t i=0; i<4; i++) {
86 //////////////////////////////////////////////////////////////////////////////////
87 void AliTRDqaGuiClusters::SetQAFile(const char *filename) {
89 // sets the file with histograms
92 for(Int_t i=0; i<4; i++) {
93 if (fHistList[i]) delete fHistList[i];
94 for(Int_t j=0; j<3; j++)
95 if (fHistRefs[i][j]) delete fHistRefs[i][j];
98 const char *opt[4] = {"colz", "", "", ""};
100 TFile *file = new TFile(filename);
101 file->cd("TRD/RecPoints");
103 for(int i=0; i<4; i++) {
105 fCanvasList[i]->GetCanvas()->cd();
106 gPad->SetLogy(fgkLogList[i]);
108 fHistList[i] = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s", fNameList[i]));
109 if (fHistList[i]) fHistList[i]->Draw(opt[i]);
110 // if (fgkLogList[i]) fHistList[i]->SetMinimum(0.1);
112 TH1D *refHist = (TH1D*)gDirectory->Get(Form("qaTRD_recPoints_%s_%s", fNameList[i], "ref"));
115 BuildColor(i, refHist);
116 for(Int_t j=0; j<3; j++) fHistRefs[i][j]->Draw("SAME");
120 fCanvasList[i]->GetCanvas()->Update();
124 //////////////////////////////////////////////////////////////////////////////////
126 TH2D *AliTRDqaGuiClusters::BuildHisto(TH1D *ref, TH1D *data) {
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();
134 TH2D *pad = new TH2D("pad", "", nbinsx, minx, maxx, 1, 0.7, 0.9);
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));
147 //////////////////////////////////////////////////////////////////////////////////
149 void AliTRDqaGuiClusters::BuildColor(Int_t i, TH1D *ref) {
151 const Int_t nHist = 3;
152 const Int_t clr[nHist] = {3, 5, 2};
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]);
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);
168 //////////////////////////////////////////////////////////////////////////////////