]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/corrs/ExtractSecMap.C
Fixed references from PWG2 -> PWGLF - very efficiently done using ETags.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / corrs / ExtractSecMap.C
CommitLineData
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 */
27void
28ExtractSecMap(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 }
40
41 ExtractFMDSecMap(file, sys, sNN, field);
42 ExtractSPDSecMap(file, sys, sNN, field);
43}
44
45//____________________________________________________________________
46/**
47 * Extract and copy FMD secondary map to file
48 *
49 * @param file Input file
50 * @param sys Collision system (1:pp, 2:PbPb)
51 * @param sNN Center of mass energy (GeV) per nucleon
52 * @param field L3 magnetic field
53 *
bd6f5206 54 * @ingroup pwglf_forward_scripts_corr
8b1c306c 55 */
56void
57ExtractFMDSecMap(TFile* file, UShort_t sys, UShort_t sNN, Short_t field)
58{
59 TList* forward = static_cast<TList*>(file->Get("ForwardResults"));
bd6f5206 60 // static_cast<TList*>(file->Get("PWGLFforwardDnDeta/Forward"));
8b1c306c 61 if (!forward) {
62 Error("ExtractSecMap", "Couldn't get forward list from %s", fname);
63 return;
64 }
65
66 TString n(AliFMDCorrSecondaryMap::Class()->GetName());
67 TObject* fmdCorr = forward->FindObject(n);
68 if (!fmdCorr) {
69 Error("ExtractSecMap", "Couldn't get forward correction object %s",
70 n.Data());
71 return;
72 }
73
74 AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance();
75 mgr.WriteFile(AliForwardCorrectionManager::kSecondaryMap,
76 sys, sNN, field, false, fmdCorr, false);
77}
78
79//____________________________________________________________________
80/**
81 * Extract and copy SPD secondary map to file
82 *
83 * @param file Input file
84 * @param sys Collision system (1:pp, 2:PbPb)
85 * @param sNN Center of mass energy (GeV) per nucleon
86 * @param field L3 magnetic field
87 *
bd6f5206 88 * @ingroup pwglf_forward_scripts_corr
8b1c306c 89 */
90void
91ExtractSPDSecMap(TFile* file, UShort_t sys, UShort_t sNN, Short_t field)
92{
93 TList* central = static_cast<TList*>(file->Get("CentralResults"));
bd6f5206 94 // static_cast<TList*>(file->Get("PWGLFcentralDnDeta/Central"));
8b1c306c 95 if (!central) {
96 Error("ExtractSecMap", "Couldn't get central list from %s", fname);
97 return;
98 }
99
100 TString n(AliCentralCorrSecondaryMap::Class()->GetName());
101 TObject* spdCorr = central->FindObject(n);
102 if (!spdCorr) {
103 Error("ExtractSecMap", "Couldn't get central correction object %s",
104 n.Data());
105 return;
106 }
107
108
109 AliCentralMultiplicityTask::Manager* mgr = new
110 AliCentralMultiplicityTask::Manager;
111 // mgr->Dump();
112 mgr->Print();
113 mgr->WriteFile(0, sys, sNN, field, spdCorr, false);
114}
115
116
117//____________________________________________________________________
118/**
119 * Extract the energy loss correction object from file and rename it
120 * according to the settings
121 *
122 * @param fname File to extract from
123 * @param sys Collision system (pp, PbPb)
124 * @param sNN Center of mass energy (in GeV) per nucleon
125 * @param field L3 magnetic field (-5,0,5) in kGaus
8b1c306c 126 *
bd6f5206 127 * @ingroup pwglf_forward_scripts_corr
8b1c306c 128 */
129void
130ExtractSecMap(const char* fname="forward_mccorr.root",
131 const char* sys="p-p",
132 Float_t sNN=900,
133 Float_t field=5)
134{
bd6f5206 135 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
8b1c306c 136
137 UShort_t uSys = AliForwardUtil::ParseCollisionSystem(sys);
138 UShort_t usNN = AliForwardUtil::ParseCenterOfMassEnergy(uSys,sNN);
139 Short_t sField = AliForwardUtil::ParseMagneticField(field);
140
141 ExtractSecMap(fname, uSys, usNN, sField);
142}
143
144//____________________________________________________________________
145//
146// EOF
147//