Removed generated files@
[u/mrichter/AliRoot.git] / FMD / AliFMDAnaRing.cxx
CommitLineData
9b98d361 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// Utility class for analysing ESD data.
18// This class does sharing and background correction
6ce810fc 19// It can form a base class for other things too.
20// This line is here to make the silly code checker happy!
21// This line is here to make the silly code checker happy!
9b98d361 22//
23#include "AliFMDAnaRing.h"
24#include <TH2.h>
25#include <TMath.h>
26#include <TBrowser.h>
27// #include <AliLog.h>
6ce810fc 28#define ne 80
29#define emin -3.7
30#define emax 5.3
31#define nm 100
32#define mmin -.5
33#define mmax 9.5
34// namespace {
35// Int_t ne = 80;
36// Float_t emin = -3.7;
37// Float_t emax = 5.3;
38// Int_t nm = 100;
39// Int_t mmin = -.5;
40// Int_t mmax = 9.5;
41// }
9b98d361 42
43//____________________________________________________________________
44AliFMDAnaRing::AliFMDAnaRing()
45 : fDet(0),
46 fRing('\0'),
47 fBg(0),
48 fCut0(0),
49 fCut1(0),
50 fUseBgCor(kFALSE),
6ce810fc 51 fNSeq(0),
52 fBareMult(),
53 fMergedMult(),
54 fRemovedMult(),
55 fMult(),
56 fStep1(),
57 fStep2(),
58 fStep3(),
59 fNEvents(0)
9b98d361 60{
61 // Default constructor.
62 // Do not use.
63 // Used by ROOT I/O
133f1578 64 for (int i = 0; i < 6; i++) fName[i] = '\0';
9b98d361 65}
66
67//____________________________________________________________________
68AliFMDAnaRing::AliFMDAnaRing(UShort_t det, Char_t ring,
69 TH2* bg, Float_t c0, Float_t c1)
70 : fDet(det),
71 fRing(ring),
72 fBg(bg),
73 fCut0(c0),
74 fCut1(c1),
75 fUseBgCor(bg ? kTRUE : kFALSE),
76 fNSeq(ring == 'I' || ring == 'i' ? 20 : 40),
77 fBareMult(Form("bareMult%d%c", fDet, fRing), "Bare multiplicity",
78 ne, emin, emax, fNSeq, 0, 2*TMath::Pi()),
79 fMergedMult(Form("mergedMult%d%c", fDet, fRing), "Merged multiplicity",
80 ne, emin, emax, fNSeq, 0, 2*TMath::Pi()),
81 fRemovedMult(Form("removedMult%d%c", fDet, fRing), "Removed multiplicity",
82 ne, emin, emax, fNSeq, 0, 2*TMath::Pi()),
83 fMult(Form("mult%d%c", fDet, fRing), "Multiplicity",
84 ne, emin, emax, fNSeq, 0, 2*TMath::Pi()),
85 fStep1(Form("step1_%d%c",fDet,fRing), "Step 1", nm,mmin,mmax,nm,mmin,mmax),
86 fStep2(Form("step2_%d%c",fDet,fRing), "Step 2", nm,mmin,mmax,nm,mmin,mmax),
6ce810fc 87 fStep3(Form("step3_%d%c",fDet,fRing), "Step 3", nm,mmin,mmax,nm,mmin,mmax),
88 fNEvents(0)
9b98d361 89{
90 // Constructor
6ce810fc 91 //
9b98d361 92 // Parameters
93 // det Detector
94 // ring Ring
95 // bg Background
96 // c0 Lower cut
97 // c1 higher cut */
98 fName[0] = 'F'; fName[1] = 'M'; fName[2] = 'D';
99 fName[3] = Char_t(det+48); fName[4] = ring;
100 fName[5] = '\0';
101 fBareMult.SetDirectory(0);
102 fBareMult.SetXTitle("#eta");
103 fBareMult.SetYTitle("#varphi");
104 fBareMult.SetZTitle("d^2M_{ch}'/d#etad#varphi");
105 fMergedMult.SetDirectory(0);
106 fMergedMult.SetXTitle("#eta");
107 fMergedMult.SetYTitle("#varphi");
108 fMergedMult.SetZTitle("d^2M_{ch}''/d#etad#varphi");
109 fRemovedMult.SetDirectory(0);
110 fRemovedMult.SetXTitle("#eta");
111 fRemovedMult.SetYTitle("#varphi");
112 fRemovedMult.SetZTitle("d^2M_{ch}'''/d#etad#varphi");
113 fMult.SetDirectory(0);
114 fMult.SetXTitle("#eta");
115 fMult.SetYTitle("#varphi");
116 fMult.SetZTitle("d^2M_{ch}/d#etad#varphi");
117 fStep1.SetDirectory(0);
118 fStep1.SetXTitle("Bare multiplicity");
119 fStep1.SetYTitle("Merged multiplicity");
120 fStep2.SetDirectory(0);
121 fStep2.SetXTitle("Merged multiplicity");
122 fStep2.SetYTitle("Cut multiplicity");
123 fStep3.SetDirectory(0);
124 fStep3.SetXTitle("Cut multiplicity");
125 fStep3.SetYTitle("Multiplicity");
126}
127
128//____________________________________________________________________
129AliFMDAnaRing::AliFMDAnaRing(const AliFMDAnaRing& o)
6ce810fc 130 : TObject(o),
131 fDet(o.fDet),
9b98d361 132 fRing(o.fRing),
133 fBg(o.fBg),
134 fCut0(o.fCut0),
135 fCut1(o.fCut1),
136 fUseBgCor(o.fUseBgCor),
137 fNSeq(o.fNSeq),
138 fBareMult(o.fBareMult),
139 fMergedMult(o.fMergedMult),
140 fRemovedMult(o.fRemovedMult),
6ce810fc 141 fMult(o.fMult),
142 fStep1(o.fStep1),
143 fStep2(o.fStep2),
144 fStep3(o.fStep3),
145 fNEvents(o.fNEvents)
9b98d361 146{
147 // Copy constructor.
148 // Do not use.
149 // Used by ROOT I/O
150 fBareMult.SetDirectory(0);
151 fBareMult.SetXTitle("#eta");
152 fBareMult.SetYTitle("#varphi");
153 fBareMult.SetZTitle("dM_{ch}'/d#eta");
154 fMergedMult.SetDirectory(0);
155 fMergedMult.SetXTitle("#eta");
156 fMergedMult.SetYTitle("#varphi");
157 fMergedMult.SetZTitle("dM_{ch}''/d#eta");
158 fRemovedMult.SetDirectory(0);
159 fRemovedMult.SetXTitle("#eta");
160 fRemovedMult.SetYTitle("#varphi");
161 fRemovedMult.SetZTitle("dM_{ch}'''/d#eta");
162 fMult.SetDirectory(0);
163 fMult.SetXTitle("#eta");
164 fMult.SetYTitle("#varphi");
165 fMult.SetZTitle("dM_{ch}/d#eta");
133f1578 166 for (int i = 0; i < 6; i++) fName[i] = o.fName[i];
9b98d361 167}
168
169//____________________________________________________________________
170AliFMDAnaRing&
171AliFMDAnaRing::operator=(const AliFMDAnaRing& o)
172{
173 // Assignment operator
6ce810fc 174 //
175 // Parameters:
176 // o Object to assign from
177 // Returns:
178 // Reference to this object.
9b98d361 179 this->fDet = o.fDet;
180 this->fRing = o.fRing;
181 this->fBg = o.fBg;
182 this->fCut0 = o.fCut0;
183 this->fCut1 = o.fCut1;
184 this->fUseBgCor = o.fUseBgCor;
185 this->fNSeq = o.fNSeq;
186 fBareMult.Reset(); fBareMult.Add(&o.fBareMult);
187 fMergedMult.Reset(); fMergedMult.Add(&o.fMergedMult);
188 fRemovedMult.Reset(); fRemovedMult.Add(&o.fRemovedMult);
189 fMult.Reset(); fMult.Add(&o.fMult);
190 return *this;
191}
192
193
194//____________________________________________________________________
195Bool_t
196AliFMDAnaRing::ProcessESD(Float_t phi, Float_t eta, Float_t& m1, Float_t m2)
197{
198 // Process ESD
199 // Parameters
200 // phi Azimuthal angle @f$ \varphi @f$ of the hit
201 // eta Psuedo-rapidity @f$ \eta@f$ of hit
202 // m1 Multiplicity of this strip. C ontains the corrected
203 // value on return
204 // m2 Multiplicity of neighbor strip
205 // Return
206 // true if hits are merged */
207
208 // Merge shared hits
209 Bool_t merged = false;
210 Float_t sig = m1;
211 fBareMult.Fill(eta, phi, m1);
212 if ((m1 < fCut0 || m2 < fCut0) && m2 > 0.001) {
213 sig = m1 + m2;
214 merged = true;
215 fRemovedMult.Fill(eta, phi, TMath::Min(m1,m2));
216 }
217 fMergedMult.Fill(eta, phi, sig);
218 fStep1.Fill(m1, sig);
219
220 // Real multiplicity
221 Double_t cmult = 1;
222 if (sig < fCut0 / 2) cmult = 0; // return merged; // cmult = 0;
223 if (sig > fCut1) cmult = 2;
224 fStep2.Fill(sig, cmult);
225
226 // Background correction
227 Float_t bmult = cmult;
228 if (fUseBgCor && fBg) {
229 // Float_t bgPhi = phi + (phi > TMath::Pi() ? -2*TMath::Pi() : 0);
230 Float_t bgPhi = phi - TMath::Pi();
231 Int_t bgBin = fBg->FindBin(eta, bgPhi);
232 Float_t bgCor = (bgBin > 0 ? fBg->GetBinContent(bgBin) : 0);
233 bmult = (bgCor < 0.01 ? 0 : cmult / bgCor);
234 }
235 fStep3.Fill(cmult, bmult);
236 fMult.Fill(eta, phi, bmult);
237
238 // Call user code
239 Fill(phi, eta, bmult);
240 m1 = bmult;
241
242 return merged;
243}
244//____________________________________________________________________
245void
246AliFMDAnaRing::Finish()
247{
6ce810fc 248 // Finish this task
249 //
250 // Parameters:
251 // none
252 // Returns:
253 // nothing
9b98d361 254 Double_t de = (fMult.GetXaxis()->GetXmax() -
255 fMult.GetXaxis()->GetXmin())/fMult.GetNbinsX();
256 Double_t dp = 2*TMath::Pi() / fNSeq;
257 Double_t scale = ((fNEvents == 0 ? 1. : 1. / fNEvents) * 1 / de * 1 / dp);
258 fBareMult.Scale(scale);
259 fMergedMult.Scale(scale);
260 fRemovedMult.Scale(scale);
261 fMult.Scale(scale);
262}
263//____________________________________________________________________
264Int_t
265AliFMDAnaRing::Color() const
266{
267 // Get the ring specific color
6ce810fc 268 //
269 // Returns:
270 // The color of the current ring
9b98d361 271 switch (fDet) {
272 case 1: return kGreen + 2;
273 case 2: return kRed + (fRing == 'I' || fRing == 'i' ? 2 : -7);
274 case 3: return kBlue + (fRing == 'I' || fRing == 'i' ? 2 : -7);
275 }
276 return 0;
277}
278//____________________________________________________________________
279void
280AliFMDAnaRing::Browse(TBrowser* b)
281{
6ce810fc 282 // Browse this object
283 //
284 // Parameters:
285 // b Browser to use
286 // Returns:
287 // nothing
9b98d361 288 b->Add(&fBareMult);
289 b->Add(&fMergedMult);
290 b->Add(&fRemovedMult);
291 b->Add(&fMult);
292 b->Add(&fStep1);
293 b->Add(&fStep2);
294 b->Add(&fStep3);
295 if (fBg) b->Add(fBg);
296}
297
298//____________________________________________________________________
299//
300// EOF
301//
302