]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/trains/MakeMCCorrTrain.C
9065243284da58266851fabda6f63af3f2e051db
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / trains / MakeMCCorrTrain.C
1 /**
2  * @file   MakeMCCorrTrain.C
3  * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
4  * @date   Fri Jun  1 13:54:47 2012
5  * 
6  * @brief  
7  * 
8  * @ingroup pwglf_forward_trains_specific
9  */
10 #include "TrainSetup.C"
11
12 //====================================================================
13 /**
14  * Analysis train to make Forward and Central MC corrections
15  * 
16  *
17  * @ingroup pwglf_forward_mc
18  * @ingroup pwglf_forward_trains_specific
19  */
20 class MakeMCCorrTrain : public TrainSetup
21 {
22 public:
23   /** 
24    * Constructor.  Date and time must be specified when running this
25    * in Termiante mode on Grid
26    * 
27    * @param name     Name of train (free form)
28    */
29   MakeMCCorrTrain(const  char* name) 
30   : TrainSetup(name)
31   {
32     fOptions.Set("type", "ESD");
33   }
34 protected:
35   /** 
36    * Create the tasks 
37    * 
38    * @param par  Whether to use par files 
39    * @param mgr  Analysis manager 
40    */
41   void CreateTasks(AliAnalysisManager* mgr)
42   {
43     // --- Output file name ------------------------------------------
44     AliAnalysisManager::SetCommonFileName("forward_mccorr.root");
45
46     // --- Load libraries/pars ---------------------------------------
47     LoadLibrary("PWGLFforward2");
48     
49     // --- Set load path ---------------------------------------------
50     gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
51                              gROOT->GetMacroPath()));
52
53     // --- Check if this is MC ---------------------------------------
54     if (!mgr->GetMCtruthEventHandler()) return;
55     
56     // --- Task to copy header information ---------------------------
57     gROOT->Macro("AddTaskCopyHeader.C");
58
59     // --- Add the task ----------------------------------------------
60     gROOT->Macro("AddTaskForwardMCCorr.C"); 
61
62     // --- Add the task ----------------------------------------------
63     gROOT->Macro("AddTaskCentralMCCorr.C");
64   }
65   //__________________________________________________________________
66   /** 
67    * Create physics selection , and add to manager
68    * 
69    * @param mc Whether this is for MC 
70    * @param mgr Manager 
71    */
72   void CreatePhysicsSelection(Bool_t mc,
73                               AliAnalysisManager* mgr)
74   {
75     TrainSetup::CreatePhysicsSelection(mc, mgr);
76
77     // --- Get input event handler -----------------------------------
78     AliInputEventHandler* ih =
79       dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
80     if (!ih) 
81       Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih);
82     
83     // --- Get Physics selection -------------------------------------
84     AliPhysicsSelection* ps = 
85       dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection());
86     if (!ps) 
87       Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)", ps);
88
89     // --- Ignore trigger class when selecting events.  This means ---
90     // --- that we get offline+(A,C,E) events too --------------------
91     // ps->SetSkipTriggerClassSelection(true);
92   }
93   /** 
94    * Do not the centrality selection
95    */
96   // void CreateCentralitySelection(Bool_t, AliAnalysisManager*) {}
97   //__________________________________________________________________
98   const char* ClassName() const { return "MakeMCCorrTrain"; }
99 };
100
101 //
102 // EOF
103 //