just some code cleanup in DecalibrateTOFSignal
[u/mrichter/AliRoot.git] / TPC / AliTPCCalPad.cxx
CommitLineData
07627591 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$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TPC calibration class for parameters which saved per pad //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliTPCCalPad.h"
25#include "AliTPCCalROC.h"
184bcc16 26#include <TObjArray.h>
27#include <TAxis.h>
28#include <TGraph.h>
200be8a6 29#include <TGraph2D.h>
30#include <TH2F.h>
07627591 31ClassImp(AliTPCCalPad)
32
33//_____________________________________________________________________________
34AliTPCCalPad::AliTPCCalPad():TNamed()
35{
36 //
37 // AliTPCCalPad default constructor
38 //
39
40 for (Int_t isec = 0; isec < kNsec; isec++) {
41 fROC[isec] = 0;
42 }
43
44}
45
46//_____________________________________________________________________________
47AliTPCCalPad::AliTPCCalPad(const Text_t *name, const Text_t *title)
48 :TNamed(name,title)
49{
50 //
51 // AliTPCCalPad constructor
52 //
53 for (Int_t isec = 0; isec < kNsec; isec++) {
54 fROC[isec] = new AliTPCCalROC(isec);
55 }
56}
57
58
59//_____________________________________________________________________________
60AliTPCCalPad::AliTPCCalPad(const AliTPCCalPad &c):TNamed(c)
61{
62 //
63 // AliTPCCalPad copy constructor
64 //
65
66 ((AliTPCCalPad &) c).Copy(*this);
67
68}
69
184bcc16 70//_____________________________________________________________________________
71AliTPCCalPad::AliTPCCalPad(TObjArray * array):TNamed()
72{
73 //
74 // AliTPCCalPad default constructor
75 //
76
77 for (Int_t isec = 0; isec < kNsec; isec++) {
78 fROC[isec] = (AliTPCCalROC *)array->At(isec);
79 }
80
81}
82
83
07627591 84///_____________________________________________________________________________
85AliTPCCalPad::~AliTPCCalPad()
86{
87 //
88 // AliTPCCalPad destructor
89 //
90
91 for (Int_t isec = 0; isec < kNsec; isec++) {
92 if (fROC[isec]) {
93 delete fROC[isec];
94 fROC[isec] = 0;
95 }
96 }
97
98}
99
100//_____________________________________________________________________________
101AliTPCCalPad &AliTPCCalPad::operator=(const AliTPCCalPad &c)
102{
103 //
104 // Assignment operator
105 //
106
107 if (this != &c) ((AliTPCCalPad &) c).Copy(*this);
108 return *this;
109
110}
111
112//_____________________________________________________________________________
113void AliTPCCalPad::Copy(TObject &c) const
114{
115 //
116 // Copy function
117 //
118
119 for (Int_t isec = 0; isec < kNsec; isec++) {
120 if (fROC[isec]) {
121 fROC[isec]->Copy(*((AliTPCCalPad &) c).fROC[isec]);
122 }
123 }
124 TObject::Copy(c);
125}
184bcc16 126
127TGraph * AliTPCCalPad::MakeGraph(Int_t type, Float_t ratio){
128 //
129 // type=1 - mean
130 // 2 - median
131 // 3 - LTM
132 Int_t npoints = 0;
133 for (Int_t i=0;i<72;i++) if (fROC[i]) npoints++;
134 TGraph * graph = new TGraph(npoints);
135 npoints=0;
136 for (Int_t isec=0;isec<72;isec++){
137 if (!fROC[isec]) continue;
138 if (type==0) graph->SetPoint(npoints,isec,fROC[isec]->GetMean());
139 if (type==1) graph->SetPoint(npoints,isec,fROC[isec]->GetMedian());
140 if (type==2) graph->SetPoint(npoints,isec,fROC[isec]->GetLTM(0,ratio));
141 npoints++;
142 }
143
144 graph->GetXaxis()->SetTitle("Sector");
145 if (type==0) {
146 graph->GetYaxis()->SetTitle("Mean");
147 graph->SetMarkerStyle(22);
148 }
149 if (type==1) {
150 graph->GetYaxis()->SetTitle("Median");
151 graph->SetMarkerStyle(22);
152 }
153 if (type==2) {
154 graph->GetYaxis()->SetTitle(Form("Mean%f",ratio));
155 graph->SetMarkerStyle(24);
156 }
157
158 return graph;
159}
200be8a6 160
161TH2F *AliTPCCalPad::MakeHisto2D(Int_t side){
162 //
163 // Make 2D graph
164 // side - specify the side A = 0 C = 1
165 // type - used types of determination of boundaries in z
166 Float_t kEpsilon = 0.000000000001;
167 TH2F * his = new TH2F(GetName(), GetName(), 250,-250,250,250,-250,250);
168 AliTPCROC * roc = AliTPCROC::Instance();
169 for (Int_t isec=0; isec<72; isec++){
170 if (side==0 && isec%36>=18) continue;
171 if (side>0 && isec%36<18) continue;
172 if (fROC[isec]){
173 AliTPCCalROC * calRoc = fROC[isec];
174 for (UInt_t irow=0; irow<calRoc->GetNrows(); irow++)
175 for (UInt_t ipad=0; ipad<calRoc->GetNPads(irow); ipad++)
176 if (TMath::Abs(calRoc->GetValue(irow,ipad))>kEpsilon){
177 Float_t xyz[3];
178 roc->GetPositionGlobal(isec,irow,ipad,xyz);
179 Int_t binx = 1+TMath::Nint((xyz[0]+250.)*0.5);
180 Int_t biny = 1+TMath::Nint((xyz[1]+250.)*0.5);
181 Float_t value = calRoc->GetValue(irow,ipad);
182 his->SetBinContent(binx,biny,value);
183 }
184 }
185 }
186 his->SetXTitle("x (cm)");
187 his->SetYTitle("y (cm)");
188 return his;
189}
190
191
192