AliPhysics  71e3bc7 (71e3bc7)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliFlowTrackSimpleCuts.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 // AliFlowTrackSimpleCuts:
19 // A simple track cut class to the the AliFlowTrackSimple
20 // for basic kinematic cuts
21 //
22 // author: N. van der Kolk (kolk@nikhef.nl)
23 // mods: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch), Redmer Bertens (rbertens@cern.ch)
24 
25 #include <limits.h>
26 #include <float.h>
27 #include "TH2.h"
28 #include "TAxis.h"
29 #include "TRandom.h"
30 #include "TNamed.h"
31 #include "TParticle.h"
32 #include "TParticlePDG.h"
33 #include "AliFlowTrackSimpleCuts.h"
34 #include "AliFlowTrackSimple.h"
35 
37 
38 //-----------------------------------------------------------------------
40  TNamed(name,name),
41  fCutPt(kFALSE),
42  fPtMax(FLT_MAX),
43  fPtMin(-FLT_MAX),
44  fCutEta(kFALSE),
45  fEtaMax(FLT_MAX),
46  fEtaMin(-FLT_MAX),
47  fCutEtaGap(kFALSE),
48  fEtaGapMax(0.),
49  fEtaGapMin(0.),
50  fCutPhi(kFALSE),
51  fPhiMax(FLT_MAX),
52  fPhiMin(-FLT_MAX),
53  fCutPID(kFALSE),
54  fPID(0),
55  fCutCharge(kFALSE),
56  fCharge(0),
57  fCutMass(kFALSE),
58  fMassMax(FLT_MAX),
59  fMassMin(-FLT_MAX),
60  fEtaPhiEff(0x0),
61  fCutEtaPhiEff(kFALSE),
62  fPOItype(1)
63 {
64  //constructor
65 }
66 
68 //AliFlowTrackSimpleCuts::AliFlowTrackSimpleCuts(const AliFlowTrackSimpleCuts& someCuts):
69 // TNamed(),
70 // fCutPt(someCuts.fCutPt),
71 // fPtMax(someCuts.fPtMax),
72 // fPtMin(someCuts.fPtMin),
73 // fCutEta(someCuts.fCutEta),
74 // fEtaMax(someCuts.fEtaMax),
75 // fEtaMin(someCuts.fEtaMin),
76 // fCutPhi(someCuts.fCutPhi),
77 // fPhiMax(someCuts.fPhiMax),
78 // fPhiMin(someCuts.fPhiMin),
79 // fCutPID(someCuts.fCutPID),
80 // fPID(someCuts.fPID),
81 // fCutCharge(someCuts.fCutCharge),
82 // fCharge(someCuts.fCharge)
83 //{
84 // //copy constructor
85 //}
86 //
88 //AliFlowTrackSimpleCuts& AliFlowTrackSimpleCuts::operator=(const AliFlowTrackSimpleCuts& someCuts)
89 //{
90 // TNamed::operator=(someCuts);
91 // fCutPt = someCuts.fCutPt;
92 // fPtMax = someCuts.fPtMax;
93 // fPtMin = someCuts.fPtMin;
94 // fCutEta = someCuts.fCutEta;
95 // fEtaMax = someCuts.fEtaMax;
96 // fEtaMin = someCuts.fEtaMin;
97 // fCutPhi = someCuts.fCutPhi;
98 // fPhiMax = someCuts.fPhiMax;
99 // fPhiMin = someCuts.fPhiMin;
100 // fCutPID = someCuts.fCutPID;
101 // fPID = someCuts.fPID;
102 // fCutCharge = someCuts.fCutCharge;
103 // fCharge = someCuts.fCharge;
104 //
105 // return *this;
106 //}
107 
108 //-----------------------------------------------------------------------
110 {
111  //check cuts
112  TParticle* p = dynamic_cast<TParticle*>(obj);
113  if (p) return PassesCuts(p);
114  AliFlowTrackSimple* ts = dynamic_cast<AliFlowTrackSimple*>(obj);
115  if (ts) return PassesCuts(ts);
116  return kFALSE; //default when passed a wrong type of object
117 }
118 
119 //-----------------------------------------------------------------------
121 {
122  //simple method to check if the simple track passes the simple cuts
123  if(fCutPt) {if (track->Pt() < fPtMin || track->Pt() >= fPtMax ) return kFALSE;}
124  if(fCutEta) {if (track->Eta() < fEtaMin || track->Eta() >= fEtaMax ) return kFALSE;}
125  if(fCutPhi) {if (track->Phi() < fPhiMin || track->Phi() >= fPhiMax ) return kFALSE;}
126  if(fCutCharge) {if (track->Charge() != fCharge) return kFALSE;}
127  if(fCutMass) {if (track->Mass() < fMassMin || track->Mass() >= fMassMax ) return kFALSE;}
128  if(fCutEtaGap) {if (track->Eta() > fEtaGapMin && track->Eta() < fEtaGapMax) return kFALSE;}
129  //if(fCutPID) {if (track->PID() != fPID) return kFALSE;}
130  if(fCutEtaPhiEff) {
131  Int_t binX(fEtaPhiEff->GetXaxis()->FindBin(track->Eta())), binY(fEtaPhiEff->GetYaxis()->FindBin(track->Phi()+fEtaPhiEff->GetYaxis()->GetXmin()));
132  if(fEtaPhiEff->GetBinContent(binX, binY) < gRandom->Uniform(0,1)*(fEtaPhiEff->GetMaximum())) return kFALSE;
133  }
134  return kTRUE;
135 }
136 
137 //-----------------------------------------------------------------------
139 {
140  //simple method to check if the simple track passes the simple cuts
141  if(fCutPt) {if (track->Pt() < fPtMin || track->Pt() >= fPtMax ) return kFALSE;}
142  if(fCutEta) {if (track->Eta() < fEtaMin || track->Eta() >= fEtaMax ) return kFALSE;}
143  if(fCutPhi) {if (track->Phi() < fPhiMin || track->Phi() >= fPhiMax ) return kFALSE;}
144  if(fCutEtaGap) {if (track->Eta() > fEtaGapMin && track->Eta() < fEtaGapMax) return kFALSE;}
145 
146  //if(fCutPID) {if (track->GetPdgCode() != fPID) return kFALSE;}
147 
148  //getting the charge from a tparticle is expensive
149  //only do it if neccesary
150  if (fCutCharge)
151  {
152  TParticlePDG* ppdg = track->GetPDG();
153  Int_t charge = TMath::Nint(ppdg->Charge()/3.0); //mc particles have charge in units of 1/3e
154  return (charge==fCharge);
155  }
156 
157  if (fCutMass) {
158  TParticlePDG* ppdg = track->GetPDG();
159  if (ppdg->Mass() < fMassMin || ppdg->Mass() >= fMassMax )
160  return kFALSE;
161  }
162 
163  return kTRUE;
164 }
Int_t charge
Bool_t PassesCuts(const AliFlowTrackSimple *track) const
Double_t Mass() const
TRandom * gRandom
ClassImp(AliFlowTrackSimpleCuts) AliFlowTrackSimpleCuts
Double_t Phi() const
int Int_t
Definition: External.C:63
virtual Bool_t IsSelected(TObject *obj, Int_t id=-1)
Double_t Pt() const
Double_t Eta() const
bool Bool_t
Definition: External.C:53