]>
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 "TAxis.h" | |
10 | #include "TH2F.h" | |
11 | #include "AliFMDAnalysisTaskDensity.h" | |
12 | #include "AliAnalysisManager.h" | |
13 | #include "AliESDFMD.h" | |
14 | #include "AliESDEvent.h" | |
15 | #include "AliAODEvent.h" | |
16 | #include "AliAODHandler.h" | |
17 | #include "AliMCEventHandler.h" | |
18 | #include "AliStack.h" | |
19 | #include "AliESDVertex.h" | |
20 | #include "TMath.h" | |
21 | #include "AliFMDAnaParameters.h" | |
22 | #include "AliFMDGeometry.h" | |
23 | ||
24 | ClassImp(AliFMDAnalysisTaskDensity) | |
25 | ||
26 | //_____________________________________________________________________ | |
27 | AliFMDAnalysisTaskDensity::AliFMDAnalysisTaskDensity() | |
28 | : fDebug(0), | |
29 | fOutputList(0), | |
30 | fArray(0), | |
31 | fESD(0x0) | |
32 | { | |
33 | // Default constructor | |
34 | DefineInput (0, AliESDEvent::Class()); | |
35 | DefineOutput(0,TList::Class()); | |
36 | } | |
37 | //_____________________________________________________________________ | |
38 | AliFMDAnalysisTaskDensity::AliFMDAnalysisTaskDensity(const char* name): | |
39 | AliAnalysisTask(name, "Density"), | |
40 | fDebug(0), | |
41 | fOutputList(0), | |
42 | fArray(0), | |
43 | fESD(0x0) | |
44 | { | |
45 | DefineInput (0, AliESDEvent::Class()); | |
46 | DefineOutput(0, TList::Class()); | |
47 | } | |
48 | //_____________________________________________________________________ | |
49 | void AliFMDAnalysisTaskDensity::CreateOutputObjects() | |
50 | { | |
51 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
52 | fOutputList = new TList(); | |
53 | ||
54 | fArray = new TObjArray(); | |
55 | fArray->SetName("FMD"); | |
56 | fArray->SetOwner(); | |
57 | ||
58 | TH2F* hMult = 0; | |
59 | ||
60 | Int_t nVtxbins = pars->GetNvtxBins(); | |
61 | ||
62 | for(Int_t det =1; det<=3;det++) | |
63 | { | |
64 | TObjArray* detArray = new TObjArray(); | |
65 | detArray->SetName(Form("FMD%d",det)); | |
66 | fArray->AddAtAndExpand(detArray,det); | |
67 | Int_t nRings = (det==1 ? 1 : 2); | |
68 | for(Int_t ring = 0;ring<nRings;ring++) | |
69 | { | |
70 | Char_t ringChar = (ring == 0 ? 'I' : 'O'); | |
71 | Int_t nSec = (ring == 0 ? 20 : 40); | |
72 | ||
73 | TObjArray* vtxArray = new TObjArray(); | |
74 | vtxArray->SetName(Form("FMD%d%c",det,ringChar)); | |
75 | detArray->AddAtAndExpand(vtxArray,ring); | |
76 | for(Int_t i = 0; i< nVtxbins; i++) { | |
77 | TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i); | |
78 | ||
79 | hMult = new TH2F(Form("FMD%d%c_vtxbin%d",det,ringChar,i),Form("FMD%d%c_vtxbin%d",det,ringChar,i), | |
80 | hBg->GetNbinsX(), | |
81 | hBg->GetXaxis()->GetXmin(), | |
82 | hBg->GetXaxis()->GetXmax(), | |
83 | nSec, 0, 2*TMath::Pi()); | |
84 | vtxArray->AddAtAndExpand(hMult,i); | |
85 | ||
86 | } | |
87 | } | |
88 | } | |
89 | ||
90 | fOutputList->Add(fArray); | |
91 | ||
92 | ||
93 | } | |
94 | //_____________________________________________________________________ | |
95 | void AliFMDAnalysisTaskDensity::ConnectInputData(Option_t */*option*/) | |
96 | { | |
97 | ||
98 | fESD = (AliESDEvent*)GetInputData(0); | |
99 | } | |
100 | //_____________________________________________________________________ | |
101 | void AliFMDAnalysisTaskDensity::Exec(Option_t */*option*/) | |
102 | { | |
103 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
104 | AliFMDGeometry* geo = AliFMDGeometry::Instance(); | |
105 | ||
106 | AliESDFMD* fmd = fESD->GetFMDData(); | |
107 | ||
108 | Int_t nVtxbins = pars->GetNvtxBins(); | |
109 | ||
110 | Double_t vertex[3]; | |
111 | fESD->GetPrimaryVertexSPD()->GetXYZ(vertex); | |
112 | ||
113 | if( TMath::Abs(vertex[2]) > pars->GetVtxCutZ()) | |
114 | return; | |
115 | Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins(); | |
116 | Double_t vertexBinDouble = (vertex[2] + pars->GetVtxCutZ()) / delta; | |
117 | ||
118 | Int_t vtxbin = (Int_t)vertexBinDouble; | |
119 | ||
120 | //Resetting everything | |
121 | for(UShort_t det=1;det<=3;det++) { | |
122 | TObjArray* detArray = (TObjArray*)fArray->At(det); | |
123 | Int_t nRings = (det==1 ? 1 : 2); | |
124 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
125 | TObjArray* vtxArray = (TObjArray*)detArray->At(ir); | |
126 | ||
127 | TH2F* hMult = (TH2F*)vtxArray->At(vtxbin); | |
128 | hMult->Reset(); | |
129 | } | |
130 | ||
131 | } | |
132 | ||
133 | ||
134 | for(UShort_t det=1;det<=3;det++) { | |
135 | TObjArray* detArray = (TObjArray*)fArray->At(det); | |
136 | Int_t nRings = (det==1 ? 1 : 2); | |
137 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
138 | TObjArray* vtxArray = (TObjArray*)detArray->At(ir); | |
139 | ||
140 | TH2F* hMult = (TH2F*)vtxArray->At(vtxbin); | |
141 | Char_t ring = (ir == 0 ? 'I' : 'O'); | |
142 | UShort_t nsec = (ir == 0 ? 20 : 40); | |
143 | UShort_t nstr = (ir == 0 ? 512 : 256); | |
144 | for(UShort_t sec =0; sec < nsec; sec++) { | |
145 | for(UShort_t strip = 0; strip < nstr; strip++) { | |
146 | Float_t mult = fmd->Multiplicity(det,ring,sec,strip); | |
147 | if(mult<1) continue; | |
148 | Float_t eta = fmd->Eta(det,ring,sec,strip); | |
149 | Double_t x,y,z; | |
150 | geo->Detector2XYZ(det,ring,sec,strip,x,y,z); | |
151 | Float_t phi = TMath::ATan2(y,x); | |
152 | if(phi<0) | |
153 | phi = phi+2*TMath::Pi(); | |
154 | hMult->Fill(eta,phi,mult); | |
155 | ||
156 | } | |
157 | } | |
158 | } | |
159 | ||
160 | ||
161 | } | |
162 | PostData(0, fOutputList); | |
163 | ||
164 | } | |
165 | //_____________________________________________________________________ | |
166 | // | |
167 | //EOF | |
168 | // |