Moved old macros for lego_train into lego_train/old folder
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / lego_train / old / AddRsnDaughterCutsRhoNsigma.C
CommitLineData
4ce3e7cd 1#ifndef __CINT__
2#include <AliRsnCutPIDNSigma.h>
3#include <PWGLF/RESONANCES/AliRsnCutTrackQuality.h>
4#endif
5Int_t AddRsnDaughterCutsRhoNsigma(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,Bool_t isRsnMini=kFALSE,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
6{
7
8 if (!rsnIH) return 0;
9
10 Bool_t valid = kTRUE;
11 Int_t isPP = AliAnalysisManager::GetGlobalInt("rsnIsPP",valid);
12
13 Bool_t usePPCut = kFALSE;
14
15 if (isPP && (opt.Contains("usePP"))) usePPCut = kTRUE;
16
17
18 // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
19 Int_t numberOfCuts = 1;
20
21 //---------------------------------------------
22 // Define single cuts
23 //---------------------------------------------
24
25 Printf("AddRsnDaughterCutsRho Option : %s",opt.Data());
26
27 Double_t nSigmaTPC=3.0;
28 Double_t nSigmaTOF=3.0;
29 Double_t etaRange=0.8;
30 Bool_t useTPC_Pi=kFALSE;
31 Bool_t useTOF_Pi=kFALSE;
32
33 if (opt.Contains("qualityonly")) {
34 useTPC_Pi=kFALSE;
35 useTOF_Pi=kFALSE;
36 } else if (!opt.Contains("nsig")) {
37 useTPC_Pi=kTRUE;
38 useTOF_Pi=kTRUE;
39 }
40
41 if (opt.Contains("PiTPCnsig")) useTPC_Pi=kTRUE;
42 if (opt.Contains("PiTOFnsig")) useTOF_Pi=kTRUE;
43
44 if (opt.Contains("PiTPCnsig10")) nSigmaTPC = 1.0;
45 if (opt.Contains("PiTPCnsig15")) nSigmaTPC = 1.5;
46 if (opt.Contains("PiTPCnsig20")) nSigmaTPC = 2.0;
47 if (opt.Contains("PiTPCnsig25")) nSigmaTPC = 2.5;
48 if (opt.Contains("PiTPCnsig30")) nSigmaTPC = 3.0;
49
50 if (opt.Contains("PiTOFnsig10")) nSigmaTOF = 1.0;
51 if (opt.Contains("PiTOFnsig15")) nSigmaTOF = 1.5;
52 if (opt.Contains("PiTOFnsig20")) nSigmaTOF = 2.0;
53 if (opt.Contains("PiTOFnsig25")) nSigmaTOF = 2.5;
54 if (opt.Contains("PiTOFnsig30")) nSigmaTOF = 3.0;
55
56 Bool_t usePDG=kFALSE;
57 if (opt.Contains("pdg")) {
58 Printf("Using PDG");
59 usePDG = kTRUE;
60 }
61
62 Bool_t useEta = kFALSE;
63 if (opt.Contains("eta")) {
64 Printf("Using ETA range (%.2f,%.2f)",-etaRange,etaRange);
65 useEta = kTRUE;
66 }
67
68//---------------------------------------------
69// Combine cuts
70//---------------------------------------------
71
72 TString cutname = "Pi_Rho";
73 if (!opt.IsNull()) cutname += Form("_%s",opt.Data());
74 AliRsnCutSet *cuts = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter);
75
76 TString scheme="";
77
78 AliRsnCutTrackQuality *qualityCut = new AliRsnCutTrackQuality("cutQuatityPi");
79 qualityCut->SetDefaults2010();
80 cuts->AddCut(qualityCut);
81 if (!scheme.IsNull()) scheme += "&";
82 scheme += qualityCut->GetName();
83
84 if (useTPC_Pi) {
85 AliRsnCutPIDNSigma *cutPiTPC = new AliRsnCutPIDNSigma("cutPIDNSigmaTPCPi",AliPID::kPion,AliRsnCutPIDNSigma::kTPC);
86 cutPiTPC->SinglePIDRange(nSigmaTPC);
87 cuts->AddCut(cutPiTPC);
88 if (!scheme.IsNull()) scheme += "&";
89 scheme += cutPiTPC->GetName();
90 }
91 if (useTOF_Pi) {
92 AliRsnCutPIDNSigma *cutPiTOF = new AliRsnCutPIDNSigma("cutPIDNSigmaTOFPi",AliPID::kPion,AliRsnCutPIDNSigma::kTOF);
93 cutPiTOF->SinglePIDRange(nSigmaTOF);
94 cuts->AddCut(cutPiTOF);
95 if (!scheme.IsNull()) scheme += "&";
96 scheme += cutPiTOF->GetName();
97 }
98 if (useEta) {
99 Printf("Adding ETA ...");
100 AliRsnValueDaughter *valEta = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta);
101 AliRsnCutValue *cutEta = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),-etaRange,etaRange);
102 cutEta->SetTargetType(AliRsnTarget::kDaughter);
103 cutEta->SetValueObj(valEta);
104 cuts->AddCut(cutEta);
105 if (!scheme.IsNull()) scheme += "&";
106 scheme += cutEta->GetName();
107 }
108 if (usePDG) {
109 Printf("Adding PDG ...");
110 AliRsnCutPID *cutPDG = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);
111 cuts->AddCut(cutPDG);
112 if (!scheme.IsNull()) scheme += "&";
113 scheme += cutPDG->GetName();
114 }
115
116 Printf ("CUT Scheme is '%s'",scheme.Data());
117 cuts->SetCutScheme(scheme.Data());
118
119 if (opt.Contains("mon")) {
120 AddMonitorOutput(cuts->GetMonitorOutput(),opt);
121 }
122 if (isRsnMini) {
123 AliRsnMiniAnalysisTask *taskRsnMini = dynamic_cast<AliRsnMiniAnalysisTask *>(task);
124 if (taskRsnMini) {
125 taskRsnMini->AddTrackCuts(cuts);
126 }
127 } else {
128 AliRsnDaughterSelector *sel = rsnIH->GetSelector();
129// sel->SetLabelCheck(kFALSE);
130 sel->Add(cuts, kTRUE);
131 }
132 return numberOfCuts;
133
134}
135