Patch for jet analysis
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEmcalEsdTpcTrack.C
CommitLineData
0601d71e 1// $Id$
2
53dca394 3AliEmcalEsdTpcTrackTask* AddTaskEmcalEsdTpcTrack(const char *name = "TpcSpdVertexConstrainedTracks",
e1bdcdfb 4 const char *trackCuts = "Hybrid_LHC11h"
5 )
6{
7 enum CutsType {
8 kHybrid = 0,
9 kTpcOnly = 1
10 };
11
12 enum DataSet {
13 kLHC11h = 0,
14 kLHC11a = 1
15 };
16
17 CutsType cutsType = kHybrid;
18 DataSet dataSet = kLHC11h;
19
20 TString cutsLabel("hybrid tracks");
21 TString dataSetLabel("LHC11h");
22
23 TString strTrackCuts(trackCuts);
24
25 if (strTrackCuts.Contains("Hybrid")) {
26 cutsType = kHybrid;
27 }
28 else if (strTrackCuts.Contains("TpcOnly")) {
29 cutsType = kTpcOnly;
30 cutsLabel = "TPC only constrained tracks";
31 }
32 else {
33 ::Warning("AddTaskEmcalEsdTpcTrack", "Cuts type not recognized, will assume Hybrid");
34 }
35
36 if (strTrackCuts.Contains("LHC11h")) {
37 dataSet = kLHC11h;
38 }
39 else if (strTrackCuts.Contains("LHC11a")) {
40 dataSet = kLHC11a;
41 dataSetLabel = "LHC11a";
42 }
43 else {
44 ::Warning("AddTaskEmcalEsdTpcTrack", "Dataset not recognized, will assume LHC11h");
45 }
46
25283b37 47 // Get the pointer to the existing analysis manager via the static access method.
48 //==============================================================================
49 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
53dca394 50 if (!mgr) {
25283b37 51 ::Error("AddTaskEmcalEsdTpcTrack", "No analysis manager to connect to.");
52 return NULL;
53 }
54
55 // Check the analysis type using the event handlers connected to the analysis manager.
56 //==============================================================================
53dca394 57 AliVEventHandler *evhand = mgr->GetInputEventHandler();
58 if (!evhand) {
25283b37 59 ::Error("AddTaskEmcalEsdTpcTrack", "This task requires an input event handler");
60 return NULL;
61 }
62
53dca394 63 if (!evhand->InheritsFrom("AliESDInputHandler")) {
64 ::Info("AddTaskEmcalEsdTpcTrack", "This task is only needed for ESD analysis. No task added.");
65 return NULL;
66 }
67
25283b37 68 //-------------------------------------------------------
69 // Init the task and do settings
70 //-------------------------------------------------------
71
344cd45d 72 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
73
e1bdcdfb 74 AliEmcalEsdTpcTrackTask *eTask = new AliEmcalEsdTpcTrackTask(); // default is TPC only tracks constrained to the vertex
25283b37 75
e1bdcdfb 76 if (dataSet == kLHC11h && cutsType == kHybrid) {
77 /* hybrid track cuts*/
78 AliESDtrackCuts *cutsp = CreateTrackCutsPWGJE(10001007); //1000 adds SPD any requirement
79 AliESDtrackCuts *hybsp = CreateTrackCutsPWGJE(10041007); //1004 removes ITSrefit requirement from standard set
80 hybsp->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
81 eTask->SetTrackCuts(cutsp);
82 eTask->SetHybridTrackCuts(hybsp);
83 }
84 else if (dataSet == kLHC11a && cutsType == kHybrid) {
85 /* hybrid track cuts*/
86 AliESDtrackCuts *cutsp = CreateTrackCutsPWGJE(10001006); //1000 adds SPD any requirement
87 AliESDtrackCuts *hybsp = CreateTrackCutsPWGJE(10041006); //1004 removes ITSrefit requirement from standard set
88 hybsp->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
89 eTask->SetTrackCuts(cutsp);
90 eTask->SetHybridTrackCuts(hybsp);
91 }
344cd45d 92
25283b37 93 eTask->SetTracksName(name);
94
e1bdcdfb 95 cout << " *** Track selector task configured to select " << cutsLabel << " in dataset "<< dataSetLabel << " *** " << endl;
25283b37 96
97 //-------------------------------------------------------
98 // Final settings, pass to manager and set the containers
99 //-------------------------------------------------------
25283b37 100 mgr->AddTask(eTask);
101
102 // Create containers for input/output
344cd45d 103 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
104 mgr->ConnectInput(eTask, 0, cinput1);
25283b37 105
106 return eTask;
25283b37 107}