AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeMultDistsTrain.C
Go to the documentation of this file.
1 
13 #include "TrainSetup.C"
14 
15 //====================================================================
25 {
26 public:
32  MakeMultDistsTrain(const char* name)
33  : TrainSetup(name)
34  {
35  fOptions.Add("trig", "TYPE", "Trigger type", "V0AND");
36  fOptions.Add("ipz-min", "CENTIMETER", "Min Ip Z", -4);
37  fOptions.Add("ipz-max", "CENTIMETER", "Max Ip Z", +4);
38  fOptions.Add("phi-acc", "Use stored phi acceptance", false);
39  fOptions.Add("asymmetric", "Make asymmetric (+/-) bins", false);
40  }
41 protected:
47  {
48  // --- Output file name ------------------------------------------
49  AliAnalysisManager::SetCommonFileName("forward_multdists.root");
50 
51  // --- Load libraries/pars ---------------------------------------
52  fRailway->LoadLibrary("PWGLFforward2");
53 
54  // --- Set load path ---------------------------------------------
55  gROOT->SetMacroPath(Form("%s:$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2",
56  gROOT->GetMacroPath()));
57 
58  // --- Get parameters --------------------------------------------
59  TString trig = fOptions.AsString("trig", "V0AND");
60  Double_t vzMin = fOptions.AsDouble("vzmin", -4);
61  Double_t vzMax = fOptions.AsDouble("vzmax", +4);
62  Bool_t phiAcc = fOptions.AsBool("phi-acc");
63  Bool_t aSymm = fOptions.AsBool("asymmetric");
64 
65  // --- Form arguments --------------------------------------------
66  TString args;
67  args.Form("\"%s\",%f,%f,%d,%d",
68  trig.Data(), vzMin, vzMax, phiAcc, aSymm);
69  // --- Add the task ----------------------------------------------
70  CoupleSECar("AddTaskForwardMultDists.C(%s)", args,AliVEvent::kAny);
71 );
72  AddMonitor("ForwardMultSums");
73  }
74  //__________________________________________________________________
78  //__________________________________________________________________
85  AliVEventHandler* CreateMCHandler(UShort_t, bool) { return 0; }
86  //__________________________________________________________________
92  AliVEventHandler* CreateOutputHandler(UShort_t) { return 0; }
93  //__________________________________________________________________
94  const char* ClassName() const { return "MakeMultDistsTrain"; }
95  //__________________________________________________________________
101  void SaveSetup(Bool_t asShellScript)
102  {
103  TrainSetup::SaveSetup(asShellScript);
104 
105  SaveSummarize();
106  SaveUnfold();
107  SaveDraw();
108  }
109  void SaveUnfold()
110  {
111  std::ofstream f("Unfold.C");
112  if (!f) {
113  Error("SaveUnfold", "Failed to open Unfold.C script");
114  return;
115  }
116  f << "// Generated by " << ClassName() << "\n"
117  << "void Unfold(const char* other=\"\",\n"
118  << " Double_t regP=20,\n"
119  << " const char* here=\"forward_multdists.root\")\n"
120  << "{\n"
121  << " const char* rooUnfold = gSystem->Getenv(\"ROOUNFOLD\");\n"
122  << " if (rooUnfold) {\n"
123  << " gSystem->AddIncludePath(Form(\"-I%s/src\",rooUnfold));\n"
124  << " gSystem->AddDynamicPath(Form(\"%s\", rooUnfold));\n"
125  << " }\n"
126  << " gSystem->Load(\"libRooUnfold\");\n"
127  << " const char* fwd=\"$ALICE_PHYSICS/PWGLF/FORWARD/analysis2\";\n"
128  << " gROOT->LoadMacro(Form(\"%s/scripts/UnfoldMultDists.C++g\",fwd));\n"
129  << " UnfoldMultDists(\"bayes\",regP,here,other);\n"
130  << "}\n"
131  << "// EOF" << std::endl;
132 
133  f.close();
134  }
136  {
137  std::ofstream f("Summarize.C");
138  if (!f) {
139  Error("SaveSummarize", "Failed to open Summarize.C script");
140  return;
141  }
142  f << "// Generated by " << ClassName() << "\n"
143  << "// WHAT is a bit mask of\n"
144  << "// 0x001 Forward\n"
145  << "// 0x002 Central\n"
146  << "// 0x004 Sums\n"
147  << "// 0x008 Results\n"
148  << "// 0x010 Only min-bias (no centrality)\n"
149  << "// 0x020 Landscape\n"
150  << "// 0x040 Pause\n"
151  << "//\n"
152  << "void Summarize(const char* filename=\"forward_multdists.root\",\n"
153  << " UShort_t what=0xF)\n"
154  << "{\n"
155  << " const char* fwd=\"$ALICE_PHYSICS/PWGLF/FORWARD/analysis2\";\n"
156  << " gROOT->LoadMacro(Form(\"%s/DrawMultDistsSummary.C\",fwd));\n"
157  << " DrawMultDistsSummary(filename,what);\n"
158  << "}\n"
159  << "// EOF" << std::endl;
160  f.close();
161  }
162  void SaveDraw()
163  {
164  std::ofstream f("Draw.C");
165  if (!f) {
166  Error("SaveSummarize", "Failed to open Summarize.C script");
167  return;
168  }
169  f << "// Generated by " << ClassName() << "\n"
170  << "// WHAT is a bit mask of\n"
171  << "// 0x001 Forward\n"
172  << "// 0x002 Central\n"
173  << "// 0x004 Sums\n"
174  << "// 0x008 Results\n"
175  << "// 0x010 Only min-bias (no centrality)\n"
176  << "// 0x020 Landscape\n"
177  << "// 0x040 Pause\n"
178  << "//\n"
179  << "void Draw(const char* filename=\"forward_unfolded.root\",\n"
180  << " UShort_t what=0xF)\n"
181  << "{\n"
182  << " const char* fwd=\"$ALICE_PHYSICS/PWGLF/FORWARD/analysis2\";\n"
183  << " gROOT->LoadMacro(Form(\"%s/DrawUnfoldedSummary.C\",fwd));\n"
184  << " DrawUnfoldedSummary(filename);\n"
185  << "}\n"
186  << "// EOF" << std::endl;
187  f.close();
188  }
189  void PostShellCode(std::ostream& f)
190  {
191  f << " echo \"=== Summarizing results ...\"\n"
192  << " aliroot -l -b -q ${prefix}Summarize.C\n"
193  << " echo \"=== Unfolding ...\"\n"
194  << " export ROOUNFOLD=${HOME}/tmp/RooUnfoldMyEdits\n"
195  << " mc=\n"
196  << " if test x$dest != x ; then mc=${dest}/forward_multdists.root; fi\n"
197  << " aliroot -l -b -q ${prefix}Unfold.C\\(\\\"${mc}\\\"\\)\n"
198  << " aliroot -l -b -q ${prefix}Draw.C\n"
199  << std::endl;
200  }
201 };
202 //
203 // EOF
204 //
Double_t AsDouble(const TString &name, Double_t def=0) const
Definition: Option.C:673
double Double_t
Definition: External.C:58
Railway * fRailway
Definition: TrainSetup.C:1666
Bool_t AsBool(const TString &name) const
Definition: Option.C:631
const char * AsString(const TString &name, const TString &def="") const
Definition: Option.C:687
MakeMultDistsTrain(const char *name)
void PostShellCode(std::ostream &f)
void CreateTasks(AliAnalysisManager *)
Base classs for train specifications.
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1471
AliVEventHandler * CreateMCHandler(UShort_t, bool)
OptionList fOptions
Definition: TrainSetup.C:1665
void SaveSetup(Bool_t asShellScript)
unsigned short UShort_t
Definition: External.C:28
AliVEventHandler * CreateOutputHandler(UShort_t)
const char * ClassName() const
void CreateCentralitySelection(Bool_t)
bool Bool_t
Definition: External.C:53
virtual void AddMonitor(const TString &name)
Definition: TrainSetup.C:1333
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, const TString &args, UInt_t mask=0)
Definition: TrainSetup.C:875
virtual Bool_t LoadLibrary(const TString &name, Bool_t slave=true, Bool_t forcePar=false)=0