AliPhysics  8d00e07 (8d00e07)
AAFPluginRailway.C
Go to the documentation of this file.
1 
11 #ifndef AAFPLUGINHELPER_C
12 #define AAFPLUGINHELPER_C
13 #include "PluginRailway.C"
14 #ifndef __CINT__
15 # include <TUrl.h>
16 # include <TString.h>
17 # include <AliAnalysisManager.h>
18 # include <AliAnalysisAlien.h>
19 #else
20 class TUrl;
21 class AliAnalysisAlien;
22 #endif
23 
24 // ===================================================================
74 {
81  AAFPluginRailway(const TUrl& url, Int_t verbose)
82  : PluginRailway(url, verbose)
83  {
84  fOptions.Add("workers", "N[x]", "Number of workers to use", 0);
85  fOptions.Add("dsname", "NAME", "Make output dataset", "");
86  fOptions.Add("wrapper", "CMD", "Wrapper command", "");
87  fOptions.Add("clear", "Clear all packages");
88  fOptions.Add("reset", "soft|hard", "Reset cluster", "hard");
89 
90  }
94  virtual ~AAFPluginRailway() {}
100  virtual Bool_t PreSetup()
101  {
102  // --- Handle software options -----------------------------------
103  // TString root = fOptions.Get("root");
104  // fHandler->SetRootVersionForProof(Form("VO_ALICE@ROOT::%s", root.Data()));
105  fHandler->SetProofCluster(fUrl.GetHost());
106  fHandler->SetProofDataSet(fUrl.GetFile());
107 
108  // --- Handle worker options -------------------------------------
109  if (fOptions.Has("workers")) {
110  TString nwork = fOptions.Get("workers");
111  if (nwork.EndsWith("x"))
112  fHandler->SetNproofWorkersPerSlave(nwork.Atoi());
113  else
114  fHandler->SetNproofWorkers(nwork.Atoi());
115  }
116 
117  // --- Check if we're using a wrapper ----------------------------
118  if (fOptions.Has("wrapper")) {
119  TString wrapper = fOptions.Get("wrapper");
120  if (wrapper.IsNull())
121  // In case of no argument, use GDB
122  // Just run and backtrace
123  wrapper = "/usr/bin/gdb --batch -ex run -ex bt --args";
124  Info("ProofRailway::PreSetup", "Using wrapper command: %s",
125  wrapper.Data());
126  TProof::AddEnvVar("PROOF_WRAPPERCMD", wrapper);
127  }
128 
129  // --- Check if we need to clear packages ------------------------
130  fHandler->SetClearPackages(fOptions.Has("clear"));
131 
132  // --- Check if we need to reset first ---------------------------
133  if (fOptions.Has("reset")) {
134  TString reset = fOptions.Get("reset");
135  Bool_t hard = (reset.IsNull() ||
136  reset.EqualTo("hard", TString::kIgnoreCase));
137  Info("AAFPluginRailway::PreSetup", "Will do a %s reset of %s",
138  hard ? "hard" : "soft", fUrl.GetHost());
139  fHandler->SetProofReset(hard ? 2 : 1);
140  }
141 
142  return PluginRailway::PreSetup();
143  }
149  virtual Bool_t PostSetup()
150  {
151  if (!PluginRailway::PostSetup()) return false;
152  if (fOptions.Has("dsname"))
154 
155  return true;
156  };
162  virtual UShort_t Mode() const { return kProof; }
166  virtual const char* ModeString() const { return "proof"; }
175  {
176  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
177 
178  TString dsName(fUrl.GetFile());
179  if (fUrl.GetAnchor() && fUrl.GetAnchor()[0] != '\0')
180  dsName.Append(Form("#%s", fUrl.GetAnchor()));
181  return mgr->StartAnalysis(fUrl.GetProtocol(), dsName, nEvents);
182  }
186  virtual const Char_t* UrlHelp() const
187  {
188  return "proof://alice-caf*/<dataset>?plugin[&<options>][#<treename>]";
189  }
193  virtual const char* Desc() const { return "CAF w/plugin (deprecated)"; }
194 };
195 #endif
196 //
197 // EOF
198 //
virtual Bool_t PreSetup()
OptionList fOptions
Definition: Railway.C:663
const char * url
virtual Bool_t PostSetup()
Base class for helpers using the AliAnalysisAlien plugin.
long long Long64_t
Definition: External.C:43
virtual const Char_t * UrlHelp() const
char Char_t
Definition: External.C:18
AAFPluginRailway(const TUrl &url, Int_t verbose)
Definition: External.C:92
const TString & Get(const TString &name) const
Definition: Option.C:596
virtual const char * ModeString() const
virtual Bool_t PreSetup()
Bool_t Has(const TString &name) const
Definition: Option.C:584
int Int_t
Definition: External.C:63
virtual const char * Desc() const
virtual ~AAFPluginRailway()
Double_t nEvents
plot quality messages
TUrl fUrl
Definition: Railway.C:662
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
virtual Bool_t PostSetup()
virtual Long64_t Run(Long64_t nEvents=-1)
virtual UShort_t Mode() const
unsigned short UShort_t
Definition: External.C:28
AliAnalysisAlien * fHandler
bool Bool_t
Definition: External.C:53
static Bool_t RegisterDataset(const TString &dsname)