b034a92c22578a3203ab0db82185371f90c4a110
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskJetResponse.C
1 AliAnalysisTaskJetResponse* AddTaskJetResponse(Char_t* type = "clusters", Char_t* jf = "FASTKT", Float_t radius = 0.4, UInt_t filterMask = 256 , Float_t ptTrackMin = 0.15, Int_t iBack = 1, Int_t eventClassMin = 1, Int_t eventClassMax = 5){
2
3   Printf("adding task jet response\n");
4
5     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
6     if(!mgr){
7         ::Error("AddTaskJetResponse", "No analysis manager to connect ot.");
8         return NULL;
9     }
10     if(!mgr->GetInputEventHandler()){
11         ::Error("AddTaskJetResponse", "This task requires an input event handler.");
12         return NULL;
13     }
14
15     TString suffix = "";
16     suffix += Form("_%s", jf);
17     suffix += Form("%02d", (int)((radius+0.01)*10.));
18     suffix += Form("_B0");                                // no background subtraction for extra-only
19     suffix += Form("_Filter%05d", filterMask);
20     suffix += Form("_Cut%05d", (int)((1000.*ptTrackMin)));
21     if(type=="clusters") suffix += Form("_Skip00");
22
23     TString suffix2 = "";
24     suffix2 += Form("_%s", jf);
25     suffix2 += Form("%02d", (int)((radius+0.01)*10.));
26     suffix2 += Form("_B%d", iBack);
27     suffix2 += Form("_Filter%05d", filterMask);
28     suffix2 += Form("_Cut%05d", (int)((1000.*ptTrackMin)));
29     if(type=="clusters") suffix2 += Form("_Skip00");
30
31     AliAnalysisTaskJetResponse *task = new AliAnalysisTaskJetResponse(Form("JetResponse%s", suffix2.Data()));
32
33     TString branch1 = Form("%sAODextraonly%s",type, suffix.Data());
34     Printf("Branch1: %s",branch1.Data());
35
36     TString branch2 = Form("%sAODextra%s",type, suffix2.Data());
37     Printf("Branch2: %s",branch2.Data());
38  
39     task->SetBranchNames(branch1,branch2);
40     task->SetOfflineTrgMask(AliVEvent::kMB);
41
42     task->SetEvtClassMin(eventClassMin);
43     task->SetEvtClassMax(eventClassMax);
44     task->SetCentMin(0.);
45     task->SetCentMax(100.);
46
47
48     mgr->AddTask(task);
49
50     AliAnalysisDataContainer *coutputJetResponse = mgr->CreateContainer(
51          Form("jetresponse_%s%s", type,suffix2.Data()), TList::Class(), AliAnalysisManager::kOutputContainer,
52          Form("%s:PWG4_JetResponse_%s%s", AliAnalysisManager::GetCommonFileName(), type, suffix2.Data()));
53
54     mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
55     mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());
56     mgr->ConnectOutput(task, 1, coutputJetResponse);
57
58     return task;
59 }