]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | ||
3 | AliAnalysisTaskRho* AddTaskRho( | |
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 | TF1 *sfunc = 0, | |
13 | const UInt_t exclJets = 2, | |
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 | 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"; | |
46 | AliAnalysisTaskRho *rhotask = new AliAnalysisTaskRho(name, histo); | |
47 | rhotask->SetAnaType(type); | |
48 | rhotask->SetScaleFunction(sfunc); | |
49 | rhotask->SetJetsName(nJets); | |
50 | rhotask->SetTracksName(nTracks); | |
51 | rhotask->SetClusName(nClusters); | |
52 | rhotask->SetRhoName(nRho); | |
53 | rhotask->SetJetAreaCut(jetareacut); | |
54 | rhotask->SetAreaEmcCut(emcareacut); | |
55 | rhotask->SetJetPtCut(0); | |
56 | rhotask->SetJetRadius(jetradius); | |
57 | rhotask->SetExcludeLeadJets(exclJets); | |
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 | |
66 | mgr->ConnectInput(rhotask, 0, mgr->GetCommonInputContainer()); | |
67 | if (histo) { | |
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); | |
74 | } | |
75 | ||
76 | return rhotask; | |
77 | } |