]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/corrs/ExtractELoss.C
Mega commit of many changes to PWGLFforward
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / corrs / ExtractELoss.C
CommitLineData
ab0f914c 1/**
2 * Script to draw the energy loss fits
3 *
bd6f5206 4 * @ingroup pwglf_forward_scripts_corr
ab0f914c 5 */
ab0f914c 6
7//____________________________________________________________________
1c762251 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 * @param mc Whether this is from MC data or not
17 *
bd6f5206 18 * @ingroup pwglf_forward_scripts_corr
1c762251 19 */
ab0f914c 20void
8449e3e0 21ExtractELoss(const char* fname = "forward_eloss.root",
22 Bool_t mc=false)
ab0f914c 23{
8449e3e0 24 const char* fwd = "$ALICE_ROOT/../trunk/PWGLF/FORWARD/analysis2";
25 gSystem->AddIncludePath(Form("-I%s", fwd));
26 gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
27 gROOT->LoadMacro(Form("%s/corrs/CorrExtractor.C++g", fwd));
ab0f914c 28
8449e3e0 29 CorrExtractor fmdEx(&AliForwardCorrectionManager::Instance());
30 if (fmdEx.Init(fname, "Forward", "fmd_corrections.root")) {
31 fmdEx.SetMC(mc);
32 fmdEx.Extract(AliFMDCorrELossFit::Class(),
33 "ForwardResults/fmdEnergyFitter");
ab0f914c 34 }
35
f07a5032 36 std::ofstream f("Upload.C");
f07a5032 37 f << "// Generated by ExtractELoss.C\n"
8449e3e0 38 << "TString MakeDest(const TString& dest, const TString& fname)\n"
f07a5032 39 << "{\n"
8449e3e0 40 << " TString tmp(dest);\n"
41 << " if (!tmp.IsNull()) {\n"
42 << " if (!tmp.EndsWith(\"/\")) tmp.Append(\"/\");\n"
43 << " tmp.Append(fname);\n"
f07a5032 44 << " }\n"
8449e3e0 45 << " return tmp;\n"
46 << "}\n\n"
47 << "void Upload(const TString& dest=\"\")\n"
48 << "{\n"
49 << " gROOT->Macro(\"" << fwd << "/scripts/LoadLibs.C\");\n"
50 << " \n"
51 << " const char* fmdFile = \"fmd_corrections.root\";\n"
52 << " TString fdest = MakeDest(dest, fmdFile);\n"
53 << " \n"
54 << " AliForwardCorrectionManager::Instance().Append(fmdFile, fdest);\n"
f07a5032 55 << "}\n"
8449e3e0 56 << "// EOF\n"
f07a5032 57 << std::endl;
58 f.close();
ab0f914c 59}
60
61//____________________________________________________________________
62//
63// EOF
64//