]>
Commit | Line | Data |
---|---|---|
3bb122c7 | 1 | |
2 | #include <TROOT.h> | |
3 | #include <TSystem.h> | |
4 | #include <TInterpreter.h> | |
5 | #include <TChain.h> | |
6 | #include <TFile.h> | |
7 | #include <TList.h> | |
8 | #include <iostream> | |
9 | #include "TH2F.h" | |
10 | #include "AliFMDAnalysisTaskBackgroundCorrection.h" | |
11 | #include "AliAnalysisManager.h" | |
12 | #include "AliESDFMD.h" | |
13 | #include "AliESDEvent.h" | |
14 | #include "AliAODEvent.h" | |
15 | #include "AliAODHandler.h" | |
16 | #include "AliMCEventHandler.h" | |
17 | #include "AliStack.h" | |
7c3e5162 | 18 | #include "AliLog.h" |
3bb122c7 | 19 | #include "AliESDVertex.h" |
20 | #include "TMath.h" | |
21 | #include "AliFMDAnaParameters.h" | |
04f1ff3d | 22 | #include "AliESDInputHandler.h" |
23 | #include "AliMultiplicity.h" | |
ff293341 | 24 | #include "TProfile2D.h" |
78f6f750 | 25 | //#include "AliFMDGeometry.h" |
3bb122c7 | 26 | |
27 | ClassImp(AliFMDAnalysisTaskBackgroundCorrection) | |
28 | ||
29 | ||
30 | AliFMDAnalysisTaskBackgroundCorrection::AliFMDAnalysisTaskBackgroundCorrection() | |
31 | : fDebug(0), | |
3bb122c7 | 32 | fOutputList(0), |
7c3e5162 | 33 | fInputList(0), |
cc066cb9 | 34 | fHitList(0), |
c78bc12b | 35 | fVertexString(0x0), |
7c3e5162 | 36 | fNevents(), |
37 | fStandalone(kTRUE), | |
38 | fOutputVertexString(0) | |
3bb122c7 | 39 | { |
40 | // Default constructor | |
41 | DefineInput (0, TList::Class()); | |
8dc7c4c2 | 42 | DefineOutput(0, TList::Class()); |
9f55be54 | 43 | |
3bb122c7 | 44 | } |
8dc823cc | 45 | //_____________________________________________________________________ |
7c3e5162 | 46 | AliFMDAnalysisTaskBackgroundCorrection::AliFMDAnalysisTaskBackgroundCorrection(const char* name, Bool_t SE): |
3bb122c7 | 47 | AliAnalysisTask(name, "Density"), |
48 | fDebug(0), | |
7c3e5162 | 49 | fOutputList(0), |
50 | fInputList(0), | |
cc066cb9 | 51 | fHitList(0), |
c78bc12b | 52 | fVertexString(0x0), |
7c3e5162 | 53 | fNevents(), |
54 | fStandalone(kTRUE), | |
55 | fOutputVertexString(0) | |
3bb122c7 | 56 | { |
7c3e5162 | 57 | fStandalone = SE; |
58 | if(fStandalone) { | |
59 | DefineInput (0, TList::Class()); | |
60 | DefineOutput(0, TList::Class()); | |
7c3e5162 | 61 | } |
3bb122c7 | 62 | } |
8dc823cc | 63 | //_____________________________________________________________________ |
3bb122c7 | 64 | void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects() |
65 | { | |
66 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
3bb122c7 | 67 | |
7c3e5162 | 68 | if(!fOutputList) |
69 | fOutputList = new TList(); | |
70 | fOutputList->SetName("BackgroundCorrectedPerEvent"); | |
cc066cb9 | 71 | if(!fHitList) |
72 | fHitList = new TList(); | |
73 | fHitList->SetName("HitsList"); | |
7c3e5162 | 74 | |
9f55be54 | 75 | //if(fStandalone) { |
76 | fOutputVertexString = new TObjString(); | |
77 | // } | |
78 | fOutputList->Add(fOutputVertexString); | |
79 | ||
80 | ||
7c3e5162 | 81 | |
059c7c6b | 82 | TH2F* hMult = 0; |
83 | TH2F* hMultTrVtx = 0; | |
84 | TH2F* hMultNSD = 0; | |
85 | TH2F* hHits = 0; | |
86 | TH2F* hSPDMult = 0; | |
04f1ff3d | 87 | TH2F* hSPDMultTrVtx = 0; |
059c7c6b | 88 | TH2F* hSPDMultNSD = 0; |
ae26bdd7 | 89 | // TH2F* hHitsNoCuts = 0; |
3bb122c7 | 90 | Int_t nVtxbins = pars->GetNvtxBins(); |
04f1ff3d | 91 | for(Int_t i = 0; i< nVtxbins; i++) { |
92 | for(Int_t det =1; det<=3;det++) | |
93 | { | |
94 | Int_t nRings = (det==1 ? 1 : 2); | |
95 | for(Int_t ring = 0;ring<nRings;ring++) | |
96 | { | |
97 | Char_t ringChar = (ring == 0 ? 'I' : 'O'); | |
98 | Int_t nSec = (ring == 0 ? 20 : 40); | |
99 | ||
100 | ||
3bb122c7 | 101 | TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i); |
102 | hMult = new TH2F(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i),Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i), | |
103 | hBg->GetNbinsX(), | |
104 | hBg->GetXaxis()->GetXmin(), | |
105 | hBg->GetXaxis()->GetXmax(), | |
106 | nSec, 0, 2*TMath::Pi()); | |
8dc823cc | 107 | hMult->Sumw2(); |
7c3e5162 | 108 | fOutputList->Add(hMult); |
059c7c6b | 109 | hMultTrVtx = new TH2F(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i),Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,i), |
6c63da78 | 110 | hBg->GetNbinsX(), |
111 | hBg->GetXaxis()->GetXmin(), | |
112 | hBg->GetXaxis()->GetXmax(), | |
113 | nSec, 0, 2*TMath::Pi()); | |
114 | hMultTrVtx->Sumw2(); | |
115 | ||
116 | fOutputList->Add(hMultTrVtx); | |
059c7c6b | 117 | |
118 | hMultNSD = new TH2F(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,i),Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,i), | |
119 | hBg->GetNbinsX(), | |
120 | hBg->GetXaxis()->GetXmin(), | |
121 | hBg->GetXaxis()->GetXmax(), | |
122 | nSec, 0, 2*TMath::Pi()); | |
123 | hMultNSD->Sumw2(); | |
124 | ||
125 | fOutputList->Add(hMultNSD); | |
126 | ||
bb8a464f | 127 | hHits = new TH2F(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i), |
128 | hBg->GetNbinsX(), | |
129 | hBg->GetXaxis()->GetXmin(), | |
130 | hBg->GetXaxis()->GetXmax(), | |
131 | nSec, 0, 2*TMath::Pi()); | |
132 | ||
0a2f2742 | 133 | /* hHitsNoCuts = new TH2F(Form("hits_NoCuts_FMD%d%c_vtxbin%d",det,ringChar,i),Form("hits_NoCuts_FMD%d%c_vtxbin%d",det,ringChar,i), |
134 | hBg->GetNbinsX(), | |
135 | hBg->GetXaxis()->GetXmin(), | |
136 | hBg->GetXaxis()->GetXmax(), | |
137 | nSec, 0, 2*TMath::Pi()); | |
138 | ||
139 | */ | |
bb8a464f | 140 | hHits->Sumw2(); |
cc066cb9 | 141 | fHitList->Add(hHits); |
04f1ff3d | 142 | |
3bb122c7 | 143 | } |
04f1ff3d | 144 | } |
145 | //HHD SPD hists | |
146 | TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', i); | |
147 | hSPDMult = new TH2F(Form("mult_SPD_vtxbin%d",i),Form("mult_SPD_vtxbin%d",i), | |
148 | hBg->GetNbinsX(), | |
149 | hBg->GetXaxis()->GetXmin(), | |
150 | hBg->GetXaxis()->GetXmax(), | |
151 | 20, 0, 2*TMath::Pi()); | |
152 | hSPDMult->Sumw2(); | |
153 | fOutputList->Add(hSPDMult); | |
154 | hSPDMultTrVtx = new TH2F(Form("multTrVtx_SPD_vtxbin%d",i),Form("multTrVtx_SPD_vtxbin%d",i), | |
155 | hBg->GetNbinsX(), | |
156 | hBg->GetXaxis()->GetXmin(), | |
157 | hBg->GetXaxis()->GetXmax(), | |
158 | 20, 0, 2*TMath::Pi()); | |
159 | hSPDMultTrVtx->Sumw2(); | |
160 | fOutputList->Add(hSPDMultTrVtx); | |
059c7c6b | 161 | hSPDMultNSD = new TH2F(Form("multNSD_SPD_vtxbin%d",i),Form("multNSD_SPD_vtxbin%d",i), |
162 | hBg->GetNbinsX(), | |
163 | hBg->GetXaxis()->GetXmin(), | |
164 | hBg->GetXaxis()->GetXmax(), | |
165 | 20, 0, 2*TMath::Pi()); | |
166 | hSPDMultNSD->Sumw2(); | |
167 | fOutputList->Add(hSPDMultNSD); | |
168 | ||
04f1ff3d | 169 | |
170 | } | |
a99f398f | 171 | TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', 5); |
172 | TH2F* dNdetadphiHistogram = new TH2F("dNdetadphiHistogramTrVtx","dNdetadphiHistogramTrVtx;#eta;#Phi",pars->GetNetaBins(),hBg->GetXaxis()->GetXmin(),hBg->GetXaxis()->GetXmax(),20,0,2*TMath::Pi()); | |
173 | TH2F* dNdetadphiHistogramSPD = new TH2F("dNdetadphiHistogramSPDTrVtx","dNdetadphiHistogramSPDTrVtx;#eta;#Phi",pars->GetNetaBins(),hBg->GetXaxis()->GetXmin(),hBg->GetXaxis()->GetXmax(),20,0,2*TMath::Pi()); | |
ff293341 | 174 | //dNdetadphiHistogram->SetErrorOption("g"); |
175 | ||
176 | fHitList->Add(dNdetadphiHistogram); | |
b4387910 | 177 | fOutputList->Add(dNdetadphiHistogram); |
2f323ab5 | 178 | fHitList->Add(dNdetadphiHistogramSPD); |
179 | fOutputList->Add(dNdetadphiHistogramSPD); | |
3bb122c7 | 180 | |
bb8a464f | 181 | |
3bb122c7 | 182 | } |
8dc823cc | 183 | //_____________________________________________________________________ |
3bb122c7 | 184 | void AliFMDAnalysisTaskBackgroundCorrection::ConnectInputData(Option_t */*option*/) |
185 | { | |
7c3e5162 | 186 | if(fStandalone) { |
187 | fInputList = (TList*)GetInputData(0); | |
188 | ||
189 | } | |
3bb122c7 | 190 | } |
8dc823cc | 191 | //_____________________________________________________________________ |
3bb122c7 | 192 | void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/) |
193 | { | |
194 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
195 | ||
9f55be54 | 196 | fVertexString = (TObjString*)fInputList->At(0); |
197 | ||
8dc823cc | 198 | Int_t vtxbin = fVertexString->GetString().Atoi(); |
7c3e5162 | 199 | fOutputVertexString->SetString(Form("%d",vtxbin)); |
8dc7c4c2 | 200 | |
875e75b6 | 201 | fNevents.Fill(vtxbin); |
7c3e5162 | 202 | //Reset everything |
203 | for(UShort_t det=1;det<=3;det++) { | |
7c3e5162 | 204 | Int_t nRings = (det==1 ? 1 : 2); |
205 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
9f55be54 | 206 | Char_t ringChar = (ir == 0 ? 'I' : 'O'); |
207 | TH2F* hMult = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); | |
7c3e5162 | 208 | hMult->Reset(); |
6c63da78 | 209 | TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); |
210 | hMultTrVtx->Reset(); | |
059c7c6b | 211 | TH2F* hMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); |
212 | hMultNSD->Reset(); | |
04f1ff3d | 213 | |
214 | TH2F* hSPDMult = (TH2F*)fOutputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin)); | |
215 | hSPDMult->Reset(); | |
216 | TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin)); | |
7d51350c | 217 | hSPDMultTrVtx->Reset(); |
059c7c6b | 218 | TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin)); |
219 | hSPDMultNSD->Reset(); | |
7c3e5162 | 220 | } |
221 | ||
222 | } | |
223 | ||
507687cd | 224 | |
059c7c6b | 225 | Bool_t nsd = pars->IsEventTriggered(AliFMDAnaParameters::kNSD); |
3bb122c7 | 226 | for(UShort_t det=1;det<=3;det++) { |
6c63da78 | 227 | |
3bb122c7 | 228 | Int_t nRings = (det==1 ? 1 : 2); |
229 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
230 | Char_t ringChar = (ir == 0 ? 'I' : 'O'); | |
6c63da78 | 231 | |
232 | TH2F* hMult = (TH2F*)fOutputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); | |
233 | TH2F* hMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); | |
059c7c6b | 234 | TH2F* hMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); |
9f55be54 | 235 | TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); |
5c7816c0 | 236 | TH2F* hHits = (TH2F*)fHitList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); |
bb8a464f | 237 | |
5c7816c0 | 238 | //if(pars->GetProcessHits()) |
239 | hHits->Add(hMultInput); | |
55cadbf9 | 240 | |
8dc823cc | 241 | TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, vtxbin); |
507687cd | 242 | TH2F* hBgNSD = pars->GetBackgroundCorrectionNSD(det, ringChar, vtxbin); |
6c63da78 | 243 | hMult->Add(hMultInput); |
244 | hMultTrVtx->Add(hMultInput); | |
059c7c6b | 245 | |
6c63da78 | 246 | hMult->Divide(hBg);//,"B"); |
247 | hMultTrVtx->Divide(hBg);//,"B"); | |
059c7c6b | 248 | |
249 | if(nsd) { | |
250 | hMultNSD->Add(hMultInput); | |
df2a9c32 | 251 | hMultNSD->Divide(hBgNSD); |
059c7c6b | 252 | } |
253 | ||
6c63da78 | 254 | //sharing efficiency correction ? |
70d74659 | 255 | if(pars->SharingEffPresent()) { |
ab3e0abc | 256 | TH1F* hSharingEff = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin); |
70d74659 | 257 | TH1F* hSharingEffTrVtx = pars->GetSharingEfficiencyTrVtx(det,ringChar,vtxbin); |
bb8a464f | 258 | |
f7356393 | 259 | for(Int_t nx=1; nx<=hMult->GetNbinsX(); nx++) { |
059c7c6b | 260 | Float_t correction = hSharingEff->GetBinContent(nx); |
70d74659 | 261 | Float_t correctionTrVtx = hSharingEffTrVtx->GetBinContent(nx); |
059c7c6b | 262 | //FIXME : This should be for NSD events |
263 | Float_t correctionNSD = hSharingEff->GetBinContent(nx); | |
ab3e0abc | 264 | |
f7356393 | 265 | for(Int_t ny=1; ny<=hMult->GetNbinsY(); ny++) { |
70d74659 | 266 | |
267 | if(correction != 0){ | |
268 | hMult->SetBinContent(nx,ny,hMult->GetBinContent(nx,ny)/correction); | |
269 | Float_t error = TMath::Sqrt(TMath::Power(hMult->GetBinError(nx,ny),2) + TMath::Power(hMult->GetBinContent(nx,ny)*hSharingEff->GetBinError(nx),2)) / correction; | |
270 | hMult->SetBinError(nx,ny,error); | |
271 | } | |
272 | if(correctionTrVtx != 0){ | |
273 | hMultTrVtx->SetBinContent(nx,ny,hMultTrVtx->GetBinContent(nx,ny)/correctionTrVtx); | |
274 | Float_t error = TMath::Sqrt(TMath::Power(hMultTrVtx->GetBinError(nx,ny),2) + TMath::Power(hMultTrVtx->GetBinContent(nx,ny)*hSharingEffTrVtx->GetBinError(nx),2)) / correctionTrVtx; | |
275 | hMultTrVtx->SetBinError(nx,ny,error); | |
276 | } | |
059c7c6b | 277 | if(correctionNSD != 0 && nsd) { |
278 | hMultNSD->SetBinContent(nx,ny,hMultNSD->GetBinContent(nx,ny)/correctionNSD); | |
279 | Float_t error = TMath::Sqrt(TMath::Power(hMultNSD->GetBinError(nx,ny),2) + TMath::Power(hMultNSD->GetBinContent(nx,ny)*hSharingEff->GetBinError(nx),2)) / correctionNSD; | |
280 | hMultNSD->SetBinError(nx,ny,error); | |
281 | } | |
282 | ||
283 | ||
6c63da78 | 284 | } |
70d74659 | 285 | |
6c63da78 | 286 | } |
6c63da78 | 287 | } |
ab3e0abc | 288 | |
df2a9c32 | 289 | // if(pars->GetEventSelectionEfficiency(vtxbin) > 0) |
ab3e0abc | 290 | // hMult->Scale(1/pars->GetEventSelectionEfficiency(vtxbin)); |
df2a9c32 | 291 | //else |
292 | // hMult->Scale(0); | |
059c7c6b | 293 | hMult->Divide(pars->GetEventSelectionEfficiency("INEL",vtxbin,ringChar)); |
294 | hMultNSD->Divide(pars->GetEventSelectionEfficiency("NSD",vtxbin,ringChar)); | |
ab3e0abc | 295 | |
6c63da78 | 296 | |
70d74659 | 297 | } |
04f1ff3d | 298 | } |
299 | ||
300 | //HHD SPD code | |
301 | ||
302 | TH2F* hSPDMult = (TH2F*)fOutputList->FindObject(Form("mult_SPD_vtxbin%d",vtxbin)); | |
303 | TH2F* hSPDMultTrVtx = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin)); | |
059c7c6b | 304 | TH2F* hSPDMultNSD = (TH2F*)fOutputList->FindObject(Form("multNSD_SPD_vtxbin%d",vtxbin)); |
04f1ff3d | 305 | |
1b418b63 | 306 | AliESDInputHandler* eventHandler = |
307 | dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager() | |
308 | ->GetInputEventHandler()); | |
309 | if (!eventHandler) return; | |
310 | ||
507687cd | 311 | AliESDEvent* esd = eventHandler->GetEvent(); |
312 | ||
04f1ff3d | 313 | const AliMultiplicity* spdmult = esd->GetMultiplicity(); |
314 | for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++) { | |
315 | hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j)); | |
316 | hSPDMultTrVtx->Fill(spdmult->GetEta(j),spdmult->GetPhi(j)); | |
059c7c6b | 317 | hSPDMultNSD->Fill(spdmult->GetEta(j),spdmult->GetPhi(j)); |
04f1ff3d | 318 | } |
319 | for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) { | |
320 | hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j)); | |
321 | hSPDMultTrVtx->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j)); | |
059c7c6b | 322 | hSPDMultNSD->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j)); |
04f1ff3d | 323 | } |
324 | ||
325 | TH2F* hBgSPD = pars->GetBackgroundCorrection(0, 'Q', vtxbin); | |
326 | if(hBgSPD) { | |
df2a9c32 | 327 | |
328 | hSPDMult->Divide(hBgSPD); | |
329 | hSPDMultTrVtx->Divide(hBgSPD); | |
330 | hSPDMultNSD->Divide(hBgSPD); | |
331 | ||
541c19ed | 332 | TH1F* hDead = pars->GetSPDDeadCorrection(vtxbin); |
333 | for(Int_t i=1; i<=hSPDMult->GetNbinsX(); i++) { | |
334 | for(Int_t j=1; j<=hSPDMult->GetNbinsY(); j++) { | |
335 | Float_t mult = hSPDMult->GetBinContent(i,j); | |
336 | Float_t correction = hBgSPD->GetBinContent(i,j); | |
337 | Float_t correctedMult = 0; | |
338 | Float_t correctedError = 0; | |
df2a9c32 | 339 | |
340 | ||
341 | if( mult > 0 && correction > 0.) { | |
342 | correctedMult = mult;///correction; | |
343 | //std::cout<<correction<<" "<<hSPDMult->GetXaxis()->GetBinCenter(i)<<std::endl; | |
344 | // correctedMult = mult/correction; | |
541c19ed | 345 | |
346 | if(hDead->GetBinContent(i) > 0) | |
347 | correctedMult = correctedMult/hDead->GetBinContent(i); | |
348 | correctedError = correctedMult*TMath::Sqrt( TMath::Power(hSPDMult->GetBinError(i,j)/hSPDMult->GetBinContent(i,j),2) + | |
349 | TMath::Power(hBgSPD->GetBinError(i,j)/hBgSPD->GetBinContent(i,j),2)); | |
350 | ||
059c7c6b | 351 | } |
df2a9c32 | 352 | |
353 | if(correctedMult > 0) { | |
354 | hSPDMult->SetBinContent(i,j,correctedMult); | |
355 | hSPDMultTrVtx->SetBinContent(i,j,correctedMult); | |
356 | hSPDMult->SetBinError(i,j,correctedError); | |
357 | hSPDMultTrVtx->SetBinError(i,j,correctedError); | |
358 | if(nsd) { | |
359 | hSPDMultNSD->SetBinContent(i,j,correctedMult); | |
360 | hSPDMultNSD->SetBinError(i,j,correctedError); | |
361 | } | |
362 | ||
541c19ed | 363 | } |
df2a9c32 | 364 | } |
541c19ed | 365 | } |
366 | hSPDMult->Divide(pars->GetEventSelectionEfficiency("INEL",vtxbin,'I')); | |
367 | hSPDMultNSD->Divide(pars->GetEventSelectionEfficiency("NSD",vtxbin,'I')); | |
04f1ff3d | 368 | } |
369 | else | |
370 | AliWarning("No SPD background map found"); | |
371 | ||
372 | //std::cout<<spdmult->GetNumberOfTracklets()<<" "<<spdmult->GetNumberOfITSClusters(0)<<" "<< spdmult->GetNumberOfSingleClusters()<<std::endl; | |
ff293341 | 373 | |
374 | CreatePerEventHistogram(vtxbin); | |
375 | ||
7c3e5162 | 376 | if(fStandalone) { |
377 | PostData(0, fOutputList); | |
7c3e5162 | 378 | } |
3bb122c7 | 379 | |
380 | } | |
8dc823cc | 381 | //_____________________________________________________________________ |
382 | void AliFMDAnalysisTaskBackgroundCorrection::Terminate(Option_t */*option*/) { | |
18d4b9ae | 383 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); |
8dc823cc | 384 | |
18d4b9ae | 385 | Int_t nVtxbins = pars->GetNvtxBins(); |
8dc823cc | 386 | |
18d4b9ae | 387 | for(UShort_t det=1;det<=3;det++) { |
388 | Int_t nRings = (det==1 ? 1 : 2); | |
389 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
390 | Char_t ringChar = (ir == 0 ? 'I' : 'O'); | |
391 | for(Int_t i =0; i<nVtxbins; i++) { | |
5c7816c0 | 392 | TH2F* hHits = (TH2F*)fHitList->FindObject(Form("hits_FMD%d%c_vtxbin%d",det,ringChar,i)); |
18d4b9ae | 393 | TH1D* hHitsproj = hHits->ProjectionX(Form("hits_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hHits->GetNbinsY()); |
0a2f2742 | 394 | TH1D* hHitsNoCuts = (TH1D*)hHitsproj->Clone(Form("hits_NoCuts_FMD%d%c_vtxbin%d_proj",det,ringChar,i)); |
70d74659 | 395 | if(pars->GetEventSelectionEfficiency(i) > 0) |
396 | hHitsNoCuts->Scale(1/pars->GetEventSelectionEfficiency(i)); | |
397 | else | |
398 | hHitsNoCuts->Scale(0); | |
18d4b9ae | 399 | fHitList->Add(hHitsproj); |
0a2f2742 | 400 | fHitList->Add(hHitsNoCuts); |
18d4b9ae | 401 | |
402 | } | |
403 | } | |
404 | } | |
8dc823cc | 405 | } |
ff293341 | 406 | |
407 | //_____________________________________________________________________ | |
408 | void AliFMDAnalysisTaskBackgroundCorrection::CreatePerEventHistogram(Int_t vtxbin) { | |
409 | ||
410 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
411 | TH2F* dNdetadphiHistogram = (TH2F*)fHitList->FindObject("dNdetadphiHistogramTrVtx"); | |
2f323ab5 | 412 | TH2F* dNdetadphiHistogramSPD = (TH2F*)fHitList->FindObject("dNdetadphiHistogramSPDTrVtx"); |
413 | ||
ff293341 | 414 | dNdetadphiHistogram->Reset(); |
2f323ab5 | 415 | dNdetadphiHistogramSPD->Reset(); |
ff293341 | 416 | |
2f323ab5 | 417 | for(Int_t det = 0; det<=3; det++) { |
418 | Int_t maxRing = (det<= 1 ? 0 : 1); | |
419 | ||
420 | ||
421 | ||
ff293341 | 422 | for(Int_t ring = 0;ring<=maxRing;ring++) { |
423 | ||
424 | Char_t ringChar = (ring == 0 ? 'I' : 'O'); | |
425 | ||
2f323ab5 | 426 | TH2F* multhistoriginal = 0; |
427 | ||
428 | if(det == 0) | |
429 | multhistoriginal = (TH2F*)fOutputList->FindObject(Form("multTrVtx_SPD_vtxbin%d",vtxbin)); | |
430 | else | |
431 | multhistoriginal = (TH2F*)fOutputList->FindObject(Form("multTrVtx_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); | |
432 | ||
ff293341 | 433 | TH2F* multhist = (TH2F*)multhistoriginal->Clone("tmp"); |
2f323ab5 | 434 | |
435 | ||
436 | ||
437 | if(ringChar == 'O' && det > 0) | |
ff293341 | 438 | multhist->RebinY(2); |
439 | ||
440 | for(Int_t i=pars->GetFirstEtaBinToInclude(vtxbin,det,ringChar); i<=pars->GetLastEtaBinToInclude(vtxbin,det,ringChar); i++) { | |
441 | for(Int_t j=1; j<=multhist->GetNbinsY(); j++) { | |
442 | if(multhist->GetBinContent(i,j) < 0.0001) continue; | |
443 | ||
2f323ab5 | 444 | Bool_t overlapFMD = kFALSE; |
445 | Bool_t overlapSPD = kFALSE; | |
446 | ||
ff293341 | 447 | if(det == 1 && ringChar =='I') |
448 | if(i<=pars->GetLastEtaBinToInclude(vtxbin,2,'I')) | |
2f323ab5 | 449 | overlapFMD = kTRUE; |
ff293341 | 450 | |
2f323ab5 | 451 | if(det == 2 && ringChar =='O') { |
ff293341 | 452 | if(i>=pars->GetFirstEtaBinToInclude(vtxbin,2,'I')) |
2f323ab5 | 453 | overlapFMD = kTRUE; |
454 | if(i<=pars->GetLastEtaBinToInclude(vtxbin,0,'I'))// && TMath::Abs(multhist->GetXaxis()->GetBinCenter(i)) < 2) | |
455 | overlapSPD = kTRUE; | |
456 | } | |
ff293341 | 457 | if(det == 2 && ringChar =='I') |
458 | if(i<=pars->GetLastEtaBinToInclude(vtxbin,2,'O') || i>=pars->GetFirstEtaBinToInclude(vtxbin,1,'I')) | |
2f323ab5 | 459 | overlapFMD = kTRUE; |
ff293341 | 460 | |
461 | if(det == 3 && ringChar =='I') | |
462 | if(i>=pars->GetFirstEtaBinToInclude(vtxbin,3,'O')) | |
2f323ab5 | 463 | overlapFMD = kTRUE; |
ff293341 | 464 | |
2f323ab5 | 465 | if(det == 3 && ringChar =='O') { |
ff293341 | 466 | if(i<=pars->GetLastEtaBinToInclude(vtxbin,3,'I')) |
2f323ab5 | 467 | overlapFMD = kTRUE; |
468 | if(i>=pars->GetFirstEtaBinToInclude(vtxbin,0,'I'))// && TMath::Abs(multhist->GetXaxis()->GetBinCenter(i)) < 2) | |
469 | overlapSPD = kTRUE; | |
470 | } | |
ff293341 | 471 | |
2f323ab5 | 472 | if(det == 0) { |
473 | if(i<=pars->GetLastEtaBinToInclude(vtxbin,3,'O') || i>=pars->GetFirstEtaBinToInclude(vtxbin,2,'O')) | |
474 | overlapSPD = kTRUE; | |
475 | } | |
476 | //std::cout<<overlapFMD<<" "<<overlapSPD<<std::endl; | |
ff293341 | 477 | |
ff293341 | 478 | |
2f323ab5 | 479 | if(det > 0) { |
480 | if(overlapFMD) { | |
481 | dNdetadphiHistogram->SetBinContent(i,j,dNdetadphiHistogram->GetBinContent(i,j)+0.5*multhist->GetBinContent(i,j)); | |
482 | dNdetadphiHistogram->SetBinError(i,j,TMath::Sqrt(TMath::Power(dNdetadphiHistogram->GetBinError(i,j),2)+TMath::Power(0.5*multhist->GetBinError(i,j),2))); | |
483 | } | |
ff293341 | 484 | else { |
485 | dNdetadphiHistogram->SetBinContent(i,j,multhist->GetBinContent(i,j)); | |
486 | dNdetadphiHistogram->SetBinError(i,j,multhist->GetBinError(i,j)); | |
487 | } | |
2f323ab5 | 488 | } |
489 | ||
490 | if( overlapFMD && overlapSPD) { | |
491 | dNdetadphiHistogramSPD->SetBinContent(i,j,dNdetadphiHistogramSPD->GetBinContent(i,j)+0.33*multhist->GetBinContent(i,j)); | |
492 | dNdetadphiHistogramSPD->SetBinError(i,j,TMath::Sqrt(TMath::Power(dNdetadphiHistogramSPD->GetBinError(i,j),2)+TMath::Power(0.33*multhist->GetBinError(i,j),2))); | |
493 | } | |
494 | else if( overlapFMD || overlapSPD) { | |
495 | dNdetadphiHistogramSPD->SetBinContent(i,j,dNdetadphiHistogramSPD->GetBinContent(i,j)+0.5*multhist->GetBinContent(i,j)); | |
496 | dNdetadphiHistogramSPD->SetBinError(i,j,TMath::Sqrt(TMath::Power(dNdetadphiHistogramSPD->GetBinError(i,j),2)+TMath::Power(0.5*multhist->GetBinError(i,j),2))); | |
497 | } | |
498 | else { | |
499 | dNdetadphiHistogramSPD->SetBinContent(i,j,multhist->GetBinContent(i,j)); | |
500 | dNdetadphiHistogramSPD->SetBinError(i,j,multhist->GetBinError(i,j)); | |
501 | } | |
502 | ||
503 | ||
504 | ||
505 | ||
506 | ||
ff293341 | 507 | } |
508 | } | |
509 | delete multhist; | |
510 | } | |
511 | } | |
512 | } | |
8dc823cc | 513 | //_____________________________________________________________________ |
514 | // | |
515 | // | |
516 | // EOF |