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