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