]>
Commit | Line | Data |
---|---|---|
7c3e5162 | 1 | #include "AliFMDAnalysisTaskSE.h" |
2 | #include "AliESDEvent.h" | |
3 | #include "iostream" | |
4 | #include "AliESDFMD.h" | |
bb0a45c3 | 5 | #include "AliMCEventHandler.h" |
6 | #include "AliAnalysisManager.h" | |
b64db9b1 | 7 | #include "AliFMDAnaParameters.h" |
85da855f | 8 | #include "AliLog.h" |
70d74659 | 9 | #include "AliFMDDndeta.h" |
10 | #include "TDirectory.h" | |
dc4750e3 | 11 | #include "TProfile2D.h" |
7c3e5162 | 12 | ClassImp(AliFMDAnalysisTaskSE) |
dc4750e3 | 13 | // |
14 | // This task controls the running of the FMD analysis. The current version is made for | |
15 | // dN/deta analysis but multiplicity and correlation tasks will be added here as well. | |
16 | // | |
17 | // To get the dN/detadphi per selected event as a TH2F* object connect to the | |
18 | // output list of this task in the analysis framework and do | |
19 | // | |
20 | // TH2F* hFMDdNdetadphi = (TH2F*)list->FindObject("dNdetadphiHistogramTrVtx"); | |
7c3e5162 | 21 | //_____________________________________________________________________ |
22 | AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(): | |
23 | AliAnalysisTaskSE(), | |
24 | fListOfHistos(0), | |
25 | fSharing("Sharing",kFALSE), | |
26 | fDensity("Density",kFALSE), | |
27 | fBackground("BackgroundCorrected",kFALSE), | |
85da855f | 28 | fDndeta("dNdeta",kFALSE), |
1c038f67 | 29 | fBFCorrelation("BFCorrelation",kFALSE), |
85da855f | 30 | fParams(0) |
7c3e5162 | 31 | { |
32 | // Default constructor | |
33 | } | |
34 | //_____________________________________________________________________ | |
35 | AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(const char* name): | |
36 | AliAnalysisTaskSE(name), | |
37 | fListOfHistos(0), | |
38 | fSharing("Sharing",kFALSE), | |
39 | fDensity("Density",kFALSE), | |
40 | fBackground("BackgroundCorrected",kFALSE), | |
85da855f | 41 | fDndeta("dNdeta",kFALSE), |
1c038f67 | 42 | fBFCorrelation("BFCorrelation",kFALSE), |
85da855f | 43 | fParams(0) |
7c3e5162 | 44 | { |
85da855f | 45 | SetParams(AliFMDAnaParameters::Instance()); |
7c3e5162 | 46 | DefineOutput(1, TList::Class()); |
dc4750e3 | 47 | // DefineOutput(2, TH2F::Class()); |
7c3e5162 | 48 | } |
49 | //_____________________________________________________________________ | |
50 | void AliFMDAnalysisTaskSE::UserCreateOutputObjects() | |
51 | { | |
1282ce49 | 52 | // Create the output containers |
7c3e5162 | 53 | // |
54 | fListOfHistos = new TList(); | |
55 | ||
56 | AliESDFMD* fmd = new AliESDFMD(); | |
57 | AliESDVertex* vertex = new AliESDVertex(); | |
58 | ||
7c3e5162 | 59 | TList* densitylist = new TList(); |
60 | ||
61 | TList* bgcorlist = new TList(); | |
62 | ||
63 | fSharing.SetFMDData(fmd); | |
64 | fSharing.SetVertex(vertex); | |
a38d1871 | 65 | fSharing.SetOutputList(fListOfHistos); |
da0805e2 | 66 | |
67 | fDensity.Init(); | |
7c3e5162 | 68 | fDensity.SetOutputList(densitylist); |
69 | fDensity.SetInputESDFMD(fmd) ; | |
70 | fDensity.SetInputVertex(vertex); | |
71 | ||
72 | fBackground.SetInputList(densitylist); | |
73 | fBackground.SetOutputList(bgcorlist); | |
cc066cb9 | 74 | fBackground.SetHitList(fListOfHistos); |
9f55be54 | 75 | |
7c3e5162 | 76 | fDndeta.SetInputList(bgcorlist); |
77 | fDndeta.SetOutputList(fListOfHistos); | |
1c038f67 | 78 | fBFCorrelation.SetInputList(bgcorlist); |
79 | fBFCorrelation.SetOutputList(fListOfHistos); | |
9f55be54 | 80 | |
7c3e5162 | 81 | fSharing.CreateOutputObjects(); |
82 | fDensity.CreateOutputObjects(); | |
83 | fBackground.CreateOutputObjects(); | |
84 | fDndeta.CreateOutputObjects(); | |
1c038f67 | 85 | fBFCorrelation.CreateOutputObjects(); |
dc4750e3 | 86 | |
7c3e5162 | 87 | |
11e702b3 | 88 | PostData(1, fListOfHistos); |
dc4750e3 | 89 | |
7c3e5162 | 90 | } |
91 | //_____________________________________________________________________ | |
92 | void AliFMDAnalysisTaskSE::Init() | |
93 | { | |
94 | std::cout<<"Init"<<std::endl; | |
95 | } | |
96 | //_____________________________________________________________________ | |
97 | void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/) | |
98 | { | |
99 | // Execute analysis for current event | |
100 | // | |
2380f57c | 101 | |
7c3e5162 | 102 | AliESDEvent* fESD = (AliESDEvent*)InputEvent(); |
059c7c6b | 103 | |
1c038f67 | 104 | //std::cout<<fESD->GetBeamEnergy()<<" "<<fESD->GetBeamType()<<" "<<fESD->GetCurrentL3()<<std::endl; |
059c7c6b | 105 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); |
106 | ||
107 | pars->SetTriggerStatus(fESD); | |
7c3e5162 | 108 | fSharing.SetInputESD(fESD); |
109 | ||
110 | fSharing.Exec(""); | |
bb8a464f | 111 | if(fSharing.GetEventStatus()) { |
112 | fDensity.Exec(""); | |
113 | if(fDensity.GetEventStatus()) { | |
114 | fBackground.Exec(""); | |
bb8a464f | 115 | fDndeta.Exec(""); |
059c7c6b | 116 | // fBFCorrelation.Exec(""); |
bb8a464f | 117 | } |
da0805e2 | 118 | else return; |
bb8a464f | 119 | } |
da0805e2 | 120 | else return; |
bb8a464f | 121 | |
9346c920 | 122 | |
dc4750e3 | 123 | PostData(1, fListOfHistos); |
124 | ||
7c3e5162 | 125 | } |
1282ce49 | 126 | //_____________________________________________________________________ |
127 | void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/) | |
128 | { | |
da0805e2 | 129 | |
130 | TList* outputList = (TList*)GetOutputData(1); | |
daedf077 | 131 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); |
da0805e2 | 132 | |
11e702b3 | 133 | if(outputList) { |
134 | fSharing.SetOutputList(outputList); | |
135 | fBackground.SetHitList(outputList); | |
136 | fDndeta.SetOutputList(outputList); | |
daedf077 | 137 | //fBFCorrelation.SetOutputList(outputList); |
11e702b3 | 138 | fSharing.Terminate(""); |
139 | fBackground.Terminate(""); | |
daedf077 | 140 | if(fSharing.GetVtxEfficiencyFromData() > 0) |
141 | fDndeta.SetVtxEfficiency(fSharing.GetVtxEfficiencyFromData()); | |
142 | else | |
143 | fDndeta.SetVtxEfficiency(pars->GetVtxSelectionEffFromMC()); | |
059c7c6b | 144 | std::cout<<fSharing.GetNSDVtxEfficiencyFromData()<<" "<<fSharing.GetVtxEfficiencyFromData()<<" "<<pars->GetVtxSelectionEffFromMC()<<std::endl; |
145 | if(fSharing.GetNSDVtxEfficiencyFromData() > 0) | |
146 | fDndeta.SetVtxEfficiencyNSD(fSharing.GetNSDVtxEfficiencyFromData()); | |
147 | else | |
148 | fDndeta.SetVtxEfficiency(pars->GetVtxSelectionEffFromMC()); | |
daedf077 | 149 | |
11e702b3 | 150 | fDndeta.Terminate(""); |
daedf077 | 151 | //fBFCorrelation.Terminate(""); |
11e702b3 | 152 | |
153 | AliFMDDndeta t; | |
154 | t.SetNbinsToCut(2); | |
155 | t.Init(outputList); | |
156 | t.GenerateMult(AliFMDDndeta::kMult); | |
157 | ||
158 | TList* dNdetalist = t.GetMultList(AliFMDDndeta::kMult); | |
159 | TList* cloneList = (TList*)dNdetalist->Clone("dNdeta"); | |
160 | cloneList->SetName("dNdeta"); | |
161 | outputList->Add(cloneList); | |
162 | ||
163 | t.GenerateMult(AliFMDDndeta::kMultTrVtx); | |
164 | TList* dNdetalist2 = t.GetMultList(AliFMDDndeta::kMultTrVtx); | |
165 | TList* cloneList2 = (TList*)dNdetalist2->Clone("dNdetaTrVtx"); | |
166 | cloneList2->SetName("dNdetaTrVtx"); | |
167 | outputList->Add(cloneList2); | |
168 | ||
169 | t.GenerateMult(AliFMDDndeta::kHits); | |
170 | TList* dNdetalist3 = t.GetMultList(AliFMDDndeta::kHits); | |
171 | TList* cloneList3 = (TList*)dNdetalist3->Clone("Hits"); | |
172 | cloneList3->SetName("Hits"); | |
173 | outputList->Add(cloneList3); | |
059c7c6b | 174 | |
11e702b3 | 175 | t.GenerateMult(AliFMDDndeta::kHitsTrVtx); |
176 | TList* dNdetalist4 = t.GetMultList(AliFMDDndeta::kHits); | |
177 | TList* cloneList4 = (TList*)dNdetalist4->Clone("HitsTrVtx"); | |
178 | cloneList4->SetName("HitsTrVtx"); | |
179 | outputList->Add(cloneList4); | |
059c7c6b | 180 | |
181 | t.GenerateMult(AliFMDDndeta::kMultNSD); | |
182 | TList* dNdetalist5 = t.GetMultList(AliFMDDndeta::kMultNSD); | |
183 | TList* cloneList5 = (TList*)dNdetalist4->Clone("MultNSD"); | |
184 | cloneList5->SetName("MultNSD"); | |
185 | outputList->Add(cloneList5); | |
186 | ||
11e702b3 | 187 | // TFile file("fmd_ana_histos_tmp.root","RECREATE"); |
188 | // fListOfHistos->Write(); | |
189 | // file.Close(); | |
190 | } | |
191 | else | |
192 | AliWarning("no merged output from manager"); | |
193 | ||
da0805e2 | 194 | |
1282ce49 | 195 | } |
85da855f | 196 | |
197 | //_____________________________________________________________________ | |
198 | void AliFMDAnalysisTaskSE::Print(Option_t* option) const | |
199 | { | |
200 | AliInfo(Form("FMD Single Event Analysis Task\n" | |
201 | "Parameters set to %p", fParams)); | |
202 | TString opt(option); | |
203 | opt.ToLower(); | |
204 | if (opt.Contains("s")) { | |
205 | fSharing.Print(option); | |
206 | fDensity.Print(option); | |
207 | fBackground.Print(option); | |
1c038f67 | 208 | fDndeta.Print(option); |
209 | fBFCorrelation.Print(option); | |
85da855f | 210 | } |
211 | if (opt.Contains("p") && fParams) | |
212 | fParams->Print(option); | |
213 | } | |
214 | ||
7c3e5162 | 215 | //_____________________________________________________________________ |
216 | // | |
217 | // EOF | |
218 | // |