]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/trains/MakeMCCorrTrain.C
Some changes to make it possible to run the DA's
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / trains / MakeMCCorrTrain.C
CommitLineData
39fd42ed 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 */
20class MakeMCCorrTrain : public TrainSetup
21{
22public:
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 }
34protected:
35 /**
36 * Create the tasks
37 *
39fd42ed 38 * @param mgr Analysis manager
39 */
40 void CreateTasks(AliAnalysisManager* mgr)
41 {
42 // --- Output file name ------------------------------------------
43 AliAnalysisManager::SetCommonFileName("forward_mccorr.root");
44
45 // --- Load libraries/pars ---------------------------------------
46 fHelper->LoadLibrary("PWGLFforward2");
47
48 // --- Set load path ---------------------------------------------
49 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
50 gROOT->GetMacroPath()));
51
52 // --- Check if this is MC ---------------------------------------
53 if (!mgr->GetMCtruthEventHandler()) return;
54
55 // --- Task to copy header information ---------------------------
56 // gROOT->Macro("AddTaskCopyHeader.C");
57
58 // --- Add the task ----------------------------------------------
59 gROOT->Macro("AddTaskForwardMCCorr.C");
60
61 // --- Add the task ----------------------------------------------
62 gROOT->Macro("AddTaskCentralMCCorr.C");
63 }
64 //__________________________________________________________________
65 /**
66 * Create physics selection , and add to manager
67 *
68 * @param mc Whether this is for MC
69 * @param mgr Manager
70 */
71 void CreatePhysicsSelection(Bool_t mc,
72 AliAnalysisManager* mgr)
73 {
74 TrainSetup::CreatePhysicsSelection(mc, mgr);
75
76 // --- Get input event handler -----------------------------------
77 AliInputEventHandler* ih =
78 dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
79 if (!ih)
80 Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih);
81
82 // --- Get Physics selection -------------------------------------
83 AliPhysicsSelection* ps =
84 dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection());
85 if (!ps)
86 Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)", ps);
87
88 // --- Ignore trigger class when selecting events. This means ---
89 // --- that we get offline+(A,C,E) events too --------------------
90 // ps->SetSkipTriggerClassSelection(true);
91 }
92 //__________________________________________________________________
93 /**
94 * @return 0 - AOD disabled
95 */
96 virtual AliVEventHandler* CreateOutputHandler(UShort_t) { return 0; }
97 /**
98 * Do not the centrality selection
99 */
100 // void CreateCentralitySelection(Bool_t, AliAnalysisManager*) {}
101 //__________________________________________________________________
102 const char* ClassName() const { return "MakeMCCorrTrain"; }
103 //__________________________________________________________________
104 /**
105 * Overloaded to create new Extract.C in the output
106 * directory
107 *
108 * @param asShellScript
109 */
110 void SaveSetup(Bool_t asShellScript)
111 {
112 TrainSetup::SaveSetup(asShellScript);
113
114 std::ofstream f("Extract.C");
115 if (!f) {
116 Error("SaveSetup", "Failed to open Extract.C");
117 return;
118 }
119 f << "// Generated by " << ClassName() << "\n"
120 << "void Extract()\n"
121 << "{\n"
122 << " gROOT->LoadMacro(\"$ALICE_ROOT/PWGLF/FORWARD/analysis2/corrs/ExtractMCCorr.C\");\n"
123 << " ExtractMCCorr(\"forward_mccorr.root\",0,0,0);\n"
124 << "}\n"
125 << "// EOF" << std::endl;
126 f.close();
127 }
128};
129
130//
131// EOF
132//