]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/trains/MakeAODTrain.C
Various fixes
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / trains / MakeAODTrain.C
CommitLineData
fdfd93b4 1/**
2 * @file MakeAODTrain.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Tue Jul 12 10:05:30 2011
5 *
6 * @brief Run first pass analysis - make AOD tree
7 *
8 * @ingroup pwglf_forward_trains_specific
9 */
10#include "TrainSetup.C"
11
12//====================================================================
13/**
14 * Analysis train to make Forward and Central multiplicity
15 *
16 *
17 * @ingroup pwglf_forward_aod
18 * @ingroup pwglf_forward_trains_specific
19 */
20class MakeAODTrain : public TrainSetup
21{
22public:
23 /**
24 * Constructor.
25 *
26 * @param name Name of train (free form)
27 */
28 MakeAODTrain(const TString& name)
29 : TrainSetup(name)
30 {
31 fOptions.Add("sys", "SYSTEM", "1:pp, 2:PbPb, 3:pPb", "");
32 fOptions.Add("snn", "ENERGY", "Center of mass energy in GeV", "");
33 fOptions.Add("field", "STRENGTH","L3 field strength in kG", "");
34 fOptions.Add("cent", "Use centrality");
35 fOptions.Add("tpc-ep", "Use TPC event plane");
36 fOptions.Add("forward-config", "FILE", "Forward configuration",
37 "ForwardAODConfig.C");
38 fOptions.Add("central-config", "FILE", "Forward configuration",
39 "CentralAODConfig.C");
40 fOptions.Add("satelitte", "Use satelitte interactions");
41 fOptions.Set("type", "ESD");
42 }
43protected:
44 /**
45 * Create the tasks
46 *
47 * @param par Whether to use par files
48 * @param mgr Analysis manager
49 */
50 void CreateTasks(AliAnalysisManager* mgr)
51 {
52 // --- Output file name ------------------------------------------
53 AliAnalysisManager::SetCommonFileName("forward.root");
54
55 // --- Load libraries/pars ---------------------------------------
56 fHelper->LoadLibrary("PWGLFforward2");
57
58 // --- Set load path ---------------------------------------------
59 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
60 gROOT->GetMacroPath()));
61 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/ANALYSIS/macros",
62 gROOT->GetMacroPath()));
63
64 // --- Check if this is MC ---------------------------------------
65 Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
66
67 // --- Add TPC eventplane task
68 if (fOptions.Has("tpc-ep")) gROOT->Macro("AddTaskEventplane.C");
69
70 // --- Task to copy header information ---------------------------
71 gROOT->Macro("AddTaskCopyHeader.C");
72
73 // --- Get options -----------------------------------------------
74 UShort_t sys = fOptions.AsInt("sys", 0);
75 UShort_t sNN = fOptions.AsInt("snn", 0);
76 UShort_t fld = fOptions.AsInt("field", 0);
77
78 // --- Add the task ----------------------------------------------
79 TString fwdConfig = fOptions.Get("forward-config");
80 gROOT->Macro(Form("AddTaskForwardMult.C(%d,%d,%d,%d,\"%s\")",
81 mc, sys, sNN, fld, fwdConfig.Data()));
82 fHelper->LoadAux(gSystem->Which(gROOT->GetMacroPath(), fwdConfig));
83
84 // --- Add the task ----------------------------------------------
85 TString cenConfig = fOptions.Get("central-config");
86 gROOT->Macro(Form("AddTaskCentralMult.C(%d,%d,%d,%d,\"%s\")",
87 mc, sys, sNN, fld, cenConfig.Data()));
88 fHelper->LoadAux(gSystem->Which(gROOT->GetMacroPath(), cenConfig));
89
90 // --- Add MC particle task --------------------------------------
91 if (mc) gROOT->Macro("AddTaskMCParticleFilter.C");
92
93 }
94 //__________________________________________________________________
95 /**
96 * Create physics selection , and add to manager
97 *
98 * @param mc Whether this is for MC
99 * @param mgr Manager
100 */
101 void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager* mgr)
102 {
103 TrainSetup::CreatePhysicsSelection(mc, mgr);
104
105 // --- Get input event handler -----------------------------------
106 AliInputEventHandler* ih =
107 dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
108 if (!ih)
109 Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih);
110
111 // --- Get Physics selection -------------------------------------
112 AliPhysicsSelection* ps =
113 dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection());
114 if (!ps)
115 Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)",ps);
116
117 // --- Special for pPb pilot run Sep. 2012 -----------------------
118 UShort_t sys = fOptions.AsInt("sys", 0);
119 if (sys == 3) {
120 Warning("CreatePhysicsSelection",
121 "Special setup for pPb pilot run September, 2012");
122 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/ANALYSIS/macros",
123 gROOT->GetMacroPath()));
124 gROOT->LoadMacro("PhysicsSelectionOADB_CINT5_pA.C");
125 gROOT->ProcessLine(Form("((AliPhysicsSelection*)%p)"
126 "->SetCustomOADBObjects("
127 "OADBSelection_CINT5_V0A(),0);", ps));
128 ps->SetSkipTriggerClassSelection(true);
129 }
130 // --- Ignore trigger class when selecting events. This means ---
131 // --- that we get offline+(A,C,E) events too --------------------
132 // ps->SetSkipTriggerClassSelection(true);
133 }
134 //__________________________________________________________________
135 /**
136 * Create the centrality selection only if requested
137 *
138 * @param mc Monte-Carlo truth flag
139 * @param mgr Manager
140 */
141 void CreateCentralitySelection(Bool_t mc, AliAnalysisManager* mgr)
142 {
143 if (!fOptions.Has("cent")) return;
144 TrainSetup::CreateCentralitySelection(mc, mgr);
145 }
146 //__________________________________________________________________
147 const char* ClassName() const { return "MakeAODTrain"; }
148 //__________________________________________________________________
149 /**
150 * Overloaded to create new dNdeta.C and dndeta.sh in the output
151 * directory
152 *
153 * @param asShellScript
154 */
155 void SaveSetup(Bool_t asShellScript)
156 {
157 TrainSetup::SaveSetup(asShellScript);
158
159 TString cls("MakedNdetaTrain");
160 TString name(fName); name.Append("_dndeta");
161 OptionList opts(fOptions);
162 opts.Remove("forward-config");
163 opts.Remove("central-config");
164 opts.Remove("sys");
165 opts.Remove("snn");
166 opts.Remove("field");
167 opts.Remove("bare-ps");
168 opts.Remove("tpc-ep");
169 opts.Add("trig", "TRIGGER", "Trigger type", "");
170 opts.Add("vzMin", "CENTIMETER", "Lower bound on Ip Z", "-10");
171 opts.Add("vzMax", "CENTIMETER", "Upper bound on Ip Z", "+10");
46b25775 172 opts.Add("scheme", "FLAGS", "Normalization scheme",
173 "TRIGGER EVENT BACKGROUND");
fdfd93b4 174 opts.Add("cut-edges", "Cut edges of acceptance");
175 opts.Add("trigEff", "EFFICIENCY", "Trigger efficiency", "1");
176 opts.Add("trigEff0", "EFFICIENCY", "0-bin trigger efficiency", "1");
177 TString out = fHelper->OutputLocation();
178 if (out.IsNull()) out = fEscapedName;
179 opts.Set("url", out);
180 opts.Set("type", "AOD");
46b25775 181
fdfd93b4 182 SaveSetupROOT("dNdeta", cls, name, opts);
183 if (asShellScript)
184 SaveSetupShell("dndeta", cls, name, opts);
185 }
186};
187//
188// EOF
189//