]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskFastSimulation.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskFastSimulation.C
1 // $Id$
2
3 AliJetFastSimulation* AddTaskFastSimulation(
4                                             const char     *tracksName1   = "Tracks",
5                                             const char     *tracksName2   = "Tracks2",
6                                             const char     *taskName      = "JetFastSimulation"
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   {
14     ::Error("AddTaskMergeBranches", "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   if (!mgr->GetInputEventHandler())
21   {
22     ::Error("AddTaskMergeBranches", "This task requires an input event handler");
23     return NULL;
24   }
25   
26   //-------------------------------------------------------
27   // Init the task and do settings
28   //-------------------------------------------------------
29
30   AliJetFastSimulation *jetFastSim = new AliJetFastSimulation(taskName);
31   jetFastSim->SetTracksName(tracksName1);
32   jetFastSim->SetTracksOutName(tracksName2);
33
34   //-------------------------------------------------------
35   // Final settings, pass to manager and set the containers
36   //-------------------------------------------------------
37   mgr->AddTask(jetFastSim);
38     
39   // Create containers for input/output
40   mgr->ConnectInput (jetFastSim, 0, mgr->GetCommonInputContainer() );
41
42   TString contName = taskName;
43   contName += "_histos";
44   TString outputfile = Form("%s",AliAnalysisManager::GetCommonFileName());
45   AliAnalysisDataContainer *outc = mgr->CreateContainer(contName.Data(),
46                                                         TList::Class(),
47                                                         AliAnalysisManager::kOutputContainer,
48                                                         outputfile);
49   mgr->ConnectOutput(jetFastSim, 1, outc);
50
51   return jetFastSim;
52 }