1 //====================================================================
3 // Base class for classes that calculate the multiplicity in the
4 // forward regions event-by-event
10 // - AliAODForwardMult
15 #include "AliForwardMultiplicityBase.h"
16 #include "AliForwardCorrectionManager.h"
18 #include "AliAODHandler.h"
19 #include "AliInputEventHandler.h"
20 #include "AliAnalysisManager.h"
21 #include "AliFMDEventInspector.h"
22 #include "AliFMDEnergyFitter.h"
23 #include "AliFMDSharingFilter.h"
24 #include "AliFMDDensityCalculator.h"
25 #include "AliFMDCorrector.h"
26 #include "AliFMDHistCollector.h"
27 #include "AliESDEvent.h"
32 //====================================================================
33 AliForwardMultiplicityBase::AliForwardMultiplicityBase(const char* name)
34 : AliAnalysisTaskSE(name),
39 // Set our persistent pointer
40 fCorrManager = &AliForwardCorrectionManager::Instance();
43 //____________________________________________________________________
45 AliForwardMultiplicityBase::CheckCorrections(UInt_t what) const
48 // Check if all needed corrections are there and accounted for. If not,
52 // what Which corrections is needed
55 // true if all present, false otherwise
58 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
59 // Check that we have the energy loss fits, needed by
60 // AliFMDSharingFilter
61 // AliFMDDensityCalculator
62 if (what & AliForwardCorrectionManager::kELossFits && !fcm.GetELossFit()) {
63 AliFatal(Form("No energy loss fits"));
66 // Check that we have the double hit correction - (optionally) used by
67 // AliFMDDensityCalculator
68 if (what & AliForwardCorrectionManager::kDoubleHit && !fcm.GetDoubleHit()) {
69 AliFatal("No double hit corrections");
72 // Check that we have the secondary maps, needed by
74 // AliFMDHistCollector
75 if (what & AliForwardCorrectionManager::kSecondaryMap &&
76 !fcm.GetSecondaryMap()) {
77 AliFatal("No secondary corrections");
80 // Check that we have the vertex bias correction, needed by
82 if (what & AliForwardCorrectionManager::kVertexBias &&
83 !fcm.GetVertexBias()) {
84 AliFatal("No event vertex bias corrections");
87 // Check that we have the merging efficiencies, optionally used by
89 if (what & AliForwardCorrectionManager::kMergingEfficiency &&
90 !fcm.GetMergingEfficiency()) {
91 AliFatal("No merging efficiencies");
94 // Check that we have the acceptance correction, needed by
96 if (what & AliForwardCorrectionManager::kAcceptance &&
97 !fcm.GetAcceptance()) {
98 AliFatal("No acceptance corrections");
103 //____________________________________________________________________
105 AliForwardMultiplicityBase::ReadCorrections(const TAxis*& pe,
109 UInt_t what = AliForwardCorrectionManager::kAll;
111 what ^= AliForwardCorrectionManager::kDoubleHit;
112 if (!GetCorrections().IsUseVertexBias())
113 what ^= AliForwardCorrectionManager::kVertexBias;
114 if (!GetCorrections().IsUseAcceptance())
115 what ^= AliForwardCorrectionManager::kAcceptance;
116 if (!GetCorrections().IsUseMergingEfficiency())
117 what ^= AliForwardCorrectionManager::kMergingEfficiency;
119 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
120 if (!fcm.Init(GetEventInspector().GetCollisionSystem(),
121 GetEventInspector().GetEnergy(),
122 GetEventInspector().GetField(),
125 if (!CheckCorrections(what)) return false;
127 // Sett our persistency pointer
128 // fCorrManager = &fcm;
130 // Get the eta axis from the secondary maps - if read in
132 pe = fcm.GetEtaAxis();
133 if (!pe) AliFatal("No eta axis defined");
135 // Get the vertex axis from the secondary maps - if read in
137 pv = fcm.GetVertexAxis();
138 if (!pv) AliFatal("No vertex axis defined");
143 //____________________________________________________________________
145 AliForwardMultiplicityBase::GetESDEvent()
147 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
149 AliWarning("No ESD event found for input event");
153 // On the first event, initialize the parameters
154 if (fFirstEvent && esd->GetESDRun()) {
155 GetEventInspector().ReadRunDetails(esd);
157 AliInfo(Form("Initializing with parameters from the ESD:\n"
158 " AliESDEvent::GetBeamEnergy() ->%f\n"
159 " AliESDEvent::GetBeamType() ->%s\n"
160 " AliESDEvent::GetCurrentL3() ->%f\n"
161 " AliESDEvent::GetMagneticField()->%f\n"
162 " AliESDEvent::GetRunNumber() ->%d\n",
163 esd->GetBeamEnergy(),
166 esd->GetMagneticField(),
167 esd->GetRunNumber()));
175 //____________________________________________________________________
177 AliForwardMultiplicityBase::MarkEventForStore() const
179 // Make sure the AOD tree is filled
180 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
182 dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
184 AliFatal("No AOD output handler set in analysis manager");
186 ah->SetFillAOD(kTRUE);
189 //____________________________________________________________________
191 AliForwardMultiplicityBase::Print(Option_t* option) const
200 std::cout << "AliForwardMultiplicityBase: " << GetName() << "\n"
201 << " Enable low flux code: " << (fEnableLowFlux ? "yes" : "no")
203 << " Off-line trigger mask: 0x"
204 << std::hex << std::setfill('0')
205 << std::setw (8) << fOfflineTriggerMask
206 << std::dec << std::setfill (' ') << std::endl;
207 gROOT->IncreaseDirLevel();
208 if (fCorrManager) fCorrManager->Print();
210 std::cout << " Correction manager not set yet" << std::endl;
211 GetEventInspector() .Print(option);
212 GetEnergyFitter() .Print(option);
213 GetSharingFilter() .Print(option);
214 GetDensityCalculator().Print(option);
215 GetCorrections() .Print(option);
216 GetHistCollector() .Print(option);
217 gROOT->DecreaseDirLevel();