]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.cxx
when checking the pass, if non standard production like muoncalo or highlumi, set...
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / charmFlow / AliEventPlaneResolutionHandler.cxx
CommitLineData
f5e6ce8f 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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#include <TMath.h>
17#include <TH1F.h>
18#include <TFile.h>
19#include "AliVertexingHFUtils.h"
20#include "AliEventPlaneResolutionHandler.h"
21#include "AliLog.h"
22
23/* $Id$ */
24
25///////////////////////////////////////////////////////////////////
26// //
27// Class with functions useful for different D2H analyses //
28// - event plane resolution //
29// - <pt> calculation with side band subtraction //
30// - tracklet multiplicity calculation //
31// Origin: F.Prino, Torino, prino@to.infn.it //
32// //
33///////////////////////////////////////////////////////////////////
34
35ClassImp(AliEventPlaneResolutionHandler)
36
37//______________________________________________________________________
38AliEventPlaneResolutionHandler::AliEventPlaneResolutionHandler():TObject(),
39 fEventPlane(kTPCPosEta),
40 fResolOption(kTwoEtaSub),
41 fMinCent(30.),
42 fMaxCent(50.),
43 fCorrHistoName1(""),
44 fCorrHistoName2(""),
45 fCorrHistoName3(""),
46 fNsubevents(2),
47 fExtrapToFull(kFALSE),
c60a4ab5 48 fWeight(0),
f5e6ce8f 49 fRootFileName("$ALICE_ROOT/PWGHF/vertexingHF/charmFlow/EventPlaneResolutionHistos.root")
50{
51 // Default contructor
c60a4ab5 52 InitializeWeights();
f5e6ce8f 53}
54//______________________________________________________________________
55AliEventPlaneResolutionHandler::AliEventPlaneResolutionHandler(TString filename):TObject(),
56 fEventPlane(kTPCPosEta),
57 fResolOption(kTwoEtaSub),
58 fMinCent(30.),
59 fMaxCent(50.),
60 fCorrHistoName1(""),
61 fCorrHistoName2(""),
62 fCorrHistoName3(""),
63 fNsubevents(2),
64 fExtrapToFull(kFALSE),
c60a4ab5 65 fWeight(0),
f5e6ce8f 66 fRootFileName(filename.Data())
67{
68 // Standard contructor
c60a4ab5 69 InitializeWeights();
f5e6ce8f 70}
71//______________________________________________________________________
72Double_t AliEventPlaneResolutionHandler::GetEventPlaneResolution(Double_t minCent, Double_t maxCent){
73 // method to compute the event plane resolution starting from correlations
74
75 TFile* inputFile=new TFile(fRootFileName.Data());
76 if(!inputFile || (inputFile && !inputFile->IsOpen())){
77 printf("Root file not opened --- Return dummy resolution value\n");
78 return -1.;
79 }
80 Bool_t isOk=SetHistoNames();
81 if(!isOk){
82 printf("Return dummy resolution value\n");
83 return -1.;
84 }
85
86 Int_t minCentrTimesTen=(Int_t)(minCent*10);
87 Int_t maxCentrTimesTen=(Int_t)(maxCent*10);
88 Int_t ncBin=minCentrTimesTen/25;
c60a4ab5 89 Int_t whichWei=fWeight;
90 if(minCent>50.5 || maxCent>50.5) fWeight=0;
91 Double_t weight=-1.;
92 if(fWeight==1) weight=fNcoll[ncBin];
f6d53534 93 // protection: weights from yield computed for 30-50, 10-30 and 0-10 centralities
94 // cannot be used on wider ranges
95 else if(fWeight==2 && minCent>29.5 && maxCent<50.5) weight=fYield24[ncBin];
c60a4ab5 96 else if(fWeight==3 && minCent>29.5 && maxCent<50.5) weight=fYield46[ncBin];
97 else if(fWeight==4 && minCent>29.5 && maxCent<50.5) weight=fYield612[ncBin];
f6d53534 98 else if(fWeight==2 && minCent>9.5 && maxCent<30.5) weight=fYield24[ncBin];
99 else if(fWeight==3 && minCent>9.5 && maxCent<30.5) weight=fYield46[ncBin];
100 else if(fWeight==4 && minCent>9.5 && maxCent<30.5) weight=fYield612[ncBin];
101 else if(fWeight==2 && maxCent<10.5) weight=fYield24[ncBin];
102 else if(fWeight==3 && maxCent<10.5) weight=fYield46[ncBin];
103 else if(fWeight==4 && maxCent<10.5) weight=fYield612[ncBin];
f5e6ce8f 104 TH1F* hevpls2=0x0;
105 TH1F* hevpls3=0x0;
106 TH1F* hevpls1=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName1.Data(),minCentrTimesTen,minCentrTimesTen+25));
107 hevpls1->SetName(Form("%sCentr%d_%d",fCorrHistoName1.Data(),minCentrTimesTen,maxCentrTimesTen));
c60a4ab5 108 if(weight>0.) hevpls1->Scale(weight);
f5e6ce8f 109 if(fNsubevents==3){
110 hevpls2=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName2.Data(),minCentrTimesTen,minCentrTimesTen+25));
111 hevpls2->SetName(Form("%sCentr%d_%d",fCorrHistoName2.Data(),minCentrTimesTen,maxCentrTimesTen));
112 hevpls3=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName3.Data(),minCentrTimesTen,minCentrTimesTen+25));
113 hevpls3->SetName(Form("%sCentr%d_%d",fCorrHistoName2.Data(),minCentrTimesTen,maxCentrTimesTen));
c60a4ab5 114 if(weight>0.){
115 hevpls2->Scale(weight);
116 hevpls3->Scale(weight);
f5e6ce8f 117 }
118 }
119 for(Int_t iCentr=minCentrTimesTen+25; iCentr<maxCentrTimesTen; iCentr+=25){
120 ncBin=iCentr/25;
c60a4ab5 121 weight=-1.;
122 if(fWeight==1) weight=fNcoll[ncBin];
123 else if(fWeight==2 && minCent>29.5 && maxCent<50.5) weight=fYield24[ncBin];
124 else if(fWeight==3 && minCent>29.5 && maxCent<50.5) weight=fYield46[ncBin];
125 else if(fWeight==4 && minCent>29.5 && maxCent<50.5) weight=fYield612[ncBin];
f6d53534 126 else if(fWeight==2 && minCent>9.5 && maxCent<30.5) weight=fYield24[ncBin];
127 else if(fWeight==3 && minCent>9.5 && maxCent<30.5) weight=fYield46[ncBin];
128 else if(fWeight==4 && minCent>9.5 && maxCent<30.5) weight=fYield612[ncBin];
129 else if(fWeight==2 && maxCent<10.5) weight=fYield24[ncBin];
130 else if(fWeight==3 && maxCent<10.5) weight=fYield46[ncBin];
131 else if(fWeight==4 && maxCent<10.5) weight=fYield612[ncBin];
f5e6ce8f 132 TH1F* htmp1=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName1.Data(),iCentr,iCentr+25));
c60a4ab5 133 if(weight>0.) htmp1->Scale(weight);
f5e6ce8f 134 hevpls1->Add(htmp1);
135 if(fNsubevents==3){
136 TH1F* htmp2=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName2.Data(),iCentr,iCentr+25));
137 TH1F* htmp3=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName3.Data(),iCentr,iCentr+25));
c60a4ab5 138 if(weight>0.){
139 htmp2->Scale(weight);
140 htmp3->Scale(weight);
f5e6ce8f 141 }
142 hevpls2->Add(htmp2);
143 hevpls3->Add(htmp3);
144 }
145 }
c60a4ab5 146 fWeight=whichWei;
f5e6ce8f 147 Double_t resol=1.;
148 if(fNsubevents==2){
149 if(fExtrapToFull) resol=AliVertexingHFUtils::GetFullEvResol(hevpls1);
150 else resol=AliVertexingHFUtils::GetSubEvResol(hevpls1);
151 }else if(fNsubevents==3){
152 Double_t correl1=hevpls1->GetMean();
153 Double_t correl2=hevpls2->GetMean();
154 Double_t correl3=hevpls3->GetMean();
155 resol=TMath::Sqrt(correl1*correl2/correl3);
156 }
157 inputFile->Close();
158 return resol;
159}
160//______________________________________________________________________
161Bool_t AliEventPlaneResolutionHandler::SetHistoNames(){
162 // set names for histograms to be read
163 if(fEventPlane==kTPCPosEta && fResolOption==kTwoRandSub){
164 fCorrHistoName1="hCorrelRandSubTPCPosEta";
165 fNsubevents=2;
166 fExtrapToFull=kTRUE;
167 }else if(fEventPlane==kTPCPosEta && fResolOption==kTwoChargeSub){
168 fCorrHistoName1="hCorrelChargeSubTPCPosEta";
169 fNsubevents=2;
170 fExtrapToFull=kTRUE;
171 }else if(fEventPlane==kTPCPosEta && fResolOption==kTwoEtaSub){
172 fCorrHistoName1="hCorrelTPCEtaPosTPCEtaNeg";
173 fNsubevents=2;
174 fExtrapToFull=kFALSE;
175 }else if(fEventPlane==kTPCPosEta && fResolOption==kThreeSub){
176 fCorrHistoName1="hCorrelTPCPosEtaV0A";
177 fCorrHistoName2="hCorrelTPCPosEtaV0C";
178 fCorrHistoName3="hCorrelV0AV0C";
179 fNsubevents=3;
180 fExtrapToFull=kFALSE;
181 }else if(fEventPlane==kTPCFullEta && fResolOption==kTwoRandSub){
182 fCorrHistoName1="hCorrelRandSubTPCFullEta";
183 fNsubevents=2;
184 fExtrapToFull=kTRUE;
185 }else if(fEventPlane==kTPCFullEta && fResolOption==kTwoEtaSub){
186 fCorrHistoName1="hCorrelTPCEtaPosTPCEtaNeg";
187 fNsubevents=2;
188 fExtrapToFull=kTRUE;
189 }else if(fEventPlane==kTPCFullEta && fResolOption==kThreeSub){
190 fCorrHistoName1="hCorrelTPCFullEtaV0A";
191 fCorrHistoName2="hCorrelTPCFullEtaV0C";
192 fCorrHistoName3="hCorrelV0AV0C";
193 fNsubevents=3;
194 fExtrapToFull=kFALSE;
195 }else if(fEventPlane==kVZERO && fResolOption==kThreeSub){
196 fCorrHistoName1="hCorrelTPCEtaPosV0";
197 fCorrHistoName2="hCorrelTPCEtaNegV0";
198 fCorrHistoName3="hCorrelTPCEtaPosTPCEtaNeg";
199 fNsubevents=3;
200 fExtrapToFull=kFALSE;
201 }else if(fEventPlane==kVZERO && fResolOption==kThreeSubTPCGap){
202 fCorrHistoName1="hCorrelTPCEtaGt02V0";
203 fCorrHistoName2="hCorrelTPCEtaLt02V0";
204 fCorrHistoName3="hCorrelTPCEtaGt02TPCEtaLt02";
205 fNsubevents=3;
206 fExtrapToFull=kFALSE;
207 }else if(fEventPlane==kVZEROA && fResolOption==kThreeSub){
208 fCorrHistoName1="hCorrelTPCFullEtaV0A";
209 fCorrHistoName2="hCorrelV0AV0C";
210 fCorrHistoName3="hCorrelTPCFullEtaV0C";
211 fNsubevents=3;
212 fExtrapToFull=kFALSE;
213 }else if(fEventPlane==kVZEROC && fResolOption==kThreeSub){
214 fCorrHistoName1="hCorrelTPCFullEtaV0C";
215 fCorrHistoName2="hCorrelV0AV0C";
216 fCorrHistoName3="hCorrelTPCFullEtaV0A";
217 fNsubevents=3;
218 fExtrapToFull=kFALSE;
219 }else{
220 printf("Not possible to compute the resolution with the required option\n");
221 return kFALSE;
222 }
223 return kTRUE;
224}
225//______________________________________________________________________
c60a4ab5 226void AliEventPlaneResolutionHandler::InitializeWeights(){
f5e6ce8f 227 // Ncoll values in 2.5% wide classes
228 Double_t ncoll[20]={1790.77,1578.44,1394.82,1236.17,1095.08,
229 969.86,859.571,759.959,669.648,589.588,
230 516.039,451.409,392.853,340.493,294.426,
231 252.385,215.484,183.284,155.101,130.963};
c60a4ab5 232
f6d53534 233 Double_t y24[20]={544.155,491.803,533.516,449.618,
234 213.097,179.483,194.977,156.73,118.84,152.306,92.7,122.538,
235 36.64,33.01,27.79,22.57,17.90,15.25,15.03,8.57};
236
237 Double_t y46[20]={158.386,129.294,135.683,112.203,
238 59.425,61.506,65.779,43.521,35.530,41.014,26.744,33.593,
239 12.24,12.32,10.44,8.55,7.20,5.85,5.80,4.37};
240
241 Double_t y612[20]={76.010,85.944,99.105,84.779,
242 45.404,25.059,36.734,31.177,31.587,46.088,19.367,39.945,
243 7.31,7.55,6.47,5.38,4.68,4.86,3.10,4.78};
244
c60a4ab5 245 for(Int_t i=0; i<20; i++){
246 fNcoll[i]=ncoll[i];
247 fYield24[i]=y24[i];
248 fYield46[i]=y46[i];
249 fYield612[i]=y612[i];
250 }
f5e6ce8f 251}