e1605cc5008a680f7d642c424e3aadfbe42e7f95
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskJetResponseV2.C
1
2
3 AliAnalysisTaskJetResponseV2* AddTaskJetResponseV2(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 = 0, Int_t eventClassMax = 4){
4
5    return AddTaskJetResponseV2(kTRUE, type, jf, radius, filterMask, ptTrackMin, iBack, eventClassMin, eventClassMax);
6
7 }
8
9
10 AliAnalysisTaskJetResponseV2* AddTaskJetResponseV2(Bool_t emb = kTRUE, 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 = 0, Int_t eventClassMax = 4){
11
12   Printf("adding task jet response\n");
13
14     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
15     if(!mgr){
16         ::Error("AddTaskJetResponseV2", "No analysis manager to connect to.");
17         return NULL;
18     }
19     if(!mgr->GetInputEventHandler()){
20         ::Error("AddTaskJetResponseV2", "This task requires an input event handler.");
21         return NULL;
22     }
23
24    TString branch1 = "";
25    TString branch2 = "";
26    TString suffix  = "";
27    TString suffix2 = "";
28     
29    if(emb){
30
31       // embedding in HI event
32       
33       suffix += Form("_%s", jf);
34       suffix += Form("%02d", (int)((radius+0.01)*10.));
35       suffix += Form("_B0");                                // no background subtraction for extra-only
36       suffix += Form("_Filter%05d", filterMask);
37       suffix += Form("_Cut%05d", (int)((1000.*ptTrackMin)));
38       if(type=="clusters") suffix += Form("_Skip00");
39       
40       suffix2 += Form("_%s", jf);
41       suffix2 += Form("%02d", (int)((radius+0.01)*10.));
42       suffix2 += Form("_B%d", iBack);
43       suffix2 += Form("_Filter%05d", filterMask);
44       suffix2 += Form("_Cut%05d", (int)((1000.*ptTrackMin)));
45       if(type=="clusters") suffix2 += Form("_Skip00");
46     
47       branch1 = Form("%sAODextraonly%s",type, suffix.Data());
48       branch2 = Form("%sAODextra%s",type, suffix2.Data());
49       
50    } else {
51    
52       // p-p detector response
53       suffix += Form("_%s", jf);
54       suffix += Form("%02d", (int)((radius+0.01)*10.));
55       suffix += Form("_B0");                        
56       suffix += Form("_Filter%05d", filterMask);
57       suffix += Form("_Cut%05d", (int)((1000.*ptTrackMin)));
58       if(type=="clusters") suffix += Form("_Skip00");
59       
60       suffix2 += Form("_%s", jf);
61       suffix2 += Form("%02d", (int)((radius+0.01)*10.));
62       suffix2 += Form("_B0");
63       suffix2 += Form("_Filter%05d", filterMask);
64       suffix2 += Form("_Cut%05d", (int)((1000.*ptTrackMin)));
65       if(type=="clusters") suffix2 += Form("_Skip02");
66       
67       branch1 = Form("%sAODMC2%s",type, suffix.Data()); // MC truth
68       branch2 = Form("%sAOD%s",type, suffix2.Data());    // MC reconstucted
69          
70    }
71    
72    AliAnalysisTaskJetResponseV2 *task = new AliAnalysisTaskJetResponseV2(Form("JetResponseV2%s", suffix2.Data()));
73     
74     Printf("Branch1: %s",branch1.Data());
75     Printf("Branch2: %s",branch2.Data());
76  
77     task->SetBranchNames(branch1,branch2);
78     task->SetOfflineTrgMask(AliVEvent::kMB);
79
80     task->SetEvtClassMin(eventClassMin);
81     task->SetEvtClassMax(eventClassMax);
82     task->SetCentMin(0.);
83     task->SetCentMax(100.);
84    
85     task->SetJetPtMin(0.);   // min jet pt is implicit a cut on delta pT!!
86
87     //task->SetNMatchJets(1); // leading jets only
88
89     if(!emb){
90        task->SetIsPbPb(kFALSE);
91        task->SetJetPtFractionMin(0.01);
92        task->SetNMatchJets(999);
93     }
94
95
96     mgr->AddTask(task);
97
98
99     AliAnalysisDataContainer *coutputJetResponseV2 = mgr->CreateContainer(
100          Form("jetresponseV2_%s%s", type,suffix2.Data()), TList::Class(), AliAnalysisManager::kOutputContainer,
101          Form("%s:PWG4_JetResponseV2_%s%s", AliAnalysisManager::GetCommonFileName(), type, suffix2.Data()));
102
103     mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
104     mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());
105     mgr->ConnectOutput(task, 1, coutputJetResponseV2);
106
107     return task;
108 }