Belle II Software  release-08-01-10
ISuperLayer.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
11 
12 #include <tracking/trackFindingCDC/utilities/FunctorTag.h>
13 
14 #include <climits>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22 
24  using ISuperLayer = signed short;
25 
27  struct GetISuperLayer {
29  operator FunctorTag();
30 
32  template<class T, class SFINAE = decltype(&T::getISuperLayer)>
33  ISuperLayer operator()(const T& t) const
34  {
35  return t.getISuperLayer();
36  }
37 
39  template < class T, class SFINAE = decltype(std::declval<T>()->getISuperLayer()) >
40  auto operator()(const T& t) const -> decltype(t->getISuperLayer())
41  {
42  return t->getISuperLayer();
43  }
44  };
45 
50  struct ISuperLayerUtil {
51 
53  ISuperLayerUtil() = delete;
54 
56  static const ISuperLayer c_N = 9;
57 
59  static const ISuperLayer c_InnerVolume = -1;
60 
62  static const ISuperLayer c_OuterVolume = 9;
63 
65  static const ISuperLayer c_Invalid = SHRT_MIN;
66 
68  static bool isInvalid(ISuperLayer iSuperLayer);
69 
71  static bool isInCDC(ISuperLayer iSuperLayer);
72 
74  static bool isLogical(ISuperLayer iSuperLayer);
75 
77  static bool isInnerVolume(ISuperLayer iSuperLayer);
78 
80  static bool isOuterVolume(ISuperLayer iSuperLayer);
81 
83  static bool isAxial(ISuperLayer iSuperLayer);
84 
86  static EStereoKind getStereoKind(ISuperLayer iSuperLayer);
87 
92  static ISuperLayer getNextInwards(ISuperLayer iSuperLayer);
93 
98  static ISuperLayer getNextOutwards(ISuperLayer iSuperLayer);
99 
101  template<class T>
102  static ISuperLayer getFrom(const T& t)
103  {
104  return GetISuperLayer()(t);
105  }
106  };
107  }
109 }
Abstract base class for different kinds of events.
Tag class to facilitate marking of class as a functor in the sense of this code.
Definition: FunctorTag.h:20
Generic functor to get the superlayer id from an object.
Definition: ISuperLayer.h:27
ISuperLayer operator()(const T &t) const
Returns the superlayer of an object.
Definition: ISuperLayer.h:33
This is a utility class for the free ISuperLayer type.
Definition: ISuperLayer.h:50
static const ISuperLayer c_Invalid
Constant making an invalid superlayer id.
Definition: ISuperLayer.h:65
static bool isAxial(ISuperLayer iSuperLayer)
Returns if the super layer with the given id is axial.
Definition: ISuperLayer.cc:21
static const ISuperLayer c_N
Constant representing the total number of cdc superlayers.
Definition: ISuperLayer.h:56
static ISuperLayer getNextInwards(ISuperLayer iSuperLayer)
Returns the super layer that is inside of the given super layer.
Definition: ISuperLayer.cc:63
static bool isInvalid(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...
Definition: ISuperLayer.cc:38
static const ISuperLayer c_InnerVolume
Constant marking the subdetectors closer to the IP than the CDC.
Definition: ISuperLayer.h:59
ISuperLayerUtil()=delete
Utility classes should not be instantiated.
static bool isLogical(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a logical superlayer - includes the logic ids for inner ...
Definition: ISuperLayer.cc:48
static bool isInnerVolume(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to the logical superlayer of the column inside the CDC.
Definition: ISuperLayer.cc:53
static ISuperLayer getNextOutwards(ISuperLayer iSuperLayer)
Returns the super layer that is outside of the given super layer.
Definition: ISuperLayer.cc:72
static bool isInCDC(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...
Definition: ISuperLayer.cc:43
static const ISuperLayer c_OuterVolume
Constant marking the subdetectors further away from the IP than the CDC.
Definition: ISuperLayer.h:62
static EStereoKind getStereoKind(ISuperLayer iSuperLayer)
Returns the stereo kind of the super layer.
Definition: ISuperLayer.cc:26
static ISuperLayer getFrom(const T &t)
Returns the superlayer of an object.
Definition: ISuperLayer.h:102
static bool isOuterVolume(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to the logical superlayer of the volumn outside the CDC.
Definition: ISuperLayer.cc:58