AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Correct.C
Go to the documentation of this file.
1 #ifndef __CINT__
2 # include <TObject.h>
3 # include <TSystem.h>
4 # include <TROOT.h>
5 # include <TFile.h>
6 void SimpleCorrect(UShort_t,UShort_t,const char*,const char*,Int_t,const char*);
7 #else
8 class TCanvas;
9 #endif
10 const Bool_t kCorrectLoaded = true;
11 namespace CorrectNS {
12  void AddPath(const TString& dir, Bool_t prepend=true)
13  {
14  TString d(gSystem->ExpandPathName(dir.Data()));
15  gSystem->AddIncludePath(Form("-I%s", d.Data()));
16  const char* oldPath = gROOT->GetMacroPath();
17  gROOT->SetMacroPath(Form(".:%s:%s",
18  prepend ? d.Data() : oldPath,
19  prepend ? oldPath : d.Data()));
20  }
21 }
22 
23 void
24 Correct(UShort_t flags=0x3,
25  const char* side="middle",
26  const char* var="none",
27  Bool_t forceK=false)
28 {
29  const char* fwd = "$ALICE_PHYSICS/PWGLF/FORWARD/analysis2";
30  if (gSystem->Getenv("ANA_SRC")) fwd = gSystem->Getenv("ANA_SRC");
31  CorrectNS::AddPath(TString::Format("%s/dndeta/tracklets", fwd));
32  if (!gROOT->GetListOfGlobals()->FindObject("kSimpleCorrectLoaded"))
33  gROOT->LoadMacro("SimpleCorrect.C");
34  TString v(var);
35  if (v.EqualTo("PtPidStrK")) { forceK = true; v = "PtPidStr"; }
36  Printf("Processing dt_%s_%s/trdt.root and mc_%s_%s/trmc.root",
37  side, "none", side, v.Data());
38  SimpleCorrect(flags, TString(var).EqualTo("none") || forceK ? 2 : 3,
39  Form("dt_%s_%s/trdt.root", side, "none"),
40  Form("mc_%s_%s/trmc.root", side, v.Data()),
41  9,
42  "");
43  TString resFile;
44  resFile.Form("result_0x%x.root", flags & 0x3);
45  TObject* resObj = gROOT->GetListOfFiles()->FindObject(resFile);
46  if (resObj) {
47  TFile* tmp = static_cast<TFile*>(resObj);
48  Printf("Closing %s", tmp->GetName());
49  tmp->Close();
50  }
51  gSystem->mkdir("partial", 1);
52  TString dest;
53  dest.Form("partial/%s_%s_0x%x.root", side, var, flags&0x3);
54  Printf("%s -> %s", resFile.Data(), dest.Data());
55  gSystem->Rename(resFile, dest);
56 }
57 
58 
59 
TSystem * gSystem
void SimpleCorrect(UShort_t, UShort_t, const char *, const char *, Int_t, const char *)
int Int_t
Definition: External.C:63
void AddPath(const TString &dir, Bool_t prepend=true)
Definition: Correct.C:12
const char * fwd
unsigned short UShort_t
Definition: External.C:28
const Bool_t kCorrectLoaded
Definition: Correct.C:10
bool Bool_t
Definition: External.C:53
void Correct(UShort_t flags=0x3, const char *side="middle", const char *var="none", Bool_t forceK=false)
Definition: Correct.C:24
TDirectoryFile * dir