]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalPad.cxx
Adding statistical function (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCCalPad.cxx
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"
26 #include <TObjArray.h>
27 #include <TAxis.h>
28 #include <TGraph.h>
29 ClassImp(AliTPCCalPad)
30
31 //_____________________________________________________________________________
32 AliTPCCalPad::AliTPCCalPad():TNamed()
33 {
34   //
35   // AliTPCCalPad default constructor
36   //
37
38   for (Int_t isec = 0; isec < kNsec; isec++) {
39     fROC[isec] = 0;
40   }
41
42 }
43
44 //_____________________________________________________________________________
45 AliTPCCalPad::AliTPCCalPad(const Text_t *name, const Text_t *title)
46                 :TNamed(name,title)
47 {
48   //
49   // AliTPCCalPad constructor
50   //
51   for (Int_t isec = 0; isec < kNsec; isec++) {
52     fROC[isec] = new AliTPCCalROC(isec);
53   }
54 }
55
56
57 //_____________________________________________________________________________
58 AliTPCCalPad::AliTPCCalPad(const AliTPCCalPad &c):TNamed(c)
59 {
60   //
61   // AliTPCCalPad copy constructor
62   //
63
64   ((AliTPCCalPad &) c).Copy(*this);
65
66 }
67
68 //_____________________________________________________________________________
69 AliTPCCalPad::AliTPCCalPad(TObjArray * array):TNamed()
70 {
71   //
72   // AliTPCCalPad default constructor
73   //
74
75   for (Int_t isec = 0; isec < kNsec; isec++) {
76     fROC[isec] = (AliTPCCalROC *)array->At(isec);
77   }
78
79 }
80
81
82 ///_____________________________________________________________________________
83 AliTPCCalPad::~AliTPCCalPad()
84 {
85   //
86   // AliTPCCalPad destructor
87   //
88
89   for (Int_t isec = 0; isec < kNsec; isec++) {
90     if (fROC[isec]) {
91       delete fROC[isec];
92       fROC[isec] = 0;
93     }
94   }
95
96 }
97
98 //_____________________________________________________________________________
99 AliTPCCalPad &AliTPCCalPad::operator=(const AliTPCCalPad &c)
100 {
101   //
102   // Assignment operator
103   //
104
105   if (this != &c) ((AliTPCCalPad &) c).Copy(*this);
106   return *this;
107
108 }
109
110 //_____________________________________________________________________________
111 void AliTPCCalPad::Copy(TObject &c) const
112 {
113   //
114   // Copy function
115   //
116
117   for (Int_t isec = 0; isec < kNsec; isec++) {
118     if (fROC[isec]) {
119       fROC[isec]->Copy(*((AliTPCCalPad &) c).fROC[isec]);
120     }
121   }
122   TObject::Copy(c);
123 }
124
125 TGraph  *  AliTPCCalPad::MakeGraph(Int_t type, Float_t ratio){
126   //
127   //   type=1 - mean
128   //        2 - median
129   //        3 - LTM
130   Int_t npoints = 0;
131   for (Int_t i=0;i<72;i++) if (fROC[i]) npoints++;
132   TGraph * graph = new TGraph(npoints);
133   npoints=0;   
134   for (Int_t isec=0;isec<72;isec++){
135     if (!fROC[isec]) continue;
136     if (type==0)  graph->SetPoint(npoints,isec,fROC[isec]->GetMean());      
137     if (type==1)  graph->SetPoint(npoints,isec,fROC[isec]->GetMedian());
138     if (type==2)  graph->SetPoint(npoints,isec,fROC[isec]->GetLTM(0,ratio));    
139     npoints++;
140   }
141
142   graph->GetXaxis()->SetTitle("Sector"); 
143   if (type==0) {
144     graph->GetYaxis()->SetTitle("Mean");   
145     graph->SetMarkerStyle(22);    
146   }
147   if (type==1) {
148     graph->GetYaxis()->SetTitle("Median");   
149     graph->SetMarkerStyle(22);    
150   }
151   if (type==2) {
152       graph->GetYaxis()->SetTitle(Form("Mean%f",ratio));      
153       graph->SetMarkerStyle(24);
154   }
155
156   return graph;
157 }