AliPhysics  b76e98e (b76e98e)
ExtractMCCorr.C
Go to the documentation of this file.
1 
7 //____________________________________________________________________
21 void
22 ExtractMCCorr(const char* fname,
23  ULong_t runNo=0,
24  UShort_t sys=0,
25  UShort_t sNN=0,
26  Short_t fld=999,
27  Bool_t sat=false)
28 {
29  const char* fwd = "$ALICE_PHYSICS/PWGLF/FORWARD/analysis2";
30  gSystem->AddIncludePath(Form("-I%s -I$ALICE_PHYSICS/include", fwd));
31  gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
32  gROOT->LoadMacro(Form("%s/corrs/CorrExtractor.C++g", fwd));
33 
35  if (runNo > 0) fmdEx.fRunNo = runNo;
36  if (sys > 0) fmdEx.fSys = sys;
37  if (sNN > 0) fmdEx.fSNN = sNN;
38  if (fld < 999) fmdEx.fField = fld;
39  if (sat) fmdEx.fSatellite = sat;
40  if (fmdEx.Init(fname, "ForwardCorrSums", "fmd_corrections.root"))
41  fmdEx.Extract(AliFMDCorrSecondaryMap::Class(),
42  "ForwardCorrResults");
43 
45  if (runNo > 0) spdEx.fRunNo = runNo;
46  if (sys > 0) spdEx.fSys = sys;
47  if (sNN > 0) spdEx.fSNN = sNN;
48  if (fld < 999) spdEx.fField = fld;
49  if (sat) spdEx.fSatellite = sat;
50  if (spdEx.Init(fname, "CentralCorrSums", "spd_corrections.root")) {
51  spdEx.Extract(AliCentralCorrSecondaryMap::Class(), "CentralCorrResults");
52  spdEx.Extract(AliCentralCorrAcceptance::Class(), "CentralCorrResults");
53  }
54 
55  std::ofstream f("Upload.C");
56  f << "// Generated by ExtractMCCorr.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  << " const char* spdFile = \"spd_corrections.root\";\n"
72  << " TString fdest = MakeDest(dest, fmdFile);\n"
73  << " TString sdest = MakeDest(dest, spdFile);\n"
74  << " \n"
75  << " AliForwardCorrectionManager::Instance().Append(fmdFile, fdest);\n"
76  << " AliCentralCorrectionManager::Instance().Append(spdFile, sdest);\n"
77  << "}\n"
78  << "// EOF\n"
79  << std::endl;
80  f.close();
81 }
82 
83 //____________________________________________________________________
84 //
85 // EOF
86 //
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 * fwd
void ExtractMCCorr(const char *fname, ULong_t runNo=0, UShort_t sys=0, UShort_t sNN=0, Short_t fld=999, Bool_t sat=false)
Definition: ExtractMCCorr.C:22
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
static AliCentralCorrectionManager & Instance()
static AliForwardCorrectionManager & Instance()