]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/trains/MakedNdetaTrain.C
DrawdNdeta.C AliceLogo.C OtherData.C DrawdNDetaSummary
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / trains / MakedNdetaTrain.C
CommitLineData
39fd42ed 1/**
2 * @file MakedNdetaTrain.C
3 * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
4 * @date Fri Jun 1 13:51:26 2012
5 *
6 * @brief
7 *
8 * @ingroup pwglf_forward_trains_specific
9 *
10 */
11
12#include "TrainSetup.C"
13
14//====================================================================
15/**
16 * Analysis train to make @f$ dN/d\eta@f$
17 *
18 *
19 * @ingroup pwglf_forward_dndeta
20 * @ingroup pwglf_forward_trains_specific
21 */
22class MakedNdetaTrain : public TrainSetup
23{
24public:
25 /**
26 * Constructor.
27 *
28 * @param name Name of train (free form)
29 */
30 MakedNdetaTrain(const char* name)
31 : TrainSetup(name)
32 {
33 fOptions.Add("trig", "TYPE", "Trigger type", "INEL");
34 fOptions.Add("vzMin", "CENTIMETER", "Min Ip Z", "-10");
35 fOptions.Add("vzMax", "CENTIMETER", "Max Ip Z", "+10");
36 fOptions.Add("scheme", "SCHEME", "Normalization scheme", "");
37 fOptions.Add("trigEff", "EFFICENCY", "Trigger effeciency", "1");
38 fOptions.Add("trigEff0", "EFFICENCY", "0-bin trigger effeciency", "1");
39 fOptions.Add("cent", "Use centrality");
40 fOptions.Add("cut-edges", "Cut acceptance edges");
41 fOptions.Add("corr-empty", "Correct for empty bins (deprecated)");
bfab35d9 42 fOptions.Add("mc", "Also make dN/deta for MC truth");
43 fOptions.Add("mc-corr", "FILE", "MC corrections file", "");
44 fOptions.Add("satellite","Restrict analysis to satellite events", false);
39fd42ed 45 }
46protected:
47 /**
48 * Create the tasks
49 *
39fd42ed 50 */
51 void CreateTasks(AliAnalysisManager*)
52 {
53 // --- Output file name ------------------------------------------
54 AliAnalysisManager::SetCommonFileName("forward_dndeta.root");
55
56 // --- Load libraries/pars ---------------------------------------
57 fHelper->LoadLibrary("PWGLFforward2");
58
59 // --- Set load path ---------------------------------------------
60 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
61 gROOT->GetMacroPath()));
62
63 // --- Get parameters --------------------------------------------
bfab35d9 64 TString trig = fOptions.Get("trig");
65 TString scheme = fOptions.Get("scheme");
66 Double_t vzMin = fOptions.AsDouble("vzmin", -10);
67 Double_t vzMax = fOptions.AsDouble("vzmax", +10);
68 Double_t effT = fOptions.AsDouble("trigEff", 1);
69 Double_t effT0 = fOptions.AsDouble("trigEff0", 1);
70 Bool_t cent = fOptions.Has("cent");
71 Bool_t edges = fOptions.Has("cut-edges");
72 Bool_t corrEm = fOptions.Has("corr-empty");
73 Bool_t mc = fOptions.Has("mc");
74 TString mccorr = fOptions.AsString("mc-corr", "");
75 Bool_t satonly = fOptions.AsBool("satellite");
39fd42ed 76
77 // --- Form arguments --------------------------------------------
78 TString args;
79 args.Form("\"%s\",%f,%f,%d,\"%s\",%d,%g,%g,%d",
80 trig.Data(), vzMin, vzMax, cent, scheme.Data(),
81 edges, effT, effT0, corrEm);
bfab35d9 82 TString fargs(args);
83 fargs.Append(Form(",%d,\"%s\"",satonly, mccorr.Data()));
84
39fd42ed 85 // --- Add the task ----------------------------------------------
bfab35d9 86 gROOT->Macro(Form("AddTaskForwarddNdeta.C(%s);", fargs.Data()));
39fd42ed 87 gROOT->Macro(Form("AddTaskCentraldNdeta.C(%s);", args.Data()));
bfab35d9 88 if (mc)
89 gROOT->Macro(Form("AddTaskMCTruthdNdeta.C(%s);", args.Data()));
39fd42ed 90 }
91 //__________________________________________________________________
92 /**
93 * Do not the centrality selection
94 */
73b32206 95 //__________________________________________________________________
39fd42ed 96 void CreateCentralitySelection(Bool_t, AliAnalysisManager*) {}
73b32206 97 /**
98 * Do not create MC input handler
99 *
100 * @return Always null
101 */
102 AliVEventHandler* CreateMCHandler(UShort_t, bool) { return 0; }
39fd42ed 103 //__________________________________________________________________
104 /**
105 * Crete output handler - we don't want one here.
106 *
107 * @return 0
108 */
109 AliVEventHandler* CreateOutputHandler(UShort_t) { return 0; }
110 //__________________________________________________________________
111 const char* ClassName() const { return "MakedNdetaTrain"; }
112 //__________________________________________________________________
113 /**
114 * Overloaded to create new draw.C
115 *
116 * @param asShellScript
117 */
118 void SaveSetup(Bool_t asShellScript)
119 {
120 TrainSetup::SaveSetup(asShellScript);
121
bfab35d9 122 SaveDraw();
123 SaveSummarize();
124 }
125 void SaveSummarize()
126 {
127 std::ofstream f("Summarize.C");
128 if (!f) {
129 Error("SaveSummarize", "Failed to open Summarize.C script");
130 return;
131 }
132 f << "// Generated by " << ClassName() << "\n"
133 << "// WHAT is a bit mask of\n"
134 << "// 0x001 Forward\n"
135 << "// 0x002 Central\n"
136 << "// 0x004 Sums\n"
137 << "// 0x008 Results\n"
138 << "// 0x010 Only min-bias (no centrality)\n"
139 << "// 0x020 Landscape\n"
140 << "// 0x040 Pause\n"
141 << "//\n"
142 << "void Summarize(const char* filename=\"forward_dndeta.root\",\n"
143 << " UShort_t what=0xF)\n"
144 << "{\n"
145 << " gROOT->LoadMacro(\"$ALICE_ROOT/PWGLF/FORWARD/analysis2/DrawdNdetaSummary.C\");\n"
146 << " DrawdNdetaSummary(filename,what);\n"
147 << "}\n"
148 << "// EOF" << std::endl;
149 f.close();
150 }
151 /**
152 * Make a ROOT script to draw results
153 *
154 */
155 void SaveDraw()
156 {
73b32206 157 std::ofstream o("Draw.C");
39fd42ed 158 if (!o) {
73b32206 159 Error("MakedNdetaTrain::SaveSetup", "Failed to open Draw.C");
39fd42ed 160 return;
161 }
162
163 o << "// Created by " << ClassName() << "\n"
164 << "// \n"
165 << "// Will draw dN/deta results from produced file\n"
166 << "// \n"
167 << "// Options can be specified as needed. To get help, pass the\n"
168 << "// string \"help\" for the title\n"
bfab35d9 169 << "// \n";
170 o << "// Usage:\n"
171 << "// Draw(TITLE,REBIN,OTHER,FLAGS,SNN,SYS,TRG,EFF,IPZMIN,IPZMAX)\n"
172 << "// \n"
173 << "// const char* TITLE Title to put on plot\n"
174 << "// UShort_t REBIN Rebinning factor\n"
175 << "// UShort_t OTHER Other data to draw - more below\n"
176 << "// UShort_t FLAGS Visualisation flags - more below\n"
177 << "// UShort_t SYS (optional) 1:pp, 2:PbPb, 3:pPb\n"
178 << "// UShort_t SNN (optional) sqrt(s_NN) in GeV\n"
179 << "// UShort_t TRIG (optional) 1: INEL, 2: INEL>0, 4: NSD, ...\n"
180 << "// Float_t EFF (optional) Trigger efficiency\n"
181 << "// Float_t IPZMIN (optional) Least z coordinate of IP\n"
182 << "// Float_t IPZMAX (optional) Largest z coordinate of IP\n"
183 << "// \n";
184 o << "// OTHERS is a bit mask of\n"
185 << "// \n"
186 << "// 0x1 Show UA5 data (INEL,NSD, ppbar, 900GeV)\n"
187 << "// 0x2 Show CMS data (NSD, pp)\n"
188 << "// 0x4 Show published ALICE data (INEL,INEL>0,NSD, pp)\n"
189 << "// 0x8 Show event genertor data\n"
190 << "// \n";
191 o << "// FLG is a bit mask of\n"
192 << "// \n"
193 << "// 0x1 Show ratios of data to other data and possibly MC\n"
194 << "// 0x2 Show left-right asymmetry\n"
195 << "// 0x4 Show systematic error band\n"
196 << "// 0x8 Show individual ring results (INEL only)\n"
197 << "// 0x10 Cut edges when rebinning\n"
198 << "// 0x20 Remove FMDxO points\n"
199 << "// 0x40 Do not make our own canvas\n"
200 << "// 0x80 Force use of MB\n"
201 << "// 0x100 Mirror data\n"
202 << "// 0x200 Apply `final MC' correction\n"
203 << "// 0x400 Apply `Emperical' correction\n"
204 << "// 0x800 Export results to script\n"
205 << "// 0x1000 Add code to do combined zooms on eta axis\n"
206 << "// 0x2000 Assume old-style input\n"
207 << "// \n";
208 o << "// 0x200 requires the file forward_dndetamc.root\n"
209 << "// 0x400 requires the file EmpiricalCorrection.root\n"
210 << "// \n"
211 << "// To specify that you want ratios, force MB, apply empirical\n"
212 << "// correction, and export to script, set flags to\n"
39fd42ed 213 << "// \n"
bfab35d9 214 << "// 0x1|0x80|0x400|0x800=0xC81\n"
215 << "// \n";
216 o << "void Draw(const TString& title=\"\",\n"
39fd42ed 217 << " UShort_t rebin=5,\n"
bfab35d9 218 << " UShort_t others=0xf,\n"
219 << " UShort_t flags=0x907,\n"
39fd42ed 220 << " UShort_t sNN=0,\n"
221 << " UShort_t sys=0,\n"
222 << " UShort_t trg=0,\n"
bfab35d9 223 << " Float_t eff=0,\n"
224 << " Float_t vzMin=999,\n"
39fd42ed 225 << " Float_t vzMax=-999)\n"
226 << "{\n"
227 << " gROOT->LoadMacro(\"$ALICE_ROOT/PWGLF/FORWARD/analysis2/"
228 << "DrawdNdeta.C++\");\n\n"
229 << " if (title.EqualTo(\"help\",TString::kIgnoreCase)) {\n"
230 << " DrawdNdeta(\"help\"); // Get the help\n"
231 << " return;\n"
232 << " }\n\n"
233 << " DrawdNdeta(\"forward_dndeta.root\",\n"
234 << " title,\n"
235 << " rebin,\n"
236 << " others,\n"
237 << " flags,\n"
238 << " sNN,\n"
239 << " sys,\n"
240 << " trg,\n"
bfab35d9 241 << " eff,\n"
39fd42ed 242 << " vzMin,\n"
d43c6cd0 243 << " vzMax,\n"
244 <<" \"dNdeta_<trig>\");\n"
39fd42ed 245 << "}\n"
246 << "//\n"
247 << "// EOF\n"
248 << "//" << std::endl;
249 o.close();
250 }
251};
252//
253// EOF
254//