]>
Commit | Line | Data |
---|---|---|
900e06e4 | 1 | #ifndef __CINT__ |
43d3541a | 2 | #include <AliAnalysisManager.h> |
3 | #include <PWGLF/RESONANCES/AliRsnCutPrimaryVertex.h> | |
4 | #include <PWGLF/RESONANCES/AliRsnValuePair.h> | |
5 | #include <PWGLF/RESONANCES/AliRsnListOutput.h> | |
6 | #include <PWGLF/RESONANCES/AliRsnPairDef.h> | |
7 | #include <PWGLF/RESONANCES/AliRsnLoopPair.h> | |
8 | #include <PWGLF/RESONANCES/AliRsnAnalysisTask.h> | |
9 | #include <PWGLF/RESONANCES/AliRsnLoopDaughter.h> | |
10 | #include <PWGLF/RESONANCES/AliRsnValueDaughter.h> | |
11 | #include <PWGLF/RESONANCES/AliRsnMiniAnalysisTask.h> | |
12 | #include <PWGLF/RESONANCES/AliRsnCutMiniPair.h> | |
13 | #include <PWGLF/RESONANCES/AliRsnInputHandler.h> | |
14 | #include <PWGLF/RESONANCES/AliRsnMiniMonitor.h> | |
15 | #include <PWGLF/RESONANCES/AliRsnValueEvent.h> | |
975568d5 | 16 | #include <AliRsnMiniMonitorTask.h> |
db54daad | 17 | #include <TROOT.h> |
900e06e4 | 18 | #endif |
19 | ||
20 | Bool_t RsnConfig(AliAnalysisTaskSE *task,Bool_t isMC,Bool_t isMixing,AliRsnInputHandler *rsnIH=0,TList *listRsn=0) { | |
21 | ||
22 | if (!task) return kFALSE; | |
23 | ||
24 | if (!listRsn) { | |
25 | return kFALSE; | |
26 | } | |
547e2d97 | 27 | Bool_t valid; |
28 | Int_t isRsnMini = AliAnalysisManager::GetGlobalInt("rsnUseMiniPackage",valid); | |
43d3541a | 29 | TString rsnCutOptCommon = AliAnalysisManager::GetGlobalStr("rsnLegoTrainCommonCutOption",valid); |
900e06e4 | 30 | Int_t cutIndex = 0; |
31 | Int_t numOfCuts = 0; | |
32 | ||
33 | // set commol eventCuts | |
34 | ||
547e2d97 | 35 | if (!RsnLoadMacroFromConfig("AddRsnCommonEventCuts.C")) return kFALSE; |
900e06e4 | 36 | AliRsnCutSet *commonEventCuts = AddRsnCommonEventCuts(task); |
37 | ||
547e2d97 | 38 | if (!RsnLoadMacroFromConfig("AddRsnCommonPairCuts.C")) return kFALSE; |
900e06e4 | 39 | AliRsnCutSet *commonPairCuts = AddRsnCommonPairCuts(); |
db54daad | 40 | |
900e06e4 | 41 | TIter next(listRsn); |
42 | TNamed *rsnObj=0; | |
43 | TString rsnName,rsnNameOpt,rsnNameOptFull,rsnCutName,rsnCutOpt,rsnCutNameOptFull; | |
44 | while ((rsnObj = (TNamed *)next())) { | |
45 | GetOptionFromString(rsnObj->GetName(),rsnName,rsnNameOpt); | |
43d3541a | 46 | rsnNameOptFull=rsnName; |
47 | if (!rsnNameOpt.IsNull()) rsnNameOptFull += Form("_%s",rsnNameOpt.Data()); | |
900e06e4 | 48 | |
49 | GetOptionFromString(rsnObj->GetTitle(),rsnCutName,rsnCutOpt); | |
43d3541a | 50 | rsnCutNameOptFull=rsnCutName; |
51 | if (!rsnCutOpt.IsNull())rsnCutNameOptFull += Form("_%s",rsnCutOpt.Data()); | |
52 | ||
53 | if (!rsnCutOptCommon.IsNull()) { | |
54 | if (!rsnCutOpt.IsNull()) rsnCutOpt += "_"; | |
55 | rsnCutOpt += rsnCutOptCommon.Data(); | |
56 | } | |
900e06e4 | 57 | |
547e2d97 | 58 | if (!RsnLoadMacroFromConfig(Form("AddRsnDaughterCuts%s.C",rsnCutName.Data()))) return kFALSE; |
59 | if (!RsnLoadMacroFromConfig(Form("AddRsnPairs%s.C",rsnName.Data()))) return kFALSE; | |
900e06e4 | 60 | |
61 | rsnNameOptFull.ToLower(); | |
62 | rsnName.ToLower(); | |
63 | // add cuts | |
64 | if (!rsnName.CompareTo("phi")) { | |
547e2d97 | 65 | numOfCuts = gROOT->ProcessLine(Form("AddRsnDaughterCuts%s(AliPID::kKaon,AliPID::kKaon,\"%s\",%d,(AliRsnInputHandler*)%p,(AliAnalysisTaskSE*)%p)",rsnCutName.Data(), rsnCutOpt.Data(),isRsnMini,rsnIH, task)); |
900e06e4 | 66 | if (numOfCuts) { |
67 | if (rsnNameOpt.Contains("mon")) AddParticleMonitor(task,isMC,cutIndex,commonEventCuts,commonPairCuts,Form("%s_%s_K",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); | |
3da8cef7 | 68 | AddRsnPairsPhi(task,isMC,isMixing,AliPID::kKaon,cutIndex,AliPID::kKaon,cutIndex,commonEventCuts,commonPairCuts,Form("%s.%s",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); |
900e06e4 | 69 | cutIndex+=numOfCuts; |
70 | } | |
71 | } else if (!rsnName.CompareTo("kstar")) { | |
547e2d97 | 72 | numOfCuts = gROOT->ProcessLine(Form("AddRsnDaughterCuts%s(AliPID::kKaon,AliPID::kPion,\"%s\",%d,(AliRsnInputHandler*)%p,(AliAnalysisTaskSE*)%p)",rsnCutName.Data(), rsnCutOpt.Data(),isRsnMini,rsnIH,task)); |
900e06e4 | 73 | if (numOfCuts) { |
74 | if (rsnNameOpt.Contains("mon")) AddParticleMonitor(task,isMC,cutIndex,commonEventCuts,commonPairCuts,Form("%s_%s_K",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); | |
75 | if (rsnNameOpt.Contains("mon")) AddParticleMonitor(task,isMC,cutIndex+1,commonEventCuts,commonPairCuts,Form("%s_%s_pi",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); | |
3da8cef7 | 76 | AddRsnPairsKStar(task,isMC,isMixing,AliPID::kKaon,cutIndex,AliPID::kPion,cutIndex+1,commonEventCuts,commonPairCuts,Form("%s.%s",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); |
900e06e4 | 77 | cutIndex+=numOfCuts; |
b63dbf69 | 78 | } |
79 | } else if (!rsnName.CompareTo("rho")) { | |
80 | numOfCuts = gROOT->ProcessLine(Form("AddRsnDaughterCuts%s(AliPID::kPion,AliPID::kPion,\"%s\",%d,(AliRsnInputHandler*)%p,(AliAnalysisTaskSE*)%p)",rsnCutName.Data(), rsnCutOpt.Data(),isRsnMini,rsnIH,task)); | |
81 | if (numOfCuts) { | |
82 | if (rsnNameOpt.Contains("mon")) AddParticleMonitor(task,isMC,cutIndex,commonEventCuts,commonPairCuts,Form("%s_%s_pi",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); | |
3da8cef7 | 83 | AddRsnPairsRho(task,isMC,isMixing,AliPID::kPion,cutIndex,AliPID::kPion,cutIndex,commonEventCuts,commonPairCuts,Form("%s.%s",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); |
b63dbf69 | 84 | cutIndex+=numOfCuts; |
85 | } | |
86 | } else if (!rsnName.CompareTo("lambda")) { | |
87 | numOfCuts = gROOT->ProcessLine(Form("AddRsnDaughterCuts%s(AliPID::kProton,AliPID::kKaon,\"%s\",%d,(AliRsnInputHandler*)%p,(AliAnalysisTaskSE*)%p)",rsnCutName.Data(), rsnCutOpt.Data(),isRsnMini,rsnIH,task)); | |
88 | if (numOfCuts) { | |
89 | if (rsnNameOpt.Contains("mon")) AddParticleMonitor(task,isMC,cutIndex,commonEventCuts,commonPairCuts,Form("%s_%s_p",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); | |
90 | if (rsnNameOpt.Contains("mon")) AddParticleMonitor(task,isMC,cutIndex+1,commonEventCuts,commonPairCuts,Form("%s_%s_K",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); | |
3da8cef7 | 91 | AddRsnPairsLambda(task,isMC,isMixing,AliPID::kProton,cutIndex,AliPID::kKaon,cutIndex+1,commonEventCuts,commonPairCuts,Form("%s.%s",rsnNameOptFull.Data(),rsnCutNameOptFull.Data())); |
b63dbf69 | 92 | cutIndex+=numOfCuts; |
900e06e4 | 93 | } |
94 | } else { | |
95 | Printf("Error : Particle %s is not supported !!!!",rsnName.Data()); | |
96 | return kFALSE; | |
97 | } | |
98 | ||
99 | } | |
100 | ||
101 | return kTRUE; | |
102 | } | |
103 | ||
547e2d97 | 104 | Bool_t RsnLoadMacroFromConfig(TString macro,TString path="") { |
105 | ||
106 | Bool_t valid; | |
107 | TString lego_path = AliAnalysisManager::GetGlobalStr("rsnLegoTrainPath",valid); | |
43d3541a | 108 | if (!valid) lego_path = "$ALICE_ROOT/PWGLF/RESONANCES/macros/lego_train"; |
547e2d97 | 109 | |
110 | if (!gSystem->AccessPathName(macro.Data())) { | |
db54daad | 111 | Int_t ret = gROOT->LoadMacro(macro.Data()); |
112 | Printf("Macro loaded from %s/%s [%d]...",gSystem->pwd(),macro.Data(),ret); | |
547e2d97 | 113 | return kTRUE; |
114 | } | |
115 | ||
116 | if (!gSystem->AccessPathName(gSystem->ExpandPathName(Form("%s/%s",lego_path.Data(),macro.Data())))) { | |
117 | gROOT->LoadMacro(gSystem->ExpandPathName(Form("%s/%s",lego_path.Data(),macro.Data()))); | |
118 | Printf("Macro loaded from %s ...",gSystem->ExpandPathName(Form("%s/%s",lego_path.Data(),macro.Data()))); | |
119 | return kTRUE; | |
120 | } | |
121 | ||
122 | Printf("Error loading %s",macro.Data()); | |
123 | ||
124 | return kFALSE; | |
125 | } | |
126 | ||
900e06e4 | 127 | void GetOptionFromString(TString str,TString &outStr1,TString &outStr2,TString d=":") { |
3248b3db | 128 | // TStringO |
900e06e4 | 129 | TObjArray *tokens = str.Tokenize(d.Data()); |
130 | TObjString *objStr = (TObjString *)tokens->At(0); | |
131 | if (!objStr) { | |
132 | outStr1 = "err"; | |
133 | outStr2 = ""; | |
134 | return; | |
135 | } | |
136 | outStr1 = objStr->GetString(); | |
137 | ||
138 | objStr = (TObjString *) tokens->At(1); | |
139 | if (!objStr) { | |
140 | outStr2 = ""; | |
141 | return; | |
142 | } | |
143 | outStr2 = objStr->GetString(); | |
144 | ||
145 | } | |
146 | ||
147 | Bool_t AddPair(AliAnalysisTaskSE *task, Bool_t isMC,Bool_t isMixing, AliPID::EParticleType pType1,Int_t listID1, AliPID::EParticleType pType2,Int_t listID2, Int_t pdgMother,Double_t massMother, AliRsnCutSet *commonEventCuts=0,AliRsnCutSet *commonPairCuts=0, TString name = "") { | |
148 | ||
547e2d97 | 149 | Bool_t valid; |
150 | Int_t useMCMomentum = AliAnalysisManager::GetGlobalInt("rsnUseMCMomentum",valid); | |
900e06e4 | 151 | Bool_t typeSame = (pType1 == pType2); |
152 | ||
3da8cef7 | 153 | Printf("------------- id1=%d id2=%d",pType1,pType2); |
900e06e4 | 154 | |
155 | TList *listLoops = new TList; | |
156 | ||
157 | // pair definition | |
158 | AliRsnPairDef *pairDefPM = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '+', (AliRsnDaughter::ESpecies)pType2, '-', pdgMother, massMother); | |
159 | AliRsnPairDef *pairDefMP = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '-', (AliRsnDaughter::ESpecies)pType2, '+', pdgMother, massMother); | |
160 | AliRsnPairDef *pairDefPP = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '+', (AliRsnDaughter::ESpecies)pType2, '+', pdgMother, massMother); | |
161 | AliRsnPairDef *pairDefMM = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '-', (AliRsnDaughter::ESpecies)pType2, '-', pdgMother, massMother); | |
162 | ||
163 | // loop object creation | |
164 | AliRsnLoopPair *lp = 0; | |
165 | ||
166 | // sets +- | |
3da8cef7 | 167 | lp = new AliRsnLoopPair(Form("%s.RecPM", name.Data()), pairDefPM, kFALSE); |
900e06e4 | 168 | listLoops->Add(lp); |
169 | ||
170 | if (!typeSame) { | |
3da8cef7 | 171 | lp = new AliRsnLoopPair(Form("%s.RecMP", name.Data()), pairDefMP, kFALSE); |
900e06e4 | 172 | listLoops->Add(lp); |
173 | } | |
174 | ||
175 | // sets +- TRUE pairs | |
176 | if (isMC) { | |
3da8cef7 | 177 | lp = new AliRsnLoopPair(Form("%s.RecPM_RecMother", name.Data()), pairDefPM, kFALSE); |
900e06e4 | 178 | lp->SetOnlyTrue(kTRUE); |
179 | lp->SetCheckDecay(kTRUE); | |
180 | listLoops->Add(lp); | |
181 | if (!typeSame) { | |
3da8cef7 | 182 | lp = new AliRsnLoopPair(Form("%s.RecMP_RecMother", name.Data()), pairDefMP, kFALSE); |
900e06e4 | 183 | lp->SetOnlyTrue(kTRUE); |
184 | lp->SetCheckDecay(kTRUE); | |
185 | listLoops->Add(lp); | |
186 | } | |
187 | // sets +- TRUE paris (MC is used for momentum) | |
3da8cef7 | 188 | lp = new AliRsnLoopPair(Form("%s.GenPM_RecMother", name.Data()), pairDefPM, kFALSE); |
900e06e4 | 189 | lp->SetTrueMC(kTRUE); |
190 | listLoops->Add(lp); | |
191 | if (!typeSame) { | |
192 | // sets +- TRUE paris (MC is used for momentum) | |
3da8cef7 | 193 | lp = new AliRsnLoopPair(Form("%s.GenMP_RecMother", name.Data()), pairDefMP, kFALSE); |
900e06e4 | 194 | lp->SetTrueMC(kTRUE); |
195 | listLoops->Add(lp); | |
196 | } | |
197 | } | |
198 | ||
199 | // sets ++ | |
3da8cef7 | 200 | lp = new AliRsnLoopPair(Form("%s.RecPP", name.Data()), pairDefPP, kFALSE); |
900e06e4 | 201 | listLoops->Add(lp); |
202 | ||
203 | // sets -- | |
3da8cef7 | 204 | lp = new AliRsnLoopPair(Form("%s.RecMM", name.Data()), pairDefMM, kFALSE); |
900e06e4 | 205 | listLoops->Add(lp); |
206 | ||
207 | if (isMixing) { | |
208 | // sets +- Mixing (NOT mini) | |
3da8cef7 | 209 | lp = new AliRsnLoopPair(Form("%s.RecPM_mix", name.Data()), pairDefPM, kTRUE); |
900e06e4 | 210 | listLoops->Add(lp); |
211 | ||
212 | // sets -+ Mixing (NOT mini) | |
3da8cef7 | 213 | lp = new AliRsnLoopPair(Form("%s.RecMP_mix", name.Data()), pairDefMP, kTRUE); |
900e06e4 | 214 | listLoops->Add(lp); |
215 | ||
216 | // sets ++ Mixing (NOT mini) | |
3da8cef7 | 217 | lp = new AliRsnLoopPair(Form("%s.RecPP_mix", name.Data()), pairDefPP, kTRUE); |
900e06e4 | 218 | listLoops->Add(lp); |
219 | ||
220 | // sets -- Mixing (NOT mini) | |
3da8cef7 | 221 | lp = new AliRsnLoopPair(Form("%s.RecMM_mix", name.Data()), pairDefMM, kTRUE); |
900e06e4 | 222 | listLoops->Add(lp); |
223 | } | |
224 | ||
225 | ||
226 | // loops over all AliRsnLoops and sets everything (don't touch it if you don't know what you are doing) | |
227 | TIter next(listLoops); | |
228 | while ((lp = (AliRsnLoopPair *)next.Next())) { | |
229 | lp->SetListID(0, listID1); | |
230 | lp->SetListID(1, listID2); | |
547e2d97 | 231 | lp->SetMCRefInfo(useMCMomentum); |
900e06e4 | 232 | if (commonPairCuts) lp->SetPairCuts(commonPairCuts); |
233 | if (commonEventCuts) lp->SetEventCuts(commonEventCuts); | |
234 | if (name.Contains("phi")) AddPairOutputPhi(lp); | |
235 | else if (name.Contains("kstar")) AddPairOutputKStar(lp); | |
3da8cef7 | 236 | else if (name.Contains("rho")) AddPairOutputRho(lp); |
237 | else if (name.Contains("lambda")) AddPairOutputLambda(lp); | |
238 | else if (name.Contains("sigma")) AddPairOutputSigma(lp); | |
900e06e4 | 239 | else continue; |
240 | ((AliRsnAnalysisTask *)task)->AddLoop(lp); | |
241 | } | |
242 | return kTRUE; | |
243 | } | |
244 | ||
975568d5 | 245 | void AddMonitorOutput(TObjArray *mon=0,TString opt="",AliRsnLoopDaughter *lm=0) |
900e06e4 | 246 | { |
3248b3db | 247 | |
547e2d97 | 248 | Bool_t valid; |
43d3541a | 249 | Int_t useMCMon = AliAnalysisManager::GetGlobalInt("rsnUseMCMonitoring",valid); |
250 | // if (useMCMon) return; | |
900e06e4 | 251 | |
252 | // dEdx tpc | |
253 | AliRsnValueDaughter *axisMomTPC = new AliRsnValueDaughter("pTPC", AliRsnValueDaughter::kPtpc); | |
254 | AliRsnValueDaughter *axisSigTPC = new AliRsnValueDaughter("sTPC", AliRsnValueDaughter::kTPCsignal); | |
db54daad | 255 | //axisMomTPC->SetBins(0.0,5.0,0.01); |
256 | axisMomTPC->SetBins(0.0,12.0,0.05); | |
900e06e4 | 257 | axisSigTPC->SetBins(0.0,500.0,2.0); |
258 | ||
259 | // output: 2D histogram of TPC signal vs. TPC momentum | |
260 | AliRsnListOutput *outMonitordEdxTPC = new AliRsnListOutput("dEdx", AliRsnListOutput::kHistoDefault); | |
261 | outMonitordEdxTPC->AddValue(axisMomTPC); | |
262 | outMonitordEdxTPC->AddValue(axisSigTPC); | |
263 | ||
264 | // add outputs to loop | |
975568d5 | 265 | if (mon) mon->Add(outMonitordEdxTPC); |
266 | if (lm) lm->AddOutput(outMonitordEdxTPC); | |
900e06e4 | 267 | |
268 | // dEdx tpc | |
269 | AliRsnValueDaughter *axisMomTPCForTOF = new AliRsnValueDaughter("pTPC", AliRsnValueDaughter::kPtpc); | |
270 | AliRsnValueDaughter *axisSigTOF = new AliRsnValueDaughter("sTOF", AliRsnValueDaughter::kTOFsignal); | |
db54daad | 271 | //axisMomTPCForTOF->SetBins(0.0,5.0,0.01); |
272 | //axisSigTOF->SetBins(0.0,500.0,2.0); | |
273 | axisMomTPCForTOF->SetBins(0.0,12.0,0.05); | |
274 | axisSigTOF->SetBins(0.0,5.e5,1.e3); | |
900e06e4 | 275 | |
276 | // output: 2D histogram of TPC signal vs. TPC momentum | |
db54daad | 277 | AliRsnListOutput *outMonitordEdxTOF = new AliRsnListOutput("TOF", AliRsnListOutput::kHistoDefault); |
900e06e4 | 278 | outMonitordEdxTOF->AddValue(axisMomTPCForTOF); |
279 | outMonitordEdxTOF->AddValue(axisSigTOF); | |
280 | ||
281 | // add outputs to loop | |
975568d5 | 282 | if (mon) mon->Add(outMonitordEdxTOF); |
283 | if (lm) lm->AddOutput(outMonitordEdxTOF); | |
900e06e4 | 284 | |
285 | ||
286 | // Momentum | |
287 | AliRsnValueDaughter *axisMomP = new AliRsnValueDaughter("p", AliRsnValueDaughter::kP); | |
db54daad | 288 | //axisMomP->SetBins(0.0,5.0,0.01); |
289 | axisMomP->SetBins(0.0,12.0,0.05); | |
900e06e4 | 290 | |
291 | // output: 2D histogram of TPC signal vs. TPC momentum | |
292 | AliRsnListOutput *outMonitorP = new AliRsnListOutput("P", AliRsnListOutput::kHistoDefault); | |
293 | outMonitorP->AddValue(axisMomP); | |
294 | ||
295 | // add outputs to loop | |
975568d5 | 296 | if (mon) mon->Add(outMonitorP); |
297 | if (lm) lm->AddOutput(outMonitorP); | |
900e06e4 | 298 | |
43d3541a | 299 | |
300 | if (useMCMon) { | |
301 | AliRsnValueDaughter *axisMomPMC = new AliRsnValueDaughter("pMC", AliRsnValueDaughter::kP); | |
302 | axisMomPMC->SetUseMCInfo(kTRUE); | |
db54daad | 303 | //axisMomPMC->SetBins(0.0,5.0,0.01); |
304 | axisMomPMC->SetBins(0.0,12.0,0.05); | |
43d3541a | 305 | |
306 | // output: 2D histogram of TPC signal vs. TPC momentum | |
307 | AliRsnListOutput *outMonitorPMC = new AliRsnListOutput("PMC", AliRsnListOutput::kHistoDefault); | |
308 | outMonitorPMC->AddValue(axisMomPMC); | |
309 | ||
310 | // add outputs to loop | |
975568d5 | 311 | if (mon) mon->Add(outMonitorPMC); |
312 | if (lm) lm->AddOutput(outMonitorPMC); | |
43d3541a | 313 | } |
314 | ||
315 | ||
900e06e4 | 316 | // Momentum Pt |
317 | AliRsnValueDaughter *axisMomPt = new AliRsnValueDaughter("pt", AliRsnValueDaughter::kPt); | |
db54daad | 318 | //axisMomPt->SetBins(0.0,5.0,0.01); |
319 | axisMomPt->SetBins(0.0,12.0,0.05); | |
900e06e4 | 320 | |
321 | // output: 2D histogram of TPC signal vs. TPC momentum | |
322 | AliRsnListOutput *outMonitorPt = new AliRsnListOutput("Pt", AliRsnListOutput::kHistoDefault); | |
323 | outMonitorPt->AddValue(axisMomPt); | |
324 | ||
325 | // add outputs to loop | |
975568d5 | 326 | if (mon) mon->Add(outMonitorPt); |
327 | if (lm) lm->AddOutput(outMonitorPt); | |
43d3541a | 328 | if (useMCMon) { |
329 | // Momentum Pt | |
330 | AliRsnValueDaughter *axisMomPtMC = new AliRsnValueDaughter("ptMC", AliRsnValueDaughter::kPt); | |
331 | axisMomPtMC->SetUseMCInfo(kTRUE); | |
db54daad | 332 | //axisMomPtMC->SetBins(0.0,5.0,0.01); |
333 | axisMomPtMC->SetBins(0.0,12.0,0.05); | |
43d3541a | 334 | |
335 | // output: 2D histogram of TPC signal vs. TPC momentum | |
336 | AliRsnListOutput *outMonitorPtMC = new AliRsnListOutput("PtMC", AliRsnListOutput::kHistoDefault); | |
337 | outMonitorPtMC->AddValue(axisMomPtMC); | |
338 | ||
339 | // add outputs to loop | |
975568d5 | 340 | if (mon) mon->Add(outMonitorPtMC); |
341 | if (lm) lm->AddOutput(outMonitorPtMC); | |
43d3541a | 342 | } |
343 | ||
900e06e4 | 344 | // Eta |
345 | AliRsnValueDaughter *axisMomEta = new AliRsnValueDaughter("eta", AliRsnValueDaughter::kEta); | |
346 | axisMomEta->SetBins(-1.0,1.0,0.01); | |
347 | ||
348 | // output: 2D histogram of TPC signal vs. TPC momentum | |
349 | AliRsnListOutput *outMonitorEta = new AliRsnListOutput("Eta", AliRsnListOutput::kHistoDefault); | |
350 | outMonitorEta->AddValue(axisMomEta); | |
351 | ||
352 | // add outputs to loop | |
975568d5 | 353 | if (mon) mon->Add(outMonitorEta); |
354 | if (lm) lm->AddOutput(outMonitorEta); | |
900e06e4 | 355 | |
43d3541a | 356 | if (useMCMon) { |
357 | // Eta | |
358 | AliRsnValueDaughter *axisMomEtaMC = new AliRsnValueDaughter("etaMC", AliRsnValueDaughter::kEta); | |
359 | axisMomEtaMC->SetUseMCInfo(kTRUE); | |
360 | axisMomEtaMC->SetBins(-1.0,1.0,0.01); | |
361 | ||
362 | // output: 2D histogram of TPC signal vs. TPC momentum | |
363 | AliRsnListOutput *outMonitorEtaMC = new AliRsnListOutput("EtaMC", AliRsnListOutput::kHistoDefault); | |
364 | outMonitorEtaMC->AddValue(axisMomEtaMC); | |
365 | ||
366 | // add outputs to loop | |
975568d5 | 367 | if (mon) mon->Add(outMonitorEtaMC); |
368 | if (lm) lm->AddOutput(outMonitorEtaMC); | |
43d3541a | 369 | } |
db54daad | 370 | |
371 | AliRsnValueDaughter *axisPtBig = new AliRsnValueDaughter("pt", AliRsnValueDaughter::kPt); | |
372 | axisPtBig->SetBins(0.0,12.0,0.5); | |
373 | ||
900e06e4 | 374 | // kTOFnsigmaK |
375 | AliRsnValueDaughter *axisTPCnsigmaK = new AliRsnValueDaughter("K", AliRsnValueDaughter::kTPCnsigmaK); | |
43d3541a | 376 | axisTPCnsigmaK->SetBins(1001,-100,100); |
900e06e4 | 377 | |
378 | // output: 2D histogram of TPC signal vs. TPC momentum | |
379 | AliRsnListOutput *outMonitorTPCnsigmaK = new AliRsnListOutput("TPC_nsigma", AliRsnListOutput::kHistoDefault); | |
380 | outMonitorTPCnsigmaK->AddValue(axisTPCnsigmaK); | |
db54daad | 381 | outMonitorTPCnsigmaK->AddValue(axisPtBig); |
900e06e4 | 382 | |
383 | // add outputs to loop | |
975568d5 | 384 | if (mon) mon->Add(outMonitorTPCnsigmaK); |
385 | if (lm) lm->AddOutput(outMonitorTPCnsigmaK); | |
900e06e4 | 386 | |
387 | // kTPCnsigmaPi | |
388 | AliRsnValueDaughter *axisTPCnsigmaPi = new AliRsnValueDaughter("pi", AliRsnValueDaughter::kTPCnsigmaPi); | |
43d3541a | 389 | axisTPCnsigmaPi->SetBins(1001,-100,100); |
900e06e4 | 390 | |
391 | // output: 2D histogram of TPC signal vs. TPC momentum | |
392 | AliRsnListOutput *outMonitorTPCnsigmaPi = new AliRsnListOutput("TPC_nsigma", AliRsnListOutput::kHistoDefault); | |
393 | outMonitorTPCnsigmaPi->AddValue(axisTPCnsigmaPi); | |
db54daad | 394 | outMonitorTPCnsigmaPi->AddValue(axisPtBig); |
900e06e4 | 395 | |
396 | // add outputs to loop | |
975568d5 | 397 | if (mon) mon->Add(outMonitorTPCnsigmaPi); |
398 | if (lm) lm->AddOutput(outMonitorTPCnsigmaPi); | |
900e06e4 | 399 | |
400 | // kTPCnsigmaP | |
401 | AliRsnValueDaughter *axisTPCnsigmaP = new AliRsnValueDaughter("p", AliRsnValueDaughter::kTPCnsigmaP); | |
43d3541a | 402 | axisTPCnsigmaP->SetBins(1001,-100,100); |
900e06e4 | 403 | |
404 | // output: 2D histogram of TPC signal vs. TPC momentum | |
405 | AliRsnListOutput *outMonitorTPCnsigmaP = new AliRsnListOutput("TPC_nsigma", AliRsnListOutput::kHistoDefault); | |
406 | outMonitorTPCnsigmaP->AddValue(axisTPCnsigmaP); | |
db54daad | 407 | outMonitorTPCnsigmaP->AddValue(axisPtBig); |
900e06e4 | 408 | |
409 | // add outputs to loop | |
975568d5 | 410 | if (mon) mon->Add(outMonitorTPCnsigmaP); |
411 | if (lm) lm->AddOutput(outMonitorTPCnsigmaP); | |
900e06e4 | 412 | |
413 | ||
43d3541a | 414 | if (!opt.Contains("NoTOFSIGMA")) { |
900e06e4 | 415 | |
43d3541a | 416 | // kTOFnsigmaK |
417 | AliRsnValueDaughter *axisTOFnsigmaK = new AliRsnValueDaughter("K", AliRsnValueDaughter::kTOFnsigmaK); | |
418 | axisTOFnsigmaK->SetBins(1001,-100,100); | |
900e06e4 | 419 | |
43d3541a | 420 | // output: 2D histogram of TPC signal vs. TPC momentum |
421 | AliRsnListOutput *outMonitorTOFnsigmaK = new AliRsnListOutput("TOF_nsigma", AliRsnListOutput::kHistoDefault); | |
422 | outMonitorTOFnsigmaK->AddValue(axisTOFnsigmaK); | |
db54daad | 423 | outMonitorTOFnsigmaK->AddValue(axisPtBig); |
900e06e4 | 424 | |
43d3541a | 425 | // add outputs to loop |
975568d5 | 426 | if (mon) mon->Add(outMonitorTOFnsigmaK); |
427 | if (lm) lm->AddOutput(outMonitorTOFnsigmaK); | |
900e06e4 | 428 | |
43d3541a | 429 | // kTOFnsigmaPi |
430 | AliRsnValueDaughter *axisTOFnsigmaPi = new AliRsnValueDaughter("pi", AliRsnValueDaughter::kTOFnsigmaPi); | |
431 | axisTOFnsigmaPi->SetBins(1001,-100,100); | |
900e06e4 | 432 | |
43d3541a | 433 | // output: 2D histogram of TPC signal vs. TPC momentum |
434 | AliRsnListOutput *outMonitorTOFnsigmaPi = new AliRsnListOutput("TOF_nsigma", AliRsnListOutput::kHistoDefault); | |
435 | outMonitorTOFnsigmaPi->AddValue(axisTOFnsigmaPi); | |
db54daad | 436 | outMonitorTOFnsigmaPi->AddValue(axisPtBig); |
900e06e4 | 437 | |
43d3541a | 438 | // add outputs to loop |
975568d5 | 439 | if (mon) mon->Add(outMonitorTOFnsigmaPi); |
440 | if (lm) lm->AddOutput(outMonitorTOFnsigmaPi); | |
900e06e4 | 441 | |
43d3541a | 442 | // kTOFnsigmaP |
443 | AliRsnValueDaughter *axisTOFnsigmaP = new AliRsnValueDaughter("p", AliRsnValueDaughter::kTOFnsigmaP); | |
444 | axisTOFnsigmaP->SetBins(1001,-100,100); | |
900e06e4 | 445 | |
43d3541a | 446 | // output: 2D histogram of TPC signal vs. TPC momentum |
447 | AliRsnListOutput *outMonitorTOFnsigmaP = new AliRsnListOutput("TOF_nsigma", AliRsnListOutput::kHistoDefault); | |
448 | outMonitorTOFnsigmaP->AddValue(axisTOFnsigmaP); | |
db54daad | 449 | outMonitorTOFnsigmaP->AddValue(axisPtBig); |
43d3541a | 450 | |
451 | // add outputs to loop | |
975568d5 | 452 | if (mon) mon->Add(outMonitorTOFnsigmaP); |
453 | if (lm) lm->AddOutput(outMonitorTOFnsigmaP); | |
43d3541a | 454 | } |
900e06e4 | 455 | |
456 | ||
a83bcf6e | 457 | // nITCcluster |
458 | AliRsnValueDaughter *axisITSnClusters = new AliRsnValueDaughter("ITS", AliRsnValueDaughter::kNITSclusters); | |
459 | axisITSnClusters->SetBins(10,0,10); | |
460 | ||
461 | AliRsnListOutput *outMonitorITSnClusters = new AliRsnListOutput("nClusters", AliRsnListOutput::kHistoDefault); | |
462 | outMonitorITSnClusters->AddValue(axisITSnClusters); | |
463 | // add outputs to loop | |
464 | if (mon) mon->Add(outMonitorITSnClusters); | |
465 | if (lm) lm->AddOutput(outMonitorITSnClusters); | |
466 | ||
467 | // nTPCcluster | |
468 | AliRsnValueDaughter *axisTPCnClusters = new AliRsnValueDaughter("TPC", AliRsnValueDaughter::kNTPCclusters); | |
469 | axisTPCnClusters->SetBins(300,0,300); | |
470 | ||
471 | AliRsnListOutput *outMonitorTPCnClusters = new AliRsnListOutput("nClusters", AliRsnListOutput::kHistoDefault); | |
472 | outMonitorTPCnClusters->AddValue(axisTPCnClusters); | |
473 | // add outputs to loop | |
474 | if (mon) mon->Add(outMonitorTPCnClusters); | |
475 | if (lm) lm->AddOutput(outMonitorTPCnClusters); | |
476 | ||
477 | // ITSchi2 | |
478 | AliRsnValueDaughter *axisITSchi2 = new AliRsnValueDaughter("ITS", AliRsnValueDaughter::kITSchi2); | |
479 | axisITSchi2->SetBins(10,0,10); | |
480 | ||
481 | AliRsnListOutput *outMonitorITSchi2 = new AliRsnListOutput("chi2", AliRsnListOutput::kHistoDefault); | |
482 | outMonitorITSchi2->AddValue(axisITSchi2); | |
483 | // add outputs to loop | |
484 | if (mon) mon->Add(outMonitorITSchi2); | |
485 | if (lm) lm->AddOutput(outMonitorITSchi2); | |
486 | ||
487 | // TPCchi2 | |
488 | AliRsnValueDaughter *axisTPCchi2 = new AliRsnValueDaughter("TPC", AliRsnValueDaughter::kTPCchi2); | |
489 | axisTPCchi2->SetBins(10,0,10); | |
490 | ||
491 | AliRsnListOutput *outMonitorTPCchi2 = new AliRsnListOutput("chi2", AliRsnListOutput::kHistoDefault); | |
492 | outMonitorTPCchi2->AddValue(axisTPCchi2); | |
493 | // add outputs to loop | |
494 | if (mon) mon->Add(outMonitorTPCchi2); | |
495 | if (lm) lm->AddOutput(outMonitorTPCchi2); | |
496 | ||
497 | ||
900e06e4 | 498 | AliRsnListOutput *outMonitorPTvsMult = new AliRsnListOutput("PTvsMult",AliRsnListOutput::kHistoDefault); |
499 | AliRsnValueDaughter *vd1 = new AliRsnValueDaughter("pt",AliRsnValueDaughter::kPt); | |
500 | vd1->SetBins(0.0,5.0,0.01); | |
501 | outMonitorPTvsMult->AddValue(vd1); | |
502 | ||
503 | AliRsnValueEvent *ve1 = new AliRsnValueEvent("mult",AliRsnValueEvent::kMult); | |
504 | ve1->SetBins(0.0,100.0,1); | |
505 | outMonitorPTvsMult->AddValue(ve1); | |
975568d5 | 506 | if (mon) mon->Add(outMonitorPTvsMult); |
507 | if (lm) lm->AddOutput(outMonitorPTvsMult); | |
db54daad | 508 | |
509 | // AliRsnListOutput *outMonitorMult = new AliRsnListOutput("EventMult",AliRsnListOutput::kHistoDefault); | |
510 | // | |
511 | // AliRsnValueEvent *ve1Multi = new AliRsnValueEvent("centrality",AliRsnValueEvent::kCentralityV0); | |
512 | // ve1Multi->SetBins(0.0,100,10.0); | |
513 | // outMonitorMult->AddValue(ve1Multi); | |
514 | // if (mon) mon->Add(outMonitorMult); | |
515 | // if (lm) lm->AddOutput(outMonitorMult); | |
900e06e4 | 516 | } |
517 | ||
975568d5 | 518 | void AddMonitorOutputMini(AliRsnMiniMonitorTask *task,Int_t listID1,TString name = "",Char_t charge='0') |
900e06e4 | 519 | { |
520 | TString chargeName="all"; | |
521 | if ( charge == '+' ) chargeName = "pos"; | |
522 | if ( charge == '-' ) chargeName = "neg"; | |
523 | ||
975568d5 | 524 | AliRsnMiniMonitor *mondEdx = task->CreateMonitor(Form("%s_dEdx_pTPC_%s", name.Data(),chargeName.Data()),AliRsnMiniMonitor::kdEdxTPCvsP, listID1); |
900e06e4 | 525 | mondEdx->SetCharge(charge); |
975568d5 | 526 | AliRsnMiniMonitor *monPt = task->CreateMonitor(Form("%s_Pt_%s", name.Data(),chargeName.Data()),AliRsnMiniMonitor::kTrackPt, listID1); |
900e06e4 | 527 | monPt->SetCharge(charge); |
900e06e4 | 528 | } |
529 | ||
530 | void AddParticleMonitor(AliAnalysisTaskSE *task, Bool_t isMC, Int_t listID1,AliRsnCutSet *commonEventCuts=0,AliRsnCutSet *cutPair=0,TString name = "") | |
531 | { | |
547e2d97 | 532 | Bool_t valid; |
533 | Int_t isRsnMini = AliAnalysisManager::GetGlobalInt("rsnUseMiniPackage",valid); | |
975568d5 | 534 | Int_t useMCMon = AliAnalysisManager::GetGlobalInt("rsnUseMCMonitoring",valid); |
535 | ||
547e2d97 | 536 | if (isRsnMini) { |
975568d5 | 537 | // Printf("Monitoring by mini is not supported now. It will be soon !!!"); |
538 | // return ; | |
539 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
540 | AliRsnMiniMonitorTask *monTask = new AliRsnMiniMonitorTask(name.Data(),useMCMon); | |
541 | AddMonitorOutputMini(monTask,listID1,name); | |
542 | // AddMonitorOutputMini(monTask,listID1,name,'+'); | |
543 | // AddMonitorOutputMini(monTask,listID1,name,'-'); | |
544 | mgr->AddTask(monTask); | |
545 | // connect input container according to source choice | |
546 | mgr->ConnectInput(monTask, 0, mgr->GetCommonInputContainer()); | |
547 | ||
548 | // create paths for the output in the common file | |
549 | TString commonPath = AliAnalysisManager::GetCommonFileName(); | |
550 | ||
551 | // create containers for output | |
552 | AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnMonMini%s", name.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, commonPath.Data()); | |
553 | ||
554 | mgr->ConnectOutput(monTask, 1, output); | |
555 | ||
556 | ||
557 | ||
900e06e4 | 558 | } else { |
975568d5 | 559 | |
900e06e4 | 560 | TList *listLoops = new TList; |
561 | // monitor definition | |
562 | AliRsnDaughterDef *tracksAll = new AliRsnDaughterDef(AliRsnDaughter::kTrack /*'+' or '-'*/); | |
975568d5 | 563 | // // AliRsnDaughterDef *tracksPos = new AliRsnDaughterDef(AliRsnDaughter::kTrack,'+'); |
564 | // // AliRsnDaughterDef *tracksNeg = new AliRsnDaughterDef(AliRsnDaughter::kTrack,'-'); | |
565 | // | |
900e06e4 | 566 | AliRsnLoopDaughter *lm =0; |
975568d5 | 567 | // // loop object |
568 | listLoops->Add(new AliRsnLoopDaughter(Form("ALL_%s", name.Data()), listID1, tracksAll)); | |
569 | // | |
570 | // // listLoops->Add(new AliRsnLoopDaughter(Form("%s_pos", name.Data()), listID1, tracksPos)); | |
571 | // // listLoops->Add(new AliRsnLoopDaughter(Form("%s_neg", name.Data()), listID1, tracksNeg)); | |
572 | // | |
900e06e4 | 573 | TIter next(listLoops); |
3248b3db | 574 | while ((lm = (AliRsnLoopDaughter *)next.Next())) { |
975568d5 | 575 | // if (commonEventCuts) lm->SetEventCuts(commonEventCuts); |
576 | AddMonitorOutput(0,"mc_loop",lm); | |
900e06e4 | 577 | ((AliRsnAnalysisTask *)task)->AddLoop(lm); |
578 | } | |
900e06e4 | 579 | } |
900e06e4 | 580 | } |
975568d5 | 581 |