]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/macros/AddTaskEmcalTrackPropagator.C
added a few more datasets
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEmcalTrackPropagator.C
1 // $Id$
2
3 AliEmcalTrackPropagatorTask* AddTaskEmcalTrackPropagator(
4   const char *name         = "Tracks",
5   const Double_t d         = -1,
6   const Double_t pt        = -1
7 )
8 {  
9   // Get the pointer to the existing analysis manager via the static access method.
10   //==============================================================================
11   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12   if (!mgr) {
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   //==============================================================================
19   AliVEventHandler *evhand = mgr->GetInputEventHandler();
20   if (!evhand) {
21     ::Error("AddTaskEmcalTrackPropagator", "This task requires an input event handler");
22     return NULL;
23   }
24   
25   if (!evhand->InheritsFrom("AliESDInputHandler")) {
26     ::Info("AddTaskEmcalTrackPropagator", "This task is only needed for ESD analysis. No task added.");
27     return NULL;
28   }
29
30   //-------------------------------------------------------
31   // Init the task and do settings
32   //-------------------------------------------------------
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   //-------------------------------------------------------
41   mgr->AddTask(propagator);
42   
43   // Create containers for input/output
44   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
45   mgr->ConnectInput  (propagator, 0,  cinput1 );
46   
47   return propagator;
48 }