AliPhysics  5403132 (5403132)
GridRailway.C
Go to the documentation of this file.
1 
11 #ifndef GRIDHELPER_C
12 #define GRIDHELPER_C
13 #include "PluginRailway.C"
14 #ifndef __CINT__
15 # include <TUrl.h>
16 # include <TString.h>
17 # include <TGrid.h>
18 # include <AliAnalysisManager.h>
19 # include <AliAnalysisAlien.h>
20 # include <sstream>
21 #else
22 class TUrl;
23 class AliAnalysisAlien;
24 #endif
25 
26 // ===================================================================
76 struct GridRailway : public PluginRailway
77 {
84  GridRailway(const TUrl& url, Int_t verbose)
85  : PluginRailway(url, verbose), fRuns()
86  {
87  // Note, split, merge, and ttl are by default set to values
88  // optimized for AOD production on real PbPb data.
89  //
90  // TTL shouldn't be much smaller than 4h10m. Split and merge
91  // shouldn't be much larger than 75, but probably not smaller than
92  // 50.
93  fOptions.Add("oper", "FULL|TERMINATE|SUBMIT", "Analysis operation", "FULL");
94  fOptions.Add("split", "N|max", "Max number of files before split","50");
95  fOptions.Add("merge", "N|max", "Max number of files for merge", "50");
96  fOptions.Add("run", "RUNS", "Range, list, and/or file of runs", "");
97  fOptions.Add("alien", "VERSION","Alien API version", "V1.1x");
98  fOptions.Add("ttl", "N|max", "Time to live", "6h");
99  fOptions.Add("pattern","GLOB", "File/directory name pattern", "");
100  fOptions.Add("concat", "Concatenate all runs");
101  fOptions.Add("exclude", "GLOB","Comma separated list of merge excludes","");
102  fOptions.Add("files", "FILE", "file containing list of files", "");
103  }
105  : PluginRailway(o), fRuns()
106  {}
108  {
109  if (&o == this) return *this;
111  return *this;
112  }
113  virtual ~GridRailway() {}
119  virtual UShort_t Mode() const { return kGrid; }
123  virtual const char* ModeString() const { return "grid"; }
129  virtual UShort_t Operation() const
130  {
131  if (!fOptions.Has("oper")) return kFull;
132  const TString& oper = fOptions.Get("oper");
133  if (oper.EqualTo("FULL", TString::kIgnoreCase)) return kFull;
134  else if (oper.EqualTo("OFFLINE", TString::kIgnoreCase)) return kOffline;
135  else if (oper.EqualTo("SUBMIT", TString::kIgnoreCase)) return kSubmit;
136  else if (oper.EqualTo("TERMINATE", TString::kIgnoreCase)) return kTerminate;
137  else if (oper.EqualTo("TEST", TString::kIgnoreCase)) return kTest;
138  return kFull;
139  }
140  void StoreRun(Int_t r)
141  {
142  TObject* o = new TObject;
143  o->SetUniqueID(r);
144  fRuns.Add(o);
145  }
151  virtual Int_t RegisterRuns()
152  {
153  if (!fOptions.Find("run")) {
154  Error("GridRailway::RegisterRuns", "No runs specified");
155  return -1;
156  }
157  Int_t nRuns = 0;
158  TString runs = fOptions.Get("run");
159  TObjArray* tokens = runs.Tokenize(",+:");
160  TObjString* part = 0;
161  TIter next(tokens);
162  Bool_t range = false;
163  Bool_t individual = false;
164  // Info("GridRailway::RegisterRuns", "Runs specified are %s", runs.Data());
165  while ((part = static_cast<TObjString*>(next()))) {
166  TString& s = part->String();
167  if (s.Contains("-")) { // Run range
168  if (range) {
169  Warning("GridRailway::RegisterRuns", "Run range already specified, "
170  "ignoring %s", s.Data());
171  continue;
172  }
173  if (individual) {
174  Warning("GridRailway::RegisterRuns",
175  "Run ranges and individual run specs do not mix, "
176  "ignoring %s", s.Data());
177  continue;
178  }
179  TObjArray* ranges = s.Tokenize("-");
180  if (ranges->GetEntriesFast() > 2) {
181  Warning("GridRailway::RegisterRuns", "Invalid run range: %s",
182  s.Data());
183  ranges->Delete();
184  continue;
185  }
186  Int_t first = static_cast<TObjString*>(ranges->At(0))->String().Atoi();
187  Int_t last = static_cast<TObjString*>(ranges->At(1))->String().Atoi();
188  nRuns = last-first+1;
189  // Info("GridRailway::RegisterRuns", "Run range %d -> %d", first, last);
190  fHandler->SetRunRange(first, last);
191  ranges->Delete();
192  range = true;
193  for (Int_t r = first; r <= last; r++) StoreRun(r);
194  continue;
195  }
196  if (s.IsDigit()) { // single run
197  if (range) {
198  Warning("GridRailway::RegisterRuns",
199  "Run ranges and individual run specs do not mix, "
200  "ignoring %s", s.Data());
201  continue;
202  }
203  // Info("GridHandler::RegisterRuns", "Adding run %s", s.Data());
204  fHandler->AddRunNumber(s.Atoi());
205  StoreRun(s.Atoi());
206  nRuns++;
207  individual = true;
208  continue;
209  }
210  if (range) {
211  Warning("GridRailway::RegisterRuns", "Run ranges and list file "
212  "do not mix, ignoring %s", s.Data());
213  continue;
214  }
215 
216  // We assume this part is a file
217  // Info("GridRailway::RegisterRuns", "Reading runs from %s", s.Data());
218  std::ifstream in(s.Data());
219  if (!in) {
220  s.Prepend("../");
221  in.open(s.Data());
222  if (!in) {
223  Warning("GridRailway::RegisterRuns", "Failed to open %s", s.Data());
224  continue;
225  }
226  }
227  while (!in.eof()) {
228  TString lne;
229  lne.ReadLine(in);
230 
231  TString bare = lne.Strip(TString::kBoth);
232  if (bare[0] == '#') continue;
233 
234  TObjArray* ltokens = bare.Tokenize(" \t,");
235  TIter lnext(ltokens);
236  TObjString* str = 0;
237  while ((str = static_cast<TObjString*>(lnext()))) {
238  const TString& token = str->String();
239  if (!token.IsDigit()) continue;
240 
241  int r = token.Atoi();
242  fHandler->AddRunNumber(r);
243  StoreRun(r);
244  nRuns++;
245  }
246  ltokens->Delete();
247  }
248 #if 0
249  while (!in.eof()) {
250  Int_t r;
251  in >> r;
252  // Info("GridRailway::RegisterRuns", "Read %d, adding", r);
253  fHandler->AddRunNumber(r);
254  StoreRun(r);
255  nRuns++;
256  Char_t c;
257  in >> c;
258  if (in.bad()) break;
259  }
260 #endif
261  individual = true;
262  in.close();
263  }
264  return nRuns;
265  }
271  virtual Bool_t PreSetup()
272  {
273  if (!PluginRailway::PreSetup()) return false;
274 
275  // --- Add system library dir to load path -----------------------
276  gSystem->AddDynamicPath("/usr/lib");
277 
278  // --- Open a connection to the grid -----------------------------
279  if (!TGrid::Connect(Form("%s://", fUrl.GetProtocol()))) {
280  Error("GridRailway::PreSetup", "Failed to connect to AliEN");
281  return false;
282  }
283  if (!gGrid || !gGrid->IsConnected()) {
284  Error("GridRailway::PreSetup", "Failed to connect to AliEN");
285  return false;
286  }
287 
288  return true;
289  }
295  virtual Bool_t PostSetup()
296  {
297  // Info("GridRailway::PostSetup", "Calling super.PostSetup");
298  if (!PluginRailway::PostSetup()) return false;
299 
300  // --- API version -----------------------------------------------
301  fHandler->SetAPIVersion(fOptions.Get("alien"));
302 
303  // --- Get the name ----------------------------------------------
304  // Info("GridRailway", "Proceeding with plugin setup");
305  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
306  TString name(mgr->GetName());
307 
308  // --- Set the operation to do (TEST, SUBMIT, TERMINATE, FULL) ---
309  TString operation("FULL");
310  if (fOptions.Has("oper")) operation = fOptions.Get("oper");
311  fHandler->SetRunMode(operation);
312 
313  // --- Add the run numbers ---------------------------------------
314  fHandler->SetRunPrefix(fOptions.Has("mc") ? "%d" : "%09d");
315  Int_t nRun = RegisterRuns();
316 
317  // --- Possibly add files from input file ------------------------
318  AddFiles();
319 
320  // --- Do not test copying ---------------------------------------
321  fHandler->SetCheckCopy(false);
322 
323  // --- Set output to be per run ----------------------------------
324  fHandler->SetOutputToRunNo(true);
325 
326  // --- Set the job tag -------------------------------------------
327  fHandler->SetJobTag(name);
328 
329  // --- Set number of test files - used in test mode only ---------
330  fHandler->SetNtestFiles(1);
331 
332  // --- Set the Time-To-Live --------------------------------------
333  if (fOptions.Has("ttl")) {
334  TString sttl = fOptions.Get("ttl");
335  if (!sttl.EqualTo("max")) {
336  Int_t ttl = 0;
337  if (sttl.IsDigit()) ttl = sttl.Atoi();
338  else {
339  // Parse string of the form <DAYS>d<HOURS>h<MINUTES>m<SECONDS>s
340  Int_t id = sttl.Index("d", 0);
341  if (id == kNPOS) id = -1;
342  else {
343  TString sdays(sttl(0,id));
344  ttl += 24 * 60 * 60 * sdays.Atoi();
345  }
346  Int_t ih = sttl.Index("h", id+1);
347  if (ih == kNPOS) ih = id;
348  else {
349  TString shour(sttl(id+1,ih-id-1));
350  ttl += 60 * 60 * shour.Atoi();
351  }
352  Int_t im = sttl.Index("m", ih+1);
353  if (im == kNPOS) im = ih;
354  else {
355  TString smin(sttl(ih+1, im-ih-1));
356  ttl += 60 * smin.Atoi();
357  }
358  Int_t is = sttl.Index("s", im+1);
359  if (is != kNPOS) {
360  TString ssec(sttl(im+1, is-im-1));
361  ttl += ssec.Atoi();
362  }
363  }
364  if (ttl != 0) fHandler->SetTTL(ttl);
365  else
366  Warning("", "Option ttl given but no value found");
367  }
368  }
369 
370  // --- Re-submit failed jobs as long as the ratio of failed jobs -
371  // --- is this percentage.
372  fHandler->SetMasterResubmitThreshold(95);
373 
374  // --- Set the input format --------------------------------------
375  fHandler->SetInputFormat("xml-single");
376 
377  // --- Set names of generated files ------------------------------
378  fHandler->SetAnalysisMacro(Form("%s.C", name.Data()));
379  fHandler->SetJDLName(Form("%s.jdl", name.Data()));
380  fHandler->SetExecutable(Form("%s.sh", name.Data()));
381 
382  // ---- Set the job price !? -------------------------------------
383  fHandler->SetPrice(1);
384 
385  // --- Set whether to merge via JDL ------------------------------
386  fHandler->SetMergeViaJDL(true);
387 
388  // --- Fast read otion -------------------------------------------
389  fHandler->SetFastReadOption(false);
390 
391  // --- Whether to overwrite existing output ----------------------
392  fHandler->SetOverwriteMode(true);
393 
394  // --- Set the executable binary name and options ----------------
395  fHandler->SetExecutableCommand("aliroot -b -q -x");
396 
397  // --- Split by storage element - must be lower case! ------------
398  fHandler->SetSplitMode("se");
399 
400  // --- How much to split -----------------------------------------
401  if (fOptions.Has("split")) {
402  if (!fOptions.Get("split").EqualTo("max")) {
403  fHandler->SetSplitMaxInputFileNumber(fOptions.AsInt("split"));
404  }
405  }
406  // --- Merge parameters ------------------------------------------
407  if (fOptions.Has("merge")) {
408  if (!fOptions.Get("merge").EqualTo("max")) {
409  fHandler->SetMaxMergeFiles(fOptions.AsInt("merge"));
410  }
411  }
412  TString exclude="AliAOD.root *EventStat*.root *event_stat*.root";
413  if (fOptions.Has("exclude")) {
414  TString exOpt = fOptions.Get("exclude");
415  exOpt.ReplaceAll(",", " ");
416  exclude.Append(" ");
417  exclude.Append(exOpt);
418  }
419  fHandler->SetMergeExcludes(exclude);
420 
421  // --- Set number of runs per master - 1 or all ------------------
422  fHandler->SetNrunsPerMaster(fOptions.Has("concat") ? nRun+1 : 1);
423 
424 
425  // --- Enable default outputs ------------------------------------
426  fHandler->SetDefaultOutputs(true);
427 
428  // --- Keep log files ------------------------------------------
429  fHandler->SetKeepLogs();
430 
431  // --- Set the working directory to be the trains name (with -----
432  // --- special characters replaced by '_' and the date appended),
433  // --- and also set the output directory (relative to working
434  // --- directory)
435  fHandler->SetGridWorkingDir(name.Data());
436  fHandler->SetGridOutputDir("output");
437  fHandler->SetGridDataDir(fUrl.GetFile());
438 
439  // --- Get the tree name and set the file pattern ----------------
440  TString pattern;
441  if (fOptions.Has("pattern")) pattern = fOptions.Get("pattern");
442  else {
443  TString treeName(fUrl.GetAnchor());
444  if (treeName.IsNull()) {
445  Warning("GridRailway::PreSetup", "No tree name specified, assuming T");
446  treeName = "T";
447  }
448  if (treeName.EqualTo("esdTree")) pattern = "AliESD";
449  else if (treeName.EqualTo("aodTree")) pattern = "AliAOD";
450  }
451  fHandler->SetDataPattern(pattern);
452 
453  // --- Loop over defined containers in the analysis manager, and -
454  // --- declare these as outputs
455  TString listOfAODs = "";
456  TString listOfHists = "";
457  TString listOfTerms = "";
458 
459  TObjArray* outs[] = { mgr->GetOutputs(), mgr->GetParamOutputs(), 0 };
460  TObjArray** out = outs;
461  while (*out) {
462  AliAnalysisDataContainer* cont = 0;
463  TIter nextCont(*out);
464  while ((cont = static_cast<AliAnalysisDataContainer*>(nextCont()))) {
465  TString outName(cont->GetFileName());
466  Bool_t term = (*out == outs[1]);
467  TString& list = (outName == "default" ? listOfAODs :
468  !term ? listOfHists : listOfTerms);
469  if (outName == "default") {
470  if (!mgr->GetOutputEventHandler()) continue;
471 
472  outName = mgr->GetOutputEventHandler()->GetOutputFileName();
473  }
474  if (list.Contains(outName)) continue;
475  if (!list.IsNull()) list.Append(",");
476  list.Append(outName);
477  }
478  out++;
479  }
480  TString extra = mgr->GetExtraFiles();
481  if (!extra.IsNull()) {
482  if (!listOfAODs.IsNull()) listOfAODs.Append("+");
483  extra.ReplaceAll(" ", ",");
484  listOfAODs.Append(extra);
485  }
486 
487 #if 0
488  Int_t nReplica = 2;
489  TString outArchive = Form("stderr, stdout@disk=%d", nReplica);
490  if (!listOfHists.IsNull())
491  outArchive.Append(Form(" hist_archive.zip:%s@disk=%d",
492  listOfHists.Data(), nReplica));
493  if (!listOfAODs.IsNull())
494  outArchive.Append(Form(" aod_archive.zip:%s@disk=%d",
495  listOfAODs.Data(), nReplica));
496  // Disabled for now
497  // plugin->SetOutputArchive(outArchive);
498 #endif
499 
500  if (listOfAODs.IsNull() && listOfHists.IsNull())
501  Fatal("PostSetup", "No outputs defined");
502  if (!listOfTerms.IsNull())
503  fHandler->SetTerminateFiles(listOfTerms);
504 
505  return true;
506  };
507  void ScanFiles()
508  {
509  // Check if runs where registered, and if so that the first run
510  // registered isn't 0
511  if (fRuns.GetEntries() > 0 &&
512  fRuns.At(0)->GetUniqueID() != 0) return;
513 
514  TString path = fUrl.GetFile();
515  TString pattern = fOptions.Get("pattern");
516 
517  if (path.IsNull() || pattern.IsNull()) {
518  Warning("ScanFiles", "No search path (%s) or pattern (%s) specified",
519  path.Data(), pattern.Data());
520  return;
521  }
522 
523  TString cmd = Form("alien_find %s %s", path.Data(), pattern.Data());
524  TString ret = gSystem->GetFromPipe(cmd);
525  if (ret.IsNull()) {
526  Warning("ScanFiles", "Command %s failed", cmd.Data());
527  return;
528  }
529 
530  std::stringstream str(ret.Data());
531  AddFiles(str);
532 
533  }
534  void AddFiles()
535  {
536  TString files = fOptions.Get("files");
537  // Info("AddFiles", "Getting list of files from '%s'", files.Data());
538  if (files.IsNull()) {
539  ScanFiles();
540  return;
541  }
542 
543  std::ifstream in(files.Data());
544  if (!in) {
545  Warning("", "Failed to open the file %s", files.Data());
546  in.open(Form("../%s", files.Data()));
547  if (!in) {
548  Warning("", "Failed to open the file ../%s - giving up", files.Data());
549  return;
550  }
551  }
552  AddFiles(in);
553  in.close();
554  }
555  void AddFiles(std::istream& in)
556  {
557  do {
558  TString l;
559  l.ReadLine(in);
560 
561  TString tmp = l.Strip(TString::kBoth, ' ');
562  if (!tmp.EndsWith(".root")) {
563  // Info("AddFiles", "'%s' is not a ROOT file!", l.Data());
564  continue;
565  }
566  // Info("AddFiles", "Adding %s to list of inputs", tmp.Data());
567  fHandler->AddDataFile(tmp);
568  } while (!in.eof());
569  }
570 
579  {
580  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
581  if (nEvents == 0) return 0;
582  if (nEvents < 0) nEvents = 123456789;
583  Long64_t ret = mgr->StartAnalysis("grid", nEvents);
584 
585 #if 1
586  std::ofstream outJobs(Form("%s.jobid", mgr->GetName()));
587  outJobs << fHandler->GetGridJobIDs() << std::endl;
588  outJobs.close();
589 
590  std::ofstream outStages(Form("%s.stage", mgr->GetName()));
591  outStages << fHandler->GetGridStages() << std::endl;
592  outStages.close();
593 #endif
594  return ret;
595  }
604  virtual Bool_t AuxFile(TString& name, bool copy=false)
605  {
606  TString local = name;
607  if (!Railway::AuxFile(local, copy)) return false;
608  // We need to add this file as an additional 'library', so that the
609  // file is uploaded to the users Grid working directory.
610  fHandler->AddAdditionalLibrary(local);
611  return true;
612  }
617  virtual TString OutputPath() const
618  {
619  TString ret;
620  if (!fHandler) {
621  Warning("GridRailway::OutputLocation", "No AliEn handler");
622  return ret;
623  }
624  ret = fHandler->GetGridOutputDir();
625  if (ret.BeginsWith("/")) return ret;
626 
627  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
628  if (!mgr) {
629  Warning("GridRailway::OutputLocation", "No analysis manager");
630  return ret;
631  }
632  ret.Prepend(Form("%s/", mgr->GetName()));
633  if (gGrid)
634  ret.Prepend(Form("%s/", gGrid->GetHomeDirectory()));
635 
636  return ret;
637  }
641  virtual const Char_t* UrlHelp() const
642  {
643  return "alien:///<datadir>[?<options>][#<treeName>]";
644  }
648  virtual const char* Desc() const { return "AliEn"; }
655  void AuxSave(const TString& escaped,
656  Bool_t /*asShellScript*/)
657  {
658  // Write plug-in to file
659  TFile* plug = TFile::Open(Form("%s_plugin.root", escaped.Data()),
660  "RECREATE");
661  fHandler->Write("plugin");
662  plug->Close();
663 
664  TIter nextLib(&fExtraLibs);
665  TObjString* lib = 0;
666  TString libs;
667  while ((lib = static_cast<TObjString*>(nextLib()))) {
668  if (!libs.IsNull()) libs.Append(" ");
669  libs.Append(lib->String());
670  }
671  TIter nextPar(&fExtraPars);
672  TObjString* par = 0;
673  TString pars;
674  while ((par = static_cast<TObjString*>(nextPar()))) {
675  if (!pars.IsNull()) pars.Append(" ");
676  pars.Append(par->String());
677  }
678  TIter nextSrc(&fExtraSrcs);
679  TObjString* src = 0;
680  TString srcs;
681  while ((src = static_cast<TObjString*>(nextSrc()))) {
682  if (!srcs.IsNull()) srcs.Append(" ");
683  srcs.Append(src->String());
684  }
685  TString macDir("$ALICE_PHYSICS/PWGLF/FORWARD/trains");
686  TString outDir(OutputPath());
687  std::ofstream t("Terminate.C");
688  if (!t) {
689  Error("GridRailway::AuxSave", "Failed to make terminate ROOT script");
690  return;
691  }
692 
693  t << "// Generated by GridRailway\n"
694  << "Bool_t Terminate(Bool_t localMerge=false)\n"
695  << "{\n"
696  << " TString name = \"" << escaped << "\";\n"
697  << " TString libs = \"" << libs << "\";\n"
698  << " TString pars = \"" << pars << "\";\n"
699  << " TString srcs = \"" << srcs << "\";\n\n"
700  << " gSystem->Load(\"libANALYSIS\");\n"
701  << " gSystem->Load(\"libANALYSISalice\");\n"
702  << " gSystem->AddIncludePath(\"-I$ALICE_ROOT/include\");\n\n"
703  << " gSystem->AddIncludePath(\"-I$ALICE_PHYSICS/include\");\n\n"
704  << " gROOT->LoadMacro(\"" << macDir << "/GridTerminate.C+g\");\n\n"
705  << " return GridTerminate(name,libs,pars,srcs,localMerge);\n"
706  << "}\n"
707  << "// EOF\n"
708  << std::endl;
709  t.close();
710 
711  TString runs;
712  TString format(fOptions.Has("mc") ? "%d" : "%09d");
713  if (fOptions.Has("concat")) {
714  Int_t first = fRuns.First()->GetUniqueID();
715  Int_t last = fRuns.Last()->GetUniqueID();
716  TString fmt(format);
717  fmt.Append("_");
718  fmt.Append(format);
719  if (!runs.IsNull()) runs.Append(" ");
720  runs.Append(TString::Format(fmt, first, last));
721  }
722  else {
723  TIter next(&fRuns);
724  TObject* o = 0;
725  while ((o = next())) {
726  if (!runs.IsNull()) runs.Append(" ");
727  runs.Append(Form(format, o->GetUniqueID()));
728  }
729  }
730 
731  std::ofstream d("Download.C");
732  if (!d) {
733  Error("GridRailway::AuxSave", "Failed to make ROOT script Download.C");
734  return;
735  }
736  d << "// Generated by GridRailway\n"
737  << "void Download(Bool_t unpack=true)\n"
738  << "{\n"
739  << " TString base = \"" << fUrl.GetProtocol()<<"://"<< outDir << "\";\n"
740  << " TString runs = \"" << runs << "\";\n\n"
741  << " gROOT->LoadMacro(\"" << macDir << "/GridDownload.C\");\n\n"
742  << " GridDownload(base, runs, unpack);\n"
743  << "}\n"
744  << "// EOF\n"
745  << std::endl;
746  d.close();
747 
748  std::ofstream w("Watch.C");
749  if (!w) {
750  Error("GridRailway::AuxSave", "Failed to make ROOT script Watch.C");
751  return;
752  }
753  w << "// Generated by GridRailway\n"
754  << "void Watch(Bool_t batch=false, Int_t delay=5*60)\n"
755  << "{\n"
756  << " TString name = \"" << escaped << "\";\n"
757  << " gROOT->LoadMacro(\"" << macDir << "/GridWatch.C+g\");\n\n"
758  << " GridWatch(name,batch,delay);\n"
759  << "}\n"
760  << "// EOF\n"
761  << std::endl;
762  w.close();
763 
764  if (!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler())
765  // No AODs generated - no need for DownloadAODs.C script
766  return;
767 
768  std::ofstream a("DownloadAODs.C");
769  if (!a) {
770  Error("GridRailway::AuxSave", "Failed to open DownloadAODs.C");
771  return;
772  }
773  a << "// Generated by GridRailway\n"
774  << "void DownloadAODs(Bool_t verbose=false,Bool_t force=false)\n"
775  << "{\n"
776  << " gROOT->LoadMacro(\"" << macDir << "/GridDownloadAODs.C\");\n"
777  << " GridDownloadAODs(\"" << outDir << "\",verbose,force);\n"
778  << "}\n"
779  << "// EOF\n"
780  << std::endl;
781  a.close();
782 
783  std::ofstream e("downloadAODs.sh");
784  if (!e) {
785  Error("GridRailway::AuxSave", "Failed to open downloadAODs.sh");
786  return;
787  }
788  e << "#!/bin/sh\n"
789  << "# Generated by GridRailway\n"
790  << "exec " << macDir << "/downloadAODs.sh -s 0 -e 10000 -f AliAOD.root "
791  << "-d " << outDir << " $@\n"
792  << "# EOF\n" << std::endl;
793  e.close();
794  gSystem->Exec("chmod a+x downloadAODs.sh");
795 
796  std::ofstream c("MakeIndex.C");
797  if (!c) {
798  Error("GridRailway::AuxSave", "Failed to open MakeIndex.C");
799  return;
800  }
801  c << "// Generated by GridRailway\n"
802  << "void MakeIndex()\n"
803  << "{\n"
804  << " TString libs = \"" << libs << "\";\n"
805  << " TString pars = \"" << pars << "\";\n"
806  << " TString srcs = \"" << srcs << "\";\n\n"
807  << " gSystem->Load(\"libANALYSIS\");\n"
808  << " gSystem->Load(\"libANALYSISalice\");\n"
809  << " gSystem->AddIncludePath(\"-I$ALICE_ROOT/include\");\n\n"
810  << " gSystem->AddIncludePath(\"-I$ALICE_PHYSICS/include\");\n\n"
811  << " gROOT->LoadMacro(\"" << macDir << "/CreateIndex.C\");\n"
812  << " CreateIndex(\".\",\"aodTree\",0,libs,pars,srcs);\n"
813  << "}\n"
814  << "// EOF\n"
815  << std::endl;
816  c.close();
817  }
819 };
820 #endif
821 //
822 // EOF
823 //
virtual Bool_t PreSetup()
virtual const Char_t * UrlHelp() const
Definition: GridRailway.C:641
virtual Bool_t PostSetup()
Definition: GridRailway.C:295
OptionList fOptions
Definition: Railway.C:663
const char * url
Base class for helpers using the AliAnalysisAlien plugin.
void ScanFiles()
Definition: GridRailway.C:507
long long Long64_t
Definition: External.C:43
const char * fmt
void StoreRun(Int_t r)
Definition: GridRailway.C:140
TString format
file names tag, basically the trigger and calorimeter combination
Option * Find(const TString &name) const
Definition: Option.C:401
TSystem * gSystem
char Char_t
Definition: External.C:18
TCanvas * c
Definition: TestFitELoss.C:172
GridRailway(const GridRailway &o)
Definition: GridRailway.C:104
void AuxSave(const TString &escaped, Bool_t)
Definition: GridRailway.C:655
Int_t AsInt(const TString &name, Int_t def=0) const
Definition: Option.C:645
GridRailway(const TUrl &url, Int_t verbose)
Definition: GridRailway.C:84
virtual Int_t RegisterRuns()
Definition: GridRailway.C:151
TString part
use mixed event to constrain combinatorial background
Definition: InvMassFit.C:52
Definition: External.C:92
const TString & Get(const TString &name) const
Definition: Option.C:596
Bool_t Has(const TString &name) const
Definition: Option.C:584
int Int_t
Definition: External.C:63
GridRailway & operator=(const GridRailway &o)
Definition: GridRailway.C:107
PluginRailway & operator=(const PluginRailway &o)
virtual const char * Desc() const
Definition: GridRailway.C:648
virtual UShort_t Operation() const
Definition: GridRailway.C:129
Double_t nEvents
plot quality messages
TUrl fUrl
Definition: Railway.C:662
virtual Bool_t AuxFile(TString &name, bool copy=false)
Definition: Railway.C:525
virtual const char * ModeString() const
Definition: GridRailway.C:123
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
virtual Long64_t Run(Long64_t nEvents=-1)
Definition: GridRailway.C:578
virtual ~GridRailway()
Definition: GridRailway.C:113
virtual Bool_t PostSetup()
virtual UShort_t Mode() const
Definition: GridRailway.C:119
unsigned short UShort_t
Definition: External.C:28
virtual Bool_t PreSetup()
Definition: GridRailway.C:271
virtual Bool_t AuxFile(TString &name, bool copy=false)
Definition: GridRailway.C:604
AliAnalysisAlien * fHandler
void AddFiles()
Definition: GridRailway.C:534
bool Bool_t
Definition: External.C:53
void AddFiles(std::istream &in)
Definition: GridRailway.C:555
virtual TString OutputPath() const
Definition: GridRailway.C:617