]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/macros/lego_train/AddRsnDaughterCutsBPID.C
Migration of PWG2/RESONANCES -> PWGLF/RESONANCES
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / lego_train / AddRsnDaughterCutsBPID.C
CommitLineData
900e06e4 1#ifndef __CINT__
2#include <PWG2/RESONANCES/AliRsnCutPID.h>
3#include <PWG2/RESONANCES/AliRsnInputHandler.h>
4#include <PWG2/RESONANCES/AliRsnCutSet.h>
5#endif
6
7Int_t AddRsnDaughterCutsBPID(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,Bool_t isRsnMini=kFALSE,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
8{
9
10 if (!rsnIH) return 0;
11
12 // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
13 Int_t numberOfCuts = 1;
14
15 // gets selector
16 AliRsnDaughterSelector *sel = rsnIH->GetSelector();
17
18 //---------------------------------------------
19 // Define single cuts
20 //---------------------------------------------
21
22 AliRsnCutPID *cut1 = new AliRsnCutPID(Form("cut%sBPID%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kFALSE);
23 AliRsnCutSet *cuts1 = new AliRsnCutSet(Form("%sBPID%s",AliPID::ParticleName(type1),opt.Data()), AliRsnTarget::kDaughter);
24 cuts1->AddCut(cut1);
25 cuts1->SetCutScheme(cut1->GetName());
26 sel->Add(cuts1, kTRUE);
27
28
29 AliRsnCutSet *cuts2 = 0;
30 if (type1 != type2) {
31 AliRsnCutPID *cut2 = new AliRsnCutPID(Form("cut%sBPID%s",AliPID::ParticleName(type2),opt.Data()),type2,0.0,kFALSE);
32 cuts2 = new AliRsnCutSet(Form("%sBPID%s",AliPID::ParticleName(type2),opt.Data()), AliRsnTarget::kDaughter);
33 cuts2->AddCut(cut2);
34 cuts2->SetCutScheme(cut2->GetName());
35 sel->Add(cuts2, kTRUE);
36 numberOfCuts++;
37 }
38 if (opt.Contains("mon")) {
547e2d97 39 AddMonitorOutput(cuts1->GetMonitorOutput());
40 if (type1 != type2) {
41 AddMonitorOutput(cuts2->GetMonitorOutput());
42 }
900e06e4 43 }
44 if (isRsnMini) {
45 AliRsnMiniAnalysisTask *taskRsnMini = dynamic_cast<AliRsnMiniAnalysisTask *>(task);
46 if (taskRsnMini) {
47 taskRsnMini->AddTrackCuts(cuts1);
48 if (type1 != type2) taskRsnMini->AddTrackCuts(cuts2);
49 }
50 } else {
51 AliRsnDaughterSelector *sel = rsnIH->GetSelector();
52 sel->Add(cuts1, kTRUE);
53 if (type1 != type2) sel->Add(cuts2, kTRUE);
54 }
55
56
57 return numberOfCuts;
58}