]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/corrs/ExtractELoss.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[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
c8b1a7db 13 * @param mc Whether this is from MC data or not
14 * @param runNo Run number
1c762251 15 * @param sys Collision system (pp, PbPb)
16 * @param sNN Center of mass energy (in GeV) per nucleon
c8b1a7db 17 * @param fld L3 magnetic field (-5,0,5) in kGaus
18 * @param sat For satellite interactions
1c762251 19 *
bd6f5206 20 * @ingroup pwglf_forward_scripts_corr
1c762251 21 */
ab0f914c 22void
8449e3e0 23ExtractELoss(const char* fname = "forward_eloss.root",
fe218435 24 Bool_t mc=false,
25 ULong_t runNo=0,
26 UShort_t sys=0,
27 UShort_t sNN=0,
28 Short_t fld=999,
29 Bool_t sat=false)
ab0f914c 30{
fe218435 31 const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
81775aba 32 gSystem->AddIncludePath(Form("-I%s -I$ALICE_ROOT/include", fwd));
8449e3e0 33 gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
34 gROOT->LoadMacro(Form("%s/corrs/CorrExtractor.C++g", fwd));
ab0f914c 35
8449e3e0 36 CorrExtractor fmdEx(&AliForwardCorrectionManager::Instance());
81775aba 37 fmdEx.SetMC(mc);
38 if (runNo > 0) fmdEx.fRunNo = runNo;
39 if (sys > 0) fmdEx.fSys = sys;
40 if (sNN > 0) fmdEx.fSNN = sNN;
41 if (fld < 999) fmdEx.fField = fld;
42 if (sat) fmdEx.fSatellite = sat;
c8b1a7db 43 if (fmdEx.Init(fname, "ForwardELossSums", "fmd_corrections.root"))
8449e3e0 44 fmdEx.Extract(AliFMDCorrELossFit::Class(),
c8b1a7db 45 "ForwardELossResults/fmdEnergyFitter");
ab0f914c 46
f07a5032 47 std::ofstream f("Upload.C");
f07a5032 48 f << "// Generated by ExtractELoss.C\n"
8449e3e0 49 << "TString MakeDest(const TString& dest, const TString& fname)\n"
f07a5032 50 << "{\n"
8449e3e0 51 << " TString tmp(dest);\n"
52 << " if (!tmp.IsNull()) {\n"
53 << " if (!tmp.EndsWith(\"/\")) tmp.Append(\"/\");\n"
54 << " tmp.Append(fname);\n"
f07a5032 55 << " }\n"
8449e3e0 56 << " return tmp;\n"
57 << "}\n\n"
58 << "void Upload(const TString& dest=\"\")\n"
59 << "{\n"
60 << " gROOT->Macro(\"" << fwd << "/scripts/LoadLibs.C\");\n"
61 << " \n"
62 << " const char* fmdFile = \"fmd_corrections.root\";\n"
63 << " TString fdest = MakeDest(dest, fmdFile);\n"
64 << " \n"
65 << " AliForwardCorrectionManager::Instance().Append(fmdFile, fdest);\n"
f07a5032 66 << "}\n"
8449e3e0 67 << "// EOF\n"
f07a5032 68 << std::endl;
69 f.close();
ab0f914c 70}
71
72//____________________________________________________________________
73//
74// EOF
75//