]>
Commit | Line | Data |
---|---|---|
a487deae | 1 | |
2 | AliAnalysisTaskDeltaPt* AddTaskDeltaPt( | |
3 | const char *ntracks = "Tracks", | |
4 | const char *nclusters = "CaloClusters", | |
5 | const char *njets = "Jets", | |
6 | const char *nembtracks = "TracksEmbedded", | |
7 | const char *nembclusters = "CaloClustersEmbedded", | |
8 | const char *nembjets = "EmbJets", | |
9 | const char *nrandtracks = "TracksRandomized", | |
10 | const char *nrandclusters = "CaloClustersRandomized", | |
11 | const char *nrho = "Rho", | |
12 | Double_t jetradius = 0.2, | |
13 | Double_t jetptcut = 1, | |
14 | Double_t jetareacut = 0.8, | |
15 | Double_t ptcut = 0.15, | |
16 | UInt_t type = AliAnalysisTaskEmcal::kTPC, | |
17 | const char *taskname = "AliAnalysisTaskDeltaPt" | |
18 | ) | |
19 | { | |
20 | // Get the pointer to the existing analysis manager via the static access method. | |
21 | //============================================================================== | |
22 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
23 | if (!mgr) | |
24 | { | |
25 | ::Error("AddTaskSAJF", "No analysis manager to connect to."); | |
26 | return NULL; | |
27 | } | |
28 | ||
29 | // Check the analysis type using the event handlers connected to the analysis manager. | |
30 | //============================================================================== | |
31 | if (!mgr->GetInputEventHandler()) | |
32 | { | |
33 | ::Error("AddTaskSAJF", "This task requires an input event handler"); | |
34 | return NULL; | |
35 | } | |
36 | ||
37 | //------------------------------------------------------- | |
38 | // Init the task and do settings | |
39 | //------------------------------------------------------- | |
40 | TString name(Form("%s_%s_%s_%s_R0%d_",taskname,ntracks,nclusters,nrho,(Int_t)floor(jetradius*100+0.5))); | |
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"; | |
47 | ||
48 | AliAnalysisTaskDeltaPt* jetTask = new AliAnalysisTaskDeltaPt(name); | |
49 | jetTask->SetAnaType(type); | |
50 | jetTask->SetTracksName(ntracks); | |
51 | jetTask->SetClusName(nclusters); | |
52 | jetTask->SetJetsName(njets); | |
53 | jetTask->SetEmbTracksName(nembtracks); | |
54 | jetTask->SetEmbClusName(nembclusters); | |
55 | jetTask->SetEmbJetsName(nembjets); | |
56 | jetTask->SetRandTracksName(nrandtracks); | |
57 | jetTask->SetRandClusName(nrandclusters); | |
58 | jetTask->SetRhoName(nrho); | |
59 | jetTask->SetPtCut(ptcut); | |
60 | jetTask->SetJetRadius(jetradius); | |
61 | jetTask->SetJetPtCut(jetptcut); | |
62 | jetTask->SetPercAreaCut(jetareacut); | |
63 | ||
64 | //------------------------------------------------------- | |
65 | // Final settings, pass to manager and set the containers | |
66 | //------------------------------------------------------- | |
67 | ||
68 | mgr->AddTask(jetTask); | |
69 | ||
70 | // Create containers for input/output | |
71 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
72 | TString contname(name); | |
73 | contname += "_histos"; | |
74 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
75 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
76 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
77 | mgr->ConnectInput (jetTask, 0, cinput1 ); | |
78 | mgr->ConnectOutput (jetTask, 1, coutput1 ); | |
79 | ||
80 | return jetTask; | |
81 | } |