Update handling of different inputs
[u/mrichter/AliRoot.git] / HLT / JET / AliHLTJETTrackCuts.cxx
CommitLineData
0734d112 1//-*- Mode: C++ -*-
2// $Id: AliHLTJETTrackCuts.cxx $
3/**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
6 * *
7 * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 * for The ALICE HLT Project. *
9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19/** @file AliHLTJETTrackCuts.h
20 @author Jochen Thaeder
21 @date
22 @brief Cuts for jet input tracks
23*/
24
25// see header file for class documentation
26// or
27// refer to README to build package
28// or
29// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30
31#if __GNUC__ >= 3
32using namespace std;
33#endif
34
35#include "AliHLTJETTrackCuts.h"
c180f65d 36#include <TDatabasePDG.h>
0734d112 37
38/** ROOT macro for the implementation of ROOT specific class methods */
39ClassImp(AliHLTJETTrackCuts)
40
41/*
42 * ---------------------------------------------------------------------------------
43 * Constructor / Destructor
44 * ---------------------------------------------------------------------------------
45 */
46
47// #################################################################################
48AliHLTJETTrackCuts::AliHLTJETTrackCuts(const Char_t* name, const Char_t* title )
49 :
50 AliAnalysisCuts(name, title),
6ce099ba 51 fChargedOnly(kFALSE),
52 fPtMin(0.0),
53 fEtaMin(-0.9),
54 fEtaMax(0.9),
55 fPhiMin(0.0),
56 fPhiMax(6.3) {
0734d112 57 // see header file for class documentation
58 // or
59 // refer to README to build package
60 // or
61 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
62
63}
64
65// #################################################################################
66AliHLTJETTrackCuts::~AliHLTJETTrackCuts() {
67 // see header file for class documentation
68
69}
70
71/*
72 * ---------------------------------------------------------------------------------
73 * Selection
74 * ---------------------------------------------------------------------------------
75 */
76
77// #################################################################################
9eeae5d5 78Bool_t AliHLTJETTrackCuts::IsSelected( TObject *obj ) {
0734d112 79 // see header file for class documentation
80
81 Bool_t bResult = kTRUE;
1f9fec4a 82
0734d112 83 if ( ! strcmp(obj->ClassName(),"TParticle") )
84 bResult = IsSelected( dynamic_cast<TParticle*> (obj));
85 else if ( ! strcmp(obj->ClassName(),"AliESDtrack") )
86 bResult = IsSelected( dynamic_cast<AliESDtrack*> (obj));
87 else {
88 HLTError("Unknown object type %s", obj->ClassName() );
89 bResult = kFALSE;
90 }
91
92 HLTError("Unknown object dd type %s", obj->ClassName() );
93
94 return bResult;
95}
96
97// #################################################################################
98Bool_t AliHLTJETTrackCuts::IsSelected( TParticle *particle ) {
99 // see header file for class documentation
100
6ce099ba 101 // ----------------------------------
102 // Applied before in AliHLTMCEvent:
103 // - Is Physical Primary
104 // stack->IsPhysicalPrimary(iter)
105 // - final state
106 // particle->GetNDaughters() == 0
107 // ----------------------------------
108
0734d112 109 Bool_t bResult = kTRUE;
110
111 Int_t status = particle->GetStatusCode();
6ce099ba 112 Int_t pdgCode = TMath::Abs( particle->GetPdgCode() );
0734d112 113
114 // -- Skip non-final state particles (status != 1), neutrinos (12,14,16)
6ce099ba 115 if ( (status != 1) || (pdgCode == 12 || pdgCode == 14 || pdgCode == 16) )
116 bResult = kFALSE;
117
118 // -- Charged particles only
438118d4 119 if ( ! particle->GetPDG() )
6ce099ba 120 bResult = kFALSE;
438118d4 121 else {
122 if ( fChargedOnly && !particle->GetPDG()->Charge() )
123 bResult = kFALSE;
124 }
6ce099ba 125
126 // -- cut on min Pt
127 if ( particle->Pt() < fPtMin )
128 bResult = kFALSE;
129
130 // -- cut on eta acceptance
131 if ( ( particle->Eta() < fEtaMin ) || ( particle->Eta() > fEtaMax ) )
132 bResult = kFALSE;
133
134 // -- cut on phi acceptance
135 if ( ( particle->Phi() < fPhiMin ) || ( particle->Phi() > fPhiMax ) )
0734d112 136 bResult = kFALSE;
0734d112 137
138 return bResult;
139}
140
141// #################################################################################
6ce099ba 142Bool_t AliHLTJETTrackCuts::IsSelected( AliESDtrack *esdTrack ) {
0734d112 143 // see header file for class documentation
144
145 Bool_t bResult = kTRUE;
146
6ce099ba 147 // -- cut on min Pt
148 if ( esdTrack->Pt() < fPtMin )
149 bResult = kFALSE;
150
151 // -- cut on eta acceptance
152 if ( ( esdTrack->Eta() < fEtaMin ) || ( esdTrack->Eta() > fEtaMax ) )
153 bResult = kFALSE;
154
6ce099ba 155 // -- cut on phi acceptance
156 if ( ( esdTrack->Phi() < fPhiMin ) || ( esdTrack->Phi() > fPhiMax ) )
157 bResult = kFALSE;
158
0734d112 159 return bResult;
160}