Patch for jet analysis
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEmcalTrackPropagator.C
CommitLineData
0601d71e 1// $Id$
2
25283b37 3AliEmcalTrackPropagatorTask* AddTaskEmcalTrackPropagator(
0601d71e 4 const char *name = "Tracks",
5 const Double_t d = -1,
6 const Double_t pt = -1
7)
25283b37 8{
9 // Get the pointer to the existing analysis manager via the static access method.
10 //==============================================================================
11 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
53dca394 12 if (!mgr) {
25283b37 13 ::Error("AddTaskEmcalTrackPropagator", "No analysis manager to connect to.");
14 return NULL;
15 }
16
17 // Check the analysis type using the event handlers connected to the analysis manager.
18 //==============================================================================
53dca394 19 AliVEventHandler *evhand = mgr->GetInputEventHandler();
20 if (!evhand) {
25283b37 21 ::Error("AddTaskEmcalTrackPropagator", "This task requires an input event handler");
22 return NULL;
23 }
24
53dca394 25 if (!evhand->InheritsFrom("AliESDInputHandler")) {
26 ::Info("AddTaskEmcalTrackPropagator", "This task is only needed for ESD analysis. No task added.");
27 return NULL;
28 }
29
25283b37 30 //-------------------------------------------------------
31 // Init the task and do settings
32 //-------------------------------------------------------
25283b37 33 AliEmcalTrackPropagatorTask* propagator = new AliEmcalTrackPropagatorTask();
34 propagator->SetTracksName(name);
35 if (d > -1) propagator->SetDist(d);
36 if (pt > -1) propagator->SetMinPt(pt);
37
38 //-------------------------------------------------------
39 // Final settings, pass to manager and set the containers
40 //-------------------------------------------------------
25283b37 41 mgr->AddTask(propagator);
42
43 // Create containers for input/output
44 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
25283b37 45 mgr->ConnectInput (propagator, 0, cinput1 );
25283b37 46
47 return propagator;
25283b37 48}