]>
Commit | Line | Data |
---|---|---|
51a8c8fd | 1 | // Jet v2 task using QA method, based on jet sample task (S.Aiola). |
2 | // | |
3 | // Authors: Jason Mueller (CERN summer student 2014) & Alice Ohlson | |
4 | ||
5 | AliAnalysisTaskEmcalJetv2QA* AddTaskEmcalJetv2QA( | |
6 | const char *ntracks = "Tracks", | |
7 | const char *nclusters = "CaloClusters", | |
8 | const char *njets = "Jets", | |
9 | const char *nrho = "Rho", | |
de2a3fac | 10 | Double_t jetv2 = 0.0, |
11 | Bool_t ptweight = kFALSE, | |
51a8c8fd | 12 | Int_t nCentBins = 1, |
13 | Double_t jetradius = 0.2, | |
14 | Double_t jetptcut = 1, | |
15 | Double_t jetareacut = 0.6, | |
16 | const char *type = "TPC", | |
17 | Int_t leadhadtype = 0, | |
18 | const char *taskname = "AliAnalysisTaskEmcalJetv2QA" | |
19 | ) | |
20 | { | |
21 | // Get the pointer to the existing analysis manager via the static access method. | |
22 | //============================================================================== | |
23 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
24 | if (!mgr) | |
25 | { | |
26 | ::Error("AddTaskEmcalJetv2QA", "No analysis manager to connect to."); | |
27 | return NULL; | |
28 | } | |
29 | ||
30 | // Check the analysis type using the event handlers connected to the analysis manager. | |
31 | //============================================================================== | |
32 | if (!mgr->GetInputEventHandler()) | |
33 | { | |
34 | ::Error("AddTaskEmcalJetv2QA", "This task requires an input event handler"); | |
35 | return NULL; | |
36 | } | |
37 | ||
38 | //------------------------------------------------------- | |
39 | // Init the task and do settings | |
40 | //------------------------------------------------------- | |
41 | ||
42 | TString name(taskname); | |
43 | if (strcmp(njets,"")) { | |
44 | name += "_"; | |
45 | name += njets; | |
46 | } | |
de2a3fac | 47 | name += Form("_v%.2i",(Int_t)(10*jetv2)); |
51a8c8fd | 48 | if (strcmp(nrho,"")) { |
49 | name += "_"; | |
50 | name += nrho; | |
51 | } | |
de2a3fac | 52 | if (ptweight) |
53 | name += "_ptweight"; | |
51a8c8fd | 54 | if (strcmp(type,"")) { |
55 | name += "_"; | |
56 | name += type; | |
57 | } | |
58 | ||
59 | Printf("name: %s",name.Data()); | |
60 | ||
61 | AliAnalysisTaskEmcalJetv2QA* jetTask = new AliAnalysisTaskEmcalJetv2QA(name); | |
de2a3fac | 62 | |
63 | jetTask->SetJetv2(jetv2); // set your jet v2 here | |
64 | jetTask->SetDoPtWeight(ptweight); // set doPtWeight | |
65 | ||
51a8c8fd | 66 | jetTask->SetCentRange(0.,100.); |
67 | jetTask->SetNCentBins(nCentBins); | |
68 | ||
69 | AliParticleContainer *trackCont = jetTask->AddParticleContainer(ntracks); | |
70 | trackCont->SetClassName("AliVTrack"); | |
71 | AliClusterContainer *clusterCont = jetTask->AddClusterContainer(nclusters); | |
72 | ||
73 | TString strType(type); | |
74 | AliJetContainer *jetCont = jetTask->AddJetContainer(njets,strType,jetradius); | |
75 | if(jetCont) { | |
76 | jetCont->SetRhoName(nrho); | |
77 | jetCont->ConnectParticleContainer(trackCont); | |
78 | jetCont->ConnectClusterContainer(clusterCont); | |
79 | jetCont->SetZLeadingCut(0.98,0.98); | |
80 | jetCont->SetPercAreaCut(0.6); | |
81 | jetCont->SetJetPtCut(jetptcut); | |
82 | jetCont->SetLeadingHadronType(leadhadtype); | |
83 | } | |
84 | ||
85 | //------------------------------------------------------- | |
86 | // Final settings, pass to manager and set the containers | |
87 | //------------------------------------------------------- | |
88 | ||
89 | mgr->AddTask(jetTask); | |
90 | ||
91 | // Create containers for input/output | |
92 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; | |
93 | TString contname(name); | |
94 | contname += "_histos"; | |
95 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
96 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
97 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
98 | mgr->ConnectInput (jetTask, 0, cinput1 ); | |
99 | mgr->ConnectOutput (jetTask, 1, coutput1 ); | |
100 | ||
101 | return jetTask; | |
102 | } |