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().IsUseSecondaryMap()) {
113 what ^= AliForwardCorrectionManager::kSecondaryMap;
114 // Need to make eta and vertex axis here since we don't read
115 // that from the secondary correction objects
116 pe = new TAxis(200, -4, 6);
117 pv = new TAxis(10, -10, 10);
119 if (!GetCorrections().IsUseVertexBias())
120 what ^= AliForwardCorrectionManager::kVertexBias;
121 if (!GetCorrections().IsUseAcceptance())
122 what ^= AliForwardCorrectionManager::kAcceptance;
123 if (!GetCorrections().IsUseMergingEfficiency())
124 what ^= AliForwardCorrectionManager::kMergingEfficiency;
126 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
127 if (!fcm.Init(GetEventInspector().GetCollisionSystem(),
128 GetEventInspector().GetEnergy(),
129 GetEventInspector().GetField(),
132 if (!CheckCorrections(what)) return false;
134 // Sett our persistency pointer
135 // fCorrManager = &fcm;
137 // Get the eta axis from the secondary maps - if read in
139 pe = fcm.GetEtaAxis();
140 if (!pe) AliFatal("No eta axis defined");
142 // Get the vertex axis from the secondary maps - if read in
144 pv = fcm.GetVertexAxis();
145 if (!pv) AliFatal("No vertex axis defined");
150 //____________________________________________________________________
152 AliForwardMultiplicityBase::GetESDEvent()
154 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
156 AliWarning("No ESD event found for input event");
160 // On the first event, initialize the parameters
161 if (fFirstEvent && esd->GetESDRun()) {
162 GetEventInspector().ReadRunDetails(esd);
164 AliInfo(Form("Initializing with parameters from the ESD:\n"
165 " AliESDEvent::GetBeamEnergy() ->%f\n"
166 " AliESDEvent::GetBeamType() ->%s\n"
167 " AliESDEvent::GetCurrentL3() ->%f\n"
168 " AliESDEvent::GetMagneticField()->%f\n"
169 " AliESDEvent::GetRunNumber() ->%d\n",
170 esd->GetBeamEnergy(),
173 esd->GetMagneticField(),
174 esd->GetRunNumber()));
182 //____________________________________________________________________
184 AliForwardMultiplicityBase::MarkEventForStore() const
186 // Make sure the AOD tree is filled
187 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
189 dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
191 AliFatal("No AOD output handler set in analysis manager");
193 ah->SetFillAOD(kTRUE);
196 //____________________________________________________________________
198 AliForwardMultiplicityBase::Print(Option_t* option) const
207 std::cout << "AliForwardMultiplicityBase: " << GetName() << "\n"
208 << " Enable low flux code: " << (fEnableLowFlux ? "yes" : "no") << "\n"
209 << " Off-line trigger mask: 0x"
210 << std::hex << std::setfill('0')
211 << std::setw (8) << fOfflineTriggerMask
212 << std::dec << std::setfill (' ') << std::endl;
213 gROOT->IncreaseDirLevel();
214 if (fCorrManager) fCorrManager->Print();
215 else std::cout << " Correction manager not set yet" << std::endl;
216 GetEventInspector() .Print(option);
217 GetEnergyFitter() .Print(option);
218 GetSharingFilter() .Print(option);
219 GetDensityCalculator().Print(option);
220 GetCorrections() .Print(option);
221 GetHistCollector() .Print(option);
222 gROOT->DecreaseDirLevel();