]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/corrs/ExtractMCCorr.C
Mega commit of many changes to PWGLFforward
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / corrs / ExtractMCCorr.C
CommitLineData
d4d8f032 1/**
2 * Script to draw the energy loss fits
3 *
4 * @ingroup pwglf_forward_scripts_corr
5 */
8449e3e0 6
d4d8f032 7//____________________________________________________________________
8/**
9 * Extract the energy loss correction object from file and rename it
10 * according to the settings
11 *
12 * @param fname File to extract from
13 * @param sys Collision system (pp, PbPb)
14 * @param sNN Center of mass energy (in GeV) per nucleon
15 * @param field L3 magnetic field (-5,0,5) in kGaus
16 *
17 * @ingroup pwglf_forward_scripts_corr
18 */
19void
8449e3e0 20ExtractMCCorr(const char* fname)
d4d8f032 21{
8449e3e0 22 const char* fwd = "$ALICE_ROOT/../trunk/PWGLF/FORWARD/analysis2";
23 gSystem->AddIncludePath(Form("-I%s", fwd));
24 gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
25 gROOT->LoadMacro(Form("%s/corrs/CorrExtractor.C++g", fwd));
26
27 CorrExtractor fmdEx(&AliForwardCorrectionManager::Instance());
28 if (fmdEx.Init(fname, "ForwardCorrSums", "fmd_corrections.root")) {
29 fmdEx.Extract(AliFMDCorrSecondaryMap::Class(),
30 "ForwardCorrResults");
d4d8f032 31 }
32
8449e3e0 33 CorrExtractor spdEx(&AliCentralCorrectionManager::Instance());
34 if (spdEx.Init(fname, "CentralCorrSums", "spd_corrections.root")) {
35 spdEx.Extract(AliCentralCorrSecondaryMap::Class(), "CentralCorrResults");
36 spdEx.Extract(AliCentralCorrAcceptance::Class(), "CentralCorrResults");
37 }
f07a5032 38
f07a5032 39 std::ofstream f("Upload.C");
f07a5032 40 f << "// Generated by ExtractMCCorr.C\n"
8449e3e0 41 << "TString MakeDest(const TString& dest, const TString& fname)\n"
f07a5032 42 << "{\n"
8449e3e0 43 << " TString tmp(dest);\n"
44 << " if (!tmp.IsNull()) {\n"
45 << " if (!tmp.EndsWith(\"/\")) tmp.Append(\"/\");\n"
46 << " tmp.Append(fname);\n"
47 << " }\n"
48 << " return tmp;\n"
49 << "}\n\n"
50 << "void Upload(const TString& dest=\"\")\n"
51 << "{\n"
52 << " gROOT->Macro(\"" << fwd << "/scripts/LoadLibs.C\");\n"
53 << " \n"
54 << " const char* fmdFile = \"fmd_corrections.root\";\n"
55 << " const char* spdFile = \"spd_corrections.root\";\n"
56 << " TString fdest = MakeDest(dest, fmdFile);\n"
57 << " TString sdest = MakeDest(dest, spdFile);\n"
58 << " \n"
59 << " AliForwardCorrectionManager::Instance().Append(fmdFile, fdest);\n"
60 << " AliCentralCorrectionManager::Instance().Append(spdFile, sdest);\n"
f07a5032 61 << "}\n"
8449e3e0 62 << "// EOF\n"
f07a5032 63 << std::endl;
64 f.close();
d4d8f032 65}
66
d4d8f032 67//____________________________________________________________________
68//
69// EOF
70//