]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/macros/AddTaskEmcalTrackPropagator.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEmcalTrackPropagator.C
1 // $Id$
2
3 AliEmcalTrackPropagatorTask* AddTaskEmcalTrackPropagator(
4   const char *nameIn       = 0,
5   const char *nameOut      = 0,
6   const Bool_t onlyifnot   = kTRUE,
7   const Double_t d         = 440
8 )
9 {  
10   // Get the pointer to the existing analysis manager via the static access method.
11   //==============================================================================
12   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13   if (!mgr) {
14     ::Error("AddTaskEmcalTrackPropagator", "No analysis manager to connect to.");
15     return NULL;
16   }  
17   
18   // Check the analysis type using the event handlers connected to the analysis manager.
19   //==============================================================================
20   AliVEventHandler *evhand = mgr->GetInputEventHandler();
21   if (!evhand) {
22     ::Error("AddTaskEmcalTrackPropagator", "This task requires an input event handler");
23     return NULL;
24   }
25
26   //-------------------------------------------------------
27   // Init the task and do settings
28   //-------------------------------------------------------
29   AliEmcalTrackPropagatorTask* propagator = new AliEmcalTrackPropagatorTask();
30   if (nameIn)
31     propagator->SetTracksInName(nameIn);
32   if (nameOut)
33     propagator->SetTracksOutName(nameOut);
34   if (d>0) 
35     propagator->SetDist(d);
36   propagator->SetOnlyIfNotSet(onlyifnot);
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 }