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