]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/lego_train/AddRsnDaughterCutsBPID.C
First version of macros for lego_train
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / lego_train / AddRsnDaughterCutsBPID.C
1 #ifndef __CINT__
2 #include <PWG2/RESONANCES/AliRsnCutPID.h>
3 #include <PWG2/RESONANCES/AliRsnInputHandler.h>
4 #include <PWG2/RESONANCES/AliRsnCutSet.h>
5 #endif
6
7 Int_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")) {
39       TObjArray *output = new TObjArray;
40       AddMonitorOutput(output);
41       cuts1->SetMonitorOutput(output);
42
43       output = new TObjArray;
44       AddMonitorOutput(output);
45       cuts2->SetMonitorOutput(output);
46    }
47    if (isRsnMini) {
48       AliRsnMiniAnalysisTask *taskRsnMini = dynamic_cast<AliRsnMiniAnalysisTask *>(task);
49       if (taskRsnMini) {
50          taskRsnMini->AddTrackCuts(cuts1);
51          if (type1 != type2) taskRsnMini->AddTrackCuts(cuts2);
52       }
53    } else {
54       AliRsnDaughterSelector *sel = rsnIH->GetSelector();
55       sel->Add(cuts1, kTRUE);
56       if (type1 != type2)  sel->Add(cuts2, kTRUE);
57    }
58
59
60    return numberOfCuts;
61 }