]>
Commit | Line | Data |
---|---|---|
1a26066e | 1 | //==================================================================== |
7984e5f7 | 2 | // |
3 | // Base class for classes that calculate the multiplicity in the | |
4 | // forward regions event-by-event | |
5 | // | |
6 | // Inputs: | |
7 | // - AliESDEvent | |
8 | // | |
9 | // Outputs: | |
10 | // - AliAODForwardMult | |
11 | // | |
12 | // Histograms | |
13 | // | |
14 | // Corrections used | |
1a26066e | 15 | #include "AliForwardMultiplicityBase.h" |
1174780f | 16 | #include "AliForwardCorrectionManager.h" |
1a26066e | 17 | #include "AliLog.h" |
18 | #include "AliAODHandler.h" | |
19 | #include "AliInputEventHandler.h" | |
20 | #include "AliAnalysisManager.h" | |
1174780f | 21 | #include "AliFMDEventInspector.h" |
22 | #include "AliFMDEnergyFitter.h" | |
23 | #include "AliFMDSharingFilter.h" | |
24 | #include "AliFMDDensityCalculator.h" | |
72cc12cd | 25 | #include "AliFMDCorrector.h" |
1174780f | 26 | #include "AliFMDHistCollector.h" |
7ec4d843 | 27 | #include "AliESDEvent.h" |
1a26066e | 28 | #include <TROOT.h> |
7ec4d843 | 29 | |
1a26066e | 30 | |
31 | //==================================================================== | |
19abe41d | 32 | AliForwardMultiplicityBase::AliForwardMultiplicityBase(const char* name) |
33 | : AliAnalysisTaskSE(name), | |
34 | fEnableLowFlux(true), | |
35 | fFirstEvent(true), | |
36 | fCorrManager(0) | |
37 | { | |
38 | // Set our persistent pointer | |
39 | fCorrManager = &AliForwardCorrectionManager::Instance(); | |
40 | } | |
41 | ||
42 | //____________________________________________________________________ | |
1174780f | 43 | Bool_t |
44 | AliForwardMultiplicityBase::CheckCorrections(UInt_t what) const | |
45 | { | |
46 | // | |
47 | // Check if all needed corrections are there and accounted for. If not, | |
48 | // do a Fatal exit | |
49 | // | |
50 | // Parameters: | |
51 | // what Which corrections is needed | |
52 | // | |
53 | // Return: | |
54 | // true if all present, false otherwise | |
55 | // | |
56 | ||
57 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); | |
58 | // Check that we have the energy loss fits, needed by | |
59 | // AliFMDSharingFilter | |
60 | // AliFMDDensityCalculator | |
61 | if (what & AliForwardCorrectionManager::kELossFits && !fcm.GetELossFit()) { | |
62 | AliFatal(Form("No energy loss fits")); | |
63 | return false; | |
64 | } | |
65 | // Check that we have the double hit correction - (optionally) used by | |
66 | // AliFMDDensityCalculator | |
67 | if (what & AliForwardCorrectionManager::kDoubleHit && !fcm.GetDoubleHit()) { | |
68 | AliFatal("No double hit corrections"); | |
69 | return false; | |
70 | } | |
71 | // Check that we have the secondary maps, needed by | |
72cc12cd | 72 | // AliFMDCorrector |
1174780f | 73 | // AliFMDHistCollector |
74 | if (what & AliForwardCorrectionManager::kSecondaryMap && | |
75 | !fcm.GetSecondaryMap()) { | |
76 | AliFatal("No secondary corrections"); | |
77 | return false; | |
78 | } | |
79 | // Check that we have the vertex bias correction, needed by | |
72cc12cd | 80 | // AliFMDCorrector |
1174780f | 81 | if (what & AliForwardCorrectionManager::kVertexBias && |
82 | !fcm.GetVertexBias()) { | |
83 | AliFatal("No event vertex bias corrections"); | |
84 | return false; | |
85 | } | |
86 | // Check that we have the merging efficiencies, optionally used by | |
72cc12cd | 87 | // AliFMDCorrector |
1174780f | 88 | if (what & AliForwardCorrectionManager::kMergingEfficiency && |
89 | !fcm.GetMergingEfficiency()) { | |
90 | AliFatal("No merging efficiencies"); | |
91 | return false; | |
92 | } | |
cc83fca2 | 93 | // Check that we have the acceptance correction, needed by |
94 | // AliFMDCorrector | |
95 | if (what & AliForwardCorrectionManager::kAcceptance && | |
96 | !fcm.GetAcceptance()) { | |
97 | AliFatal("No acceptance corrections"); | |
98 | return false; | |
99 | } | |
1174780f | 100 | return true; |
101 | } | |
7ec4d843 | 102 | //____________________________________________________________________ |
103 | Bool_t | |
19abe41d | 104 | AliForwardMultiplicityBase::ReadCorrections(const TAxis*& pe, |
105 | const TAxis*& pv, | |
106 | Bool_t mc) | |
7ec4d843 | 107 | { |
108 | UInt_t what = AliForwardCorrectionManager::kAll; | |
109 | if (!fEnableLowFlux) | |
110 | what ^= AliForwardCorrectionManager::kDoubleHit; | |
111 | if (!GetCorrections().IsUseSecondaryMap()) { | |
112 | what ^= AliForwardCorrectionManager::kSecondaryMap; | |
113 | // Need to make eta and vertex axis here since we don't read | |
114 | // that from the secondary correction objects | |
115 | pe = new TAxis(200, -4, 6); | |
116 | pv = new TAxis(10, -10, 10); | |
117 | } | |
118 | if (!GetCorrections().IsUseVertexBias()) | |
119 | what ^= AliForwardCorrectionManager::kVertexBias; | |
120 | if (!GetCorrections().IsUseAcceptance()) | |
121 | what ^= AliForwardCorrectionManager::kAcceptance; | |
122 | if (!GetCorrections().IsUseMergingEfficiency()) | |
123 | what ^= AliForwardCorrectionManager::kMergingEfficiency; | |
124 | ||
125 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); | |
126 | if (!fcm.Init(GetEventInspector().GetCollisionSystem(), | |
19abe41d | 127 | GetEventInspector().GetEnergy(), |
128 | GetEventInspector().GetField(), | |
129 | mc, | |
130 | what)) return false; | |
7ec4d843 | 131 | if (!CheckCorrections(what)) return false; |
132 | ||
19abe41d | 133 | // Sett our persistency pointer |
134 | // fCorrManager = &fcm; | |
135 | ||
7ec4d843 | 136 | // Get the eta axis from the secondary maps - if read in |
137 | if (!pe) { | |
138 | pe = fcm.GetEtaAxis(); | |
139 | if (!pe) AliFatal("No eta axis defined"); | |
140 | } | |
141 | // Get the vertex axis from the secondary maps - if read in | |
142 | if (!pv) { | |
143 | pv = fcm.GetVertexAxis(); | |
144 | if (!pv) AliFatal("No vertex axis defined"); | |
145 | } | |
146 | ||
147 | return true; | |
148 | } | |
149 | //____________________________________________________________________ | |
150 | AliESDEvent* | |
151 | AliForwardMultiplicityBase::GetESDEvent() | |
152 | { | |
153 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent()); | |
154 | if (!esd) { | |
155 | AliWarning("No ESD event found for input event"); | |
156 | return 0; | |
157 | } | |
1174780f | 158 | |
7ec4d843 | 159 | // On the first event, initialize the parameters |
160 | if (fFirstEvent && esd->GetESDRun()) { | |
161 | GetEventInspector().ReadRunDetails(esd); | |
162 | ||
163 | AliInfo(Form("Initializing with parameters from the ESD:\n" | |
164 | " AliESDEvent::GetBeamEnergy() ->%f\n" | |
165 | " AliESDEvent::GetBeamType() ->%s\n" | |
166 | " AliESDEvent::GetCurrentL3() ->%f\n" | |
167 | " AliESDEvent::GetMagneticField()->%f\n" | |
168 | " AliESDEvent::GetRunNumber() ->%d\n", | |
169 | esd->GetBeamEnergy(), | |
170 | esd->GetBeamType(), | |
171 | esd->GetCurrentL3(), | |
172 | esd->GetMagneticField(), | |
173 | esd->GetRunNumber())); | |
174 | ||
175 | fFirstEvent = false; | |
176 | ||
177 | InitializeSubs(); | |
178 | } | |
179 | return esd; | |
180 | } | |
1174780f | 181 | //____________________________________________________________________ |
1a26066e | 182 | void |
183 | AliForwardMultiplicityBase::MarkEventForStore() const | |
184 | { | |
185 | // Make sure the AOD tree is filled | |
186 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
187 | AliAODHandler* ah = | |
188 | dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler()); | |
189 | if (!ah) | |
190 | AliFatal("No AOD output handler set in analysis manager"); | |
191 | ||
192 | ah->SetFillAOD(kTRUE); | |
193 | } | |
194 | ||
195 | //____________________________________________________________________ | |
196 | void | |
197 | AliForwardMultiplicityBase::Print(Option_t* option) const | |
198 | { | |
7984e5f7 | 199 | // |
200 | // Print information | |
201 | // | |
202 | // Parameters: | |
203 | // option Not used | |
204 | // | |
1a26066e | 205 | std::cout << "AliForwardMultiplicityBase: " << GetName() << "\n" |
206 | << " Enable low flux code: " << (fEnableLowFlux ? "yes" : "no") | |
207 | << std::endl; | |
1174780f | 208 | gROOT->IncreaseDirLevel(); |
209 | GetEventInspector() .Print(option); | |
210 | GetEnergyFitter() .Print(option); | |
211 | GetSharingFilter() .Print(option); | |
212 | GetDensityCalculator().Print(option); | |
213 | GetCorrections() .Print(option); | |
214 | GetHistCollector() .Print(option); | |
215 | gROOT->DecreaseDirLevel(); | |
1a26066e | 216 | } |
217 | ||
1174780f | 218 | |
1a26066e | 219 | // |
220 | // EOF | |
221 | // |