AliPhysics  58f3d52 (58f3d52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalAODFilterBitCuts.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, 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  **************************************************************************/
16 #include "AliAODTrack.h"
17 
21 
22 namespace PWG{
23 
24 namespace EMCAL{
25 
26 AliEmcalAODFilterBitCuts::AliEmcalAODFilterBitCuts():
27  AliVCuts(),
28  fAODfilterBits(0),
29  fAODstatusBits(0),
30  fSelectionMode(kSelAny)
31 {
32 }
33 
35  AliVCuts(name, title),
36  fAODfilterBits(0),
37  fAODstatusBits(0),
38  fSelectionMode(kSelAny)
39 {
40 }
41 
43  AliAODTrack *testtrack = dynamic_cast<AliAODTrack *>(o);
44  if(!testtrack) return false;
45  Bool_t result(true);
46  if(fAODfilterBits){
47  if(!IsFilterBitsSelected(testtrack)) result = false;
48  }
49  if(fAODstatusBits){
50  if(!IsStatusBitsSelected(testtrack)) result = false;
51  }
52  return result;
53 }
54 
55 Bool_t AliEmcalAODFilterBitCuts::IsFilterBitsSelected(const AliAODTrack *const trk) const {
56  Bool_t result(false);
57  switch(fSelectionMode){
58  case kSelAny: result = ((trk->GetFilterMap() & fAODfilterBits) > 0); break;
59  case kSelAll: result = ((trk->GetFilterMap() & fAODfilterBits) == fAODfilterBits); break;
60  };
61  return result;
62 }
63 
64 Bool_t AliEmcalAODFilterBitCuts::IsStatusBitsSelected(const AliAODTrack *const trk) const {
65  ULong_t trackstatusbits = trk->TestBits(fAODstatusBits);
66  Bool_t result(false);
67  switch(fSelectionMode) {
68  case kSelAny: result = (trackstatusbits > fAODstatusBits); break;
69  case kSelAll: result = (trackstatusbits == fAODstatusBits); break;
70  }
71  return result;
72 }
73 
74 }
75 
76 }
Bool_t IsFilterBitsSelected(const AliAODTrack *const trk) const
Select track according to presence of track filter bits.
const char * title
Definition: MakeQAPdf.C:27
Bool_t IsStatusBitsSelected(const AliAODTrack *const trk) const
Select track according to presence of track status bits.
unsigned long ULong_t
Definition: External.C:38
SelectionMode_t fSelectionMode
Mode of the filter bit selection (any or all)
Implementation of the AOD filter bit selection as virtual cut class.
bool Bool_t
Definition: External.C:53
ULong_t fAODstatusBits
Requested track status bits.
ULong_t fAODfilterBits
Requested filter bits.
All (all bits must be found in the AOD track)