Moved old macros for lego_train into lego_train/old folder
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / lego_train / old / RsnManagerTrain.C
CommitLineData
dc8dd82a 1TList *RsnManagerTrain(TString addRsnManager="AddRsnToManagerTrain.C",
2 Int_t isESD=0,
3 Int_t isMC=0,
4 Int_t isPP=1,
5 Int_t useRsnMini = 1,
6 Int_t useMixing = 0,
7 Int_t numMix = 10,
8 Int_t fullOutput = 1)
9{
10
11 // sets Rsn Lego train path
12 TString legoTrainPath = "$ALICE_ROOT/PWGLF/RESONANCES/macros/lego_train";
13
14 // creates list
15 TList *listRsn = new TList();
16
17 TString commonCutOption="";
18 commonCutOption = "mon";
19
20 Printf("Adding RsnManger : %s",addRsnManager.Data());
21 AddResonanceToRsnManager(listRsn,addRsnManager.Data(),legoTrainPath.Data());
22
23 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
24 if (!mgr) {
25 Printf("Error[RsnManager] mgr is null !!!");
26 return 0;
27 }
28
29 Bool_t valid;
30 AliAnalysisManager::GetGlobalStr("rsnLegoTrainPath",valid);
31 if (valid) {
32 return list;
33 }
34
35 Printf("Setting up RSN variables ...");
36 AliAnalysisManager::SetGlobalStr("rsnLegoTrainPath",legoTrainPath.Data());
37 AliAnalysisManager::SetGlobalInt("rsnIsPP",isPP);
38 AliAnalysisManager::SetGlobalInt("rsnUseMC",isMC);
39 AliAnalysisManager::SetGlobalInt("rsnUseMiniPackage",useRsnMini);
40
41 // mixing setting
42 AliAnalysisManager::SetGlobalInt("rsnUseMixing",useMixing);
43 AliAnalysisManager::SetGlobalInt("rsnNumMix",numMix);
44
45 // oputput settings
46 AliAnalysisManager::SetGlobalInt("rsnOutputFull",fullOutput);
47
48 // expert options (don't change)
49 AliAnalysisManager::SetGlobalInt("rsnMixPrintRefresh",-1);
50
51 AliAnalysisManager::SetGlobalStr("rsnLegoTrainCommonCutOption",commonCutOption.Data());
52
53 return listRsn;
54}
55
56Bool_t AddResonanceToRsnManager(TList *listRsn,TString rsnAddMacro="AddRsnToManagerPhi.C",TString path="") {
57 if (!listRsn) return kFALSE;
58
59 RsnManagerLoadMacro(rsnAddMacro,path);
60 rsnAddMacro.ReplaceAll(".C","");
61 gROOT->ProcessLine(TString::Format("%s((TList*)%p)",rsnAddMacro.Data(),listRsn).Data());
62
63 return kTRUE;
64}
65
66Bool_t RsnManagerLoadMacro(TString macro,TString path="") {
67
68 TString lego_path=path;
69
70 if (lego_path.IsNull()) {
71 Bool_t valid;
72 lego_path = AliAnalysisManager::GetGlobalStr("rsnLegoTrainPath",valid);
73 if (!valid) lego_path = "$ALICE_ROOT/PWG2/RESONANCES/macros/lego_train";
74 }
75 if (!gSystem->AccessPathName(macro.Data())) {
76 gROOT->LoadMacro(macro.Data());
77 Printf("Macro loaded from %s/%s ...",gSystem->pwd(),macro.Data());
78 return kTRUE;
79 }
80
81 if (!gSystem->AccessPathName(gSystem->ExpandPathName(Form("%s/%s",lego_path.Data(),macro.Data())))) {
82 gROOT->LoadMacro(gSystem->ExpandPathName(Form("%s/%s",lego_path.Data(),macro.Data())));
83 Printf("Macro loaded from %s ...",gSystem->ExpandPathName(Form("%s/%s",lego_path.Data(),macro.Data())));
84 return kTRUE;
85 }
86
87 Printf("Error loading %s",macro.Data());
88
89 return kFALSE;
90}
91