ATLAS Offline Software
IsolationCorrectionHelper.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAODPRIMITIVES_ISOLATIONCORRECTIONHELPER_H
8 #define XAODPRIMITIVES_ISOLATIONCORRECTIONHELPER_H
9 
10 #include <bitset>
11 #include <vector>
12 
13 namespace xAOD {
14 
15  namespace Iso {
16 
19  public:
21  static void decode( const IsolationCaloCorrectionBitset& bitset, std::vector<IsolationCaloCorrection>& results ) {
22  results.clear();
23  for( int i=0;i<static_cast<int>(IsolationCaloCorrection::numIsolationCaloCorrections);++i ){
24  if( bitset.test(i) ) results.push_back( static_cast<IsolationCaloCorrection>(i) );
25  }
26  }
27 
29  static void encode( const std::vector<IsolationCaloCorrection>& values, IsolationCaloCorrectionBitset& bitset ) {
30  bitset.reset();
31  for( auto value : values ){
32  bitset.set(static_cast<int>(value));
33  }
34  }
35  };
36 
37 
38 
39 
42  public:
44  static void decode( const IsolationTrackCorrectionBitset& bitset, std::vector<IsolationTrackCorrection>& results ) {
45  results.clear();
46  for( int i=0;i<static_cast<int>(IsolationTrackCorrection::numIsolationTrackCorrections);++i ){
47  if( bitset.test(i) ) results.push_back( static_cast<IsolationTrackCorrection>(i) );
48  }
49  }
50 
52  static void encode( const std::vector<IsolationTrackCorrection>& values, IsolationTrackCorrectionBitset& bitset ) {
53  bitset.reset();
54  for( auto value : values ){
55  bitset.set(static_cast<int>(value));
56  }
57  }
58  };
59 
60  }
61 }
62 
63 #endif
verify_menu_config.results
results
Definition: verify_menu_config.py:67
xAOD::Iso::IsolationCaloCorrectionBitset
std::bitset< 32 > IsolationCaloCorrectionBitset
typedef of the bit word used to encode the corrections used to calculate the isolation
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:114
xAOD::Iso::IsolationCaloCorrectionBitsetHelper
helper to encode and decode the isolation corrections
Definition: IsolationCorrectionHelper.h:18
athena.value
value
Definition: athena.py:124
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::Iso::numIsolationTrackCorrections
@ numIsolationTrackCorrections
unknown
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:75
xAOD::Iso::numIsolationCaloCorrections
@ numIsolationCaloCorrections
unknown
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:41
CP::Iso
@ Iso
Definition: MuonEfficiencyType.h:16
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::Iso::IsolationTrackCorrectionBitsetHelper::decode
static void decode(const IsolationTrackCorrectionBitset &bitset, std::vector< IsolationTrackCorrection > &results)
decode the bitset into the individual corrections
Definition: IsolationCorrectionHelper.h:44
xAOD::Iso::IsolationTrackCorrection
IsolationTrackCorrection
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:61
xAOD::Iso::IsolationCaloCorrection
IsolationCaloCorrection
Enumeration for different ways of correcting isolation in xAOD files.
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:18
xAOD::Iso::IsolationCaloCorrectionBitsetHelper::encode
static void encode(const std::vector< IsolationCaloCorrection > &values, IsolationCaloCorrectionBitset &bitset)
encode the bitset given a vector of corrections
Definition: IsolationCorrectionHelper.h:29
xAOD::Iso::IsolationTrackCorrectionBitsetHelper
helper to encode and decode the isolation corrections
Definition: IsolationCorrectionHelper.h:41
xAOD::Iso::IsolationTrackCorrectionBitset
std::bitset< 32 > IsolationTrackCorrectionBitset
Definition: Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:115
xAOD::Iso::IsolationTrackCorrectionBitsetHelper::encode
static void encode(const std::vector< IsolationTrackCorrection > &values, IsolationTrackCorrectionBitset &bitset)
encode the bitset given a vector of corrections
Definition: IsolationCorrectionHelper.h:52
xAOD::Iso::IsolationCaloCorrectionBitsetHelper::decode
static void decode(const IsolationCaloCorrectionBitset &bitset, std::vector< IsolationCaloCorrection > &results)
decode the bitset into the individual corrections
Definition: IsolationCorrectionHelper.h:21