AliPhysics  88b7ad0 (88b7ad0)
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  **************************************************************************/
15 #include <bitset>
16 #include <iostream>
17 #include "AliAODTrack.h"
19 #include "AliLog.h"
20 
24 
25 namespace PWG{
26 
27 namespace EMCAL{
28 
29 AliEmcalAODFilterBitCuts::AliEmcalAODFilterBitCuts():
30  AliVCuts(),
31  fAODfilterBits(0),
32  fAODstatusBits(0),
33  fSelectionMode(kSelAny)
34 {
35 }
36 
38  AliVCuts(name, title),
39  fAODfilterBits(0),
40  fAODstatusBits(0),
42 {
43 }
44 
46  AliDebugStream(1) << "Filter bit cut: selecting " << std::bitset<sizeof(decltype(fAODfilterBits))*8>(fAODfilterBits) << std::endl;
47  AliAODTrack *testtrack = dynamic_cast<AliAODTrack *>(o);
48  if(!testtrack) return false;
49  Bool_t result(true);
50  if(fAODfilterBits){
51  if(!IsFilterBitsSelected(testtrack)) result = false;
52  }
53  if(fAODstatusBits){
54  if(!IsStatusBitsSelected(testtrack)) result = false;
55  }
56  return result;
57 }
58 
59 Bool_t AliEmcalAODFilterBitCuts::IsFilterBitsSelected(const AliAODTrack *const trk) const {
60  Bool_t result(false);
61  switch(fSelectionMode){
62  case kSelAny: result = ((trk->GetFilterMap() & fAODfilterBits) > 0); break;
63  case kSelAll: result = ((trk->GetFilterMap() & fAODfilterBits) == fAODfilterBits); break;
64  };
65  return result;
66 }
67 
68 Bool_t AliEmcalAODFilterBitCuts::IsStatusBitsSelected(const AliAODTrack *const trk) const {
69  ULong_t trackstatusbits = trk->TestBits(fAODstatusBits);
70  Bool_t result(false);
71  switch(fSelectionMode) {
72  case kSelAny: result = (trackstatusbits > fAODstatusBits); break;
73  case kSelAll: result = (trackstatusbits == fAODstatusBits); break;
74  }
75  return result;
76 }
77 
78 }
79 
80 }
Bool_t IsFilterBitsSelected(const AliAODTrack *const trk) const
Select track according to presence of track filter bits.
const char * title
Definition: MakeQAPdf.C:27
Namespace for EMCAL framework classes and task.
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
Namespace for PWG framework classes.
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)