]>
Commit | Line | Data |
---|---|---|
8b1c306c | 1 | /** |
2 | * Script to draw the energy loss fits | |
3 | * | |
bd6f5206 | 4 | * @ingroup pwglf_forward_scripts_corr |
8b1c306c | 5 | */ |
6 | #ifndef __CINT__ | |
7 | #include <TFile.h> | |
8 | #include <TList.h> | |
9 | #include <TError.h> | |
10 | #include "AliFMDCorrSecondaryMap.h" | |
11 | #include "AliCentralCorrSecondaryMap.h" | |
12 | #include "AliForwardCorrectionManager.h" | |
13 | #endif | |
14 | ||
15 | //____________________________________________________________________ | |
16 | /** | |
17 | * Extract the energy loss correction object from file and rename it | |
18 | * according to the settings | |
19 | * | |
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 | |
24 | * | |
bd6f5206 | 25 | * @ingroup pwglf_forward_scripts_corr |
8b1c306c | 26 | */ |
27 | void | |
28 | ExtractSecMap(const char* fname, | |
29 | UShort_t sys=1, UShort_t sNN=900, Short_t field=5) | |
30 | { | |
31 | #ifdef __CINT__ | |
bd6f5206 | 32 | gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C"); |
8b1c306c | 33 | #endif |
34 | ||
35 | TFile* file = TFile::Open(fname, "READ"); | |
36 | if (!file) { | |
37 | Error("ExtractSecMap", "Couldn't open %s", fname); | |
38 | return; | |
39 | } | |
f07a5032 | 40 | if (sys <= 0 || sys > 3) { |
41 | TList* forward = static_cast<TList*>(file->Get("ForwardSums")); | |
42 | if (!forward) { | |
43 | Error("ExtractSecMap", "Couldn't get forward list from %s", fname); | |
44 | return; | |
45 | } | |
46 | TList* insp = static_cast<TList*>(forward->FindObject("fmdEventInspector")); | |
47 | if (!insp) { | |
48 | Error("ExtractSecMap", "Couldn't get event inspector list from %s",fname); | |
49 | return; | |
50 | } | |
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(); | |
57 | } | |
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); | |
62 | return; | |
63 | } | |
8b1c306c | 64 | |
65 | ExtractFMDSecMap(file, sys, sNN, field); | |
66 | ExtractSPDSecMap(file, sys, sNN, field); | |
f07a5032 | 67 | ExtractSPDAcceptance(file, sys, sNN, field); |
8b1c306c | 68 | } |
69 | ||
70 | //____________________________________________________________________ | |
71 | /** | |
72 | * Extract and copy FMD secondary map to file | |
73 | * | |
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 | |
78 | * | |
bd6f5206 | 79 | * @ingroup pwglf_forward_scripts_corr |
8b1c306c | 80 | */ |
81 | void | |
82 | ExtractFMDSecMap(TFile* file, UShort_t sys, UShort_t sNN, Short_t field) | |
83 | { | |
84 | TList* forward = static_cast<TList*>(file->Get("ForwardResults")); | |
bd6f5206 | 85 | // static_cast<TList*>(file->Get("PWGLFforwardDnDeta/Forward")); |
8b1c306c | 86 | if (!forward) { |
87 | Error("ExtractSecMap", "Couldn't get forward list from %s", fname); | |
88 | return; | |
89 | } | |
90 | ||
91 | TString n(AliFMDCorrSecondaryMap::Class()->GetName()); | |
92 | TObject* fmdCorr = forward->FindObject(n); | |
93 | if (!fmdCorr) { | |
94 | Error("ExtractSecMap", "Couldn't get forward correction object %s", | |
95 | n.Data()); | |
96 | return; | |
97 | } | |
98 | ||
99 | AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance(); | |
100 | mgr.WriteFile(AliForwardCorrectionManager::kSecondaryMap, | |
101 | sys, sNN, field, false, fmdCorr, false); | |
102 | } | |
103 | ||
104 | //____________________________________________________________________ | |
105 | /** | |
106 | * Extract and copy SPD secondary map to file | |
107 | * | |
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 | |
112 | * | |
bd6f5206 | 113 | * @ingroup pwglf_forward_scripts_corr |
8b1c306c | 114 | */ |
115 | void | |
116 | ExtractSPDSecMap(TFile* file, UShort_t sys, UShort_t sNN, Short_t field) | |
117 | { | |
118 | TList* central = static_cast<TList*>(file->Get("CentralResults")); | |
bd6f5206 | 119 | // static_cast<TList*>(file->Get("PWGLFcentralDnDeta/Central")); |
8b1c306c | 120 | if (!central) { |
121 | Error("ExtractSecMap", "Couldn't get central list from %s", fname); | |
122 | return; | |
123 | } | |
124 | ||
125 | TString n(AliCentralCorrSecondaryMap::Class()->GetName()); | |
126 | TObject* spdCorr = central->FindObject(n); | |
127 | if (!spdCorr) { | |
128 | Error("ExtractSecMap", "Couldn't get central correction object %s", | |
129 | n.Data()); | |
130 | return; | |
131 | } | |
132 | ||
133 | ||
134 | AliCentralMultiplicityTask::Manager* mgr = new | |
135 | AliCentralMultiplicityTask::Manager; | |
136 | // mgr->Dump(); | |
f07a5032 | 137 | // mgr->Print(); |
8b1c306c | 138 | mgr->WriteFile(0, sys, sNN, field, spdCorr, false); |
f07a5032 | 139 | } |
140 | //____________________________________________________________________ | |
141 | /** | |
142 | * Extract and copy SPD secondary map to file | |
143 | * | |
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 | |
148 | * | |
149 | * @ingroup pwglf_forward_scripts_corr | |
150 | */ | |
151 | void | |
152 | ExtractSPDAcceptance(TFile* file, UShort_t sys, UShort_t sNN, Short_t field) | |
153 | { | |
154 | TList* central = static_cast<TList*>(file->Get("CentralResults")); | |
155 | // static_cast<TList*>(file->Get("PWGLFcentralDnDeta/Central")); | |
156 | if (!central) { | |
157 | Error("ExtractAcceptance", "Couldn't get central list from %s", fname); | |
158 | return; | |
159 | } | |
160 | ||
161 | TString n(AliCentralCorrAcceptance::Class()->GetName()); | |
162 | TObject* spdCorr = central->FindObject(n); | |
163 | if (!spdCorr) { | |
164 | Error("ExtractAcceptance", "Couldn't get central correction object %s", | |
165 | n.Data()); | |
166 | return; | |
167 | } | |
168 | ||
169 | ||
170 | AliCentralMultiplicityTask::Manager* mgr = new | |
171 | AliCentralMultiplicityTask::Manager; | |
172 | // mgr->Dump(); | |
173 | // mgr->Print(); | |
174 | mgr->WriteFile(1, sys, sNN, field, spdCorr, false); | |
8b1c306c | 175 | } |
176 | ||
177 | ||
178 | //____________________________________________________________________ | |
179 | /** | |
180 | * Extract the energy loss correction object from file and rename it | |
181 | * according to the settings | |
182 | * | |
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 | |
8b1c306c | 187 | * |
bd6f5206 | 188 | * @ingroup pwglf_forward_scripts_corr |
8b1c306c | 189 | */ |
190 | void | |
191 | ExtractSecMap(const char* fname="forward_mccorr.root", | |
192 | const char* sys="p-p", | |
193 | Float_t sNN=900, | |
194 | Float_t field=5) | |
195 | { | |
bd6f5206 | 196 | gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C"); |
8b1c306c | 197 | |
198 | UShort_t uSys = AliForwardUtil::ParseCollisionSystem(sys); | |
199 | UShort_t usNN = AliForwardUtil::ParseCenterOfMassEnergy(uSys,sNN); | |
200 | Short_t sField = AliForwardUtil::ParseMagneticField(field); | |
201 | ||
202 | ExtractSecMap(fname, uSys, usNN, sField); | |
203 | } | |
204 | ||
205 | //____________________________________________________________________ | |
206 | // | |
207 | // EOF | |
208 | // |