]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskRho.C
Changes from Salvatore:
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskRho.C
CommitLineData
020052e4 1// $Id$
2
3AliAnalysisTaskRho* AddTaskRho(
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,
12 Double_t ptcut = 0.15,
13 TF1 *sfunc = 0,
14 const UInt_t exclJets = 2,
81cf988e 15 const Bool_t histo = kFALSE,
a487deae 16 const char *taskname = "Rho"
020052e4 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("AddTaskRho", "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 TString name(Form("%s_%s_", taskname, nJets));
41 if (type == AliAnalysisTaskEmcal::kTPC)
42 name += "TPC";
43 else if (type == AliAnalysisTaskEmcal::kEMCAL)
44 name += "EMCAL";
45 else if (type == AliAnalysisTaskEmcal::kUser)
46 name += "USER";
5d845887 47 AliAnalysisTaskRho *rhotask = new AliAnalysisTaskRho(name, histo);
a487deae 48 rhotask->SetAnaType(type);
49 rhotask->SetScaleFunction(sfunc);
020052e4 50 rhotask->SetJetsName(nJets);
f6e8a928 51 rhotask->SetTracksName(nTracks);
a487deae 52 rhotask->SetClusName(nClusters);
baf45d85 53 rhotask->SetRhoName(nRho);
a487deae 54 rhotask->SetJetAreaCut(jetareacut);
55 rhotask->SetAreaEmcCut(emcareacut);
56 rhotask->SetPtCut(ptcut);
57 rhotask->SetJetPtCut(0);
58 rhotask->SetJetRadius(jetradius);
c60e0a21 59 rhotask->SetExcludeLeadJets(exclJets);
020052e4 60
61 //-------------------------------------------------------
62 // Final settings, pass to manager and set the containers
63 //-------------------------------------------------------
64
65 mgr->AddTask(rhotask);
66
67 // Create containers for input/output
a487deae 68 mgr->ConnectInput(rhotask, 0, mgr->GetCommonInputContainer());
d41a0b1c 69 if (histo) {
a487deae 70 TString contname(name);
71 contname += "_histos";
72 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
73 TList::Class(),AliAnalysisManager::kOutputContainer,
74 Form("%s", AliAnalysisManager::GetCommonFileName()));
75 mgr->ConnectOutput(rhotask, 1, coutput1);
d41a0b1c 76 }
020052e4 77
78 return rhotask;
79}