3 AliEmcalAodTrackFilterTask* AddTaskEmcalAodTrackFilter(
4 const char *name = "FilterTracks",
5 const char *inname = "tracks",
6 const char *runperiod = "",
7 const char *taskName = "AliEmcalAodTrackFilterTask"
10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
15 ::Error("AddTaskAodTrackFilter", "No analysis manager to connect to.");
19 // Check the analysis type using the event handlers connected to the analysis manager.
20 //==============================================================================
21 if (!mgr->GetInputEventHandler())
23 ::Error("AddTaskAodTrackFilter", "This task requires an input event handler");
27 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
28 if (inputDataType != "AOD")) {
29 ::Info("AddTaskEmcalAodTpcTrack", "This task is only needed for AOD analysis. No task added.");
33 //-------------------------------------------------------
34 // Init the task and do settings
35 //-------------------------------------------------------
37 AliEmcalAodTrackFilterTask *aodTask = new AliEmcalAodTrackFilterTask(taskName);
38 aodTask->SetTracksOutName(name);
39 aodTask->SetTracksInName(inname);
40 aodTask->SetMC(kFALSE);
42 Bool_t includeNoITS = kFALSE;
43 Bool_t doProp = kFALSE;
44 TString runPeriod(runperiod);
46 if (runPeriod == "lhc11h" || runPeriod == "lhc13b" || runPeriod == "lhc13c" ||
47 runPeriod == "lhc13d" || runPeriod == "lhc13e" || runPeriod == "lhc13f" ||
48 runPeriod == "lhc13g" || runPeriod == "lhc12g" || runPeriod == "lhc10h" ||
49 runPeriod == "lhc10d" || runPeriod == "lhc10e" || runPeriod == "lhc12a" ||
50 runPeriod == "lhc12b" || runPeriod == "lhc12c" || runPeriod == "lhc12d" ||
51 runPeriod == "lhc12e" || runPeriod == "lhc12f" || runPeriod == "lhc12g" ||
52 runPeriod == "lhc12h" || runPeriod == "lhc12i"
54 aodTask->SetAODfilterBits(256,512); // hybrid tracks
55 if (runPeriod == "lhc10h" || runPeriod == "lhc10d" || runPeriod == "lhc10e")
57 } else if (runPeriod == "lhc12a15e" || runPeriod == "lhc13b4" || runPeriod == "lhc13b4_fix" || runPeriod == "lhc13b4_plus" || runPeriod == "lhc12a15f"
58 || runPeriod.Contains("lhc12a17") || runPeriod.Contains("lhc14a1")) {
59 aodTask->SetAODfilterBits(256,512); // hybrid tracks
60 aodTask->SetMC(kTRUE);
61 } else if (runPeriod == "lhc11a" || runPeriod == "lhc10hold") {
62 aodTask->SetAODfilterBits(256,16); // hybrid tracks
64 } else if (runPeriod.Contains("lhc12a15a")) {
65 aodTask->SetAODfilterBits(256,16); // hybrid tracks
66 aodTask->SetMC(kTRUE);
68 } else if (runPeriod.Contains(":")) {
69 TObjArray *arr = runPeriod.Tokenize(":");
70 TString arg1(arr->At(0)->GetName());
72 if (arr->GetEntries()>1)
73 arg2 = arr->At(1)->GetName();
74 if (arr->GetEntries()>2) {
75 TString arg3 = arr->At(2)->GetName();
76 if (arg3.Contains("includeNoITS=kTRUE"))
78 if (arg3.Contains("doProp=kTRUE"))
81 aodTask->SetAODfilterBits(arg1.Atoi(),arg2.Atoi());
84 if (!runPeriod.IsNull())
85 ::Warning("Run period %s not known. It will use IsHybridGlobalConstrainedGlobal.", runPeriod.Data());
87 aodTask->SetIncludeNoITS(includeNoITS);
88 aodTask->SetDoPropagation(doProp);
89 //aodTask->SetAttemptProp(kTRUE);
91 //-------------------------------------------------------
92 // Final settings, pass to manager and set the containers
93 //-------------------------------------------------------
94 mgr->AddTask(aodTask);
96 // Create containers for input/output
97 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
98 mgr->ConnectInput(aodTask, 0, cinput1 );