put clusters from fast clusterizer in separate branch (don't toch orig
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskEmcalJetSample.C
CommitLineData
8628b70c 1// $Id$
9f52c61f 2
3AliAnalysisTaskEmcalJetSample* AddTaskEmcalJetSample(
4 const char *ntracks = "Tracks",
5 const char *nclusters = "CaloClusters",
6 const char *njets = "Jets",
7 const char *nrho = "Rho",
4bb8c6df 8 Int_t nCentBins = 1,
9f52c61f 9 Double_t jetradius = 0.2,
10 Double_t jetptcut = 1,
8612dfc8 11 Double_t jetareacut = 0.6,
12 const char *type = "EMCAL",
9f52c61f 13 Int_t leadhadtype = 0,
14 const char *taskname = "AliAnalysisTaskEmcalJetSample"
15)
9f893922 16{
9f52c61f 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("AddTaskEmcalJetSample", "No analysis manager to connect to.");
23 return NULL;
9f893922 24 }
25
9f52c61f 26 // Check the analysis type using the event handlers connected to the analysis manager.
27 //==============================================================================
28 if (!mgr->GetInputEventHandler())
29 {
30 ::Error("AddTaskEmcalJetSample", "This task requires an input event handler");
31 return NULL;
32 }
9f893922 33
9f52c61f 34 //-------------------------------------------------------
35 // Init the task and do settings
36 //-------------------------------------------------------
37
38 TString name(taskname);
39 if (strcmp(njets,"")) {
40 name += "_";
41 name += njets;
42 }
43 if (strcmp(nrho,"")) {
44 name += "_";
45 name += nrho;
46 }
8612dfc8 47 if (strcmp(type,"")) {
48 name += "_";
49 name += type;
50 }
9f52c61f 51
9239b066 52 Printf("name: %s",name.Data());
53
9f52c61f 54 AliAnalysisTaskEmcalJetSample* jetTask = new AliAnalysisTaskEmcalJetSample(name);
4bb8c6df 55 jetTask->SetCentRange(0.,100.);
56 jetTask->SetNCentBins(nCentBins);
8612dfc8 57
3c91145c 58 AliParticleContainer *trackCont = jetTask->AddParticleContainer(ntracks);
46b40b53 59 if(trackCont) trackCont->SetClassName("AliVTrack");
3c91145c 60 AliClusterContainer *clusterCont = jetTask->AddClusterContainer(nclusters);
8612dfc8 61
62 TString strType(type);
3c91145c 63 AliJetContainer *jetCont = jetTask->AddJetContainer(njets,strType,jetradius);
8612dfc8 64 if(jetCont) {
65 jetCont->SetRhoName(nrho);
66 jetCont->ConnectParticleContainer(trackCont);
67 jetCont->ConnectClusterContainer(clusterCont);
68 jetCont->SetZLeadingCut(0.98,0.98);
9f893922 69 jetCont->SetPercAreaCut(jetareacut);
70 jetCont->SetJetPtCut(jetptcut);
8612dfc8 71 jetCont->SetLeadingHadronType(leadhadtype);
72 }
9f893922 73
9f52c61f 74 //-------------------------------------------------------
75 // Final settings, pass to manager and set the containers
76 //-------------------------------------------------------
9f893922 77
9f52c61f 78 mgr->AddTask(jetTask);
9f893922 79
9f52c61f 80 // Create containers for input/output
81 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
82 TString contname(name);
83 contname += "_histos";
9f893922 84 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
9f52c61f 85 TList::Class(),AliAnalysisManager::kOutputContainer,
86 Form("%s", AliAnalysisManager::GetCommonFileName()));
87 mgr->ConnectInput (jetTask, 0, cinput1 );
88 mgr->ConnectOutput (jetTask, 1, coutput1 );
9f893922 89
9f52c61f 90 return jetTask;
91}
00862474 92
93AliAnalysisTaskEmcalJetSample* AddTaskEmcalJetSample( AliEmcalJetTask* jetFinderTask,
94 Int_t nCentBins = 1,
95 Double_t jetareacut = 0.6,
96 const char *type = "EMCAL",
97 Int_t leadhadtype = 0,
98 const char *taskname = "AliAnalysisTaskEmcalJetSample"
99)
100 {
101 const char* ntracks = jetFinderTask->GetTracksName();
102 const char* nclusters = jetFinderTask->GetClusName();
103 const char* njets = jetFinderTask->GetJetsName();
104 const char* nrho = jetFinderTask->GetRhoName();
105 Double_t jetradius = jetFinderTask->GetRadius();
106 Double_t jetptcut = jetFinderTask->GetMinJetPt();
107
108 AliAnalysisTaskEmcalJetSample* jetTask = AddTaskEmcalJetSample(ntracks , nclusters, njets, nrho, nCentBins, jetradius, jetptcut, jetareacut, type, leadhadtype, taskname);
109
110 return jetTask;
111 }