]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/trains/MakeFMDMCHitTrain.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / trains / MakeFMDMCHitTrain.C
1 /**
2  * @file   MakeFMDMCHitTrain.C
3  * @author Christian Holm Christensen <cholm@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 // #include "ParUtilities.C"
12
13 //====================================================================
14 /**
15  * Analysis train to make Forward and Central MC corrections
16  * 
17  *
18  * @ingroup pwglf_forward_mc
19  * @ingroup pwglf_forward_trains_specific
20  */
21 class MakeFMDMCHitTrain : public TrainSetup
22 {
23 public:
24   /** 
25    * Constructor.  Date and time must be specified when running this
26    * in Termiante mode on Grid
27    * 
28    * @param name     Name of train (free form)
29    */
30   MakeFMDMCHitTrain(const  char* name) 
31     : TrainSetup(name)
32   {
33     fOptions.Add("use-tuple", "Whether to make an NTuple of hits");
34     fOptions.Set("type", "ESD");
35   }
36 protected:
37   /** 
38    * Create the tasks 
39    * 
40    * @param mgr  Analysis manager 
41    */
42   void CreateTasks(AliAnalysisManager* mgr)
43   {
44     // --- Output file name ------------------------------------------
45     AliAnalysisManager::SetCommonFileName("forward_mchits.root");
46
47
48     // --- Load libraries/pars ---------------------------------------
49     fRailway->LoadLibrary("PWGLFforward2");
50     fRailway->LoadLibrary("Proof");
51     fRailway->LoadLibrary("Gui"); // Sigh! CDB depends on GUI!
52     fRailway->LoadLibrary("CDB");
53     fRailway->LoadLibrary("RAWDatabase");
54     fRailway->LoadLibrary("STEER");
55     fRailway->LoadLibrary("FMDbase");
56     fRailway->LoadLibrary("FMDsim");
57     fRailway->LoadLibrary("PWGLFforwardhit");
58     
59     // --- Set load path ---------------------------------------------
60     gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
61                              gROOT->GetMacroPath()));
62
63     // --- Check if this is MC ---------------------------------------
64     if (!mgr->GetMCtruthEventHandler()) 
65       Fatal("CreateTasks", "No MC truth handler");
66     
67     TString args = TString::Format("%d,%d", 
68                                    fOptions.AsBool("use-tuple"),
69                                    fOptions.AsInt("verbose"));
70     if (!CoupleCar("AddTaskFMDMCHit.C", args))
71       Fatal("CreateTasks", "Couldn't add our task");
72   }
73   //__________________________________________________________________
74   /** 
75    * Create physics selection , and add to manager
76    * 
77    * @param mc Whether this is for MC 
78    * @param mgr Manager 
79    */
80   void CreatePhysicsSelection(Bool_t mc,
81                               AliAnalysisManager* mgr)
82   {
83     TrainSetup::CreatePhysicsSelection(mc, mgr);
84
85     // --- Get input event handler -----------------------------------
86     AliInputEventHandler* ih =
87       dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
88     if (!ih) 
89       Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih);
90     
91     // --- Get Physics selection -------------------------------------
92     AliPhysicsSelection* ps = 
93       dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection());
94     if (!ps) 
95       Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)", ps);
96
97     // --- Ignore trigger class when selecting events.  This means ---
98     // --- that we get offline+(A,C,E) events too --------------------
99     // ps->SetSkipTriggerClassSelection(true);
100   }
101   //__________________________________________________________________
102   /** 
103    * @return 0 - AOD disabled 
104    */
105   virtual AliVEventHandler* CreateOutputHandler(UShort_t) { return 0; }
106   /** 
107    * Do not the centrality selection
108    */
109   // void CreateCentralitySelection(Bool_t) {}
110   //__________________________________________________________________
111   const char* ClassName() const { return "MakeFMDMCHitTrain"; }
112 };
113
114 //
115 // EOF
116 //