1 #include "AliFMDAnalysisTaskSE.h"
2 #include "AliESDEvent.h"
5 #include "AliMCEventHandler.h"
6 #include "AliAnalysisManager.h"
7 #include "AliFMDAnaParameters.h"
9 #include "AliFMDDndeta.h"
10 #include "TDirectory.h"
11 #include "TProfile2D.h"
12 ClassImp(AliFMDAnalysisTaskSE)
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.
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
20 // TH2F* hFMDdNdetadphi = (TH2F*)list->FindObject("dNdetadphiHistogramTrVtx");
21 //_____________________________________________________________________
22 AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE():
25 fSharing("Sharing",kFALSE),
26 fDensity("Density",kFALSE),
27 fBackground("BackgroundCorrected",kFALSE),
28 fDndeta("dNdeta",kFALSE),
29 fBFCorrelation("BFCorrelation",kFALSE),
32 // Default constructor
34 //_____________________________________________________________________
35 AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(const char* name):
36 AliAnalysisTaskSE(name),
38 fSharing("Sharing",kFALSE),
39 fDensity("Density",kFALSE),
40 fBackground("BackgroundCorrected",kFALSE),
41 fDndeta("dNdeta",kFALSE),
42 fBFCorrelation("BFCorrelation",kFALSE),
45 SetParams(AliFMDAnaParameters::Instance());
46 DefineOutput(1, TList::Class());
47 // DefineOutput(2, TH2F::Class());
49 //_____________________________________________________________________
50 void AliFMDAnalysisTaskSE::UserCreateOutputObjects()
52 // Create the output containers
54 fListOfHistos = new TList();
56 AliESDFMD* fmd = new AliESDFMD();
57 AliESDVertex* vertex = new AliESDVertex();
59 TList* densitylist = new TList();
61 TList* bgcorlist = new TList();
63 fSharing.SetFMDData(fmd);
64 fSharing.SetVertex(vertex);
65 fSharing.SetOutputList(fListOfHistos);
68 fDensity.SetOutputList(densitylist);
69 fDensity.SetInputESDFMD(fmd) ;
70 fDensity.SetInputVertex(vertex);
72 fBackground.SetInputList(densitylist);
73 fBackground.SetOutputList(bgcorlist);
74 fBackground.SetHitList(fListOfHistos);
76 fDndeta.SetInputList(bgcorlist);
77 fDndeta.SetOutputList(fListOfHistos);
78 fBFCorrelation.SetInputList(bgcorlist);
79 fBFCorrelation.SetOutputList(fListOfHistos);
81 fSharing.CreateOutputObjects();
82 fDensity.CreateOutputObjects();
83 fBackground.CreateOutputObjects();
84 fDndeta.CreateOutputObjects();
85 fBFCorrelation.CreateOutputObjects();
88 PostData(1, fListOfHistos);
91 //_____________________________________________________________________
92 void AliFMDAnalysisTaskSE::Init()
94 std::cout<<"Init"<<std::endl;
96 //_____________________________________________________________________
97 void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/)
99 // Execute analysis for current event
102 AliESDEvent* fESD = (AliESDEvent*)InputEvent();
104 //std::cout<<fESD->GetBeamEnergy()<<" "<<fESD->GetBeamType()<<" "<<fESD->GetCurrentL3()<<std::endl;
105 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
107 pars->SetTriggerStatus(fESD);
108 fSharing.SetInputESD(fESD);
111 if(fSharing.GetEventStatus()) {
113 if(fDensity.GetEventStatus()) {
114 fBackground.Exec("");
116 // fBFCorrelation.Exec("");
123 PostData(1, fListOfHistos);
126 //_____________________________________________________________________
127 void AliFMDAnalysisTaskSE::Terminate(Option_t */*option*/)
130 TList* outputList = (TList*)GetOutputData(1);
131 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
134 fSharing.SetOutputList(outputList);
135 fBackground.SetHitList(outputList);
136 fDndeta.SetOutputList(outputList);
137 //fBFCorrelation.SetOutputList(outputList);
138 fSharing.Terminate("");
139 fBackground.Terminate("");
140 if(fSharing.GetVtxEfficiencyFromData() > 0)
141 fDndeta.SetVtxEfficiency(fSharing.GetVtxEfficiencyFromData());
143 fDndeta.SetVtxEfficiency(pars->GetVtxSelectionEffFromMC());
144 std::cout<<fSharing.GetNSDVtxEfficiencyFromData()<<" "<<fSharing.GetVtxEfficiencyFromData()<<" "<<pars->GetVtxSelectionEffFromMC()<<std::endl;
146 if(fSharing.GetNSDVtxEfficiencyFromData() > 0)
147 fDndeta.SetVtxEfficiencyNSD(fSharing.GetNSDVtxEfficiencyFromData());
149 fDndeta.SetVtxEfficiencyNSD(pars->GetVtxSelectionEffFromMC());
151 fDndeta.Terminate("");
152 //fBFCorrelation.Terminate("");
157 t.GenerateMult(AliFMDDndeta::kMult);
159 TList* dNdetalist = t.GetMultList(AliFMDDndeta::kMult);
160 TList* cloneList = (TList*)dNdetalist->Clone("dNdeta");
161 cloneList->SetName("dNdeta");
162 outputList->Add(cloneList);
164 t.GenerateMult(AliFMDDndeta::kMultTrVtx);
165 TList* dNdetalist2 = t.GetMultList(AliFMDDndeta::kMultTrVtx);
166 TList* cloneList2 = (TList*)dNdetalist2->Clone("dNdetaTrVtx");
167 cloneList2->SetName("dNdetaTrVtx");
168 outputList->Add(cloneList2);
170 t.GenerateMult(AliFMDDndeta::kHits);
171 TList* dNdetalist3 = t.GetMultList(AliFMDDndeta::kHits);
172 TList* cloneList3 = (TList*)dNdetalist3->Clone("Hits");
173 cloneList3->SetName("Hits");
174 outputList->Add(cloneList3);
176 t.GenerateMult(AliFMDDndeta::kHitsTrVtx);
177 TList* dNdetalist4 = t.GetMultList(AliFMDDndeta::kHits);
178 TList* cloneList4 = (TList*)dNdetalist4->Clone("HitsTrVtx");
179 cloneList4->SetName("HitsTrVtx");
180 outputList->Add(cloneList4);
182 t.GenerateMult(AliFMDDndeta::kMultNSD);
183 TList* dNdetalist5 = t.GetMultList(AliFMDDndeta::kMultNSD);
184 TList* cloneList5 = (TList*)dNdetalist5->Clone("MultNSD");
185 cloneList5->SetName("MultNSD");
186 outputList->Add(cloneList5);
188 // TFile file("fmd_ana_histos_tmp.root","RECREATE");
189 // fListOfHistos->Write();
193 AliWarning("no merged output from manager");
198 //_____________________________________________________________________
199 void AliFMDAnalysisTaskSE::Print(Option_t* option) const
201 AliInfo(Form("FMD Single Event Analysis Task\n"
202 "Parameters set to %p", fParams));
205 if (opt.Contains("s")) {
206 fSharing.Print(option);
207 fDensity.Print(option);
208 fBackground.Print(option);
209 fDndeta.Print(option);
210 fBFCorrelation.Print(option);
212 if (opt.Contains("p") && fParams)
213 fParams->Print(option);
216 //_____________________________________________________________________