]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | ||
3 | AliAnalysisTaskSAJF* AddTaskSAJF( | |
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.8, | |
11 | Double_t ptcut = 0.15, | |
12 | UInt_t type = AliAnalysisTaskEmcal::kTPC, | |
13 | Int_t leadhadtype = 0, | |
14 | const char *taskname = "AliAnalysisTaskSAJF" | |
15 | ) | |
16 | { | |
17 | // Get the pointer to the existing analysis manager via the static access method. | |
18 | //============================================================================== | |
19 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
20 | if (!mgr) | |
21 | { | |
22 | ::Error("AddTaskSAJF", "No analysis manager to connect to."); | |
23 | return NULL; | |
24 | } | |
25 | ||
26 | // Check the analysis type using the event handlers connected to the analysis manager. | |
27 | //============================================================================== | |
28 | if (!mgr->GetInputEventHandler()) | |
29 | { | |
30 | ::Error("AddTaskSAJF", "This task requires an input event handler"); | |
31 | return NULL; | |
32 | } | |
33 | ||
34 | //------------------------------------------------------- | |
35 | // Init the task and do settings | |
36 | //------------------------------------------------------- | |
37 | ||
38 | TString name(Form("%s_%s_%s_R0%d_",taskname,njets,nrho,(Int_t)floor(jetradius*100+0.5))); | |
39 | if (type == AliAnalysisTaskEmcal::kTPC) | |
40 | name += "TPC"; | |
41 | else if (type == AliAnalysisTaskEmcal::kEMCAL) | |
42 | name += "EMCAL"; | |
43 | else if (type == AliAnalysisTaskEmcal::kUser) | |
44 | name += "USER"; | |
45 | AliAnalysisTaskSAJF* jetTask = new AliAnalysisTaskSAJF(name); | |
46 | jetTask->SetAnaType(type); | |
47 | jetTask->SetTracksName(ntracks); | |
48 | jetTask->SetClusName(nclusters); | |
49 | jetTask->SetJetsName(njets); | |
50 | jetTask->SetRhoName(nrho); | |
51 | jetTask->SetPtCut(ptcut); | |
52 | jetTask->SetJetRadius(jetradius); | |
53 | jetTask->SetJetPtCut(jetptcut); | |
54 | jetTask->SetPercAreaCut(jetareacut); | |
55 | jetTask->SetLeadingHadronType(leadhadtype); | |
56 | ||
57 | //------------------------------------------------------- | |
58 | // Final settings, pass to manager and set the containers | |
59 | //------------------------------------------------------- | |
60 | ||
61 | mgr->AddTask(jetTask); | |
62 | ||
63 | // Create containers for input/output | |
64 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; | |
65 | TString contname(name); | |
66 | contname += "_histos"; | |
67 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
68 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
69 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
70 | mgr->ConnectInput (jetTask, 0, cinput1 ); | |
71 | mgr->ConnectOutput (jetTask, 1, coutput1 ); | |
72 | ||
73 | return jetTask; | |
74 | } |