]>
Commit | Line | Data |
---|---|---|
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 | |
33 | ClassImp(AliFlowTrackSimpleCuts) | |
34 | ||
35 | //----------------------------------------------------------------------- | |
cc0afcfc | 36 | AliFlowTrackSimpleCuts::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), |
50 | fCharge(0) | |
d29ba078 | 51 | { |
52 | //constructor | |
d29ba078 | 53 | } |
54 | ||
b4dba88d | 55 | ////----------------------------------------------------------------------- |
56 | //AliFlowTrackSimpleCuts::AliFlowTrackSimpleCuts(const AliFlowTrackSimpleCuts& someCuts): | |
57 | // TNamed(), | |
58 | // fCutPt(someCuts.fCutPt), | |
59 | // fPtMax(someCuts.fPtMax), | |
60 | // fPtMin(someCuts.fPtMin), | |
61 | // fCutEta(someCuts.fCutEta), | |
62 | // fEtaMax(someCuts.fEtaMax), | |
63 | // fEtaMin(someCuts.fEtaMin), | |
64 | // fCutPhi(someCuts.fCutPhi), | |
65 | // fPhiMax(someCuts.fPhiMax), | |
66 | // fPhiMin(someCuts.fPhiMin), | |
67 | // fCutPID(someCuts.fCutPID), | |
68 | // fPID(someCuts.fPID), | |
69 | // fCutCharge(someCuts.fCutCharge), | |
70 | // fCharge(someCuts.fCharge) | |
71 | //{ | |
72 | // //copy constructor | |
73 | //} | |
74 | // | |
75 | ////----------------------------------------------------------------------- | |
76 | //AliFlowTrackSimpleCuts& AliFlowTrackSimpleCuts::operator=(const AliFlowTrackSimpleCuts& someCuts) | |
77 | //{ | |
78 | // TNamed::operator=(someCuts); | |
79 | // fCutPt = someCuts.fCutPt; | |
80 | // fPtMax = someCuts.fPtMax; | |
81 | // fPtMin = someCuts.fPtMin; | |
82 | // fCutEta = someCuts.fCutEta; | |
83 | // fEtaMax = someCuts.fEtaMax; | |
84 | // fEtaMin = someCuts.fEtaMin; | |
85 | // fCutPhi = someCuts.fCutPhi; | |
86 | // fPhiMax = someCuts.fPhiMax; | |
87 | // fPhiMin = someCuts.fPhiMin; | |
88 | // fCutPID = someCuts.fCutPID; | |
89 | // fPID = someCuts.fPID; | |
90 | // fCutCharge = someCuts.fCutCharge; | |
91 | // fCharge = someCuts.fCharge; | |
92 | // | |
93 | // return *this; | |
94 | //} | |
e1911c19 | 95 | |
daf66719 | 96 | //----------------------------------------------------------------------- |
c1a55153 | 97 | Bool_t AliFlowTrackSimpleCuts::IsSelected(TObject* obj, Int_t) |
daf66719 | 98 | { |
99 | //check cuts | |
100 | TParticle* p = dynamic_cast<TParticle*>(obj); | |
101 | if (p) return PassesCuts(p); | |
102 | AliFlowTrackSimple* ts = dynamic_cast<AliFlowTrackSimple*>(obj); | |
103 | if (ts) return PassesCuts(ts); | |
104 | return kFALSE; //default when passed a wrong type of object | |
105 | } | |
106 | ||
e1911c19 | 107 | //----------------------------------------------------------------------- |
929098e4 | 108 | Bool_t AliFlowTrackSimpleCuts::PassesCuts(const AliFlowTrackSimple *track) const |
e1911c19 | 109 | { |
110 | //simple method to check if the simple track passes the simple cuts | |
ded1d842 | 111 | if(fCutPt) {if (track->Pt() < fPtMin || track->Pt() >= fPtMax ) return kFALSE;} |
112 | if(fCutEta) {if (track->Eta() < fEtaMin || track->Eta() >= fEtaMax ) return kFALSE;} | |
113 | if(fCutPhi) {if (track->Phi() < fPhiMin || track->Phi() >= fPhiMax ) return kFALSE;} | |
ded1d842 | 114 | if(fCutCharge) {if (track->Charge() != fCharge) return kFALSE;} |
daf66719 | 115 | //if(fCutPID) {if (track->PID() != fPID) return kFALSE;} |
b4dba88d | 116 | return kTRUE; |
e1911c19 | 117 | } |
929098e4 | 118 | |
119 | //----------------------------------------------------------------------- | |
701f71c1 | 120 | Bool_t AliFlowTrackSimpleCuts::PassesCuts(TParticle* track) const |
929098e4 | 121 | { |
122 | //simple method to check if the simple track passes the simple cuts | |
ded1d842 | 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(fCutPID) {if (track->GetPdgCode() != fPID) return kFALSE;} | |
701f71c1 | 127 | |
128 | //getting the charge from a tparticle is expensive | |
129 | //only do it if neccesary | |
b4dba88d | 130 | if (fCutCharge) |
701f71c1 | 131 | { |
132 | TParticlePDG* ppdg = track->GetPDG(); | |
daf66719 | 133 | Int_t charge = TMath::Nint(ppdg->Charge()/3.0); //mc particles have charge in units of 1/3e |
b4dba88d | 134 | return (charge==fCharge); |
701f71c1 | 135 | } |
b4dba88d | 136 | return kTRUE; |
929098e4 | 137 | } |