Merge branch 'master', remote branch 'origin' into TPCdev
[u/mrichter/AliRoot.git] / ANALYSIS / AliKineTrackCuts.cxx
CommitLineData
81ae6b8d 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#include <TObject.h>
17#include <TMath.h>
18#include <TParticle.h>
19
20#include "AliKineTrackCuts.h"
21
22//
23// Class for simple Kinematic cuts on
24// particles (tracks) from Kinematic stack (TParticle)
25// MC Simulation
26//
27
28
29//____________________________________________________________________
30ClassImp(AliKineTrackCuts)
31
32//____________________________________________________________________
33AliKineTrackCuts::AliKineTrackCuts(const Char_t* name, const Char_t* title) :
34 AliAnalysisCuts(name,title),
1294c7eb 35 fOnlyFinalParticles(kFALSE),
36 fOnlyPrimary(kFALSE),
81ae6b8d 37 fPMin(0),
38 fPMax(0),
39 fPtMin(0),
40 fPtMax(0),
41 fPxMin(0),
42 fPxMax(0),
43 fPyMin(0),
44 fPyMax(0),
45 fPzMin(0),
46 fPzMax(0),
47 fEtaMin(0),
48 fEtaMax(0),
49 fRapMin(0),
50 fRapMax(0)
51{
52 //
53 // constructor
54 //
55 // setting default cuts
56 SetPRange();
57 SetPtRange();
58 SetPxRange();
59 SetPyRange();
60 SetPzRange();
61 SetEtaRange();
62 SetRapRange();
63}
64
65
66
67//____________________________________________________________________
9eeae5d5 68Bool_t AliKineTrackCuts::IsSelected(TObject* obj)
81ae6b8d 69{
70
71 TParticle * part = (TParticle *)obj;
72
1294c7eb 73 // only final particles
74 if( fOnlyFinalParticles && part->GetStatusCode() !=1 ) return kFALSE;
75 if( fOnlyPrimary && part->IsPrimary() !=1 ) return kFALSE;
76
81ae6b8d 77 // getting the kinematic variables of the track
78 Float_t momentum = part->P();
79 Float_t pt = part->Pt();
80 Float_t energy = part->Energy();
81
82 //y-eta related calculations
83 Float_t eta = part->Eta();
84 Float_t y = -100.;
85 if((energy != TMath::Abs(part->Pz()))&&(momentum != 0))
86 y = 0.5*TMath::Log((energy + part->Pz())/(energy - part->Pz()));
87
88 if((momentum < fPMin) || (momentum > fPMax)) return kFALSE;
89 if((pt < fPtMin) || (pt > fPtMax)) return kFALSE;
90 if((part->Px() < fPxMin) || (part->Px() > fPxMax)) return kFALSE;
91 if((part->Py() < fPyMin) || (part->Py() > fPyMax)) return kFALSE;
92 if((part->Pz() < fPzMin) || (part->Pz() > fPzMax)) return kFALSE;
93 if((eta < fEtaMin) || (eta > fEtaMax)) return kFALSE;
94 if((y < fRapMin) || (y > fRapMax)) return kFALSE;
95
96 return kTRUE;
97}
98
99
100
101
102
103
104
105
106