#include <iostream>
#include "TCanvas.h"
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TAxis.h"
#include "TPostScript.h"
#include "TList.h"
#include "TMath.h"
#include "AliLog.h"
#include "AliESDVertex.h"
#include "AliPerformanceObject.h"
using namespace std;
ClassImp(AliPerformanceObject)
AliPerformanceObject::AliPerformanceObject():
TNamed("AliPerformanceObject","AliPerformanceObject"),
fMergeTHnSparseObj(kFALSE),
fAnalysisMode(-1),
fRunNumber(-1),
fHptGenerator(kFALSE),
fTriggerClass(0),
fUseTrackVertex(kFALSE),
fHighMultiplicity(kFALSE),
fUseKinkDaughters(kTRUE),
fUseCentralityBin(0),
fUseTOFBunchCrossing(kTRUE)
{
}
AliPerformanceObject::AliPerformanceObject(const char* name, const char* title, Int_t run, Bool_t highMult):
TNamed(name,title),
fMergeTHnSparseObj(kFALSE),
fAnalysisMode(-1),
fRunNumber(run),
fHptGenerator(kFALSE),
fTriggerClass(0),
fUseTrackVertex(kFALSE),
fHighMultiplicity(highMult),
fUseKinkDaughters(kTRUE),
fUseCentralityBin(0),
fUseTOFBunchCrossing(kTRUE)
{
}
AliPerformanceObject::~AliPerformanceObject(){
}
void AliPerformanceObject::PrintHisto(Bool_t logz, const Char_t * outFileName) {
TFolder *folder = this->GetAnalysisFolder();
if (!folder) {
AliDebug(AliLog::kError, "folder not available");
return;
}
TCanvas *can = new TCanvas("can");
can->Divide(2,2);
char fname[256];
const char* suffix=".ps";
if(outFileName) snprintf(fname,256,"%s",outFileName);
else snprintf(fname,256,"%s%s",folder->GetName(),suffix);
TPostScript *ps = new TPostScript(fname,112);
Printf("Histograms are stored in %s", fname);
TIter iter(folder->GetListOfFolders());
TH1 *obj = 0;
Int_t count = 0;
Int_t pad_count = 0;
while ((obj = (TH1*)iter()) !=0) {
TString name(obj->ClassName());
if((count%4) == 0) {
pad_count = 0;
ps->NewPage();
}
pad_count++;
can->cd(pad_count);
if(obj->TestBit(TH1::kLogX))
gPad->SetLogx(1);
else
gPad->SetLogx(0);
if (obj->GetYaxis() && obj->GetZaxis()) {
if(logz) gPad->SetLogz();
if ( name.CompareTo("TH3D") )
obj->Draw("colz");
}
else {
obj->SetMarkerStyle(24);
obj->SetMarkerSize(1.0);
if ( name.CompareTo("TH3D") )
obj->Draw();
}
if ((pad_count%4) == 0) {
can->Update();
}
count++;
}
ps->Close();
}
Double_t * AliPerformanceObject::CreateLogAxis(Int_t nbins, Double_t xmin, Double_t xmax) {
Double_t logxmin = TMath::Log10(xmin);
Double_t logxmax = TMath::Log10(xmax);
Double_t binwidth = (logxmax-logxmin)/nbins;
Double_t *xbins = new Double_t[nbins+1];
xbins[0] = xmin;
for (Int_t i=1;i<=nbins;i++) {
xbins[i] = xmin + TMath::Power(10,logxmin+i*binwidth);
}
return xbins;
}
void AliPerformanceObject::InitHighMult() {
fHighMultiplicity = kTRUE;
Init();
}
void AliPerformanceObject::AddProjection(TObjArray* aFolderObj, TString nameSparse, THnSparse* hSparse, Int_t xDim, TString* selString)
{
TH1 *h1=0;
TString name = "h_tpc_" + nameSparse + '_';
if (selString) { name += *selString + '_'; }
name.ToLower();
name += xDim;
TString title = hSparse->GetAxis(xDim)->GetTitle();
if (selString) { title += " (" + *selString + ")"; }
h1 = hSparse->Projection(xDim);
h1->SetName(name.Data());
h1->GetXaxis()->SetTitle(hSparse->GetAxis(xDim)->GetTitle());
h1->SetTitle(title.Data());
aFolderObj->Add(h1);
}
void AliPerformanceObject::AddProjection(TObjArray* aFolderObj, TString nameSparse, THnSparse *hSparse, Int_t yDim, Int_t xDim, TString* selString)
{
TH2 *h2=0;
TString name = "h_tpc_" + nameSparse + '_';
if (selString) { name += *selString + '_'; }
name.ToLower();
name += yDim;
name += '_';
name += xDim;
TString title = hSparse->GetAxis(yDim)->GetTitle();
title += " vs ";
title += hSparse->GetAxis(xDim)->GetTitle();
if (selString) { title += " (" + *selString + ")"; }
h2 = hSparse->Projection(yDim,xDim);
h2->SetName(name.Data());
h2->GetXaxis()->SetTitle(hSparse->GetAxis(xDim)->GetTitle());
h2->GetYaxis()->SetTitle(hSparse->GetAxis(yDim)->GetTitle());
h2->SetTitle(title.Data());
aFolderObj->Add(h2);
}
void AliPerformanceObject::AddProjection(TObjArray* aFolderObj, TString nameSparse, THnSparse *hSparse, Int_t xDim, Int_t yDim, Int_t zDim, TString* selString)
{
TH3 *h3=0;
TString name = "h_tpc_" + nameSparse + '_';
if (selString) { name += *selString + '_'; }
name.ToLower();
name += xDim;
name += '_';
name += yDim;
name += '_';
name += zDim;
TString title = hSparse->GetAxis(xDim)->GetTitle();
title += " vs ";
title += hSparse->GetAxis(yDim)->GetTitle();
title += " vs ";
title += hSparse->GetAxis(zDim)->GetTitle();
if (selString) { title += " (" + *selString + ")"; }
h3 = hSparse->Projection(xDim,yDim,zDim);
h3->SetName(name.Data());
h3->GetXaxis()->SetTitle(hSparse->GetAxis(xDim)->GetTitle());
h3->GetYaxis()->SetTitle(hSparse->GetAxis(yDim)->GetTitle());
h3->GetZaxis()->SetTitle(hSparse->GetAxis(zDim)->GetTitle());
h3->SetTitle(title.Data());
aFolderObj->Add(h3);
}
AliPerformanceObject.cxx:1 AliPerformanceObject.cxx:2 AliPerformanceObject.cxx:3 AliPerformanceObject.cxx:4 AliPerformanceObject.cxx:5 AliPerformanceObject.cxx:6 AliPerformanceObject.cxx:7 AliPerformanceObject.cxx:8 AliPerformanceObject.cxx:9 AliPerformanceObject.cxx:10 AliPerformanceObject.cxx:11 AliPerformanceObject.cxx:12 AliPerformanceObject.cxx:13 AliPerformanceObject.cxx:14 AliPerformanceObject.cxx:15 AliPerformanceObject.cxx:16 AliPerformanceObject.cxx:17 AliPerformanceObject.cxx:18 AliPerformanceObject.cxx:19 AliPerformanceObject.cxx:20 AliPerformanceObject.cxx:21 AliPerformanceObject.cxx:22 AliPerformanceObject.cxx:23 AliPerformanceObject.cxx:24 AliPerformanceObject.cxx:25 AliPerformanceObject.cxx:26 AliPerformanceObject.cxx:27 AliPerformanceObject.cxx:28 AliPerformanceObject.cxx:29 AliPerformanceObject.cxx:30 AliPerformanceObject.cxx:31 AliPerformanceObject.cxx:32 AliPerformanceObject.cxx:33 AliPerformanceObject.cxx:34 AliPerformanceObject.cxx:35 AliPerformanceObject.cxx:36 AliPerformanceObject.cxx:37 AliPerformanceObject.cxx:38 AliPerformanceObject.cxx:39 AliPerformanceObject.cxx:40 AliPerformanceObject.cxx:41 AliPerformanceObject.cxx:42 AliPerformanceObject.cxx:43 AliPerformanceObject.cxx:44 AliPerformanceObject.cxx:45 AliPerformanceObject.cxx:46 AliPerformanceObject.cxx:47 AliPerformanceObject.cxx:48 AliPerformanceObject.cxx:49 AliPerformanceObject.cxx:50 AliPerformanceObject.cxx:51 AliPerformanceObject.cxx:52 AliPerformanceObject.cxx:53 AliPerformanceObject.cxx:54 AliPerformanceObject.cxx:55 AliPerformanceObject.cxx:56 AliPerformanceObject.cxx:57 AliPerformanceObject.cxx:58 AliPerformanceObject.cxx:59 AliPerformanceObject.cxx:60 AliPerformanceObject.cxx:61 AliPerformanceObject.cxx:62 AliPerformanceObject.cxx:63 AliPerformanceObject.cxx:64 AliPerformanceObject.cxx:65 AliPerformanceObject.cxx:66 AliPerformanceObject.cxx:67 AliPerformanceObject.cxx:68 AliPerformanceObject.cxx:69 AliPerformanceObject.cxx:70 AliPerformanceObject.cxx:71 AliPerformanceObject.cxx:72 AliPerformanceObject.cxx:73 AliPerformanceObject.cxx:74 AliPerformanceObject.cxx:75 AliPerformanceObject.cxx:76 AliPerformanceObject.cxx:77 AliPerformanceObject.cxx:78 AliPerformanceObject.cxx:79 AliPerformanceObject.cxx:80 AliPerformanceObject.cxx:81 AliPerformanceObject.cxx:82 AliPerformanceObject.cxx:83 AliPerformanceObject.cxx:84 AliPerformanceObject.cxx:85 AliPerformanceObject.cxx:86 AliPerformanceObject.cxx:87 AliPerformanceObject.cxx:88 AliPerformanceObject.cxx:89 AliPerformanceObject.cxx:90 AliPerformanceObject.cxx:91 AliPerformanceObject.cxx:92 AliPerformanceObject.cxx:93 AliPerformanceObject.cxx:94 AliPerformanceObject.cxx:95 AliPerformanceObject.cxx:96 AliPerformanceObject.cxx:97 AliPerformanceObject.cxx:98 AliPerformanceObject.cxx:99 AliPerformanceObject.cxx:100 AliPerformanceObject.cxx:101 AliPerformanceObject.cxx:102 AliPerformanceObject.cxx:103 AliPerformanceObject.cxx:104 AliPerformanceObject.cxx:105 AliPerformanceObject.cxx:106 AliPerformanceObject.cxx:107 AliPerformanceObject.cxx:108 AliPerformanceObject.cxx:109 AliPerformanceObject.cxx:110 AliPerformanceObject.cxx:111 AliPerformanceObject.cxx:112 AliPerformanceObject.cxx:113 AliPerformanceObject.cxx:114 AliPerformanceObject.cxx:115 AliPerformanceObject.cxx:116 AliPerformanceObject.cxx:117 AliPerformanceObject.cxx:118 AliPerformanceObject.cxx:119 AliPerformanceObject.cxx:120 AliPerformanceObject.cxx:121 AliPerformanceObject.cxx:122 AliPerformanceObject.cxx:123 AliPerformanceObject.cxx:124 AliPerformanceObject.cxx:125 AliPerformanceObject.cxx:126 AliPerformanceObject.cxx:127 AliPerformanceObject.cxx:128 AliPerformanceObject.cxx:129 AliPerformanceObject.cxx:130 AliPerformanceObject.cxx:131 AliPerformanceObject.cxx:132 AliPerformanceObject.cxx:133 AliPerformanceObject.cxx:134 AliPerformanceObject.cxx:135 AliPerformanceObject.cxx:136 AliPerformanceObject.cxx:137 AliPerformanceObject.cxx:138 AliPerformanceObject.cxx:139 AliPerformanceObject.cxx:140 AliPerformanceObject.cxx:141 AliPerformanceObject.cxx:142 AliPerformanceObject.cxx:143 AliPerformanceObject.cxx:144 AliPerformanceObject.cxx:145 AliPerformanceObject.cxx:146 AliPerformanceObject.cxx:147 AliPerformanceObject.cxx:148 AliPerformanceObject.cxx:149 AliPerformanceObject.cxx:150 AliPerformanceObject.cxx:151 AliPerformanceObject.cxx:152 AliPerformanceObject.cxx:153 AliPerformanceObject.cxx:154 AliPerformanceObject.cxx:155 AliPerformanceObject.cxx:156 AliPerformanceObject.cxx:157 AliPerformanceObject.cxx:158 AliPerformanceObject.cxx:159 AliPerformanceObject.cxx:160 AliPerformanceObject.cxx:161 AliPerformanceObject.cxx:162 AliPerformanceObject.cxx:163 AliPerformanceObject.cxx:164 AliPerformanceObject.cxx:165 AliPerformanceObject.cxx:166 AliPerformanceObject.cxx:167 AliPerformanceObject.cxx:168 AliPerformanceObject.cxx:169 AliPerformanceObject.cxx:170 AliPerformanceObject.cxx:171 AliPerformanceObject.cxx:172 AliPerformanceObject.cxx:173 AliPerformanceObject.cxx:174 AliPerformanceObject.cxx:175 AliPerformanceObject.cxx:176 AliPerformanceObject.cxx:177 AliPerformanceObject.cxx:178 AliPerformanceObject.cxx:179 AliPerformanceObject.cxx:180 AliPerformanceObject.cxx:181 AliPerformanceObject.cxx:182 AliPerformanceObject.cxx:183 AliPerformanceObject.cxx:184 AliPerformanceObject.cxx:185 AliPerformanceObject.cxx:186 AliPerformanceObject.cxx:187 AliPerformanceObject.cxx:188 AliPerformanceObject.cxx:189 AliPerformanceObject.cxx:190 AliPerformanceObject.cxx:191 AliPerformanceObject.cxx:192 AliPerformanceObject.cxx:193 AliPerformanceObject.cxx:194 AliPerformanceObject.cxx:195 AliPerformanceObject.cxx:196 AliPerformanceObject.cxx:197 AliPerformanceObject.cxx:198 AliPerformanceObject.cxx:199 AliPerformanceObject.cxx:200 AliPerformanceObject.cxx:201 AliPerformanceObject.cxx:202 AliPerformanceObject.cxx:203 AliPerformanceObject.cxx:204 AliPerformanceObject.cxx:205 AliPerformanceObject.cxx:206 AliPerformanceObject.cxx:207 AliPerformanceObject.cxx:208 AliPerformanceObject.cxx:209 AliPerformanceObject.cxx:210 AliPerformanceObject.cxx:211 AliPerformanceObject.cxx:212 AliPerformanceObject.cxx:213 AliPerformanceObject.cxx:214 AliPerformanceObject.cxx:215 AliPerformanceObject.cxx:216 AliPerformanceObject.cxx:217 AliPerformanceObject.cxx:218 AliPerformanceObject.cxx:219 AliPerformanceObject.cxx:220 AliPerformanceObject.cxx:221 AliPerformanceObject.cxx:222 AliPerformanceObject.cxx:223 AliPerformanceObject.cxx:224 AliPerformanceObject.cxx:225 AliPerformanceObject.cxx:226 AliPerformanceObject.cxx:227 AliPerformanceObject.cxx:228 AliPerformanceObject.cxx:229 AliPerformanceObject.cxx:230 AliPerformanceObject.cxx:231 AliPerformanceObject.cxx:232 AliPerformanceObject.cxx:233 AliPerformanceObject.cxx:234 AliPerformanceObject.cxx:235 AliPerformanceObject.cxx:236 AliPerformanceObject.cxx:237 AliPerformanceObject.cxx:238 AliPerformanceObject.cxx:239 AliPerformanceObject.cxx:240 AliPerformanceObject.cxx:241 AliPerformanceObject.cxx:242 AliPerformanceObject.cxx:243 AliPerformanceObject.cxx:244 AliPerformanceObject.cxx:245