ATLAS Offline Software
TrackParametersIdHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRK_TRACKPARAMETERSIDHELPER_H
6 #define TRK_TRACKPARAMETERSIDHELPER_H
7 
9 
10 #include "CaloGeoHelpers/CaloSampling.h"
12 
13 typedef unsigned int TrackParametersIdentifier;
14 
15 namespace Trk {
16 
19  public:
20  // Avoid cppcheck warnings.
22 
29  bool isEntryToVolume ) const;
30 
33 
35  bool isValid( TrackParametersIdentifier id ) const;
36 
39 
42 
45 
46  private:
48  void setVersion( TrackParametersIdentifier& id ) const;
49 
50  static const unsigned int m_version;
54 
57 
58  };
59 
62  bool isEntryToVolume ) const {
64  // check whether techology matches calo
65  if( tech < AtlasDetDescr::fFirstAtlasCaloTechnology || tech > AtlasDetDescr::fLastAtlasCaloTechnology ){
66  m_validField.encode(1,id);
67  }else{
68  m_technologyField.encode(tech,id);
69  unsigned int ientry = isEntryToVolume ? 1 : 0;
70  m_isEntryToLayerField.encode(ientry,id);
72  setVersion(id);
73  }
74  return id;
75  }
76 
78  return !m_validField.decode(id);
79  }
80 
82  return m_isEntryToLayerField.decode(id);
83  }
84 
86  // check if identifier is valid
87  if( !isValid(id) ) { return AtlasDetDescr::fUndefined;}
89  }
90 
92  // check if identifier is valid
93  if( !isValid(id) ) { return CaloSampling::Unknown;}
94  return static_cast<CaloSampling::CaloSample>(m_caloSamplingField.decode(id));
95  }
96 
99  }
100 
103  m_validField.encode(1,id);
104  return id;
105  }
106 
107 }
108 
109 #endif
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
Trk::TrackParametersIdHelper::isValid
bool isValid(TrackParametersIdentifier id) const
returns true if the id is valid
Definition: TrackParametersIdHelper.h:77
AtlasDetDescr::fUndefined
@ fUndefined
Definition: AtlasDetTechnology.h:30
Trk::BitField< unsigned int >
Trk::TrackParametersIdHelper::m_isEntryToLayerField
static const BitField< unsigned int > m_isEntryToLayerField
Definition: TrackParametersIdHelper.h:55
Trk::TrackParametersIdHelper::m_technologyField
static const BitField< unsigned int > m_technologyField
Definition: TrackParametersIdHelper.h:53
BitField.h
Trk::BitField::encode
bool encode(unsigned int value, T &id) const
encode a value into id, return false if the value is out of range
Definition: BitField.h:37
Trk::TrackParametersIdHelper::caloSample
CaloSampling::CaloSample caloSample(TrackParametersIdentifier id) const
CaloSample encoded in id, returns CaloSampling::Unknown if id is not valid
Definition: TrackParametersIdHelper.h:91
Trk::TrackParametersIdHelper::encodeInValidIdentifier
TrackParametersIdentifier encodeInValidIdentifier() const
create invalid identifier
Definition: TrackParametersIdHelper.h:101
AtlasDetDescr::fLastAtlasCaloTechnology
@ fLastAtlasCaloTechnology
Definition: AtlasDetTechnology.h:46
Trk::TrackParametersIdHelper::TrackParametersIdHelper
TrackParametersIdHelper()=default
Trk::TrackParametersIdHelper::isEntryToVolume
bool isEntryToVolume(TrackParametersIdentifier id) const
returns true if the id belongs to the volume entrance
Definition: TrackParametersIdHelper.h:81
AtlasDetTechnology.h
Trk::TrackParametersIdHelper
helper class to encode and decode a TrackParametersIdentifier
Definition: TrackParametersIdHelper.h:18
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
Trk::TrackParametersIdHelper::m_versionField
static const BitField< unsigned int > m_versionField
Definition: TrackParametersIdHelper.h:52
Trk::TrackParametersIdHelper::m_caloSamplingField
static const BitField< unsigned int > m_caloSamplingField
Definition: TrackParametersIdHelper.h:56
AtlasDetDescr::AtlasDetTechnology
AtlasDetTechnology
Definition: AtlasDetTechnology.h:28
TrackParametersIdentifier
unsigned int TrackParametersIdentifier
Definition: TrackParametersIdHelper.h:13
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
Trk::BitField::decode
unsigned int decode(T id) const
returns the result of decode the input id
Definition: BitField.h:51
Trk::TrackParametersIdHelper::technology
AtlasDetDescr::AtlasDetTechnology technology(TrackParametersIdentifier id) const
AtlasDetTechnology encoded in id, returns AtlasDetDescr::fUndefined if id is not valid.
Definition: TrackParametersIdHelper.h:85
Trk::TrackParametersIdHelper::m_validField
static const BitField< unsigned int > m_validField
Definition: TrackParametersIdHelper.h:51
Trk::TrackParametersIdHelper::m_version
static const unsigned int m_version
Definition: TrackParametersIdHelper.h:50
Trk::TrackParametersIdHelper::setVersion
void setVersion(TrackParametersIdentifier &id) const
set version bits
Definition: TrackParametersIdHelper.h:97
Trk::TrackParametersIdHelper::encode
TrackParametersIdentifier encode(AtlasDetDescr::AtlasDetTechnology, CaloSampling::CaloSample, bool isEntryToVolume) const
Encodes a TrackParametersIdentifier from AtlasDetDescr::AtlasDetTechnology and CaloSampling::CaloSamp...
Definition: TrackParametersIdHelper.h:60