4 #include <TInterpreter.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"
18 #include "AliESDVertex.h"
20 #include "AliFMDAnaParameters.h"
21 #include "AliFMDGeometry.h"
23 ClassImp(AliFMDAnalysisTaskBackgroundCorrection)
26 AliFMDAnalysisTaskBackgroundCorrection::AliFMDAnalysisTaskBackgroundCorrection()
33 // Default constructor
34 DefineInput (0, TList::Class());
35 DefineOutput(0,TList::Class());
38 AliFMDAnalysisTaskBackgroundCorrection::AliFMDAnalysisTaskBackgroundCorrection(const char* name):
39 AliAnalysisTask(name, "Density"),
46 DefineInput (0, TList::Class());
47 DefineOutput(0, TList::Class());
50 void AliFMDAnalysisTaskBackgroundCorrection::CreateOutputObjects()
52 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
53 fOutputList = new TList();
55 fArray = new TObjArray();
56 fArray->SetName("FMD");
61 Int_t nVtxbins = pars->GetNvtxBins();
63 for(Int_t det =1; det<=3;det++)
65 TObjArray* detArray = new TObjArray();
66 detArray->SetName(Form("FMD%d",det));
67 fArray->AddAtAndExpand(detArray,det);
68 Int_t nRings = (det==1 ? 1 : 2);
69 for(Int_t ring = 0;ring<nRings;ring++)
71 Char_t ringChar = (ring == 0 ? 'I' : 'O');
72 Int_t nSec = (ring == 0 ? 20 : 40);
74 TObjArray* vtxArray = new TObjArray();
75 vtxArray->SetName(Form("FMD%d%c",det,ringChar));
76 detArray->AddAtAndExpand(vtxArray,ring);
77 for(Int_t i = 0; i< nVtxbins; i++) {
78 TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i);
79 hMult = new TH2F(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i),Form("mult_FMD%d%c_vtxbin%d",det,ringChar,i),
81 hBg->GetXaxis()->GetXmin(),
82 hBg->GetXaxis()->GetXmax(),
83 nSec, 0, 2*TMath::Pi());
84 vtxArray->AddAtAndExpand(hMult,i);
90 fOutputList->Add(fArray);
95 void AliFMDAnalysisTaskBackgroundCorrection::ConnectInputData(Option_t */*option*/)
98 TList* list = (TList*)GetInputData(0);
99 fInputArray = (TObjArray*)list->At(0);
103 void AliFMDAnalysisTaskBackgroundCorrection::Exec(Option_t */*option*/)
105 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
107 Int_t nVtxbins = pars->GetNvtxBins();
110 for(UShort_t det=1;det<=3;det++) {
111 TObjArray* detInputArray = (TObjArray*)fInputArray->At(det);
112 TObjArray* detArray = (TObjArray*)fArray->At(det);
113 Int_t nRings = (det==1 ? 1 : 2);
114 for (UShort_t ir = 0; ir < nRings; ir++) {
115 Char_t ringChar = (ir == 0 ? 'I' : 'O');
116 TObjArray* vtxInputArray = (TObjArray*)detInputArray->At(ir);
117 TObjArray* vtxArray = (TObjArray*)detArray->At(ir);
118 for(Int_t i =0; i<nVtxbins; i++) {
119 TH2F* hMultTotal = (TH2F*)vtxArray->At(i);
120 TH2F* hMult = (TH2F*)vtxInputArray->At(i);
121 TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i);
123 TH2F* hTmp = (TH2F*)hMult->Clone("hMult_from_event");
124 /*for(Int_t j=1; j<=hMult->GetNbinsX();j++) {
125 for(Int_t k=1; k<=hMult->GetNbinsY();k++) {
126 if(hBg->GetBinContent(j,k) != 0) {
127 // std::cout<<hMult->GetBinContent(j,k)<<" "<<hBg->GetBinContent(j,k)<<std::endl;
128 hTmp->SetBinContent(j,k,hMult->GetBinContent(j,k)/hBg->GetBinContent(j,k));
132 hTmp->Divide(hTmp,hBg,1,1,"B");
134 hMultTotal->Add(hTmp);
140 PostData(0, fOutputList);