]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/lego_train/AddRsnDaughterCutsBPID.C
Added new macros for LEGO train (mvala)
[u/mrichter/AliRoot.git] / PWGLF / 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,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
8 {
9
10    if (!rsnIH) return 0;
11    
12    Bool_t valid;
13    Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid);
14
15    // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
16    Int_t numberOfCuts = 1;
17
18    // gets selector
19    AliRsnDaughterSelector *sel = rsnIH->GetSelector();
20
21    //---------------------------------------------
22    //  Define single cuts
23    //---------------------------------------------
24
25    AliRsnCutPID *cut1 = new AliRsnCutPID(Form("cut%sBPID%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kFALSE);
26    AliRsnCutSet *cuts1 = new AliRsnCutSet(Form("%sBPID%s",AliPID::ParticleName(type1),opt.Data()), AliRsnTarget::kDaughter);
27    cuts1->AddCut(cut1);
28    cuts1->SetCutScheme(cut1->GetName());
29    sel->Add(cuts1, kTRUE);
30
31
32    AliRsnCutSet *cuts2 = 0;
33    if (type1 != type2) {
34       AliRsnCutPID *cut2 = new AliRsnCutPID(Form("cut%sBPID%s",AliPID::ParticleName(type2),opt.Data()),type2,0.0,kFALSE);
35       cuts2 = new AliRsnCutSet(Form("%sBPID%s",AliPID::ParticleName(type2),opt.Data()), AliRsnTarget::kDaughter);
36       cuts2->AddCut(cut2);
37       cuts2->SetCutScheme(cut2->GetName());
38       sel->Add(cuts2, kTRUE);
39       numberOfCuts++;
40    }
41    if (opt.Contains("mon")) {
42       AddMonitorOutput(cuts1->GetMonitorOutput(),opt);
43       if (type1 != type2) {
44          AddMonitorOutput(cuts2->GetMonitorOutput(),opt);
45       }
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 }