]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskJetRandomizer.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskJetRandomizer.C
1 // $Id$
2
3 AliJetRandomizerTask* AddTaskJetRandomizer(
4   const char     *tracksName   = "Tracks",
5   const char     *clusName     = "CaloClustersCorr",
6   const char     *taskName     = "JetRandomizerTask",
7   const Double_t  minEta       = -0.9,
8   const Double_t  maxEta       = 0.9,
9   const Double_t  minPhi       = 0,
10   const Double_t  maxPhi       = TMath::Pi() * 2,
11   const Int_t     nTracks      = 1,
12   const Int_t     nClus        = 0,
13   const Bool_t    copyArray    = kTRUE
14 )
15 {  
16   // Get the pointer to the existing analysis manager via the static access method.
17   //==============================================================================
18   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19   if (!mgr)
20   {
21     ::Error("AddTaskJetRandomizer", "No analysis manager to connect to.");
22     return NULL;
23   }  
24   
25   // Check the analysis type using the event handlers connected to the analysis manager.
26   //==============================================================================
27   if (!mgr->GetInputEventHandler())
28   {
29     ::Error("AddTaskJetRandomizer", "This task requires an input event handler");
30     return NULL;
31   }
32   
33   //-------------------------------------------------------
34   // Init the task and do settings
35   //-------------------------------------------------------
36
37   AliJetRandomizerTask *jetRand = new AliJetRandomizerTask(taskName);
38   jetRand->SetTracksName(tracksName);
39   jetRand->SetClusName(clusName);
40   jetRand->SetEtaRange(minEta, maxEta);
41   jetRand->SetPhiRange(minPhi, maxPhi);
42   jetRand->SetCopyArray(copyArray);
43   jetRand->SetNClusters(nClus);
44   jetRand->SetNTracks(nTracks);
45
46   //-------------------------------------------------------
47   // Final settings, pass to manager and set the containers
48   //-------------------------------------------------------
49
50   mgr->AddTask(jetRand);
51     
52   // Create containers for input/output
53   mgr->ConnectInput (jetRand, 0, mgr->GetCommonInputContainer() );
54
55   return jetRand;
56 }