AliPhysics  59e0e03 (59e0e03)
ExtractELoss.C
Go to the documentation of this file.
1 
7 //____________________________________________________________________
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_PHYSICS/PWGLF/FORWARD/analysis2";
32  gSystem->AddIncludePath(Form("-I%s "
33  "-I$ALICE_ROOT/include "
34  "-I$ALICE_PHYSICS/include ", fwd));
35  gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
36  gROOT->LoadMacro(Form("%s/corrs/CorrExtractor.C+g", fwd));
37 
38  TString fileName(fname);
39  TString sumDir("ForwardELossSums");
40  TString resDir("ForwardELossResults");
41  if (fileName.Contains("trending"))
42  sumDir = resDir = "forwardQAResults";
43 
45  fmdEx.SetMC(mc);
46  if (runNo > 0) fmdEx.fRunNo = runNo;
47  if (sys > 0) fmdEx.fSys = sys;
48  if (sNN > 0) fmdEx.fSNN = sNN;
49  if (fld < 999) fmdEx.fField = fld;
50  if (sat) fmdEx.fSatellite = sat;
51  if (fmdEx.Init(fname, sumDir, "fmd_corrections.root"))
52  fmdEx.Extract(AliFMDCorrELossFit::Class(),
53  Form("%s/fmdEnergyFitter",resDir.Data()));
54 
55  std::ofstream f("Upload.C");
56  f << "// Generated by ExtractELoss.C\n"
57  << "TString MakeDest(const TString& dest, const TString& fname)\n"
58  << "{\n"
59  << " TString tmp(dest);\n"
60  << " if (!tmp.IsNull()) {\n"
61  << " if (!tmp.EndsWith(\"/\")) tmp.Append(\"/\");\n"
62  << " tmp.Append(fname);\n"
63  << " }\n"
64  << " return tmp;\n"
65  << "}\n\n"
66  << "void Upload(const TString& dest=\"\")\n"
67  << "{\n"
68  << " gROOT->Macro(\"" << fwd << "/scripts/LoadLibs.C\");\n"
69  << " \n"
70  << " const char* fmdFile = \"fmd_corrections.root\";\n"
71  << " TString fdest = MakeDest(dest, fmdFile);\n"
72  << " \n"
73  << " AliForwardCorrectionManager::Instance().Append(fmdFile, fdest);\n"
74  << "}\n"
75  << "// EOF\n"
76  << std::endl;
77  f.close();
78 }
79 
80 //____________________________________________________________________
81 //
82 // EOF
83 //
void ExtractELoss(const char *fname="forward_eloss.root", Bool_t mc=false, ULong_t runNo=0, UShort_t sys=0, UShort_t sNN=0, Short_t fld=999, Bool_t sat=false)
Definition: ExtractELoss.C:23
TString fileName
TSystem * gSystem
Bool_t Init(const TString &fileName, const TString &sumFolder, const TString &out)
unsigned long ULong_t
Definition: External.C:38
Bool_t Extract(const TClass *cls, const TString &parent)
short Short_t
Definition: External.C:23
const char * resDir
const char * fwd
void SetMC(Bool_t mc=true)
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
static AliForwardCorrectionManager & Instance()