]>
Commit | Line | Data |
---|---|---|
3e9c29c7 | 1 | // $Id$ |
2 | ||
3 | AliAnalysisTaskRhoAverage* AddTaskRhoAverage( | |
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, | |
624bef5b | 12 | Double_t trackptcut = 0.15, |
13 | Double_t clusptcut = 0.30, | |
a487deae | 14 | TF1 *sfunc = 0, |
15 | const UInt_t exclPart = 2, | |
16 | const UInt_t rhotype = 1, | |
17 | const Bool_t histo = kFALSE, | |
18 | const char *taskname = "RhoAverage" | |
3e9c29c7 | 19 | ) |
20 | { | |
21 | // Get the pointer to the existing analysis manager via the static access method. | |
22 | //============================================================================== | |
23 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
24 | if (!mgr) | |
25 | { | |
26 | ::Error("AddTaskRhoAverage", "No analysis manager to connect to."); | |
27 | return NULL; | |
28 | } | |
29 | ||
30 | // Check the analysis type using the event handlers connected to the analysis manager. | |
31 | //============================================================================== | |
32 | if (!mgr->GetInputEventHandler()) | |
33 | { | |
34 | ::Error("AddTaskRhoAverage", "This task requires an input event handler"); | |
35 | return NULL; | |
36 | } | |
37 | ||
38 | //------------------------------------------------------- | |
39 | // Init the task and do settings | |
40 | //------------------------------------------------------- | |
41 | ||
a487deae | 42 | TString name(Form("%s_%s_%s_", taskname, nTracks, nClusters)); |
43 | if (type == AliAnalysisTaskEmcal::kTPC) | |
44 | name += "TPC"; | |
45 | else if (type == AliAnalysisTaskEmcal::kEMCAL) | |
46 | name += "EMCAL"; | |
47 | else if (type == AliAnalysisTaskEmcal::kUser) | |
48 | name += "USER"; | |
49 | AliAnalysisTaskRhoAverage *rhotask = new AliAnalysisTaskRhoAverage(name, histo); | |
50 | rhotask->SetAnaType(type); | |
51 | rhotask->SetScaleFunction(sfunc); | |
3e9c29c7 | 52 | rhotask->SetJetsName(nJets); |
53 | rhotask->SetTracksName(nTracks); | |
a487deae | 54 | rhotask->SetClusName(nClusters); |
3e9c29c7 | 55 | rhotask->SetRhoName(nRho); |
a487deae | 56 | rhotask->SetJetAreaCut(jetareacut); |
57 | rhotask->SetAreaEmcCut(emcareacut); | |
624bef5b | 58 | rhotask->SetClusPtCut(clusptcut); |
59 | rhotask->SetTrackPtCut(trackptcut); | |
a487deae | 60 | rhotask->SetJetPtCut(0); |
61 | rhotask->SetJetRadius(jetradius); | |
62 | rhotask->SetExcludeLeadPart(exclPart); | |
63 | rhotask->SetRhoType(rhotype); | |
3e9c29c7 | 64 | |
65 | //------------------------------------------------------- | |
66 | // Final settings, pass to manager and set the containers | |
67 | //------------------------------------------------------- | |
68 | ||
69 | mgr->AddTask(rhotask); | |
70 | ||
71 | // Create containers for input/output | |
a487deae | 72 | mgr->ConnectInput(rhotask, 0, mgr->GetCommonInputContainer()); |
73 | ||
74 | if (histo) { | |
75 | TString contname(name); | |
76 | contname += "_histos"; | |
77 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
78 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
79 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
80 | mgr->ConnectOutput(rhotask, 1, coutput1); | |
81 | } | |
3e9c29c7 | 82 | |
83 | return rhotask; | |
84 | } |