fixed typo
[u/mrichter/AliRoot.git] / PWGJE / macros / AddTaskJetSpectrum2.C
CommitLineData
86dd7ebf 1Bool_t ConfigWithFlagsJetSpectrum2();\r
2AliAnalysisTaskJetSpectrum2 *jetspec = 0;\r
3\r
3095177c 4AliAnalysisTaskJetSpectrum2 *AddTaskJetSpectrum2(const char* bRec = "jets",const char* bGen = "jetsAODMC_UA104",const char* nonStdFile="",UInt_t filterMask = 32, Int_t iPhysicsSelectionFlag = AliVEvent::kMB,UInt_t iEventSelectionMask = 0,Int_t iCl = 0);\r
6bd3fdae 5\r
6\r
37eb26ea 7AliAnalysisTaskJetSpectrum2 *AddTaskJetSpectrum2Delta(UInt_t filterMask = 32,Bool_t kUseAODMC = kFALSE,Int_t iPhysicsSelectionFlag = AliVEvent::kMB,UInt_t iFlag = 0xfffffff, UInt_t iEventSelectionMask = 0,char* back = ""){\r
599338e5 8\r
f4132e7d 9 TString cBack = back;\r
599338e5 10\r
599338e5 11 AliAnalysisTaskJetSpectrum2 *js = 0;\r
c2785065 12 if(kUseAODMC){\r
6bd3fdae 13 if(iFlag&(1<<0)){ // UA104\r
37eb26ea 14 js = AddTaskJetSpectrum2("jets","jetsAODMC_UA104",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
15 js = AddTaskJetSpectrum2("jets","jetsAODMC2_UA104",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
6bd3fdae 16 }\r
17 if(iFlag&(1<<1)){ // ANTIKT 04\r
37eb26ea 18 js = AddTaskJetSpectrum2("jetsAOD_FASTJET04","jetsAODMC_FASTJET04",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
19 js = AddTaskJetSpectrum2("jetsAOD_FASTJET04","jetsAODMC2_FASTJET04",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
6bd3fdae 20 // cross check MC only background subtration\r
37eb26ea 21 js = AddTaskJetSpectrum2("jetsAODMC2_FASTJET04","jetsAODMC_FASTJET04",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
6bd3fdae 22 }\r
23 if(iFlag&(1<<2)){ // KT 04\r
37eb26ea 24 js = AddTaskJetSpectrum2("jetsAOD_FASTKT04","jetsAODMC_FASTKT04",cBack.Data(),filterMask,iPhysicsSelectionFlag,iEventSelectionMask);\r
25 js = AddTaskJetSpectrum2("jetsAOD_FASTKT04","jetsAODMC2_FASTKT04",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
6bd3fdae 26 }\r
27 if(iFlag&(1<<3)){ // SISCONE 04\r
37eb26ea 28 js = AddTaskJetSpectrum2("jetsAOD_SISCONE04","jetsAODMC_SISCONE04",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
29 js = AddTaskJetSpectrum2("jetsAOD_SISCONE04","jetsAODMC2_SISCONE04",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
6bd3fdae 30 }\r
31 // here can go other radii\r
32 }\r
33 else { // only the data ... no MC\r
34 if(iFlag&(1<<0)){ // UA104\r
37eb26ea 35 js = AddTaskJetSpectrum2("jets","",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask,1);\r
6bd3fdae 36 }\r
37 if(iFlag&(1<<1)){ // ANTIKT 04\r
37eb26ea 38 js = AddTaskJetSpectrum2("jetsAOD_FASTJET04","",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
6bd3fdae 39 }\r
40 if(iFlag&(1<<2)){ // KT 04\r
37eb26ea 41 js = AddTaskJetSpectrum2("jetsAOD_FASTKT04","",cBack.Data(),filterMask,iPhysicsSelectionFlag,iEventSelectionMask);\r
6bd3fdae 42 }\r
43 if(iFlag&(1<<3)){ // SISCONE 04\r
37eb26ea 44 js = AddTaskJetSpectrum2("jetsAOD_SISCONE04","",cBack.Data(),filterMask,iPhysicsSelectionFlag, iEventSelectionMask);\r
c2785065 45 }\r
92bbb45d 46 }\r
599338e5 47 return js;\r
48}\r
49\r
50\r
3095177c 51AliAnalysisTaskJetSpectrum2 *AddTaskJetSpectrum2(const char* bRec,const char* bGen ,const char* nonStdFile,UInt_t filterMask,Int_t iPhysicsSelectionFlag,UInt_t iEventSelectionMask,Int_t iCl)\r
3b7ffecf 52{\r
f4132e7d 53 // Creates a jet fider task, configures it and adds it to the analysis manager.\r
54 // Get the pointer to the existing analysis manager via the static access method.\r
55 //==============================================================================\r
56 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
57 if (!mgr) {\r
58 ::Error("AddTaskJetSpectrum2", "No analysis manager to connect to.");\r
59 return NULL;\r
3b7ffecf 60 } \r
f4132e7d 61 \r
62 // Check the analysis type using the event handlers connected to the analysis manager.\r
63 //==============================================================================\r
64 if (!mgr->GetInputEventHandler()) {\r
65 ::Error("AddTaskJetSpectrum2", "This task requires an input event handler");\r
66 return NULL;\r
67 }\r
68 \r
69 TString type = mgr->GetInputEventHandler()->GetDataType();\r
70 TString typeRec(bRec);\r
71 TString typeGen(bGen);\r
72 typeGen.ToUpper();\r
73 typeRec.ToUpper();\r
74 \r
6bd3fdae 75\r
3b7ffecf 76 // Create the task and configure it.\r
77 //===========================================================================\r
6bd3fdae 78\r
86dd7ebf 79 jetspec = new AliAnalysisTaskJetSpectrum2(Form("JetSpectrum2%s-%s_%010d_Class%02d",bRec,bGen,iEventSelectionMask,iCl));\r
5c4489e2 80 if(iCl)jetspec->SetEventClass(iCl);\r
39e7e8ab 81\r
82 // add the filter mask for non default jets branches\r
83 TString cAdd("");\r
84 cAdd += Form("_Filter%05d",filterMask);\r
85\r
a31b8a87 86 \r
37eb26ea 87\r
5c4489e2 88 jetspec->SetBranchGen(bGen); \r
89 // if(typeGen.Contains("JETSAOD")&&!typeGen.Contains("MC"))jetspec->SetBranchGen(Form("%s%s",bGen,cAdd.Data())); \r
37eb26ea 90\r
5c4489e2 91 jetspec->SetBranchRec(bRec); \r
92 // if(typeRec.Contains("JETSAOD")&&!typeRec.Contains("MC")) jetspec->SetBranchRec(Form("%s%s",bRec,cAdd.Data())); \r
6bd3fdae 93\r
b03b08a3 94\r
3170a3f8 95\r
5010a3f7 96 if(type == "AOD"){\r
d5e8640d 97 // Assume all jets are not yet produced \r
5c4489e2 98 // jetspec->SetAODJetInput(kTRUE);\r
99 jetspec->SetAODTrackInput(kTRUE);\r
100 jetspec->SetAODMCInput(kTRUE);\r
565584e8 101 }\r
c2785065 102 else{\r
103 if(mgr->GetMCtruthEventHandler()){\r
5c4489e2 104 jetspec-> SetAnalysisType(AliAnalysisTaskJetSpectrum2::kAnaMCESD);\r
c2785065 105 }\r
106 }\r
565584e8 107\r
108 if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD\r
5c4489e2 109 jetspec->SetTrackTypeRec(AliAnalysisTaskJetSpectrum2::kTrackAODMCChargedAcceptance);\r
565584e8 110 }\r
111 else if (typeRec.Contains("AODMC2")){\r
5c4489e2 112 jetspec->SetTrackTypeRec(AliAnalysisTaskJetSpectrum2::kTrackAODMCCharged);\r
565584e8 113 }\r
114 else if (typeRec.Contains("AODMC")){\r
5c4489e2 115 jetspec->SetTrackTypeRec(AliAnalysisTaskJetSpectrum2::kTrackAODMCAll);\r
565584e8 116 }\r
d2e6cdd5 117 else { // catch akk use AOD\r
5c4489e2 118 jetspec->SetTrackTypeRec(AliAnalysisTaskJetSpectrum2::kTrackAOD);\r
5010a3f7 119 }\r
3b7ffecf 120\r
565584e8 121 if(typeGen.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD\r
5c4489e2 122 jetspec->SetTrackTypeGen(AliAnalysisTaskJetSpectrum2::kTrackAODMCChargedAcceptance);\r
565584e8 123 }\r
124 else if (typeGen.Contains("AODMC2")){\r
5c4489e2 125 jetspec->SetTrackTypeGen(AliAnalysisTaskJetSpectrum2::kTrackAODMCCharged);\r
3ae212a1 126 }\r
565584e8 127 else if (typeGen.Contains("AODMC")){\r
5c4489e2 128 jetspec->SetTrackTypeGen(AliAnalysisTaskJetSpectrum2::kTrackAODMCAll);\r
3ae212a1 129 }\r
b03b08a3 130 else if (typeGen.Length()>0){ // catch all use AOD\r
5c4489e2 131 jetspec->SetTrackTypeGen(AliAnalysisTaskJetSpectrum2::kTrackAOD);\r
3ae212a1 132 }\r
565584e8 133\r
5c4489e2 134 if(iEventSelectionMask)jetspec->SetEventSelectionMask(iEventSelectionMask);\r
42f4e4b8 135\r
5c4489e2 136 // jetspec->SetDebugLevel(10);\r
86dd7ebf 137 if(!ConfigWithFlagsJetSpectrum2())return 0;\r
39e7e8ab 138\r
86dd7ebf 139 jetspec->SetUseGlobalSelection(kTRUE); \r
140 jetspec->SetMinJetPt(-1.);//keep all jets \r
3095177c 141\r
142 // to fetch the AOD from the AOD extension ouput \r
5c4489e2 143 if(strlen(nonStdFile))jetspec->SetNonStdFile(nonStdFile);\r
144 mgr->AddTask(jetspec);\r
5010a3f7 145 \r
3b7ffecf 146 // Create ONLY the output containers for the data produced by the task.\r
147 // Get and connect other common input/output containers via the manager as below\r
148 //==============================================================================\r
5c4489e2 149 AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer(Form("pwgje_spec2_%s_%s_%010d_Class%02d",bRec,bGen,iEventSelectionMask,iCl),TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_spec2_%s_%s_%010d_Class%02d",AliAnalysisManager::GetCommonFileName(),bRec,bGen,iEventSelectionMask,iCl));\r
3b7ffecf 150\r
5c4489e2 151 mgr->ConnectInput (jetspec, 0, mgr->GetCommonInputContainer());\r
152 mgr->ConnectOutput (jetspec, 0, mgr->GetCommonOutputContainer());\r
153 mgr->ConnectOutput (jetspec, 1, coutput1_Spec );\r
3b7ffecf 154 \r
5c4489e2 155 return jetspec;\r
3b7ffecf 156}\r
d8f21f85 157\r
158void SetAODInput(AliAnalysisTaskJetSpectrum2 *taskJetSpectrum){\r
159 taskJetSpectrum->SetAODJetInput(kTRUE);\r
160 taskJetSpectrum->SetAODTrackInput(kTRUE);\r
161 // taskJetSpectrum->SetUseGlobalSelection(kFALSE);\r
162}\r
86dd7ebf 163\r
164Bool_t ConfigWithFlagsJetSpectrum2(){\r
165 \r
166 Bool_t bGood1 = kFALSE;\r
167 Bool_t bGood2 = kFALSE;\r
168\r
169 \r
170 Int_t nTrigger = AliAnalysisManager::GetGlobalInt("kNTrigger",bGood1);\r
171 \r
172 if(bGood1){\r
173 jetspec->SetNTrigger(nTrigger);\r
174 for(int it = 0;it < nTrigger;it++){\r
175 jetspec->SetTrigger(it,\r
176 AliAnalysisManager::GetGlobalInt(Form("kTriggerBit%d",it),bGood1),\r
177 AliAnalysisManager::GetGlobalStr(Form("kTriggerName%d",it),bGood2));\r
178 }\r
179 }\r
180 else {\r
181 Printf("%s%d: kNTrigger not defined",(char*)__FILE__,__LINE__); return kFALSE; \r
182 }\r
183\r
69a0d320 184\r
185 Int_t nAcceptance = AliAnalysisManager::GetGlobalInt("kNAcceptanceSpec",bGood1);\r
186 \r
187 if(bGood1){\r
188 jetspec->SetNAcceptance(nAcceptance);\r
189 for(int ia = 0;ia < nAcceptance;ia++){\r
190 jetspec->SetAcceptance(ia,\r
191 AliAnalysisManager::GetGlobalDbl(Form("kAcceptancePhiMinSpec%d",ia),bGood1),\r
24cc3482 192 AliAnalysisManager::GetGlobalDbl(Form("kAcceptancePhiMaxSpec%d",ia),bGood1),\r
69a0d320 193 AliAnalysisManager::GetGlobalDbl(Form("kAcceptanceEtaMinSpec%d",ia),bGood1),\r
24cc3482 194 AliAnalysisManager::GetGlobalDbl(Form("kAcceptanceEtaMaxSpec%d",ia),bGood1));\r
69a0d320 195 }\r
196 }\r
197 else {\r
198 Printf("%s%d: kNAcceptance not defined",(char*)__FILE__,__LINE__); \r
199 }\r
200\r
86dd7ebf 201 \r
202 AliAnalysisManager::GetGlobalInt("kPhysicsSelectionFlag",bGood1);if(bGood1){\r
203 jetspec->SelectCollisionCandidates(AliAnalysisManager::GetGlobalInt("kPhysicsSelectionFlag",bGood1));\r
204 }\r
205 else {Printf("%s%d: kPhysicsSelectionFlag not defined",(char*)__FILE__,__LINE__); return kFALSE; }\r
206\r
207\r
208 AliAnalysisManager::GetGlobalStr("kDeltaAODJetName",bGood1);if(bGood1)jetspec->SetNonStdFile(AliAnalysisManager::GetGlobalStr("kDeltaAODJetName",bGood1));\r
209 else {Printf("%s%d: kDeltaAODJetName not defined",(char*)__FILE__,__LINE__); return kFALSE; }\r
210\r
211 AliAnalysisManager::GetGlobalDbl("kTrackEtaWindow",bGood1);if(bGood1)jetspec->SetTrackEtaWindow(AliAnalysisManager::GetGlobalDbl("kTrackEtaWindow",bGood1));\r
212 else {Printf("%s%d: kTrackEtaWindow not defined",(char*)__FILE__,__LINE__); return kFALSE; }\r
213\r
214 AliAnalysisManager::GetGlobalDbl("kJetEtaWindow",bGood1);if(bGood1)jetspec->SetJetEtaWindow(AliAnalysisManager::GetGlobalDbl("kJetEtaWindow",bGood1));\r
215 else {Printf("%s%d: kJetEtaWindow not defined",(char*)__FILE__,__LINE__); return kFALSE; }\r
216\r
217 \r
218 AliAnalysisManager::GetGlobalInt("kHighPtFilterMask",bGood1);if(bGood1)jetspec->SetFilterMask(AliAnalysisManager::GetGlobalInt("kHighPtFilterMask",bGood1));\r
219 else {Printf("%s%d: kHighPtFilterMask not defined",(char*)__FILE__,__LINE__); return kFALSE; } \r
220 \r
221 return kTRUE;\r
222\r
223\r
224}\r