1 //====================================================================
3 // Base class for classes that calculate the multiplicity in the
4 // central region event-by-event
10 // - AliAODCentralMult
15 #include "AliCentralMCMultiplicityTask.h"
16 #include "AliForwardCorrectionManager.h"
17 #include "AliForwardUtil.h"
19 #include "AliAODHandler.h"
20 #include "AliInputEventHandler.h"
21 #include "AliESDInputHandler.h"
22 #include "AliAnalysisManager.h"
23 #include "AliESDEvent.h"
24 #include "AliMultiplicity.h"
25 #include "AliFMDEventInspector.h"
26 #include <AliMCEvent.h>
27 #include <AliTrackReference.h>
38 //====================================================================
39 AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask(const char* name)
40 : AliCentralMultiplicityTask(name),
47 DGUARD(fDebug,3,"Named CTOR of AliCentralMCMultiplicityTask: %s",
50 "ESD:AliESDRun.,AliESDHeader.,AliMultiplicity.,"
51 "SPDVertex.,PrimaryVertex.";
53 //____________________________________________________________________
54 AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask()
55 : AliCentralMultiplicityTask(),
62 DGUARD(fDebug, 3,"Default CTOR of AliCentralMCMultiplicityTask");
64 //____________________________________________________________________
65 AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask(const AliCentralMCMultiplicityTask& o)
66 : AliCentralMultiplicityTask(o),
67 fTrackDensity(o.fTrackDensity),
68 fAODMCCentral(o.fAODMCCentral)
73 DGUARD(fDebug, 3,"COPY CTOR of AliCentralMCMultiplicityTask");
75 //____________________________________________________________________
76 AliCentralMCMultiplicityTask&
77 AliCentralMCMultiplicityTask::operator=(const AliCentralMCMultiplicityTask& o)
80 // Assignment operator
82 DGUARD(fDebug,3,"Assignment of AliCentralMCMultiplicityTask");
83 if (&o == this) return *this;
84 AliCentralMultiplicityTask::operator=(o);
85 fAODMCCentral = o.fAODMCCentral;
86 fTrackDensity = o.fTrackDensity;
89 //____________________________________________________________________
90 void AliCentralMCMultiplicityTask::UserCreateOutputObjects()
93 // Create output objects
96 DGUARD(fDebug,1,"Create user output in AliCentralMCMultiplicityTask");
97 AliCentralMultiplicityTask::UserCreateOutputObjects();
99 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
101 dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
102 if (!ah) AliFatal("No AOD output handler set in analysis manager");
105 TObject* obj = &fAODMCCentral;
106 ah->AddBranch("AliAODCentralMult", &obj);
109 fTrackDensity.CreateOutputObjects(fList);
112 //____________________________________________________________________
113 void AliCentralMCMultiplicityTask::UserExec(Option_t* option)
116 // Process each event
121 DGUARD(fDebug,1,"Process event in AliCentralMCMultiplicityTask");
122 fAODMCCentral.Clear("");
124 AliCentralMultiplicityTask::UserExec(option);
125 fAODMCCentral.Init(*(fAODCentral.GetHistogram().GetXaxis()));
126 // check if we need this event
127 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
129 dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
131 AliFatal("No AOD output handler set in analysis manager");
133 // if base class did not want this event, then neither to we
134 if (!ah->GetFillAOD() || fIvz <= 0) return;
136 const AliMCEvent* mcEvent = MCEvent();
137 if (!mcEvent) return;
138 TH2D& hist = fAODMCCentral.GetHistogram();
140 Double_t vz = GetManager().GetSecMap()->GetVertexAxis().GetBinCenter(fIvz);
142 fTrackDensity.Calculate(*mcEvent, vz, hist, NULL);
144 CorrectData(hist, fIvz);
148 //____________________________________________________________________
149 void AliCentralMCMultiplicityTask::Terminate(Option_t* option)
157 DGUARD(fDebug,1,"Final analysis of merge in AliCentralMCMultiplicityTask");
158 AliCentralMultiplicityTask::Terminate(option);
160 //____________________________________________________________________
162 AliCentralMCMultiplicityTask::Print(Option_t* option) const
170 AliCentralMultiplicityTask::Print(option);
171 gROOT->IncreaseDirLevel();
172 fTrackDensity.Print(option);
173 gROOT->DecreaseDirLevel();