Belle II Software  release-08-01-10
BKLMStatus.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 
9 #pragma once
10 
11 namespace Belle2 {
20  class BKLMStatus {
21 
22  public:
23 
28  {
29  }
30 
35  {
36  }
37 
41  static int getMaximalStrip(int module)
42  {
43  return ((module & BKLM_MAXSTRIP_MASK) >> BKLM_MAXSTRIP_BIT) + 1;
44  }
45 
49  static void setMaximalStrip(int& module, int strip)
50  {
51 
52 #ifdef __clang_analyzer__
53  // unused junk assignment purely to calm the nerves of the clang analyzer
54  // (references the two arguments to avoid nattering about unused variables)
55  module = module + (strip - 1);
56 #else
57  // the clang analyzer falsely thinks that this bitwise operation produces garbage
58  module = (module & (~BKLM_MAXSTRIP_MASK)) | ((strip - 1) << BKLM_MAXSTRIP_BIT);
59 #endif
60  }
61 
62  protected:
63 
65  static constexpr int BKLM_MAXSTRIP_BIT = 15;
66 
68  static constexpr int BKLM_MAXSTRIP_MASK = (63 << BKLM_MAXSTRIP_BIT);
69 
70  };
71 
73 }
BKLM hit status.
Definition: BKLMStatus.h:20
static constexpr int BKLM_MAXSTRIP_BIT
Bit position for maxStrip-1 [0..47].
Definition: BKLMStatus.h:65
static int getMaximalStrip(int module)
Get maximal strip number.
Definition: BKLMStatus.h:41
static void setMaximalStrip(int &module, int strip)
Set maximal strip number.
Definition: BKLMStatus.h:49
~BKLMStatus()
Destructor.
Definition: BKLMStatus.h:34
static constexpr int BKLM_MAXSTRIP_MASK
Bit mask for maxStrip-1 [0..47].
Definition: BKLMStatus.h:68
BKLMStatus()
Constructor.
Definition: BKLMStatus.h:27
Abstract base class for different kinds of events.