Belle II Software  release-05-01-25
PXDGatedModeInfo.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: bjoern.spruck@belle2.org *
7  * Created: 11.04.2018 *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <TObject.h>
15 #include <vxd/dataobjects/VxdID.h>
16 #include <framework/logging/Logger.h>
17 
18 namespace Belle2 {
36  class PXDGatedModeInfo : public TObject {
37  public:
38 
40  PXDGatedModeInfo() : m_fullGated(false), m_readoutGated(false) {}
41 
42 
46  void setFullGated(bool b) { m_fullGated = b; }
47 
51  bool isFullGated() const { return m_fullGated; }
52 
56  void setReadoutGated(bool b) { m_readoutGated = b; }
57 
61  bool isReadoutGated() const { return m_readoutGated; }
62 
66  bool isGateOK(VxdID id, int gate) const
67  {
68  if (m_fullGated) {
69  return false;
70  } else {
71  if (m_readoutGated) {
72  if (id.getLayerNumber() == 1) {
73  gate = 192 - 1 - gate;
74  }
75  if (gate < 0 || gate >= 192) {
76  B2ERROR("Invalid Gate");
77  return false;
78  }
79  return !m_gateStatus[gate];
80  } else {
81  return true;
82  }
83  }
84  }
85 
87  bool isVCellOK(VxdID id, int vCellId) const { return isGateOK(id, vCellId / 4); }
88 
90  void setGateGatedL2(int gate, bool gated)
91  {
92  if (gate < 0 || gate >= 192) {
93  B2ERROR("Invalid Gate");
94  } else {
95  m_gateStatus[gate] = gated;
96  }
97  }
98 
99  private:
100  bool m_fullGated;
101  bool m_readoutGated;
103  std::vector <bool>
104  m_gateStatus;
107  ClassDef(PXDGatedModeInfo, 1)
108 
109  }; // class PXDGatedModeInfo
110 
112 } // end namespace Belle2
Belle2::PXDGatedModeInfo::isReadoutGated
bool isReadoutGated() const
Return if data was readout while detector was gated.
Definition: PXDGatedModeInfo.h:70
Belle2::PXDGatedModeInfo
The PXD Gated Info Class.
Definition: PXDGatedModeInfo.h:45
Belle2::PXDGatedModeInfo::m_fullGated
bool m_fullGated
Sensor was in gated mode while triggered.
Definition: PXDGatedModeInfo.h:109
Belle2::PXDGatedModeInfo::setReadoutGated
void setReadoutGated(bool b)
Set flag that we triggered while detector was gated.
Definition: PXDGatedModeInfo.h:65
Belle2::PXDGatedModeInfo::setGateGatedL2
void setGateGatedL2(int gate, bool gated)
set gate status of specific gate
Definition: PXDGatedModeInfo.h:99
Belle2::PXDGatedModeInfo::isFullGated
bool isFullGated() const
Return if data was recorded while detector was gated.
Definition: PXDGatedModeInfo.h:60
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXDGatedModeInfo::isGateOK
bool isGateOK(VxdID id, int gate) const
Return if gate is ok.
Definition: PXDGatedModeInfo.h:75
Belle2::PXDGatedModeInfo::m_gateStatus
std::vector< bool > m_gateStatus
Status of Gates (true=gated), the gates are numbered as (VCellID/4) for Layer 2 (as rolling shutter r...
Definition: PXDGatedModeInfo.h:113
Belle2::PXDGatedModeInfo::setFullGated
void setFullGated(bool b)
Set flag that we triggered while detector was gated.
Definition: PXDGatedModeInfo.h:55
Belle2::PXDGatedModeInfo::m_readoutGated
bool m_readoutGated
Sensor switched to gated mode during readout.
Definition: PXDGatedModeInfo.h:110
Belle2::PXDGatedModeInfo::isVCellOK
bool isVCellOK(VxdID id, int vCellId) const
is the VCELL valid
Definition: PXDGatedModeInfo.h:96
Belle2::PXDGatedModeInfo::PXDGatedModeInfo
PXDGatedModeInfo()
Default constructor for the ROOT IO.
Definition: PXDGatedModeInfo.h:49