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