AliPhysics  b555aef (b555aef)
LocalRailway.C
Go to the documentation of this file.
1 
11 #ifndef LOCALHELPER_C
12 #define LOCALHELPER_C
13 #ifndef __CINT__
14 # include "Railway.C"
15 # include "ChainBuilder.C"
16 # include <TUrl.h>
17 # include <TString.h>
18 # include <TSystem.h>
19 # include <AliAnalysisManager.h>
20 #else
21 class TChain;
22 class Railway;
23 class TUrl;
24 #endif
25 
26 // ===================================================================
65 struct LocalRailway : public Railway
66 {
73  LocalRailway(const TUrl& url, Int_t verbose)
74  : Railway(url, verbose), fChain(0)
75  {
76  fOptions.Add("recursive","Scan recursive");
77  fOptions.Add("trackref", "For MC input, check TrackRef.root presence");
78  fOptions.Add("scan", "Scan for number of events in chain");
79  fOptions.Add("clean", "Clean chain elements");
80  fOptions.Add("pattern", "GLOB", "File name pattern", "*.root");
81  }
88  : Railway(o), fChain(o.fChain)
89  {}
98  {
99  if (&o == this) return *this;
101  fChain = o.fChain;
102  return *this;
103  }
107  virtual ~LocalRailway() {}
115  virtual Bool_t LoadLibrary(const TString& name, Bool_t, Bool_t)
116  {
117  Int_t ret = gSystem->Load(MakeLibraryName(name));
118  return ret >= 0;
119  }
125  virtual UShort_t Mode() const { return kLocal; }
129  virtual const char* ModeString() const { return "local"; }
135  virtual Bool_t PreSetup()
136  {
137  return true;
138  }
144  virtual Bool_t PostSetup()
145  {
146  // --- Check that the manager was made ---------------------------
147  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
148  if (!mgr) {
149  Error("PostSetup", "No analysis manager defined");
150  return false;
151  }
152 
153  // --- Create the chain ------------------------------------------
154  fChain = LocalChain();
155  if (!fChain) return false;
156 
157  return true;
158  };
167  {
168  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
169 
170  if (nEvents < 0) nEvents = fChain->GetEntries();
171  return mgr->StartAnalysis(fUrl.GetProtocol(), fChain, nEvents);
172  }
176  virtual const Char_t* UrlHelp() const
177  {
178  return "local://<datadir or list>[?<options>][#<treeName>]";
179  }
183  virtual const char* Desc() const { return "Local"; }
184  TChain* fChain; // Our chain
185 };
186 #endif
187 //
188 // EOF
189 //
virtual Long64_t Run(Long64_t nEvents=-1)
Definition: LocalRailway.C:166
OptionList fOptions
Definition: Railway.C:663
const char * url
virtual Bool_t PostSetup()
Definition: LocalRailway.C:144
const TString & MakeLibraryName(const TString &name)
Definition: Railway.C:498
long long Long64_t
Definition: External.C:43
TSystem * gSystem
char Char_t
Definition: External.C:18
Railway & operator=(const Railway &)
Definition: Railway.C:71
virtual const Char_t * UrlHelp() const
Definition: LocalRailway.C:176
Definition: External.C:92
virtual const char * Desc() const
Definition: LocalRailway.C:183
TChain * LocalChain()
Definition: Railway.C:587
int Int_t
Definition: External.C:63
virtual UShort_t Mode() const
Definition: LocalRailway.C:125
Double_t nEvents
plot quality messages
TChain * fChain
Definition: LocalRailway.C:184
virtual const char * ModeString() const
Definition: LocalRailway.C:129
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 LoadLibrary(const TString &name, Bool_t, Bool_t)
Definition: LocalRailway.C:115
Base class for analysis helpers.
unsigned short UShort_t
Definition: External.C:28
LocalRailway(const TUrl &url, Int_t verbose)
Definition: LocalRailway.C:73
virtual ~LocalRailway()
Definition: LocalRailway.C:107
LocalRailway & operator=(const LocalRailway &o)
Definition: LocalRailway.C:97
bool Bool_t
Definition: External.C:53
Build a chain.
virtual Bool_t PreSetup()
Definition: LocalRailway.C:135
LocalRailway(const LocalRailway &o)
Definition: LocalRailway.C:87