]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/lego_train/AddRsnDaughterCutsPDG.C
PWG2/SPECTRA -> PWGLF/SPECTRA migration
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / lego_train / AddRsnDaughterCutsPDG.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 AddRsnDaughterCutsPDG(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%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);
23    AliRsnCutSet *cuts1 = new AliRsnCutSet(Form("%sPDG%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%sPDG%s",AliPID::ParticleName(type2),opt.Data()),type2,0.0,kTRUE);
32       cuts2 = new AliRsnCutSet(Form("%sPDG%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       AddMonitorOutput(cuts1->GetMonitorOutput());
40       AddMonitorOutput(cuts2->GetMonitorOutput());
41    }
42    if (isRsnMini) {
43       AliRsnMiniAnalysisTask *taskRsnMini = dynamic_cast<AliRsnMiniAnalysisTask *>(task);
44       if (taskRsnMini) {
45          taskRsnMini->AddTrackCuts(cuts1);
46          if (type1 != type2) taskRsnMini->AddTrackCuts(cuts2);
47       }
48    } else {
49       AliRsnDaughterSelector *sel = rsnIH->GetSelector();
50       sel->Add(cuts1, kTRUE);
51       if (type1 != type2)  sel->Add(cuts2, kTRUE);
52    }
53
54    return numberOfCuts;
55 }