Changed scripts for new TrainSetup
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutSetDaughterParticle.cxx
1 //
2 // Author: Francesca Bellini (fbellini@cern.ch)
3 //
4 //
5
6 #include <Riostream.h>
7
8 #include "AliPID.h"
9 #include "AliPIDResponse.h"
10 #include "AliRsnCutSetDaughterParticle.h"
11
12 class AliRsnCutPIDNSigma;
13 class AliRsnPIDRange;
14
15 ClassImp(AliRsnCutSetDaughterParticle)
16
17 //__________________________________________________________________________________________________
18 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle() :
19    AliRsnCutSet("AliRsnCutSetDaughterParticle", AliRsnTarget::kDaughter),
20    fPID(AliPID::kPion),
21    fAppliedCutSetID(AliRsnCutSetDaughterParticle::kNDaughterCuts),
22    fNsigmaTPC(1E20),
23    fNsigmaTOF(1E20),
24    fCutQuality(0x0),
25    fAODTrkCutFilterBit(0)
26 {
27    //
28    // Default constructor
29 }
30
31 //__________________________________________________________________________________________________
32 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle(const char *name, AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutSetID, AliPID::EParticleType pid, Float_t nSigmaFast = -1.0, Int_t AODfilterBit = 0) :
33    AliRsnCutSet(name, AliRsnTarget::kDaughter),
34    fPID(pid),
35    fAppliedCutSetID(cutSetID),
36    fNsigmaTPC(1E20),
37    fNsigmaTOF(1E20),
38    fCutQuality(new AliRsnCutTrackQuality("CutQuality")),
39    fAODTrkCutFilterBit(AODfilterBit)
40 {
41    //
42    // Constructor
43    //
44    if ( (nSigmaFast<=0) &&
45         ((cutSetID == AliRsnCutSetDaughterParticle::kFastTPCpidNsigma) || (cutSetID == AliRsnCutSetDaughterParticle::kFastTOFpidNsigma)) ) {
46       AliError("Requested fast n-sigma PID with invalid value for n. Setting n = 1E20");
47    } else {
48       if (cutSetID == AliRsnCutSetDaughterParticle::kFastTPCpidNsigma) {
49          fNsigmaTPC = nSigmaFast;
50       }
51       if ( (cutSetID == AliRsnCutSetDaughterParticle::kFastTOFpidNsigma) ||
52            (cutSetID == AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010) ) {
53          fNsigmaTOF = nSigmaFast;
54       }
55    }
56
57    Init();
58 }
59
60 //__________________________________________________________________________________________________
61 AliRsnCutSetDaughterParticle::AliRsnCutSetDaughterParticle(const AliRsnCutSetDaughterParticle &copy) :
62    AliRsnCutSet(copy),
63    fPID(copy.fPID),
64    fAppliedCutSetID(copy.fAppliedCutSetID),
65    fNsigmaTPC(copy.fNsigmaTPC),
66    fNsigmaTOF(copy.fNsigmaTOF),
67    fCutQuality(copy.fCutQuality),
68    fAODTrkCutFilterBit(copy.fAODTrkCutFilterBit)
69 {
70    //
71    // copy constructor
72 }
73
74 //__________________________________________________________________________________________________
75 AliRsnCutSetDaughterParticle &AliRsnCutSetDaughterParticle::operator=(const AliRsnCutSetDaughterParticle &copy)
76 {
77    //
78    // operator =
79    //
80    AliRsnCutSet::operator=(copy);
81    if (this == &copy)
82       return *this;
83    fPID=copy.fPID;
84    fAppliedCutSetID=copy.fAppliedCutSetID;
85    fNsigmaTPC=copy.fNsigmaTPC;
86    fNsigmaTOF=copy.fNsigmaTOF;
87    fAODTrkCutFilterBit=copy.fAODTrkCutFilterBit;
88    fCutQuality=copy.fCutQuality;
89    return (*this);
90 }
91
92 //----------------------------------------------------------------------------
93 AliRsnCutSetDaughterParticle::~AliRsnCutSetDaughterParticle()
94 {
95    //
96    //destructor
97    //
98    if (fCutQuality)
99       delete fCutQuality;
100 }
101 //----------------------------------------------------------------------------
102 void AliRsnCutSetDaughterParticle::Init()
103 {
104    //
105    // init cut sets by setting variable params
106    //
107    fCutQuality->SetDefaults2010();
108    fCutQuality->SetPtRange(0.15, 20.0);
109    fCutQuality->SetEtaRange(-0.8, 0.8);
110    fCutQuality->SetDCARPtFormula("0.0182+0.0350/pt^1.01");
111    fCutQuality->SetDCAZmax(2.0);
112    fCutQuality->SetSPDminNClusters(1);
113    fCutQuality->SetITSminNClusters(0);
114    fCutQuality->SetITSmaxChi2(36);
115    fCutQuality->SetTPCminNClusters(70);
116    fCutQuality->SetTPCmaxChi2(4.0);
117    fCutQuality->SetRejectKinkDaughters();
118    fCutQuality->SetAODTestFilterBit(fAODTrkCutFilterBit);
119    //fCutQuality->SetITSmaxChi2(36);
120    //fCutQuality->SetMaxChi2TPCConstrainedGlobal(36);
121
122    AliRsnCutTOFMatch  *iCutTOFMatch     = new AliRsnCutTOFMatch("CutTOFMatch");
123    AliRsnCutPIDNSigma *iCutTPCNSigma    = new AliRsnCutPIDNSigma("CutTPCNSigma", fPID, AliRsnCutPIDNSigma::kTPC);//, AliRsnCutPIDNSigma::kTPCinnerP );
124    AliRsnCutPIDNSigma *iCutTPCTOFNSigma = new AliRsnCutPIDNSigma("CutTPCTOFNSigma", fPID, AliRsnCutPIDNSigma::kTPC);//, AliRsnCutPIDNSigma::kTPCinnerP );
125    AliRsnCutPIDNSigma *iCutTOFNSigma    = new AliRsnCutPIDNSigma("CutTOFNSigma", fPID, AliRsnCutPIDNSigma::kTOF);//, AliRsnCutPIDNSigma::kP );
126
127    switch (fAppliedCutSetID)
128    {
129       case AliRsnCutSetDaughterParticle::kNoCuts :
130          AliInfo("No cuts applied to daughter particle");
131          break;
132
133       case AliRsnCutSetDaughterParticle::kQualityStd2010 :
134          AddCut(fCutQuality);
135          SetCutScheme(fCutQuality->GetName());
136          break;
137
138       case AliRsnCutSetDaughterParticle::kQualityStd2011:
139          //fCutQuality->SetAODTestFilterBit(10);     //1024
140          AddCut(fCutQuality);
141          SetCutScheme(fCutQuality->GetName());
142          break;
143
144       case AliRsnCutSetDaughterParticle::kTOFMatch :
145          AddCut(fCutQuality);
146          AddCut(iCutTOFMatch);
147          SetCutScheme( Form("%s&(%s)",fCutQuality->GetName(), iCutTOFMatch->GetName()) );
148          break;
149
150       case    AliRsnCutSetDaughterParticle::kFastTPCpidNsigma :
151          if (fNsigmaTPC <= 0.0) {
152             AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTPCNSigma->GetName()));
153             SetNsigmaForFastTPCpid(10.0);
154          }
155          iCutTPCNSigma->SinglePIDRange(fNsigmaTPC);
156          AddCut(fCutQuality);
157          AddCut(iCutTPCNSigma);
158          SetCutScheme( Form("%s&%s",fCutQuality->GetName(), iCutTPCNSigma->GetName()) );
159          break;
160
161       case    AliRsnCutSetDaughterParticle::kFastTOFpidNsigma :
162          if (fNsigmaTOF <= 0.0) {
163             AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
164             SetNsigmaForFastTOFpid(10.0);
165          }
166          iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
167          //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
168          AddCut(fCutQuality);
169          AddCut(iCutTOFNSigma);
170          SetCutScheme( Form("%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName()) );
171          break;
172
173       case    AliRsnCutSetDaughterParticle::kTPCTOFpidKstarPP2010 :
174          /* Set TPC  PID (if no TOF)*/
175          // all   below   350         MeV: 5sigma
176          // all   between 350 and 500 MeV: 3sigma
177          // pios above   500         MeV: 2sigma
178          // kaons between 500 and 700 MeV: 2sigma
179          // kaons above   700         MeV: rejected
180          iCutTPCNSigma->AddPIDRange(5.0, 0.0, 0.35);
181          iCutTPCNSigma->AddPIDRange(3.0, 0.35, 0.5);
182          if (fPID==AliPID::kPion)
183             iCutTPCNSigma->AddPIDRange(2.0, 0.5, 1E20);
184          if (fPID==AliPID::kKaon)
185             iCutTPCNSigma->AddPIDRange(2.0, 0.5, 0.7);
186
187          AddCut(fCutQuality);
188          AddCut(iCutTOFMatch);
189          AddCut(iCutTPCNSigma);
190
191          /* set TPC+TOF PID*/
192          iCutTPCTOFNSigma->SinglePIDRange(5.0);
193          iCutTOFNSigma->AddPIDRange(3.0, 0.0, 1.5);
194          iCutTOFNSigma->AddPIDRange(2.0, 1.5, 1E20);
195
196          AddCut(iCutTPCTOFNSigma);
197          AddCut(iCutTOFNSigma);
198
199          // scheme:
200          // quality & [ (TOF & TPCTOF) || (!TOFmatch & TPConly) ]
201          SetCutScheme( Form("%s&((%s&%s)|((!%s)&%s))",fCutQuality->GetName(), iCutTPCTOFNSigma->GetName(), iCutTOFNSigma->GetName(), iCutTOFMatch->GetName(), iCutTPCNSigma->GetName()) ) ;
202          break;
203
204       case AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010:
205          if (fNsigmaTOF <= 0.0) {
206             AliWarning(Form("Invalid number of sigmas required for %s. Setting default nSigma = 10",iCutTOFNSigma->GetName()));
207             SetNsigmaForFastTOFpid(10.0);
208          }
209          iCutTOFNSigma->SinglePIDRange(fNsigmaTOF);
210          //iCutTOFNSigma->AddPIDRange(3.0, 0.35, 1E20);
211          iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
212
213          AddCut(fCutQuality);
214          AddCut(iCutTOFNSigma);
215          AddCut(iCutTPCTOFNSigma);
216          SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFNSigma->GetName(), iCutTPCTOFNSigma->GetName()) );
217          break;
218
219       case AliRsnCutSetDaughterParticle::kTOFTPCmismatchKstarPbPb2010:
220          iCutTPCTOFNSigma->SinglePIDRange(5.0); //5-sigma veto on tpc signal
221          AddCut(fCutQuality);
222          AddCut(iCutTOFMatch);
223          AddCut(iCutTPCTOFNSigma);
224          SetCutScheme( Form("%s&%s&%s",fCutQuality->GetName(), iCutTOFMatch->GetName(), iCutTPCTOFNSigma->GetName()) );
225          break;
226
227       default :
228          break;
229    }
230
231 }
232
233
234