]>
Commit | Line | Data |
---|---|---|
7cc34f08 | 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 | //------------------------------------------------------------------------------ | |
17 | // Implementation of abstract AliPerformanceObject class. It keeps information from | |
18 | // comparison of reconstructed and MC particle tracks. | |
19 | // | |
20 | // Author: J.Otwinowski 14/04/2008 | |
21 | //------------------------------------------------------------------------------ | |
22 | ||
23 | #include <iostream> | |
24 | ||
25 | #include "TCanvas.h" | |
26 | #include "TH1.h" | |
27 | #include "TH2.h" | |
28 | #include "TAxis.h" | |
29 | #include "TPostScript.h" | |
30 | #include "TList.h" | |
31 | #include "TMath.h" | |
32 | ||
33 | #include "AliLog.h" | |
758320f7 | 34 | #include "AliESDVertex.h" |
7cc34f08 | 35 | #include "AliPerformanceObject.h" |
36 | ||
37 | using namespace std; | |
38 | ||
39 | ClassImp(AliPerformanceObject) | |
40 | ||
41 | //_____________________________________________________________________________ | |
42 | AliPerformanceObject::AliPerformanceObject(): | |
43 | TNamed("AliPerformanceObject","AliPerformanceObject"), | |
44 | fAnalysisMode(-1), | |
e6a60a90 | 45 | fHptGenerator(kFALSE), |
758320f7 | 46 | fTriggerClass(0), |
47 | fUseTrackVertex(kFALSE) | |
7cc34f08 | 48 | { |
49 | // constructor | |
50 | } | |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliPerformanceObject::AliPerformanceObject(const char* name, const char* title): | |
54 | TNamed(name,title), | |
55 | fAnalysisMode(-1), | |
e6a60a90 | 56 | fHptGenerator(kFALSE), |
758320f7 | 57 | fTriggerClass(0), |
58 | fUseTrackVertex(kFALSE) | |
7cc34f08 | 59 | { |
60 | // constructor | |
61 | } | |
62 | ||
63 | //_____________________________________________________________________________ | |
64 | AliPerformanceObject::~AliPerformanceObject(){ | |
65 | // destructor | |
66 | } | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | void AliPerformanceObject::PrintHisto(Bool_t logz, Char_t * outFileName) { | |
70 | // draw all histograms from the folder | |
71 | // and store them in the output *.ps file | |
72 | ||
73 | // use this folder | |
74 | TFolder *folder = this->GetAnalysisFolder(); | |
75 | if (!folder) { | |
76 | AliDebug(AliLog::kError, "folder not available"); | |
77 | return; | |
78 | } | |
79 | ||
80 | TCanvas *can = new TCanvas("can"); | |
81 | can->Divide(2,2); | |
82 | ||
83 | char fname[256]; | |
84 | const char* suffix=".ps"; | |
85 | ||
86 | if(outFileName) sprintf(fname,"%s",outFileName); | |
87 | else sprintf(fname,"%s%s",folder->GetName(),suffix); | |
88 | ||
89 | TPostScript *ps = new TPostScript(fname,112); | |
90 | Printf("Histograms are stored in %s", fname); | |
91 | TIter iter(folder->GetListOfFolders()); | |
92 | ||
93 | TH1 *obj = 0; | |
94 | Int_t count = 0; | |
95 | Int_t pad_count = 0; | |
96 | while ((obj = (TH1*)iter()) !=0) { | |
97 | ||
98 | // 4 figures per page | |
99 | if((count%4) == 0) { | |
100 | pad_count = 0; | |
101 | ps->NewPage(); | |
102 | } | |
103 | ||
104 | pad_count++; | |
105 | can->cd(pad_count); | |
106 | ||
107 | if(obj->TestBit(TH1::kLogX)) | |
108 | gPad->SetLogx(1); | |
109 | else | |
110 | gPad->SetLogx(0); | |
111 | ||
112 | if (obj->GetYaxis() && obj->GetZaxis()) { | |
113 | if(logz) gPad->SetLogz(); | |
114 | obj->Draw("colz"); | |
115 | } | |
116 | else { | |
117 | obj->SetMarkerStyle(24); | |
118 | obj->SetMarkerSize(1.0); | |
119 | obj->Draw(); | |
120 | } | |
121 | ||
122 | if ((pad_count%4) == 0) { | |
123 | can->Update(); | |
124 | } | |
125 | ||
126 | //printf("count %d \n",count); | |
127 | count++; | |
128 | } | |
129 | ps->Close(); | |
130 | } | |
131 | ||
132 | ||
133 | //_____________________________________________________________________________ | |
134 | Double_t * AliPerformanceObject::CreateLogAxis(Int_t nbins, Double_t xmin, Double_t xmax) { | |
135 | // retun pointer to the array with log axis | |
136 | // it is user responsibility to delete the array | |
137 | ||
138 | Double_t logxmin = TMath::Log10(xmin); | |
139 | Double_t logxmax = TMath::Log10(xmax); | |
140 | Double_t binwidth = (logxmax-logxmin)/nbins; | |
141 | ||
142 | Double_t *xbins = new Double_t[nbins+1]; | |
143 | ||
144 | xbins[0] = xmin; | |
145 | for (Int_t i=1;i<=nbins;i++) { | |
146 | xbins[i] = xmin + TMath::Power(10,logxmin+i*binwidth); | |
147 | } | |
148 | ||
149 | return xbins; | |
150 | } |