1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERF, 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 //------------------------------------------------------------------------------
17 // Implementation of abstract AliPerformanceObject class. It keeps information from
18 // comparison of reconstructed and MC particle tracks.
20 // Author: J.Otwinowski 14/04/2008
21 // Changes by M.Knichel 15/10/2010
22 //------------------------------------------------------------------------------
31 #include "TPostScript.h"
36 #include "AliESDVertex.h"
37 #include "AliPerformanceObject.h"
41 ClassImp(AliPerformanceObject)
43 //_____________________________________________________________________________
44 AliPerformanceObject::AliPerformanceObject():
45 TNamed("AliPerformanceObject","AliPerformanceObject"),
46 fMergeTHnSparseObj(kFALSE),
49 fHptGenerator(kFALSE),
51 fUseTrackVertex(kFALSE),
52 fHighMultiplicity(kFALSE),
53 fUseKinkDaughters(kTRUE),
55 fUseTOFBunchCrossing(kTRUE)
60 //_____________________________________________________________________________
61 AliPerformanceObject::AliPerformanceObject(const char* name, const char* title, Int_t run, Bool_t highMult):
63 fMergeTHnSparseObj(kFALSE),
66 fHptGenerator(kFALSE),
68 fUseTrackVertex(kFALSE),
69 fHighMultiplicity(highMult),
70 fUseKinkDaughters(kTRUE),
72 fUseTOFBunchCrossing(kTRUE)
77 //_____________________________________________________________________________
78 AliPerformanceObject::~AliPerformanceObject(){
82 //_____________________________________________________________________________
83 void AliPerformanceObject::PrintHisto(Bool_t logz, const Char_t * outFileName) {
84 // draw all histograms from the folder
85 // and store them in the output *.ps file
88 TFolder *folder = this->GetAnalysisFolder();
90 AliDebug(AliLog::kError, "folder not available");
94 TCanvas *can = new TCanvas("can");
98 const char* suffix=".ps";
100 if(outFileName) snprintf(fname,256,"%s",outFileName);
101 else snprintf(fname,256,"%s%s",folder->GetName(),suffix);
103 TPostScript *ps = new TPostScript(fname,112);
104 Printf("Histograms are stored in %s", fname);
105 TIter iter(folder->GetListOfFolders());
110 while ((obj = (TH1*)iter()) !=0) {
112 TString name(obj->ClassName());
115 // 4 figures per page
124 if(obj->TestBit(TH1::kLogX))
129 if (obj->GetYaxis() && obj->GetZaxis()) {
130 if(logz) gPad->SetLogz();
131 if ( name.CompareTo("TH3D") )
135 obj->SetMarkerStyle(24);
136 obj->SetMarkerSize(1.0);
137 if ( name.CompareTo("TH3D") )
141 if ((pad_count%4) == 0) {
151 //_____________________________________________________________________________
152 Double_t * AliPerformanceObject::CreateLogAxis(Int_t nbins, Double_t xmin, Double_t xmax) {
153 // retun pointer to the array with log axis
154 // it is user responsibility to delete the array
156 Double_t logxmin = TMath::Log10(xmin);
157 Double_t logxmax = TMath::Log10(xmax);
158 Double_t binwidth = (logxmax-logxmin)/nbins;
160 Double_t *xbins = new Double_t[nbins+1];
163 for (Int_t i=1;i<=nbins;i++) {
164 xbins[i] = xmin + TMath::Power(10,logxmin+i*binwidth);
170 //_____________________________________________________________________________
171 void AliPerformanceObject::InitHighMult() {
173 fHighMultiplicity = kTRUE;
179 //_____________________________________________________________________________
180 void AliPerformanceObject::AddProjection(TObjArray* aFolderObj, TString nameSparse, THnSparse* hSparse, Int_t xDim, TString* selString)
183 TString name = "h_tpc_" + nameSparse + '_';
184 if (selString) { name += *selString + '_'; }
187 TString title = hSparse->GetAxis(xDim)->GetTitle();
188 if (selString) { title += " (" + *selString + ")"; }
189 h1 = hSparse->Projection(xDim);
190 h1->SetName(name.Data());
191 h1->GetXaxis()->SetTitle(hSparse->GetAxis(xDim)->GetTitle());
192 h1->SetTitle(title.Data());
197 //_____________________________________________________________________________
198 void AliPerformanceObject::AddProjection(TObjArray* aFolderObj, TString nameSparse, THnSparse *hSparse, Int_t yDim, Int_t xDim, TString* selString)
201 TString name = "h_tpc_" + nameSparse + '_';
202 if (selString) { name += *selString + '_'; }
207 TString title = hSparse->GetAxis(yDim)->GetTitle();
209 title += hSparse->GetAxis(xDim)->GetTitle();
210 if (selString) { title += " (" + *selString + ")"; }
211 h2 = hSparse->Projection(yDim,xDim);
212 h2->SetName(name.Data());
213 h2->GetXaxis()->SetTitle(hSparse->GetAxis(xDim)->GetTitle());
214 h2->GetYaxis()->SetTitle(hSparse->GetAxis(yDim)->GetTitle());
215 h2->SetTitle(title.Data());
220 //_____________________________________________________________________________
221 void AliPerformanceObject::AddProjection(TObjArray* aFolderObj, TString nameSparse, THnSparse *hSparse, Int_t xDim, Int_t yDim, Int_t zDim, TString* selString)
224 TString name = "h_tpc_" + nameSparse + '_';
225 if (selString) { name += *selString + '_'; }
232 TString title = hSparse->GetAxis(xDim)->GetTitle();
234 title += hSparse->GetAxis(yDim)->GetTitle();
236 title += hSparse->GetAxis(zDim)->GetTitle();
237 if (selString) { title += " (" + *selString + ")"; }
238 h3 = hSparse->Projection(xDim,yDim,zDim);
239 h3->SetName(name.Data());
240 h3->GetXaxis()->SetTitle(hSparse->GetAxis(xDim)->GetTitle());
241 h3->GetYaxis()->SetTitle(hSparse->GetAxis(yDim)->GetTitle());
242 h3->GetZaxis()->SetTitle(hSparse->GetAxis(zDim)->GetTitle());
243 h3->SetTitle(title.Data());