]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTasCorrFctn.cxx
Compilation warnings
[u/mrichter/AliRoot.git] / HBTAN / AliHBTasCorrFctn.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2002, 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 #include <TH1.h>
19 #include <TObjArray.h>
20 #include <Riostream.h>
21
22 #include "AliHBTasCorrFctn.h"
23
24 ///////////////////////////////////////////////////////
25 //                                                   //
26 // AliHBTasCorrFctn.h                             //
27 //                                                   //
28 // Class for calculating 3D as correlation        //
29 // functions                                         //
30 //                                                   //
31 ///////////////////////////////////////////////////////
32
33 ClassImp(AliHBTasCorrFctn)
34
35      AliHBTasCorrFctn::AliHBTasCorrFctn(const char* name, const char* title):
36  AliHBTOnePairFctn1D(name,title),
37
38      fNum(0x0),
39      fDen(0x0),
40      fRat(0x0)
41
42 {
43 //ctor
44 }
45      
46 /******************************************************************/
47 AliHBTasCorrFctn::AliHBTasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
48  AliHBTOnePairFctn1D(name,title,nbins,maxXval,minXval),
49
50
51      fNum(new TObjArray()),
52      fDen(new TObjArray()),
53      fRat(new TObjArray())
54 {
55      SetParams(nbins,maxXval, minXval);
56 }
57
58 /******************************************************************/
59 AliHBTasCorrFctn::AliHBTasCorrFctn(const AliHBTasCorrFctn& in):
60  AliHBTOnePairFctn1D(in),
61
62
63
64      fNum((in.fNum)?(TObjArray*)in.fNum->Clone():0x0),
65      fDen((in.fDen)?(TObjArray*)in.fDen->Clone():0x0),
66      fRat((in.fRat)?(TObjArray*)in.fRat->Clone():0x0)
67  {
68 //ctor
69 }
70
71 /******************************************************************/
72
73 AliHBTasCorrFctn::~AliHBTasCorrFctn()
74 {
75  //dtor
76
77      delete fNum;
78      delete fDen;
79      delete fRat;
80      
81 }
82
83 /******************************************************************/
84 Int_t AliHBTasCorrFctn::Write(const char*,Int_t, Int_t)
85 {
86 //out    
87      Int_t i;
88 //     Int_t n=GetNumberOfIntervals();
89      Double_t scale;
90
91      for(i=0;i<fNumberOfIntervals;i++){
92           TH1D *num = ((TH1D*)fNum->At(i));
93           TH1D *den = ((TH1D*)fDen->At(i));
94           TH1D &rat = *((TH1D*)fRat->At(i));
95           scale = Scale(num,den);
96           Info("Write():","Scale in interval %d = %lf",i,scale);
97           rat.Divide(num,den,scale);
98           
99           
100           num->Write();
101           den->Write();
102           rat.Write();
103      }
104      return 0;
105 }
106
107 //-------------------------------------
108 void AliHBTasCorrFctn::ProcessSameEventParticles(AliHBTPair* pair)
109 {
110     //Fills the numerator using pair from the same event
111     pair = CheckPair(pair);
112     if(pair == 0x0) return;
113   //   int n = GetNumberOfIntervals();
114      int n = fNumberOfIntervals;
115      Double_t rplane=0.;   //reaction plane angle - 2 B determined
116      Double_t phi=(pair->Particle1()->Phi()+pair->Particle2()->Phi())/2.-rplane; //deltaphi bo nie mam nic innego pod reka
117      phi=phi*360/(2*TMath::Pi());
118      Double_t q=GetValue(pair);
119      Int_t ntv;
120      ntv =  (int)(phi*n/(360.));
121      
122      TH1D *num = ((TH1D*)fNum->At(ntv));
123
124      num->Fill(q);
125   
126 }
127
128 /****************************************************************/
129 void AliHBTasCorrFctn::Init()
130 {
131      BuildHistos();
132 }
133 /****************************************************************/
134
135
136 void AliHBTasCorrFctn::ProcessDiffEventParticles(AliHBTPair* pair)
137 {
138 //fills denumerator with data from different events 
139      Double_t rplane=0.;   //reaction plane angle - 2 B determined
140      Double_t phi=(pair->Particle1()->Phi()+pair->Particle2()->Phi())/2.-rplane; //deltaphi bo nie mam nic innego pod reka
141      phi=phi*360/(2*TMath::Pi());
142      Double_t qout=GetValue(pair);
143
144 //     int n=GetNumberOfIntervals();   
145      int n = fNumberOfIntervals;
146      
147      Int_t ntv;
148      ntv =  (int)(phi*n/(360.));
149
150      TH1D &den = *((TH1D*)fDen->At(ntv));
151
152      
153      den.Fill(qout);
154 }
155
156
157 /******************************************************************/
158
159
160 void AliHBTasCorrFctn::SetParams(Int_t nbins, Float_t maxXval, Float_t minXval)
161 {
162 //sets parameters for histograms
163         fnbins=nbins;
164      fmaxXval= maxXval;
165      fminXval=minXval;
166 }
167 TH1* AliHBTasCorrFctn::GetResult()
168 {
169 //does nothing, it can as well have nothing inside, its just for class to work normally
170      TH1D *den = ((TH1D*)fDen->UncheckedAt(1));
171      return den;
172  }
173
174
175
176 ClassImp(AliHBTQOutasCorrFctn)
177      
178      AliHBTQOutasCorrFctn::AliHBTQOutasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
179 AliHBTasCorrFctn(name,title,nbins,maxXval,minXval)
180
181 {
182 //ct0r
183 }
184
185 void AliHBTQOutasCorrFctn::BuildHistos()
186 {
187 //builds histograms
188      Int_t i;
189      int n=GetNumberOfIntervals();
190
191      int nbins=Getnbins();
192
193      double max = GetmaxXval();
194      double min = GetminXval();
195      char buff[10];
196      
197
198      
199      TH1D *num;
200      TH1D *den;
201      TH1D *rat;
202      
203      TString nameNum = "NumOut";
204      TString nameDen = "DenOut";
205      TString nameRat = "RatOut";
206      
207      for(i=0;i<n;i++){
208           
209           sprintf(buff,"%d",i);
210
211           nameNum +=TString(buff);
212
213           nameDen +=TString(buff);
214           nameRat +=TString(buff);
215           
216           
217           num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max);
218           den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max);
219           rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max);
220           
221           num->Sumw2();
222           den->Sumw2();
223           rat->Sumw2();
224           
225           num->Reset();
226           den->Reset();
227           rat->Reset();
228           
229           fNum->Add(num);
230           fDen->Add(den);
231           fRat->Add(rat);
232           
233           nameNum = TString("NumOut");
234           nameDen = TString("DenOut");
235           nameRat = TString("RatOut");
236           
237      }
238
239      
240  }
241
242 ClassImp(AliHBTQSideasCorrFctn)
243      
244      AliHBTQSideasCorrFctn::AliHBTQSideasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
245 AliHBTasCorrFctn(name,title,nbins,maxXval,minXval)
246
247 {
248 //ct0r
249 }
250
251 void AliHBTQSideasCorrFctn::BuildHistos()
252 {
253 //builds histograms
254      Int_t i;
255      int n=GetNumberOfIntervals();
256      int nbins=Getnbins();
257
258      double max = GetmaxXval();
259      double min = GetminXval();
260      char buff[10];
261      
262
263      
264      TH1D *num;
265      TH1D *den;
266      TH1D *rat;
267      
268      TString nameNum = "NumSide";
269      TString nameDen = "DenSide";
270      TString nameRat = "RatSide";
271      
272      for(i=0;i<n;i++){
273           
274           sprintf(buff,"%d",i);
275
276           nameNum +=TString(buff);
277
278           nameDen +=TString(buff);
279           nameRat +=TString(buff);
280           
281           
282           num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max);
283           den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max);
284           rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max);
285           
286           num->Sumw2();
287           den->Sumw2();
288           rat->Sumw2();
289           
290           num->Reset();
291           den->Reset();
292           rat->Reset();
293           
294           fNum->Add(num);
295           fDen->Add(den);
296           fRat->Add(rat);
297           
298           nameNum = TString("NumSide");
299           nameDen = TString("DenSide");
300           nameRat = TString("RatSide");
301           
302      }
303
304      
305  }
306
307 ClassImp(AliHBTQLongasCorrFctn)
308      
309      AliHBTQLongasCorrFctn::AliHBTQLongasCorrFctn(const char* name, const char* title, Int_t nbins, Float_t maxXval, Float_t minXval):
310 AliHBTasCorrFctn(name,title,nbins,maxXval,minXval)
311
312 {
313 //ct0r
314 }
315
316 void AliHBTQLongasCorrFctn::BuildHistos()
317 {
318 //builds histograms
319      Int_t i;
320      int n=GetNumberOfIntervals();
321      int nbins=Getnbins();
322
323      double max = GetmaxXval();
324      double min = GetminXval();
325      char buff[10];
326      
327
328      
329      TH1D *num;
330      TH1D *den;
331      TH1D *rat;
332      
333      TString nameNum = "NumLong";
334      TString nameDen = "DenLong";
335      TString nameRat = "RatLong";
336      
337      for(i=0;i<n;i++){
338           
339           sprintf(buff,"%d",i);
340
341           nameNum +=TString(buff);
342
343           nameDen +=TString(buff);
344           nameRat +=TString(buff);
345           
346           
347           num = new TH1D(nameNum.Data(),nameNum.Data(),nbins,min,max);
348           den = new TH1D(nameDen.Data(),nameDen.Data(),nbins,min,max);
349           rat = new TH1D(nameRat.Data(),nameRat.Data(),nbins,min,max);
350           
351           num->Sumw2();
352           den->Sumw2();
353           rat->Sumw2();
354           
355           num->Reset();
356           den->Reset();
357           rat->Reset();
358           
359           fNum->Add(num);
360           fDen->Add(den);
361           fRat->Add(rat);
362           
363           nameNum = TString("NumLong");
364           nameDen = TString("DenLong");
365           nameRat = TString("RatLong");
366           
367      }
368
369      
370  }