ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MicromegasDefs.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MicromegasDefs.cc
1 
6 #include "MicromegasDefs.h"
7 
8 namespace
9 {
10  //* converninece trait for underlying type
11  template<class T>
12  using underlying_type_t = typename std::underlying_type<T>::type;
13 
14  //* convert an strong type enum to integral type
15  template<class T>
16  constexpr underlying_type_t<T>
17  to_underlying_type(T value) noexcept
18  { return static_cast<underlying_type_t<T>>(value);}
19 
20 }
21 
22 namespace MicromegasDefs
23 {
24 
25  //________________________________________________________________
27  {
29 
30  TrkrDefs::hitsetkey tmp = to_underlying_type(type);
31  key |= (tmp << kBitShiftSegmentation);
32 
33  tmp = tile;
34  key |= (tmp << kBitShiftTileId);
35 
36  return key;
37  }
38 
39  //________________________________________________________________
41  {
42  TrkrDefs::hitsetkey tmp = (key >> kBitShiftSegmentation);
43  return static_cast<SegmentationType>(tmp);
44  }
45 
46  //________________________________________________________________
48  {
49  TrkrDefs::hitsetkey tmp = (key >> kBitShiftTileId);
50  return tmp;
51  }
52 
53  //________________________________________________________________
54  TrkrDefs::hitkey genHitKey(uint16_t strip)
55  {
56  TrkrDefs::hitkey key = strip << kBitShiftStrip;
57  return key;
58  }
59 
60  //________________________________________________________________
61  uint16_t getStrip( TrkrDefs::hitkey key )
62  {
63  TrkrDefs::hitkey tmp = (key >> kBitShiftStrip);
64  return tmp;
65  }
66 
67  //________________________________________________________________
69  {
71  TrkrDefs::cluskey key = (tmp << TrkrDefs::kBitShiftClusId);
72  key |= clusid;
73  return key;
74  }
75 
76  //________________________________________________________________
78  {
79  TrkrDefs::hitsetkey tmp = (key >> TrkrDefs::kBitShiftClusId);
80  return getSegmentationType( tmp );
81  }
82 
83  //________________________________________________________________
85  {
86  TrkrDefs::hitsetkey tmp = (key >> TrkrDefs::kBitShiftClusId);
87  return getTileId( tmp );
88  }
89 
90 }