]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/trains/MakedNdetaTrain.C
Fixed references from PWG2 -> PWGLF - very efficiently done using ETags.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / trains / MakedNdetaTrain.C
1 #include "TrainSetup.C"
2
3 //====================================================================
4 /**
5  * Analysis train to make @f$ dN/d\eta@f$
6  * 
7  * To run, do 
8  * @code 
9  * gROOT->LoadMacro("TrainSetup.C");
10  * // Make train 
11  * MakedNdetaTrain t("My Analysis");
12  * // Set variaous parameters on the train 
13  * t.SetDataDir("/home/of/data");
14  * t.AddRun(118506)
15  * // Run it 
16  * t.Run("LOCAL", "FULL", -1, false, false);
17  * @endcode 
18  *
19  * @ingroup pwglf_forward_dndeta
20  * @ingroup pwglf_forward_trains
21  */
22 class MakedNdetaTrain : public TrainSetup
23 {
24 public:
25   /** 
26    * Constructor.  Date and time must be specified when running this
27    * in Termiante mode on Grid
28    * 
29    * @param name     Name of train (free form)
30    * @param trig     Trigger to use 
31    * @param vzMin    Least @f$ v_z@f$
32    * @param vzMax    Largest @f$ v_z@f$
33    * @param scheme   Normalisation scheme 
34    * @param useCent  Whether to use centrality 
35    * @param dateTime Append date and time to name 
36    * @param year     Year     - if not specified, current year
37    * @param month    Month    - if not specified, current month
38    * @param day      Day      - if not specified, current day
39    * @param hour     Hour     - if not specified, current hour
40    * @param min      Minutes  - if not specified, current minutes
41    */
42   MakedNdetaTrain(const char* name, 
43                   const char* trig="INEL", 
44                   Double_t    vzMin=-10, 
45                   Double_t    vzMax=10, 
46                   const char* scheme="FULL", 
47                   Bool_t      useCent=false,
48                   Bool_t      dateTime=false,
49                   UShort_t    year  = 0, 
50                   UShort_t    month = 0, 
51                   UShort_t    day   = 0, 
52                   UShort_t    hour  = 0, 
53                   UShort_t    min   = 0) 
54     : TrainSetup(name, dateTime, year, month, day, hour, min),
55       fTrig(trig), 
56       fVzMin(vzMin), 
57       fVzMax(vzMax),
58       fScheme(scheme),
59       fUseCent(useCent)
60   {}
61   /** 
62    * Run this analysis 
63    * 
64    * @param mode     Mode - see TrainSetup::EMode
65    * @param oper     Operation - see TrainSetup::EOperation
66    * @param nEvents  Number of events (negative means all)
67    * @param usePar   If true, use PARs 
68    */
69   void Run(const char* mode, const char* oper, 
70            Int_t nEvents=-1, Bool_t usePar=false)
71   {
72     Exec("AOD", mode, oper, nEvents, false, usePar);
73   }
74   /** 
75    * Run this analysis 
76    * 
77    * @param mode     Mode - see TrainSetup::EMode
78    * @param oper     Operation - see TrainSetup::EOperation
79    * @param nEvents  Number of events (negative means all)
80    * @param usePar   If true, use PARs 
81    */
82   void Run(EMode mode, EOper oper, Int_t nEvents=-1, 
83            Bool_t usePar=false)
84   {
85     Exec(kAOD, mode, oper, nEvents, false, usePar);
86   }
87   /** 
88    * Set the trigger to use (INEL, INEL>0, NSD)
89    * 
90    * @param trig Trigger to use 
91    */
92   void SetTrigger(const char* trig) { fTrig = trig; }
93   /** 
94    * Set the vertex range to accept 
95    * 
96    * @param min Minimum 
97    * @param max Maximum 
98    */
99   void SetVertexRange(Double_t min, Double_t max) { fVzMin=min; fVzMax=max; }
100   /** 
101    * Set the normalisation scheme 
102    * 
103    * @param scheme Normalisation scheme options 
104    */
105   void SetScheme(const char* scheme) { fScheme = scheme; }
106   /** 
107    * Whether to use centrality or not 
108    * 
109    * @param use To use the centrality 
110    */
111   void SetUseCentrality(Bool_t use) { fUseCent = use; }
112 protected:
113   /** 
114    * Create the tasks 
115    * 
116    * @param mode Processing mode
117    * @param par  Whether to use par files 
118    */
119   void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager*)
120   {
121     // --- Output file name ------------------------------------------
122     AliAnalysisManager::SetCommonFileName("forward_dndeta.root");
123
124     // --- Load libraries/pars ---------------------------------------
125     LoadLibrary("PWGLFforward2", mode, par, true);
126     
127     // --- Set load path ---------------------------------------------
128     gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
129                              gROOT->GetMacroPath()));
130
131     // --- Add the task ----------------------------------------------
132     gROOT->Macro(Form("AddTaskForwarddNdeta.C(\"%s\",%f,%f,%d,\"%s\")",
133                       fTrig.Data(), fVzMin, fVzMax, fUseCent, fScheme.Data()));
134
135     gROOT->Macro(Form("AddTaskCentraldNdeta.C(\"%s\",%f,%f,%d,\"%s\")",
136                       fTrig.Data(), fVzMin, fVzMax, fUseCent, fScheme.Data()));
137
138     gROOT->Macro(Form("AddTaskMCTruthdNdeta.C(\"%s\",%f,%f,%d,\"%s\")",
139                       fTrig.Data(), fVzMin, fVzMax, fUseCent, fScheme.Data()));
140   }
141   /** 
142    * Do not the centrality selection
143    */
144   void CreateCentralitySelection(Bool_t, AliAnalysisManager*) {}
145   /** 
146    * Crete output handler - we don't want one here. 
147    * 
148    * @return 0
149    */
150   AliVEventHandler* CreateOutputHandler(EType) { return 0; }
151   TString  fTrig;      // Trigger to use 
152   Double_t fVzMin;     // Least v_z
153   Double_t fVzMax;     // Largest v_z
154   TString  fScheme;    // Normalisation scheme 
155   Bool_t   fUseCent;   // Use centrality 
156 };
157 //
158 // EOF
159 //