Moved old macros for lego_train into lego_train/old folder
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / lego_train / old / AddRsnDaughterCutsPDG.C
CommitLineData
900e06e4 1#ifndef __CINT__
975568d5 2#include <AliRsnCutPID.h>
3#include <AliRsnInputHandler.h>
4#include <AliRsnCutSet.h>
5#include <AliRsnCutValue.h>
900e06e4 6#endif
7
8Int_t AddRsnDaughterCutsPDG(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,Bool_t isRsnMini=kFALSE,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
9{
10
11 if (!rsnIH) return 0;
12
13 // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
14 Int_t numberOfCuts = 1;
15
16 // gets selector
17 AliRsnDaughterSelector *sel = rsnIH->GetSelector();
18
19 //---------------------------------------------
20 // Define single cuts
21 //---------------------------------------------
22
975568d5 23 Bool_t useQuality = kFALSE;
24 if (opt.Contains("quality")) {
25 useQuality = kTRUE;
26 }
27
28
43d3541a 29 Double_t etaRange=0.8;
30
31 AliRsnCutValue *cutEta;
32 Bool_t useEta = kFALSE;
33 if (opt.Contains("eta")) {
34 Printf("Using ETA range (%.2f,%.2f)",-etaRange,etaRange);
35 useEta = kTRUE;
36 }
37
900e06e4 38 AliRsnCutSet *cuts1 = new AliRsnCutSet(Form("%sPDG%s",AliPID::ParticleName(type1),opt.Data()), AliRsnTarget::kDaughter);
43d3541a 39
40 Double_t nSigmaTPC=3.0;
41 Double_t nSigmaTOF=3.0;
42 Double_t ptTPCMax=0.8;
975568d5 43
44 TString scheme;
43d3541a 45
46 AliRsnCutPID *cut1 = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);
900e06e4 47 cuts1->AddCut(cut1);
975568d5 48 if (!scheme.IsNull()) scheme += "&";
49 scheme += cut1->GetName();
43d3541a 50 if (useEta) {
51 AliRsnCutValue *cutEta1 = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),-etaRange,etaRange);
52 AliRsnValueDaughter *valEta1 = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1)),AliRsnValueDaughter::kEta);
53 cutEta1->SetValueObj(valEta1);
54 cuts1->AddCut(cutEta1);
975568d5 55 if (!scheme.IsNull()) scheme += "&";
56 scheme += cutEta1->GetName();
57 }
58 if (useQuality) {
3da8cef7 59 AliRsnCutTrackQuality *qualityCut1 = new AliRsnCutTrackQuality("cutQuatityPDG1");
60 qualityCut1->SetDefaults2010();
61 cuts1->AddCut(qualityCut1);
975568d5 62 if (!scheme.IsNull()) scheme += "&";
3da8cef7 63 scheme += qualityCut1->GetName();
43d3541a 64 }
975568d5 65 cuts1->SetCutScheme(scheme.Data());
43d3541a 66 sel->Add(cuts1, kTRUE);
900e06e4 67
975568d5 68 scheme = "";
900e06e4 69 AliRsnCutSet *cuts2 = 0;
70 if (type1 != type2) {
71 AliRsnCutPID *cut2 = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type2),opt.Data()),type2,0.0,kTRUE);
43d3541a 72
900e06e4 73 cuts2 = new AliRsnCutSet(Form("%sPDG%s",AliPID::ParticleName(type2),opt.Data()), AliRsnTarget::kDaughter);
74 cuts2->AddCut(cut2);
975568d5 75 if (!scheme.IsNull()) scheme += "&";
76 scheme += cut2->GetName();
77 if (useQuality) {
3da8cef7 78 AliRsnCutTrackQuality *qualityCut2 = new AliRsnCutTrackQuality("cutQuatityPDG2");
79 qualityCut2->SetDefaults2010();
80 cuts2->AddCut(qualityCut2);
975568d5 81 if (!scheme.IsNull()) scheme += "&";
3da8cef7 82 scheme += qualityCut2->GetName();
975568d5 83 }
43d3541a 84 if (useEta) {
85 AliRsnCutValue *cutEta2 = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type2),opt.Data()),-etaRange,etaRange);
86 AliRsnValueDaughter *valEta2 = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type2)),AliRsnValueDaughter::kEta);
87 cutEta2->SetValueObj(valEta2);
88 cuts2->AddCut(cutEta2);
975568d5 89 if (!scheme.IsNull()) scheme += "&";
90 scheme += cutEta2->GetName();
43d3541a 91 }
975568d5 92
93 cuts2->SetCutScheme(scheme.Data());
900e06e4 94 sel->Add(cuts2, kTRUE);
95 numberOfCuts++;
96 }
97 if (opt.Contains("mon")) {
43d3541a 98 AddMonitorOutput(cuts1->GetMonitorOutput(),opt);
99 if (type1 != type2) AddMonitorOutput(cuts2->GetMonitorOutput());
900e06e4 100 }
101 if (isRsnMini) {
102 AliRsnMiniAnalysisTask *taskRsnMini = dynamic_cast<AliRsnMiniAnalysisTask *>(task);
103 if (taskRsnMini) {
104 taskRsnMini->AddTrackCuts(cuts1);
105 if (type1 != type2) taskRsnMini->AddTrackCuts(cuts2);
106 }
107 } else {
108 AliRsnDaughterSelector *sel = rsnIH->GetSelector();
109 sel->Add(cuts1, kTRUE);
110 if (type1 != type2) sel->Add(cuts2, kTRUE);
111 }
112
113 return numberOfCuts;
114}
43d3541a 115
116