]>
Commit | Line | Data |
---|---|---|
1 | //==================================================================== | |
2 | // | |
3 | // Base class for classes that calculate the multiplicity in the | |
4 | // central region event-by-event | |
5 | // | |
6 | // Inputs: | |
7 | // - AliESDEvent | |
8 | // | |
9 | // Outputs: | |
10 | // - AliAODCentralMult | |
11 | // | |
12 | // Histograms | |
13 | // | |
14 | // Corrections used | |
15 | #include "AliCentralMCMultiplicityTask.h" | |
16 | #include "AliForwardCorrectionManager.h" | |
17 | #include "AliForwardUtil.h" | |
18 | #include "AliLog.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> | |
28 | #include <AliStack.h> | |
29 | #include <TROOT.h> | |
30 | #include <TH1D.h> | |
31 | #include <TH2D.h> | |
32 | #include <TH3D.h> | |
33 | #include <TFile.h> | |
34 | #include <TError.h> | |
35 | #include <iostream> | |
36 | #include <iomanip> | |
37 | ||
38 | //==================================================================== | |
39 | AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask(const char* name) | |
40 | : AliCentralMultiplicityTask(name), | |
41 | fTrackDensity(name), | |
42 | fAODMCCentral(kTRUE) | |
43 | { | |
44 | // | |
45 | // Constructor | |
46 | // | |
47 | DGUARD(fDebug,0,"Named CTOR of AliCentralMCMultiplicityTask: %s", name); | |
48 | } | |
49 | //____________________________________________________________________ | |
50 | AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask() | |
51 | : AliCentralMultiplicityTask(), | |
52 | fTrackDensity(), | |
53 | fAODMCCentral(kTRUE) | |
54 | { | |
55 | // | |
56 | // Constructor | |
57 | // | |
58 | DGUARD(fDebug,0,"Default CTOR of AliCentralMCMultiplicityTask"); | |
59 | } | |
60 | //____________________________________________________________________ | |
61 | AliCentralMCMultiplicityTask::AliCentralMCMultiplicityTask(const AliCentralMCMultiplicityTask& o) | |
62 | : AliCentralMultiplicityTask(o), | |
63 | fTrackDensity(o.fTrackDensity), | |
64 | fAODMCCentral(o.fAODMCCentral) | |
65 | { | |
66 | // | |
67 | // Copy constructor | |
68 | // | |
69 | DGUARD(fDebug,0,"COPY CTOR of AliCentralMCMultiplicityTask"); | |
70 | } | |
71 | //____________________________________________________________________ | |
72 | AliCentralMCMultiplicityTask& | |
73 | AliCentralMCMultiplicityTask::operator=(const AliCentralMCMultiplicityTask& o) | |
74 | { | |
75 | // | |
76 | // Assignment operator | |
77 | // | |
78 | DGUARD(fDebug,3,"Assignment of AliCentralMCMultiplicityTask"); | |
79 | if (&o == this) return *this; | |
80 | AliCentralMultiplicityTask::operator=(o); | |
81 | fAODMCCentral = o.fAODMCCentral; | |
82 | fTrackDensity = o.fTrackDensity; | |
83 | return *this; | |
84 | } | |
85 | //____________________________________________________________________ | |
86 | void AliCentralMCMultiplicityTask::UserCreateOutputObjects() | |
87 | { | |
88 | // | |
89 | // Create output objects | |
90 | // | |
91 | // | |
92 | DGUARD(fDebug,1,"Create user output in AliCentralMCMultiplicityTask"); | |
93 | AliCentralMultiplicityTask::UserCreateOutputObjects(); | |
94 | ||
95 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
96 | AliAODHandler* ah = | |
97 | dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler()); | |
98 | if (!ah) AliFatal("No AOD output handler set in analysis manager"); | |
99 | ||
100 | ||
101 | TObject* obj = &fAODMCCentral; | |
102 | ah->AddBranch("AliAODCentralMult", &obj); | |
103 | ||
104 | ||
105 | fTrackDensity.DefineOutput(fList); | |
106 | ||
107 | } | |
108 | //____________________________________________________________________ | |
109 | void AliCentralMCMultiplicityTask::UserExec(Option_t* option) | |
110 | { | |
111 | // | |
112 | // Process each event | |
113 | // | |
114 | // Parameters: | |
115 | // option Not used | |
116 | // | |
117 | DGUARD(fDebug,1,"Process event in AliCentralMCMultiplicityTask"); | |
118 | fAODMCCentral.Clear(""); | |
119 | // Call base class | |
120 | AliCentralMultiplicityTask::UserExec(option); | |
121 | fAODMCCentral.Init(*(fAODCentral.GetHistogram().GetXaxis())); | |
122 | // check if we need this event | |
123 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
124 | AliAODHandler* ah = | |
125 | dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler()); | |
126 | if (!ah) | |
127 | AliFatal("No AOD output handler set in analysis manager"); | |
128 | ||
129 | // if base class did not want this event, then neither to we | |
130 | if (!ah->GetFillAOD() || fIvz <= 0) return; | |
131 | ||
132 | const AliMCEvent* mcEvent = MCEvent(); | |
133 | if (!mcEvent) return; | |
134 | TH2D& hist = fAODMCCentral.GetHistogram(); | |
135 | ||
136 | Double_t vz = GetManager().GetSecMap()->GetVertexAxis().GetBinCenter(fIvz); | |
137 | ||
138 | fTrackDensity.Calculate(*mcEvent, vz, hist, NULL); | |
139 | ||
140 | CorrectData(hist, fIvz); | |
141 | ||
142 | } | |
143 | ||
144 | //____________________________________________________________________ | |
145 | void AliCentralMCMultiplicityTask::Terminate(Option_t* option) | |
146 | { | |
147 | // | |
148 | // End of job | |
149 | // | |
150 | // Parameters: | |
151 | // option Not used | |
152 | // | |
153 | DGUARD(fDebug,1,"Final analysis of merge in AliCentralMCMultiplicityTask"); | |
154 | AliCentralMultiplicityTask::Terminate(option); | |
155 | } | |
156 | //____________________________________________________________________ | |
157 | void | |
158 | AliCentralMCMultiplicityTask::Print(Option_t* option) const | |
159 | { | |
160 | // | |
161 | // Print information | |
162 | // | |
163 | // Parameters: | |
164 | // option Not used | |
165 | // | |
166 | AliCentralMultiplicityTask::Print(option); | |
167 | gROOT->IncreaseDirLevel(); | |
168 | fTrackDensity.Print(option); | |
169 | gROOT->DecreaseDirLevel(); | |
170 | } | |
171 | // | |
172 | // EOF | |
173 | // |