]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/trains/AAFRailway.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / trains / AAFRailway.C
1 /**
2  * @file   AAFRailway.C
3  * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
4  * @date   Tue Oct 16 19:02:14 2012
5  * 
6  * @brief  AAF analysis helper
7  * 
8  * @ingroup pwglf_forward_trains_helper
9  * 
10  */
11 #ifndef AAFHELPER_C
12 #define AAFHELPER_C
13 #include "ProofRailway.C"
14 #ifndef __CINT__
15 # include "AvailableSoftware.C"
16 # include <TUrl.h>
17 # include <TString.h>
18 # include <TProof.h>
19 # include <AliAnalysisManager.h>
20 #else
21 class TUrl;
22 class AliAnalysisAlien;
23 #endif
24
25 // ===================================================================
26 /**
27  * Handle analysis on an Alice Analysis Facility (AAF)
28  * 
29  * This helper is triggered by a URL of the form 
30  *
31  * @code
32  * proof://[<user>@]<host>[:<port>]/<dsname>[?<options>][#<treename>]
33  * @endcode 
34  * where &lt;host@&t; is a known AAF (e.g., <tt>alice-caf.cern.ch</tt>)
35  * <dl>
36  *   <dt>&lt;user&gt;</dt>
37  *   <dd>Optional user name</dd>
38  *   <dt>&lt;host&gt;</dt>
39  *   <dd>PROOF cluster master host</dd>
40  *   <dt>&lt;port&gt;</dt>
41  *   <dd>Optional PROOF cluster port on master host</dd>
42  *   <dt>&lt;dsname&gt;</dt>
43  *   <dd>Data set name</dd>
44  *   <dt>&lt;treename&gt;</dt>
45  *   <dd>Optional tree name in data set, often <tt>esdTree</tt> or
46  *   <tt>aodTree</tt></dd>
47  *   <dt>&lt;options&gt;</dt>
48  *   <dd>List of options separated by an &amp;
49  *     <dl>
50  *       <dt><tt>dsname</tt>[=&lt;output dataset&gt;]</dt>
51  *       <dd>Register tree output (e.g., AOD) as a new data set on the
52  *         PROOF cluster. If &lt;output dataset&gt; is not specified, take
53  *         the name of the train.</dd>
54  *       <dt><tt>storage=&lt;url&gt;</tt></dt>
55  *       <dd>Specify a non-default storage location for special output
56  *         (e.g., AOD trees).  &lt;url&gt; should be a valid XRootd 
57  *         server URI accessible to the slaves - e.g., 
58  *         <tt>root://lxplus.cern.ch:10930//tmp</tt>.</dd>
59  *       <dt><tt>mode=[default,rec,sim,train,custom]</tt></dt>
60  *       <dd>Set the AliROOT mode.  If not specified <tt>default</tt> 
61  *         is assumed.  See also CreateAliROOTPar</dd>
62  *       <dt><tt>par</tt></dt>
63  *       <dd> Use par files </dd>
64  *     </dl>
65  *   </dd>
66  * </dl>  
67  *
68  * Note, this helper does not use the AliAnalysisAlien plugin
69  *
70  * @ingroup pwglf_forward_trains_helper
71  */
72 struct AAFRailway : public ProofRailway
73 {
74   /** 
75    * Constructor 
76    * 
77    * @param url  Url 
78    * @param verbose Verbosity 
79    */
80   AAFRailway(const TUrl& url, Int_t verbose)
81     : ProofRailway(url, verbose)
82   {
83     fOptions.Add("aliroot", "VERSION", "AliROOT version", "last");
84     fOptions.Add("root",    "VERISON", "ROOT version", "last");
85     fOptions.Add("nocache", "Disable tree cache");
86   }
87   virtual ~AAFRailway() {}
88   /** 
89    * Get the name of the AliROOT par file to use 
90    * 
91    * @return String 
92    */
93   virtual const char* AliROOTParName() const
94   {
95     return Form("VO_ALICE@AliRoot::%s", fOptions.Get("aliroot").Data());
96   }
97   virtual Bool_t CreateAliROOTPar()
98   {
99     return true;
100   }
101   /** 
102    * Set-up done before task set-ups. Overload ProofRailway::PreSetup
103    * to specify the ROOT version using TProofMgr::SetROOTVersion
104    * 
105    * @return true on success 
106    */
107   virtual Bool_t PreSetup() 
108   {
109     TString aliroot("last");
110     TString root("last");
111     if (fOptions.Has("aliroot")) aliroot = fOptions.Get("aliroot");
112     if (fOptions.Has("root"))    root    = fOptions.Get("root");
113
114     AvailableSoftware::Check(aliroot, root);
115     fOptions.Set("aliroot", aliroot);
116     fOptions.Set("root", root);
117
118     fBasePars = false;
119
120     // Set this before we try to access the cluster
121     gEnv->SetValue("XSec.GSI.DelegProxy", "2");
122
123     TProof::Mgr(fUrl.GetHost())
124       ->SetROOTVersion(Form("VO_ALICE@ROOT::%s", root.Data()));
125
126     if (!ProofRailway::PreSetup()) return false;
127
128     if (fOptions.Has("nocache")) 
129       gProof->SetParameter("PROOF_UseTreeCache", 0);
130     return true;
131   }
132   /** 
133    * @return URI help string 
134    */
135   virtual const Char_t* UrlHelp() const 
136   {
137     return "proof://<host>/<dataset>?[&<options>][#<treename>]";
138   }
139   /** 
140    * @return short description
141    */
142   virtual const char* Desc() const { return "AAF"; }
143 };
144 #endif
145 //
146 // EOF
147 //