]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Base/AliFlowTrackSimpleCuts.cxx
initial checkin of the new flow development - from an OLD diff!
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowTrackSimpleCuts.cxx
CommitLineData
d29ba078 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$ */
d29ba078 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)
929098e4 23// mods: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
d29ba078 24
b4dba88d 25#include <limits.h>
26#include <float.h>
929098e4 27#include "TNamed.h"
28#include "TParticle.h"
701f71c1 29#include "TParticlePDG.h"
929098e4 30#include "AliFlowTrackSimpleCuts.h"
31#include "AliFlowTrackSimple.h"
d29ba078 32
33ClassImp(AliFlowTrackSimpleCuts)
34
35//-----------------------------------------------------------------------
cc0afcfc 36AliFlowTrackSimpleCuts::AliFlowTrackSimpleCuts(const char* name):
37 TNamed(name,name),
b4dba88d 38 fCutPt(kFALSE),
39 fPtMax(FLT_MAX),
ded1d842 40 fPtMin(-FLT_MAX),
b4dba88d 41 fCutEta(kFALSE),
42 fEtaMax(FLT_MAX),
ded1d842 43 fEtaMin(-FLT_MAX),
b4dba88d 44 fCutPhi(kFALSE),
45 fPhiMax(FLT_MAX),
ded1d842 46 fPhiMin(-FLT_MAX),
b4dba88d 47 fCutPID(kFALSE),
701f71c1 48 fPID(0),
b4dba88d 49 fCutCharge(kFALSE),
60875c3c 50 fCharge(0),
51 fCutMass(kFALSE),
52 fMassMax(FLT_MAX),
8fa6a5fa
MK
53 fMassMin(-FLT_MAX),
54 fNumberOfPOIclasses(1)
d29ba078 55{
56 //constructor
d29ba078 57}
58
b4dba88d 59////-----------------------------------------------------------------------
60//AliFlowTrackSimpleCuts::AliFlowTrackSimpleCuts(const AliFlowTrackSimpleCuts& someCuts):
61// TNamed(),
62// fCutPt(someCuts.fCutPt),
63// fPtMax(someCuts.fPtMax),
64// fPtMin(someCuts.fPtMin),
65// fCutEta(someCuts.fCutEta),
66// fEtaMax(someCuts.fEtaMax),
67// fEtaMin(someCuts.fEtaMin),
68// fCutPhi(someCuts.fCutPhi),
69// fPhiMax(someCuts.fPhiMax),
70// fPhiMin(someCuts.fPhiMin),
71// fCutPID(someCuts.fCutPID),
72// fPID(someCuts.fPID),
73// fCutCharge(someCuts.fCutCharge),
74// fCharge(someCuts.fCharge)
75//{
76// //copy constructor
77//}
78//
79////-----------------------------------------------------------------------
80//AliFlowTrackSimpleCuts& AliFlowTrackSimpleCuts::operator=(const AliFlowTrackSimpleCuts& someCuts)
81//{
82// TNamed::operator=(someCuts);
83// fCutPt = someCuts.fCutPt;
84// fPtMax = someCuts.fPtMax;
85// fPtMin = someCuts.fPtMin;
86// fCutEta = someCuts.fCutEta;
87// fEtaMax = someCuts.fEtaMax;
88// fEtaMin = someCuts.fEtaMin;
89// fCutPhi = someCuts.fCutPhi;
90// fPhiMax = someCuts.fPhiMax;
91// fPhiMin = someCuts.fPhiMin;
92// fCutPID = someCuts.fCutPID;
93// fPID = someCuts.fPID;
94// fCutCharge = someCuts.fCutCharge;
95// fCharge = someCuts.fCharge;
96//
97// return *this;
98//}
e1911c19 99
daf66719 100//-----------------------------------------------------------------------
8fa6a5fa 101Int_t AliFlowTrackSimpleCuts::IsSelected(TObject* obj, Int_t)
daf66719 102{
103 //check cuts
104 TParticle* p = dynamic_cast<TParticle*>(obj);
105 if (p) return PassesCuts(p);
106 AliFlowTrackSimple* ts = dynamic_cast<AliFlowTrackSimple*>(obj);
107 if (ts) return PassesCuts(ts);
8fa6a5fa 108 return 0; //default when passed a wrong type of object
daf66719 109}
110
e1911c19 111//-----------------------------------------------------------------------
8fa6a5fa 112Int_t AliFlowTrackSimpleCuts::PassesCuts(const AliFlowTrackSimple *track) const
e1911c19 113{
114 //simple method to check if the simple track passes the simple cuts
8fa6a5fa
MK
115 if(fCutPt) {if (track->Pt() < fPtMin || track->Pt() >= fPtMax ) return 0;}
116 if(fCutEta) {if (track->Eta() < fEtaMin || track->Eta() >= fEtaMax ) return 0;}
117 if(fCutPhi) {if (track->Phi() < fPhiMin || track->Phi() >= fPhiMax ) return 0;}
118 if(fCutCharge) {if (track->Charge() != fCharge) return 0;}
119 if(fCutMass) {if (track->Mass() < fMassMin || track->Mass() >= fMassMax ) return 0;}
daf66719 120 //if(fCutPID) {if (track->PID() != fPID) return kFALSE;}
8fa6a5fa 121 return 1;
e1911c19 122}
929098e4 123
124//-----------------------------------------------------------------------
8fa6a5fa 125Int_t AliFlowTrackSimpleCuts::PassesCuts(TParticle* track) const
929098e4 126{
127 //simple method to check if the simple track passes the simple cuts
8fa6a5fa
MK
128 if(fCutPt) {if (track->Pt() < fPtMin || track->Pt() >= fPtMax ) return 0;}
129 if(fCutEta) {if (track->Eta() < fEtaMin || track->Eta() >= fEtaMax ) return 0;}
130 if(fCutPhi) {if (track->Phi() < fPhiMin || track->Phi() >= fPhiMax ) return 0;}
131 //if(fCutPID) {if (track->GetPdgCode() != fPID) return 0;}
701f71c1 132
133 //getting the charge from a tparticle is expensive
134 //only do it if neccesary
b4dba88d 135 if (fCutCharge)
701f71c1 136 {
137 TParticlePDG* ppdg = track->GetPDG();
daf66719 138 Int_t charge = TMath::Nint(ppdg->Charge()/3.0); //mc particles have charge in units of 1/3e
8fa6a5fa 139 if (charge==fCharge) return 1;
701f71c1 140 }
60875c3c 141
142 if (fCutMass) {
143 TParticlePDG* ppdg = track->GetPDG();
144 if (ppdg->Mass() < fMassMin || ppdg->Mass() >= fMassMax )
8fa6a5fa 145 return 0;
60875c3c 146 }
147
8fa6a5fa 148 return 1;
929098e4 149}