]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskRho.C
move EMCALJetTasks from PWGGA to PWGJE
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskRho.C
CommitLineData
020052e4 1// $Id$
2
3AliAnalysisTaskRho* AddTaskRho(
baf45d85 4 const char *outfilename = "AnalysisResults.root",
020052e4 5 const char *nJets = "Jets",
f6e8a928 6 const char *nTracks = "PicoTracks",
baf45d85 7 const char *nRho = "Rho",
8 const Double_t minPhi = 0,
9 const Double_t maxPhi = 2 * TMath::Pi(),
020052e4 10 const Double_t minEta = -0.3,
11 const Double_t maxEta = 0.3,
81cf988e 12 const Double_t minArea = 0.01,
13 const UInt_t exclJets = 1,
14 const Bool_t histo = kFALSE,
15 const char *taskname = "Rho"
020052e4 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
81cf988e 39 TString name(Form("%s_%s", taskname, nJets));
5d845887 40 AliAnalysisTaskRho *rhotask = new AliAnalysisTaskRho(name, histo);
020052e4 41 rhotask->SetJetsName(nJets);
f6e8a928 42 rhotask->SetTracksName(nTracks);
baf45d85 43 rhotask->SetRhoName(nRho);
020052e4 44 rhotask->SetJetPhi(minPhi,maxPhi);
45 rhotask->SetJetEta(minEta,maxEta);
46 rhotask->SetAreaCut(minArea);
c60e0a21 47 rhotask->SetExcludeLeadJets(exclJets);
020052e4 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() );
d41a0b1c 57 if (histo) {
58 AliAnalysisDataContainer *corho = mgr->CreateContainer(name,
020052e4 59 TList::Class(),
60 AliAnalysisManager::kOutputContainer,
61 outfilename);
d41a0b1c 62 mgr->ConnectOutput(rhotask, 1, corho);
63 }
020052e4 64
65 return rhotask;
66}