]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/corrs/ExtractELoss.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / corrs / ExtractELoss.C
1 /**
2  * Script to draw the energy loss fits 
3  * 
4  * @ingroup pwglf_forward_scripts_corr
5  */
6
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 mc     Whether this is from MC data or not 
14  * @param runNo  Run number 
15  * @param sys    Collision system (pp, PbPb)
16  * @param sNN    Center of mass energy (in GeV) per nucleon
17  * @param fld    L3 magnetic field (-5,0,5) in kGaus
18  * @param sat    For satellite interactions 
19  * 
20  * @ingroup pwglf_forward_scripts_corr
21  */
22 void
23 ExtractELoss(const char* fname = "forward_eloss.root",
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)
30 {
31   const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
32   gSystem->AddIncludePath(Form("-I%s -I$ALICE_ROOT/include", fwd));
33   gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
34   gROOT->LoadMacro(Form("%s/corrs/CorrExtractor.C++g", fwd));
35   
36   CorrExtractor fmdEx(&AliForwardCorrectionManager::Instance());
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;
43   if (fmdEx.Init(fname, "ForwardELossSums", "fmd_corrections.root")) 
44     fmdEx.Extract(AliFMDCorrELossFit::Class(),
45                   "ForwardELossResults/fmdEnergyFitter");
46
47   std::ofstream f("Upload.C");
48   f << "// Generated by ExtractELoss.C\n"
49     << "TString MakeDest(const TString& dest, const TString& fname)\n"
50     << "{\n"
51     << "  TString tmp(dest);\n"
52     << "  if (!tmp.IsNull()) {\n"
53     << "    if (!tmp.EndsWith(\"/\")) tmp.Append(\"/\");\n"
54     << "    tmp.Append(fname);\n"
55     << "  }\n"
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"
66     << "}\n"
67     << "// EOF\n"
68     << std::endl;
69   f.close();
70 }
71
72 //____________________________________________________________________
73 //
74 // EOF
75 //