]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/trains/MakeFMDELossTrain.C
Fixed references from PWG2 -> PWGLF - very efficiently done using ETags.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / trains / MakeFMDELossTrain.C
1 //====================================================================
2 /**
3  * Analysis train to do energy loss fits
4  * 
5  * @ingroup pwglf_forward_trains
6  */
7 class MakeFMDELossTrain : public TrainSetup
8 {
9 public:
10   /** 
11    * Constructor.  Date and time must be specified when running this
12    * in Termiante mode on Grid
13    * 
14    * @param name     Name of train 
15    * @param useCent  Whether to use centrality or not 
16    * @param dateTime Append date and time to name
17    * @param year     Year
18    * @param month    Month 
19    * @param day      Day
20    * @param hour     Hour 
21    * @param min      Minutes
22    */
23   MakeFMDELossTrain(const char* name  = "FMD Energy Loss",
24                     Bool_t   useCent  = false,
25                     Bool_t   dateTime = false, 
26                     UShort_t year     = 0, 
27                     UShort_t month    = 0, 
28                     UShort_t day      = 0, 
29                     UShort_t hour     = 0, 
30                     UShort_t min      = 0) 
31     : TrainSetup(name, dateTime, year, month, day, hour, min), 
32       fUseCent(useCent)
33   {}
34   //__________________________________________________________________
35   /** 
36    * Run this analysis 
37    * 
38    * @param mode     Mode
39    * @param oper     Operation
40    * @param nEvents  Number of events (negative means all)
41    * @param mc       If true, assume simulated events 
42    * @param par      IF true, use par files 
43    */
44   void Run(const char* mode, const char* oper, 
45            Int_t nEvents=-1, Bool_t mc=false, Bool_t par=false)
46   {
47     Exec("ESD", mode, oper, nEvents, mc, par);
48   }
49   //__________________________________________________________________
50   /** 
51    * Run this analysis 
52    * 
53    * @param mode     Mode
54    * @param oper     Operation
55    * @param nEvents  Number of events (negative means all)
56    * @param mc       If true, assume simulated events 
57    * @param par      IF true, use par files 
58    */
59   void Run(EMode mode, EOper oper, Int_t nEvents=-1, Bool_t mc=false,
60            Bool_t par=false)
61   {
62     Exec(kESD, mode, oper, nEvents, mc, par);
63   }
64 protected:
65   //__________________________________________________________________
66   /** 
67    * Create the tasks 
68    * 
69    * @param mode Processing mode
70    * @param par  Whether to use par files 
71    * @param mgr  Analysis manager 
72    */
73   void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager* mgr)
74   {
75     // --- Output file name ------------------------------------------
76     AliAnalysisManager::SetCommonFileName("forward_eloss.root");
77
78     // --- Load libraries/pars ---------------------------------------
79     LoadLibrary("PWGLFforward2", mode, par, true);
80     
81     // --- Set load path ---------------------------------------------
82     gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
83                              gROOT->GetMacroPath()));
84
85     // --- Check if this is MC ---------------------------------------
86     Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
87
88     // --- Add the task ----------------------------------------------
89     gROOT->Macro(Form("AddTaskFMDELoss.C(%d,%d)", mc, fUseCent));
90   }
91   /** 
92    * Create entrality selection if enabled 
93    * 
94    * @param mc   Whether this is MC or not
95    * @param mgr  Analysis manager 
96    */
97   virtual void CreateCentralitySelection(Bool_t mc, AliAnalysisManager* mgr)
98   {
99     if (!fUseCent) return;
100
101     gROOT->Macro("AddTaskCentrality.C");
102     AliCentralitySelectionTask* ctask = 
103       dynamic_cast<AliCentralitySelectionTask*>(mgr->GetTask("CentralitySelection"));
104     if (!ctask) return;
105     ctask->SetPass(fESDPass);
106     if (mc) ctask->SetMCInput();
107   }
108   /** 
109    * Crete output handler - we don't want one here. 
110    * 
111    * @return 0
112    */
113   AliVEventHandler* CreateOutputHandler(EType) { return 0; }
114   Bool_t fUseCent; // Whether to use centrality or not 
115 };
116
117 //
118 // EOF
119 //