]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskTagCopier.C
Transition to new base class (Salvatore/Marta).
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskTagCopier.C
1 // $Id$
2
3 AliJetConstituentTagCopier* AddTaskTagCopier(
4   const char *ntracks            = "Tracks",
5   const char *nclusters          = "CaloClusters",
6   const char *nmcparticles       = "MCParticles",
7   Double_t    trackptcut         = 0.15,
8   Double_t    clusptcut          = 0.30,
9   const char *taskname           = "AliJetConstituentTagCopier"
10 )
11 {  
12   // Get the pointer to the existing analysis manager via the static access method.
13   //==============================================================================
14   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
15   if (!mgr)
16   {
17     ::Error("AddTaskTagCopier", "No analysis manager to connect to.");
18     return NULL;
19   }  
20   
21   // Check the analysis type using the event handlers connected to the analysis manager.
22   //==============================================================================
23   if (!mgr->GetInputEventHandler())
24   {
25     ::Error("AddTaskTagCopier", "This task requires an input event handler");
26     return NULL;
27   }
28   
29   //-------------------------------------------------------
30   // Init the task and do settings
31   //-------------------------------------------------------
32   
33   TString name(taskname);
34   if (strcmp(ntracks,"")) {
35     name += "_";
36     name += ntracks;
37   }
38   if (strcmp(nclusters,"")) {
39     name += "_";
40     name += nclusters;
41   }
42   if (strcmp(nmcparticles,"")) {
43     name += "_";
44     name += nmcparticles;
45   }
46
47   AliJetConstituentTagCopier* task = new AliJetConstituentTagCopier(name);
48
49   AliParticleContainer *trackCont = jetTask->AddParticleContainer(ntracks);
50   if (trackCont) trackCont->SetParticlePtCut(trackptcut);
51
52   AliClusterContainer *clusterCont = jetTask->AddClusterContainer(nclusters);
53   if (clusterCont) clusterCont->SetClusPtCut(clusptcut);
54
55   AliParticleContainer *mcPartCont = jetTask->AddParticleContainer(nmcparticles);
56
57   task->ConnectMCParticleContainerID(mcPartCont);
58
59   //-------------------------------------------------------
60   // Final settings, pass to manager and set the containers
61   //-------------------------------------------------------
62
63   mgr->AddTask(task);
64   
65   // Create containers for input/output
66   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
67   mgr->ConnectInput(task, 0, cinput1);
68
69   return task;
70