]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/trains/AAFHelper.C
cfdaba5c6a4ac6546382335c65d7facc38114633
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / trains / AAFHelper.C
1 /**
2  * @file   AAFHelper.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 "ProofHelper.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@gt; 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</tt>.  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 AAFHelper : public ProofHelper
73 {
74   /** 
75    * Constructor 
76    * 
77    * @param url  Url 
78    * @param opts Options 
79    */
80   AAFHelper(const TUrl& url, Int_t verbose)
81     : ProofHelper(url, verbose)
82   {
83     fOptions.Add("aliroot", "VERSION", "AliROOT version", "last");
84     fOptions.Add("root",    "VERISON", "ROOT version", "last");
85   }
86   virtual ~AAFHelper() {}
87   /** 
88    * Get the name of the AliROOT par file to use 
89    * 
90    * @return String 
91    */
92   virtual const char* AliROOTParName() const
93   {
94     return Form("VO_ALICE@AliRoot::%s", fOptions.Get("aliroot").Data());
95   }
96   virtual Bool_t CreateAliROOTPar()
97   {
98     return true;
99   }
100   /** 
101    * Set-up done before task set-ups. Overload ProofHelper::PreSetup
102    * to specify the ROOT version using TProofMgr::SetROOTVersion
103    * 
104    * @return true on success 
105    */
106   virtual Bool_t PreSetup() 
107   {
108     TString aliroot("last");
109     TString root("last");
110     if (fOptions.Has("aliroot")) aliroot = fOptions.Get("aliroot");
111     if (fOptions.Has("root"))    root    = fOptions.Get("root");
112
113     AvailableSoftware::Check(aliroot, root);
114     fOptions.Set("aliroot", aliroot);
115     fOptions.Set("root", root);
116
117     fBasePars = false;
118
119     // Set this before we try to access the cluster
120     gEnv->SetValue("XSec.GSI.DelegProxy", "2");
121
122     TProof::Mgr(fUrl.GetHost())
123       ->SetROOTVersion(Form("VO_ALICE@ROOT::%s", root.Data()));
124
125     return ProofHelper::PreSetup();
126   }
127   /** 
128    * @return URI help string 
129    */
130   virtual const Char_t* UrlHelp() const 
131   {
132     return "proof://<host>/<dataset>?[&<options>][#<treename>]";
133   }
134   /** 
135    * @return short description
136    */
137   virtual const char* Desc() const { return "AAF"; }
138 };
139 #endif
140 //
141 // EOF
142 //