3 #include <AliESDInputHandlerRP.h>
44 fOptions.
Add(
"trig",
"NAME",
"Trigger to use",
"V0AND");
45 fOptions.
Add(
"cent",
"METHOD",
"Centrality selector",
"V0M");
46 fOptions.
Add(
"cent-bins",
"Bins",
"Centrality bins",
47 "0-5-10-20-30-40-50-60-70-80");
48 fOptions.
Add(
"check-reco",
"Check reconstruction",
false);
49 fOptions.
Add(
"sig-n-dev",
"X",
"Cut on weighted distance", 25.);
53 fOptions.
Add(
"dtheta",
"X",
"dTheta window", 0.025);
54 fOptions.
Add(
"phi-shift",
"X",
"Bending shift", 0.0045);
55 fOptions.
Add(
"outlier-phi",
"X",
"Phi outlier cut", 0.005);
56 fOptions.
Add(
"outlier-z-eta",
"X",
"Z-Eta outlier cut", 0.05);
57 fOptions.
Add(
"phi-rot",
"X",
"Rotation BG angle", TMath::Pi());
58 fOptions.
Add(
"inj-scale",
"X",
"Injection BG scale", 1.);
59 fOptions.
Add(
"remove-outliers",
"Whether to remove outliers",
true);
60 fOptions.
Add(
"sig-dphi-s",
"X",
"Cut on dPhi-phiBent", -1.);
61 fOptions.
Add(
"sig-n-std",
"X",
"Cut on weighted distance", 1.5);
62 fOptions.
Add(
"mc-v0-scale",
"X",
"Scaling of MC V0", 1.);
65 fOptions.
Add(
"deta",
"WIDTH",
"Eta bin width", 0.25);
68 fOptions.
Add(
"fill-reco",
"Fill with new reco",
true);
69 fOptions.
Add(
"create-inj",
"Create injection BG",
true);
70 fOptions.
Add(
"create-rot",
"Create rotation BG",
false);
71 fOptions.
Add(
"reweight",
"OPTIONS",
"','-seperates list",
"");
73 "extract dNch/deta. The train should be run on "
74 "both real data and simulated data. When "
75 "processing simulated data, it is possible to "
76 "reweigh the particles according to predefined "
77 "histograms in pT. These histograms should "
78 "be stored in separate files. The option to "
79 "select reweighting is 'reweight', which is "
80 "a comma separated list of options:\n"
81 "- pt, pid, str: Reweigh according to pT, PID or "
83 "- up, down: Vary reweight up or down\n"
84 "- pi, K, p: For PID reweigh of particular specie");
103 needRec = fill_reco || create_inj || create_rot || needRec;
105 Info(
"CreateInputHandler",
106 "fill_reco=%d create_inj=%d create_rot=%d needRec=%d",
107 fill_reco, create_inj, create_rot, needRec);
121 AliMCEventHandler* ret =
123 if (ret) ret->SetPreReadMode(AliMCEventHandler::kLmPreRead);
170 if (sel.IsNull() || sel.BeginsWith(
"no"))
180 while ((ostr = static_cast<TObjString*>(next()))) {
181 const TString& token = ostr->String();
183 if (token.EqualTo(
"pt")) {
185 files.Add(
new TObjString(
"REWEIGHTpt.root"));
186 Printf(
"Will reweigh in pT");
188 else if (token.EqualTo(
"pid")) {
190 Printf(
"Will reweigh particle species");
192 else if (token.EqualTo(
"str")) {
194 Printf(
"Will reweight particles from strange weak decays");
197 if (what == 0x0)
return;
202 while ((ostr = static_cast<TObjString*>(next()))) {
203 const TString& token = ostr->String();
204 Int_t aOpt = TMath::Abs(opt);
205 if (token.EqualTo(
"up") || token.EqualTo(
"+"))
206 opt = (aOpt==0 ? +1 : +aOpt);
207 else if (token.EqualTo(
"down") || token.EqualTo(
"-"))
208 opt = (aOpt==0 ? -1 : -aOpt);
209 else if (token.EqualTo(
"pi") || token.EqualTo(
"pion")){
210 opt = 1; part =
"pi";
212 else if (token.EqualTo(
"k") || token.EqualTo(
"kaon")) {
213 opt = 2; part =
"ka";
215 else if (token.EqualTo(
"p") || token.EqualTo(
"proton")) {
216 opt = 3; part =
"pr";
220 Printf(
"Will reweigh %s (%c30%% for pT<0.05)",
221 opt < 0 ?
"down" :
"up", opt < 0 ?
'-' :
'+');
223 if (!part.IsNull()) {
224 Printf(
"Will reweight %s in particular", part.Data());
226 part.Append(opt < 0 ?
"-" :
"+");
228 files.Add(
new TObjString(Form(
"REWEIGHTpid%s.root", part.Data())));
231 files.Add(
new TObjString(Form(
"REWEIGHTstr%s.root",
233 opt == +1 ?
"+" :
"")));
236 Printf(
"Setting reweighing flag=0x%x with option=%d", what, opt);
241 while ((ostr = static_cast<TObjString*>(nextF()))) {
242 Printf(
"Loading reweighting file %s", ostr->GetName());
266 Info(
"CreateTasks",
"Loading code");
274 Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
275 const char* cls =
"AliTrackletTaskMulti";
276 Long_t ret = gROOT->ProcessLine(Form(
"new %s(\"%s\")",cls,cls));
286 UInt_t sel = AliVEvent::kINT7;
287 if (trg.EqualTo(
"MB")) sel = AliVEvent::kMB;
288 else if (trg.EqualTo(
"V0AND")) sel = AliVEvent::kINT7;
289 else if (trg.EqualTo(
"V0OR")) sel = AliVEvent::kCINT5;
290 else if (trg.EqualTo(
"ANY")) sel = AliVEvent::kAny;
296 if (sig_dphi_s<0)
fOptions.
Set(
"sig-dphi-s", TMath::Sqrt(sig_n_std)*dphi);
299 task->SelectCollisionCandidates(sel);
301 SetOnTask(task,
"TriggerSelection", sel);
302 FromOption(task,
"UseCentralityVar",
"cent",
"");
303 FromOption(task,
"CheckReconstructables",
"check-reco",
false);
304 FromOption(task,
"NStdDev",
"sig-n-dev", 25.);
305 FromOption(task,
"ScaleDThetaBySin2T",
"scale-dtheta",
false);
306 FromOption(task,
"CutOnDThetaX",
"cut-dtheta",
false);
308 FromOption(task,
"ThetaWindow",
"dtheta", 0.025);
309 FromOption(task,
"PhiShift",
"phi-shift", 0.0045);
310 FromOption(task,
"PhiOverlapCut",
"outlier-phi", 0.005);
311 FromOption(task,
"ZetaOverlapCut",
"outlier-z-eta",0.05);
312 FromOption(task,
"PhiRot",
"phi-rot", TMath::Pi());
313 FromOption(task,
"InjScale",
"inj-scale", 1.);
314 FromOption(task,
"RemoveOverlaps",
"remove-outliers",
false);
315 FromOption(task,
"DPhiSCut",
"sig-dphi-s", -1.);
316 FromOption(task,
"NStdCut",
"sig-n-std", 1.5);
317 FromOption(task,
"ScaleMCV0",
"mc-v0-scale", 1.);
320 FromOption(task,
"EtaBinWidth",
"deta", +2.5);
321 FromOption(task,
"ZVertexMin",
"ipz-min", -15.);
322 FromOption(task,
"ZVertexMax",
"ipz-max", +15.);
323 FromOption(task,
"DoNormalReco",
"fill-reco",
false);
324 FromOption(task,
"DoInjection",
"create-inj",
false);
325 FromOption(task,
"DoRotation",
"create-rot",
false);
330 TObjArray* tokens = centBins.Tokenize(
"-");
331 TArrayD array(tokens->GetEntries());
332 for (
Int_t i = 0; i < array.GetSize(); i++) {
333 TObjString* ostr =
static_cast<TObjString*
>(tokens->At(i));
335 array[i] = str.Atof();
337 gROOT->ProcessLine(Form(
"((%s)%p)->SetCentPercentiles((Double_t*)%p,%d)",
338 cls, task, array.GetArray(), array.GetSize()-1));
341 AliAnalysisDataContainer *out =
342 mgr->CreateContainer(
"clist", TList::Class(),
343 AliAnalysisManager::kOutputContainer,
344 (mc ?
"trmc.root" :
"trdt.root"));
345 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
346 mgr->ConnectOutput(task,1,out);
359 Fatal(
"",
"Failed to create the task");
364 gSystem->RedirectOutput(
"settings.txt");
365 Printf(
"=== Settings for %s train === ", mc ?
"mc" :
"dt");
376 const char*
ClassName()
const {
return "MakeTrackletTrain"; }
Double_t AsDouble(const TString &name, Double_t def=0) const
virtual AliVEventHandler * CreateInputHandler(UShort_t type, Bool_t esdRecPoints=false)
void SetupReweighting(AliAnalysisTaskSE *task)
MakeTrackletTrain(const char *name)
Bool_t AsBool(const TString &name) const
AliVEventHandler * CreateInputHandler(UShort_t type, Bool_t needRec=false)
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
const char * AsString(const TString &name, const TString &def="") const
AliVEventHandler * CreateMCHandler(UShort_t type, bool mc)
const TString & Get(const TString &name) const
const char * ClassName() const
virtual AliVEventHandler * CreateOutputHandler(UShort_t)
void CreateTasks(AliAnalysisManager *mgr)
void Set(const TString &name, const TString &value)
AliAnalysisTaskSE * CreateTask(AliAnalysisManager *mgr)
void SetDescription(const TString &d)
Base classs for train specifications.
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
virtual Bool_t LoadSource(const TString &name, bool copy=false)
void SetOnTask(AliAnalysisTaskSE *task, const char *what, UInt_t val)