2 * Script to draw the energy loss fits
4 * @ingroup pwglf_forward_scripts_corr
10 #include "AliFMDCorrSecondaryMap.h"
11 #include "AliCentralCorrSecondaryMap.h"
12 #include "AliForwardCorrectionManager.h"
15 //____________________________________________________________________
17 * Extract the energy loss correction object from file and rename it
18 * according to the settings
20 * @param fname File to extract from
21 * @param sys Collision system (pp, PbPb)
22 * @param sNN Center of mass energy (in GeV) per nucleon
23 * @param field L3 magnetic field (-5,0,5) in kGaus
25 * @ingroup pwglf_forward_scripts_corr
28 ExtractSecMap(const char* fname,
29 UShort_t sys=1, UShort_t sNN=900, Short_t field=5)
32 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
35 TFile* file = TFile::Open(fname, "READ");
37 Error("ExtractSecMap", "Couldn't open %s", fname);
40 if (sys <= 0 || sys > 3) {
41 TList* forward = static_cast<TList*>(file->Get("ForwardSums"));
43 Error("ExtractSecMap", "Couldn't get forward list from %s", fname);
46 TList* insp = static_cast<TList*>(forward->FindObject("fmdEventInspector"));
48 Error("ExtractSecMap", "Couldn't get event inspector list from %s",fname);
51 TObject* oSys = insp->FindObject("sys");
52 TObject* oSNN = insp->FindObject("sNN");
53 TObject* oFld = insp->FindObject("field");
54 if (oSys) sys = oSys->GetUniqueID();
55 if (oSNN) sNN = oSNN->GetUniqueID();
56 if (oFld) field = oFld->GetUniqueID();
58 if (sys <= 0 || sys > 3) {
59 Error("ExtractSecMap", "Couldn't get system type (%d), "
60 "collision energy (%d), "
61 "and/or field strength (%d)", sys, sNN, field);
65 ExtractFMDSecMap(file, sys, sNN, field);
66 ExtractSPDSecMap(file, sys, sNN, field);
67 ExtractSPDAcceptance(file, sys, sNN, field);
70 //____________________________________________________________________
72 * Extract and copy FMD secondary map to file
74 * @param file Input file
75 * @param sys Collision system (1:pp, 2:PbPb)
76 * @param sNN Center of mass energy (GeV) per nucleon
77 * @param field L3 magnetic field
79 * @ingroup pwglf_forward_scripts_corr
82 ExtractFMDSecMap(TFile* file, UShort_t sys, UShort_t sNN, Short_t field)
84 TList* forward = static_cast<TList*>(file->Get("ForwardResults"));
85 // static_cast<TList*>(file->Get("PWGLFforwardDnDeta/Forward"));
87 Error("ExtractSecMap", "Couldn't get forward list from %s", fname);
91 TString n(AliFMDCorrSecondaryMap::Class()->GetName());
92 TObject* fmdCorr = forward->FindObject(n);
94 Error("ExtractSecMap", "Couldn't get forward correction object %s",
99 AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance();
100 mgr.WriteFile(AliForwardCorrectionManager::kSecondaryMap,
101 sys, sNN, field, false, fmdCorr, false);
104 //____________________________________________________________________
106 * Extract and copy SPD secondary map to file
108 * @param file Input file
109 * @param sys Collision system (1:pp, 2:PbPb)
110 * @param sNN Center of mass energy (GeV) per nucleon
111 * @param field L3 magnetic field
113 * @ingroup pwglf_forward_scripts_corr
116 ExtractSPDSecMap(TFile* file, UShort_t sys, UShort_t sNN, Short_t field)
118 TList* central = static_cast<TList*>(file->Get("CentralResults"));
119 // static_cast<TList*>(file->Get("PWGLFcentralDnDeta/Central"));
121 Error("ExtractSecMap", "Couldn't get central list from %s", fname);
125 TString n(AliCentralCorrSecondaryMap::Class()->GetName());
126 TObject* spdCorr = central->FindObject(n);
128 Error("ExtractSecMap", "Couldn't get central correction object %s",
134 AliCentralMultiplicityTask::Manager* mgr = new
135 AliCentralMultiplicityTask::Manager;
138 mgr->WriteFile(0, sys, sNN, field, spdCorr, false);
140 //____________________________________________________________________
142 * Extract and copy SPD secondary map to file
144 * @param file Input file
145 * @param sys Collision system (1:pp, 2:PbPb)
146 * @param sNN Center of mass energy (GeV) per nucleon
147 * @param field L3 magnetic field
149 * @ingroup pwglf_forward_scripts_corr
152 ExtractSPDAcceptance(TFile* file, UShort_t sys, UShort_t sNN, Short_t field)
154 TList* central = static_cast<TList*>(file->Get("CentralResults"));
155 // static_cast<TList*>(file->Get("PWGLFcentralDnDeta/Central"));
157 Error("ExtractAcceptance", "Couldn't get central list from %s", fname);
161 TString n(AliCentralCorrAcceptance::Class()->GetName());
162 TObject* spdCorr = central->FindObject(n);
164 Error("ExtractAcceptance", "Couldn't get central correction object %s",
170 AliCentralMultiplicityTask::Manager* mgr = new
171 AliCentralMultiplicityTask::Manager;
174 mgr->WriteFile(1, sys, sNN, field, spdCorr, false);
178 //____________________________________________________________________
180 * Extract the energy loss correction object from file and rename it
181 * according to the settings
183 * @param fname File to extract from
184 * @param sys Collision system (pp, PbPb)
185 * @param sNN Center of mass energy (in GeV) per nucleon
186 * @param field L3 magnetic field (-5,0,5) in kGaus
188 * @ingroup pwglf_forward_scripts_corr
191 ExtractSecMap(const char* fname="forward_mccorr.root",
192 const char* sys="p-p",
196 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
198 UShort_t uSys = AliForwardUtil::ParseCollisionSystem(sys);
199 UShort_t usNN = AliForwardUtil::ParseCenterOfMassEnergy(uSys,sNN);
200 Short_t sField = AliForwardUtil::ParseMagneticField(field);
202 ExtractSecMap(fname, uSys, usNN, sField);
205 //____________________________________________________________________