28 #include <TGApplication.h> 32 #include <TObjString.h> 46 : TTimer(1000, false),
63 if (&o ==
this)
return *
this;
92 gROOT->SetMacroPath(Form(
"%s:%s",gROOT->GetMacroPath(),
dir));
93 gSystem->AddIncludePath(Form(
"-I%s", dir));
107 o <<
" --" << std::left << std::setw(30) << opt <<
" " << desc
108 << std::right << std::endl;
113 o <<
"Usage: " << progname
114 <<
" --class=CLASS --name=NAME --url=URI [OPTIONS]\n\n" 115 << progname <<
" specific options:\n";
118 PrintFakeOption(o,
"include=DIRECTORY",
"Append dir to macro/header path");
131 void Usage(
const char* progname, std::ostream& o)
135 o <<
"\nAlternatively to using --url=URI, one can use\n";
170 for (
int i = 1; i < argc; i++) {
171 if (argv[i][0] ==
'-' && argv[i][1] ==
'-') {
174 arg.ReplaceAll(
"\"'",
"");
175 Int_t eq = arg.Index(
"=");
176 if (eq != kNPOS) val = arg(eq+1, arg.Length()-eq-1);
177 if (arg.BeginsWith(
"--class")) cls = val;
178 else if (arg.BeginsWith(
"--name")) name = val;
179 else if (arg.BeginsWith(
"--include")) paths.Add(
new TObjString(val));
180 else if (arg.BeginsWith(
"--define")) defines.Add(
new TObjString(val));
181 else if (arg.BeginsWith(
"--batch")) batch =
true;
182 else if (arg.BeginsWith(
"--help")) help =
true;
183 else if (arg.BeginsWith(
"--where")) where = val;
184 else if (arg.BeginsWith(
"--file")) file = val;
185 else if (arg.BeginsWith(
"--opts")) opts = val;
186 else if (arg.BeginsWith(
"--anchor")) anchor = val;
187 else if (arg.BeginsWith(
"--spawn")) spawn =
true;
188 else if (arg.BeginsWith(
"--version")) version =
true;
190 if (arg.BeginsWith(
"--url")) urlSeen =
true;
191 optList.Add(
new TObjString(&(argv[i][2])));
201 gROOT->SetBatch(batch);
207 while ((path = nextP()))
AppendPath(path->GetName());
208 TIter nextD(&defines);
210 while ((def = nextD()))
211 gSystem->AddIncludePath(Form(
"-D%s", def->GetName()));
214 if (!where.IsNull()) {
216 Error(
"main",
"option --url and --where mutually exclusive");
220 if (!file.IsNull()) u.SetFile(file);
221 if (!opts.IsNull()) u.SetOptions(opts);
222 if (!anchor.IsNull()) u.SetAnchor(anchor);
223 optList.Add(
new TObjString(Form(
"url=%s", u.GetUrl())));
229 Usage(argv[0], std::cout);
233 optList.Add(
new TObjString(
"help"));
238 Error(
"main",
"No name specified");
242 Error(
"main",
"No class specified");
247 const char* aliPath =
gSystem->ExpandPathName(
"$ALICE_ROOT");
248 const char* phyPath =
gSystem->ExpandPathName(
"$ALICE_PHYSICS");
249 const char* fwdPath = Form(
"%s/PWGLF/FORWARD",phyPath);
255 AppendPath(Form(
"%s/analysis2/trains", fwdPath));
258 TApplication* app = 0;
261 TRint* rint =
new TRint(
"runTrain", 0, 0, 0, 0,
true);
262 rint->SetPrompt(
"runTrain[%3d]> ");
267 app =
new TApplication(
"runTrain", 0, 0);
269 if (app && !batch) app->InitializeGraphics();
277 new Deferred(name, cls, &optList, spawn);
void AppendPath(const char *dir)
void PrintFakeOption(std::ostream &o, const char *opt, const char *desc)
Base class for helpers using the AliAnalysisAlien plugin.
void ProgramUsage(const char *progname, std::ostream &o)
const TCollection * fOptions
void Usage(const char *progname, std::ostream &o)
Proof-Lite analysis helper.
Deferred(const Deferred &o)
void Version(std::ostream &o)
Base classs for train specifications.
Deferred(const TString &name, const TString &cls, const TCollection *opts, bool spawn)
TFile * file
TList with histograms for a given trigger.
Base class for analysis helpers.
int main(int argc, char **argv)
static Bool_t Main(const TString &name, const TString &cls, const TCollection *opts, Bool_t asProg=true, Bool_t spawn=false)
AAF (using AliAnalysisAlien) analysis helper.
Deferred & operator=(const Deferred &o)