]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis/AliFMDAnaCalibBackgroundCorrection.cxx
Adding correction for FMD dead channels
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis / AliFMDAnaCalibBackgroundCorrection.cxx
1
2 #include "AliFMDAnaCalibBackgroundCorrection.h"
3 #include <TH2F.h>
4 #include <TH1F.h>
5 #include <TBrowser.h>
6
7 ClassImp(AliFMDAnaCalibBackgroundCorrection)
8 #if 0
9 ; // For Emacs
10 #endif 
11
12 //____________________________________________________________________
13 AliFMDAnaCalibBackgroundCorrection::AliFMDAnaCalibBackgroundCorrection() : TObject(),
14                                                                            fArray(),
15                                                                            fAxis(),
16                                                                            fIsInit(kFALSE),
17                                                                            fListOfDoubleHitCorrection(),
18                                                                            fListOfNSDBgMaps()
19 {
20   
21   
22   
23 }
24
25
26 //____________________________________________________________________
27 AliFMDAnaCalibBackgroundCorrection::AliFMDAnaCalibBackgroundCorrection(const AliFMDAnaCalibBackgroundCorrection& o)
28   : TObject(o), fArray(o.fArray), fAxis(o.fAxis), fIsInit(o.fIsInit), fListOfDoubleHitCorrection(), fListOfNSDBgMaps()
29 {
30   // Copy ctor 
31 }
32 //____________________________________________________________________
33 AliFMDAnaCalibBackgroundCorrection&
34 AliFMDAnaCalibBackgroundCorrection::operator=(const AliFMDAnaCalibBackgroundCorrection& o) 
35 {
36   // Assignment operator 
37   
38   fArray     = o.fArray;
39   
40   return (*this);
41 }
42
43 //____________________________________________________________________
44 TH2F* AliFMDAnaCalibBackgroundCorrection::GetBgCorrection(Int_t det, 
45                                                           Char_t ring, 
46                                                           Int_t vtxbin) {
47   TObjArray* ringArray = GetRingArray(det,ring);
48   TH2F* hCorrection    = (TH2F*)ringArray->At(vtxbin);
49   return hCorrection;
50 }
51 //____________________________________________________________________
52 void AliFMDAnaCalibBackgroundCorrection::SetNSDBgCorrection(Int_t det, 
53                                                             Char_t ring, 
54                                                             Int_t vtxbin, 
55                                                             TH2F* hCorrection) {
56   if(!fIsInit)
57     Init();
58   hCorrection->SetName(Form("FMDNSD%d%c_vtxbin_%d_correction",det,ring,vtxbin));
59   fListOfNSDBgMaps.Add(hCorrection);
60     
61 }
62 //____________________________________________________________________
63 TH2F* AliFMDAnaCalibBackgroundCorrection::GetNSDBgCorrection(Int_t det, 
64                                                              Char_t ring, 
65                                                              Int_t vtxbin) {
66   TH2F* hCorrection    = (TH2F*)fListOfNSDBgMaps.FindObject(Form("FMDNSD%d%c_vtxbin_%d_correction",det,ring,vtxbin));
67   return hCorrection;
68 }
69 //____________________________________________________________________
70 void AliFMDAnaCalibBackgroundCorrection::SetBgCorrection(Int_t det, 
71                                                          Char_t ring, 
72                                                          Int_t vtxbin, 
73                                                          TH2F* hCorrection) {
74   if(!fIsInit)
75     Init();
76   
77   TObjArray* ringArray = GetRingArray(det,ring);
78   ringArray->AddAtAndExpand(hCorrection,vtxbin);
79   
80 }
81 //____________________________________________________________________
82 TH1F* AliFMDAnaCalibBackgroundCorrection::GetDoubleHitCorrection(Int_t  det, 
83                                                                  Char_t ring) {
84   
85   
86   TH1F* hCorrection    = (TH1F*)fListOfDoubleHitCorrection.FindObject(Form("hDoubleHitCorrection_FMD%d%c",det,ring));
87   return hCorrection;
88 }
89
90 //____________________________________________________________________
91 void AliFMDAnaCalibBackgroundCorrection::SetDoubleHitCorrection(Int_t det, 
92                                                                 Char_t ring, 
93                                                                 TH1F* hCorrection) {
94   hCorrection->SetName(Form("hDoubleHitCorrection_FMD%d%c",det,ring));
95   fListOfDoubleHitCorrection.Add(hCorrection);    
96 }
97 //____________________________________________________________________
98 TH1F* AliFMDAnaCalibBackgroundCorrection::GetSPDDeadCorrection(Int_t  vtxbin) {
99   
100   TH1F* hCorrection    = (TH1F*)fListOfDoubleHitCorrection.FindObject(Form("hSPDDeadCorrection_vtx%d",vtxbin));
101   return hCorrection;
102 }
103
104 //____________________________________________________________________
105 void AliFMDAnaCalibBackgroundCorrection::SetSPDDeadCorrection(Int_t vtxbin, 
106                                                               TH1F* hCorrection) {
107   hCorrection->SetName(Form("hSPDDeadCorrection_vtx%d",vtxbin));
108   fListOfDoubleHitCorrection.Add(hCorrection);    
109 }
110
111 //____________________________________________________________________
112 TH1F* AliFMDAnaCalibBackgroundCorrection::GetFMDDeadCorrection(Int_t  vtxbin) {
113   
114   TH1F* hCorrection    = (TH1F*)fListOfDoubleHitCorrection.FindObject(Form("hFMDDeadCorrection_vtx%d",vtxbin));
115   return hCorrection;
116 }
117
118 //____________________________________________________________________
119 void AliFMDAnaCalibBackgroundCorrection::SetFMDDeadCorrection(Int_t vtxbin, 
120                                                               TH1F* hCorrection) {
121   hCorrection->SetName(Form("hFMDDeadCorrection_vtx%d",vtxbin));
122   fListOfDoubleHitCorrection.Add(hCorrection);    
123 }
124
125 //____________________________________________________________________
126 void AliFMDAnaCalibBackgroundCorrection::SetRefAxis(TAxis* axis) {
127   
128  
129   fAxis.Set(axis->GetNbins(),axis->GetXmin(),axis->GetXmax());
130     
131 }
132 //____________________________________________________________________
133 void AliFMDAnaCalibBackgroundCorrection::Init() {
134   
135   fArray.SetOwner();
136   
137   TObjArray* spdArray = new TObjArray();
138   spdArray->SetOwner();
139   fArray.AddAtAndExpand(spdArray,0);
140   
141   for(Int_t det = 1; det<=3;det++) {
142     TObjArray* detArray = new TObjArray();
143     detArray->SetOwner();
144     fArray.AddAtAndExpand(detArray,det);
145     Int_t nRings = (det == 1 ? 1 : 2);
146     for(Int_t ring = 0;ring<nRings;ring++) {
147       TObjArray* ringArray = new TObjArray();
148       ringArray->SetOwner();
149       detArray->AddAtAndExpand(ringArray,ring);
150       
151     }
152   }
153   fIsInit = kTRUE;
154   
155 }
156 //____________________________________________________________________
157 TObjArray* AliFMDAnaCalibBackgroundCorrection::GetRingArray(Int_t det, 
158                                                             Char_t ring) {
159   
160   if(det==0 || det == 4) {
161     TObjArray* spdArray  = (TObjArray*)fArray.At(det);
162     return spdArray;
163   }
164   Int_t ringNumber      = (ring == 'I' ? 0 : 1);
165   TObjArray* detArray  = (TObjArray*)fArray.At(det);
166   TObjArray* ringArray = (TObjArray*)detArray->At(ringNumber);
167   
168   return ringArray;
169 }
170 //____________________________________________________________________
171 Int_t AliFMDAnaCalibBackgroundCorrection::GetNvtxBins() {
172   
173   return fAxis.GetNbins();
174   
175 }
176 //____________________________________________________________________
177 Float_t AliFMDAnaCalibBackgroundCorrection::GetVtxCutZ() {
178   
179   return fAxis.GetXmax();
180   
181 }
182
183 //____________________________________________________________________
184 void
185 AliFMDAnaCalibBackgroundCorrection::Browse(TBrowser* b)
186 {
187   b->Add(&fAxis, "Vertex bins");
188   b->Add(&fArray, "Array of histograms w/BG corrections");
189 }
190
191 //____________________________________________________________________
192 //
193 // EOF
194 //