]>
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, | |
8612dfc8 | 10 | Double_t jetareacut = 0.6, |
11 | const char *type = "EMCAL", | |
9f52c61f | 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 | } | |
8612dfc8 | 46 | if (strcmp(type,"")) { |
47 | name += "_"; | |
48 | name += type; | |
49 | } | |
9f52c61f | 50 | |
9239b066 | 51 | Printf("name: %s",name.Data()); |
52 | ||
9f52c61f | 53 | AliAnalysisTaskEmcalJetSample* jetTask = new AliAnalysisTaskEmcalJetSample(name); |
8612dfc8 | 54 | |
3c91145c | 55 | AliParticleContainer *trackCont = jetTask->AddParticleContainer(ntracks); |
56 | AliClusterContainer *clusterCont = jetTask->AddClusterContainer(nclusters); | |
8612dfc8 | 57 | |
58 | TString strType(type); | |
3c91145c | 59 | AliJetContainer *jetCont = jetTask->AddJetContainer(njets,strType,jetradius); |
8612dfc8 | 60 | if(jetCont) { |
61 | jetCont->SetRhoName(nrho); | |
62 | jetCont->ConnectParticleContainer(trackCont); | |
63 | jetCont->ConnectClusterContainer(clusterCont); | |
64 | jetCont->SetZLeadingCut(0.98,0.98); | |
65 | jetCont->SetPercAreaCut(0.6); | |
66 | jetCont->SetJetPtCut(jetptcut); | |
67 | jetCont->SetLeadingHadronType(leadhadtype); | |
68 | } | |
9f52c61f | 69 | |
70 | //------------------------------------------------------- | |
71 | // Final settings, pass to manager and set the containers | |
72 | //------------------------------------------------------- | |
73 | ||
74 | mgr->AddTask(jetTask); | |
75 | ||
76 | // Create containers for input/output | |
77 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; | |
78 | TString contname(name); | |
79 | contname += "_histos"; | |
80 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
81 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
82 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
83 | mgr->ConnectInput (jetTask, 0, cinput1 ); | |
84 | mgr->ConnectOutput (jetTask, 1, coutput1 ); | |
85 | ||
86 | return jetTask; | |
87 | } |