]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskRhoBase.C
From Salvatore
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskRhoBase.C
CommitLineData
95170bf5 1// $Id$
2
3AliAnalysisTaskRhoBase* AddTaskRhoBase(
a487deae 4 const char *nJets = "Jets",
5 const char *nTracks = "PicoTracks",
6 const char *nClusters = "CaloClusters",
7 const char *nRho = "Rho",
8 Double_t jetradius = 0.2,
9 UInt_t type = AliAnalysisTaskEmcal::kTPC,
10 Double_t jetareacut = 0.01,
11 Double_t emcareacut = 0,
a487deae 12 TF1 *sfunc = 0,
13 TF1 *rfunc = 0,
14 const Bool_t histo = kFALSE,
15 const char *taskname = "RhoBase"
16
95170bf5 17)
18{
19 // Get the pointer to the existing analysis manager via the static access method.
20 //==============================================================================
21 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
22 if (!mgr)
23 {
24 ::Error("AddTaskRhoBase", "No analysis manager to connect to.");
25 return NULL;
26 }
27
28 // Check the analysis type using the event handlers connected to the analysis manager.
29 //==============================================================================
30 if (!mgr->GetInputEventHandler())
31 {
32 ::Error("AddTaskRho", "This task requires an input event handler");
33 return NULL;
34 }
35
36 //-------------------------------------------------------
37 // Init the task and do settings
38 //-------------------------------------------------------
39
a487deae 40 AliAnalysisTaskRhoBase *rhotask = new AliAnalysisTaskRhoBase(taskname,histo);
41 rhotask->SetAnaType(type);
95170bf5 42 rhotask->SetRhoFunction(rfunc);
a487deae 43 rhotask->SetScaleFunction(sfunc);
44 rhotask->SetJetsName(nJets);
45 rhotask->SetTracksName(nTracks);
46 rhotask->SetClusName(nClusters);
47 rhotask->SetRhoName(nRho);
48 rhotask->SetJetAreaCut(jetareacut);
49 rhotask->SetAreaEmcCut(emcareacut);
a487deae 50 rhotask->SetJetPtCut(0);
51 rhotask->SetJetRadius(jetradius);
95170bf5 52
53 //-------------------------------------------------------
54 // Final settings, pass to manager and set the containers
55 //-------------------------------------------------------
56
57 mgr->AddTask(rhotask);
58
59 // Create containers for input/output
a487deae 60 mgr->ConnectInput(rhotask, 0, mgr->GetCommonInputContainer());
61
62 if (histo) {
63 TString contname(taskname);
64 contname += "_histos";
65 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
66 TList::Class(),AliAnalysisManager::kOutputContainer,
67 Form("%s", AliAnalysisManager::GetCommonFileName()));
68 mgr->ConnectOutput(rhotask, 1, coutput1);
69 }
95170bf5 70
71 return rhotask;
72}