]>
Commit | Line | Data |
---|---|---|
8628b70c | 1 | // $Id$ |
9f52c61f | 2 | |
3 | AliAnalysisTaskEmcalJetSample* AddTaskEmcalJetSample( | |
4 | const char *ntracks = "Tracks", | |
5 | const char *nclusters = "CaloClusters", | |
6 | const char *njets = "Jets", | |
7 | const char *nrho = "Rho", | |
8 | Double_t jetradius = 0.2, | |
9 | Double_t jetptcut = 1, | |
10 | Double_t jetareacut = 0.557, | |
11 | UInt_t type = AliAnalysisTaskEmcal::kEMCAL, | |
12 | Int_t leadhadtype = 0, | |
13 | const char *taskname = "AliAnalysisTaskEmcalJetSample" | |
14 | ) | |
15 | { | |
16 | // Get the pointer to the existing analysis manager via the static access method. | |
17 | //============================================================================== | |
18 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
19 | if (!mgr) | |
20 | { | |
21 | ::Error("AddTaskEmcalJetSample", "No analysis manager to connect to."); | |
22 | return NULL; | |
23 | } | |
24 | ||
25 | // Check the analysis type using the event handlers connected to the analysis manager. | |
26 | //============================================================================== | |
27 | if (!mgr->GetInputEventHandler()) | |
28 | { | |
29 | ::Error("AddTaskEmcalJetSample", "This task requires an input event handler"); | |
30 | return NULL; | |
31 | } | |
32 | ||
33 | //------------------------------------------------------- | |
34 | // Init the task and do settings | |
35 | //------------------------------------------------------- | |
36 | ||
37 | TString name(taskname); | |
38 | if (strcmp(njets,"")) { | |
39 | name += "_"; | |
40 | name += njets; | |
41 | } | |
42 | if (strcmp(nrho,"")) { | |
43 | name += "_"; | |
44 | name += nrho; | |
45 | } | |
46 | if (type == AliAnalysisTaskEmcal::kTPC) | |
47 | name += "_TPC"; | |
48 | else if (type == AliAnalysisTaskEmcal::kEMCAL) | |
49 | name += "_EMCAL"; | |
50 | else if (type == AliAnalysisTaskEmcal::kUser) | |
51 | name += "_USER"; | |
52 | ||
53 | AliAnalysisTaskEmcalJetSample* jetTask = new AliAnalysisTaskEmcalJetSample(name); | |
54 | jetTask->SetAnaType(type); | |
55 | jetTask->SetTracksName(ntracks); | |
56 | jetTask->SetClusName(nclusters); | |
57 | jetTask->SetJetsName(njets); | |
58 | jetTask->SetRhoName(nrho); | |
59 | jetTask->SetJetRadius(jetradius); | |
60 | jetTask->SetJetPtCut(jetptcut); | |
61 | jetTask->SetPercAreaCut(jetareacut); | |
62 | jetTask->SetLeadingHadronType(leadhadtype); | |
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 | } |