]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALJetTasks/macros/AddTaskRho.C
ae8e01b8bb1b6f6313442624e90ffb43c9459a41
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / macros / AddTaskRho.C
1 // $Id$
2
3 AliAnalysisTaskRho* AddTaskRho(
4    const char *outfilename    = "AnalysisResults.root",
5    const char *nJets          = "Jets",
6    const char *nTracks        = "PicoTracks",   
7    const char *nRho           = "Rho",
8    const Double_t minPhi      = 0,
9    const Double_t maxPhi      = 2 * TMath::Pi(),
10    const Double_t minEta      = -0.3,
11    const Double_t maxEta      = 0.3,
12    const Double_t minArea     = 0.01,
13    const UInt_t   exclJets    = 1,
14    const Bool_t   histo       = kFALSE,
15    const char *taskname       = "Rho"
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("AddTaskRho", "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("AddTaskRho", "This task requires an input event handler");
32     return NULL;
33   }
34   
35   //-------------------------------------------------------
36   // Init the task and do settings
37   //-------------------------------------------------------
38
39   TString name(Form("%s_%s", taskname, nJets));
40   AliAnalysisTaskRho *rhotask = new AliAnalysisTaskRho(name, histo);
41   rhotask->SetJetsName(nJets);
42   rhotask->SetTracksName(nTracks);
43   rhotask->SetRhoName(nRho);
44   rhotask->SetJetPhi(minPhi,maxPhi);
45   rhotask->SetJetEta(minEta,maxEta);
46   rhotask->SetAreaCut(minArea);
47   rhotask->SetExcludeLeadJets(exclJets);
48
49   //-------------------------------------------------------
50   // Final settings, pass to manager and set the containers
51   //-------------------------------------------------------
52
53   mgr->AddTask(rhotask);
54
55   // Create containers for input/output
56   mgr->ConnectInput (rhotask, 0, mgr->GetCommonInputContainer() );
57   if (histo) {
58     AliAnalysisDataContainer *corho = mgr->CreateContainer(name,
59                                                            TList::Class(),
60                                                            AliAnalysisManager::kOutputContainer,
61                                                            outfilename);
62     mgr->ConnectOutput(rhotask, 1, corho);
63   }
64
65   return rhotask;
66 }