ATLAS Offline Software
PixelSimHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***************************************************************************
6  InDetSimData helper for pixels
7  This is based on the G3/RD-event. The digitization packages may permit or
8  require more possibilities
9  ------------------------------
10  ATLAS Collaboration
11  ***************************************************************************/
12 
13 // $Id: PixelSimHelper.h,v 1.2 2003-02-21 09:59:12 schaffer Exp $
14 
15 #ifndef INDETRAWUTILS_PIXELSIMHELPER_H
16 # define INDETRAWUTILS_PIXELSIMHELPER_H
17 
18 //<<<<<< INCLUDES >>>>>>
20 //<<<<<< PUBLIC DEFINES >>>>>>
21 //<<<<<< PUBLIC CONSTANTS >>>>>>
22 //<<<<<< PUBLIC TYPES >>>>>>
23 //<<<<<< PUBLIC VARIABLES >>>>>>
24 //<<<<<< PUBLIC FUNCTIONS >>>>>>
25 //<<<<<< CLASS DECLARATIONS >>>>>>
26 
28 {
29 public:
30  // methods to set characteristics of a new object
31  static void noise(InDetSimData& sdo, bool flag);
32  static void belowThreshold(InDetSimData& sdo, bool flag);
33  static void disabled(InDetSimData& sdo, bool flag);
34  static void badToT(InDetSimData& sdo, bool flag);
35 
36  // methods for clients
37  static bool isNoise(const InDetSimData& sdo);
38  static bool isBelowThreshold(const InDetSimData& sdo);
39  static bool isDisabled(const InDetSimData& sdo);
40  static bool hasBadTOT(const InDetSimData& sdo);
41  static bool isRejected(const InDetSimData& sdo,
42  bool rejectOutOfBunch,
43  bool rejectUnconnected,
44  bool rejectBelowThreshold,
45  bool rejectDisabled,
46  bool rejectLostInReadout,
47  bool rejectNotTrack,
48  bool rejectExtraNoise,
49  bool rejectBadTOT);
50 private:
51  enum
52  {
53  NOISE_SET = 0x1, NOISE_CLEAR = 0xfffffffe,
54  BT_SET = 0x2, BT_CLEAR = 0xfffffffd,
55  DISABLED_SET = 0x4, DISABLED_CLEAR = 0xfffffffb,
56  BADTOT_SET = 0x8, BADTOT_CLEAR = 0xfffffff7
57  };
58 };
59 
60 inline void PixelSimHelper::noise(InDetSimData& sdo, bool flag)
61 {
62  if (flag)
63  {
64  sdo.m_word |= NOISE_SET;
65  }
66  else
67  {
68  sdo.m_word &= NOISE_CLEAR;
69  };
70 }
71 
73 {
74  if (flag)
75  {
76  sdo.m_word |= BT_SET;
77  }
78  else
79  {
80  sdo.m_word &= BT_CLEAR;
81  };
82 }
83 
85 {
86  if (flag)
87  {
88  sdo.m_word |= DISABLED_SET;
89  }
90  else
91  {
92  sdo.m_word &= DISABLED_CLEAR;
93  };
94 }
95 
96 inline void PixelSimHelper::badToT(InDetSimData& sdo, bool flag)
97 {
98 
99  if (flag)
100  {
101  sdo.m_word |= BADTOT_SET;
102  }
103  else
104  {
105  sdo.m_word &= BADTOT_CLEAR;
106  };
107 }
108 
109 inline bool PixelSimHelper::isNoise(const InDetSimData& sdo)
110 {
111  return (sdo.m_word&NOISE_SET) != 0;
112 }
113 
115 {
116  return (sdo.m_word&BT_SET) != 0;
117 }
118 
120 {
121  return (sdo.m_word&DISABLED_SET) != 0;
122 }
123 
125 {
126  return (sdo.m_word&BADTOT_SET) != 0;
127 }
128 
130  bool /*rejectOutOfBunch*/,
131  bool /*rejectUnconnected*/,
132  bool rejectBelowThreshold,
133  bool rejectDisabled,
134  bool /*rejectLostInReadout*/,
135  bool /*rejectNotTrack*/,
136  bool rejectExtraNoise,
137  bool rejectBadTOT)
138 {
139  // rejectOutOfBunch not implemented
140  // rejectUnconnected not implemented
141  if (rejectBelowThreshold && isBelowThreshold(sdo) && !isNoise(sdo))
142  return true; // as in previous PixelDigitTDR_Cnv
143  if (rejectDisabled && isDisabled(sdo)) return true;
144  // rejectLostInReadout not implemented
145  if (rejectBadTOT && hasBadTOT(sdo)) return true;
146  // rejectNotTrack not implemented
147  if (rejectExtraNoise && isNoise(sdo) && isBelowThreshold(sdo))
148  return true;
149  return false;
150 }
151 
152 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>>
153 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
154 
155 #endif // INDETRAWUTILS_PIXELSIMHELPER_H
PixelSimHelper::noise
static void noise(InDetSimData &sdo, bool flag)
Definition: PixelSimHelper.h:60
PixelSimHelper::NOISE_SET
@ NOISE_SET
Definition: PixelSimHelper.h:59
PixelSimHelper::disabled
static void disabled(InDetSimData &sdo, bool flag)
Definition: PixelSimHelper.h:84
PixelSimHelper::isNoise
static bool isNoise(const InDetSimData &sdo)
Definition: PixelSimHelper.h:109
PixelSimHelper::BT_SET
@ BT_SET
Definition: PixelSimHelper.h:60
PixelSimHelper::hasBadTOT
static bool hasBadTOT(const InDetSimData &sdo)
Definition: PixelSimHelper.h:124
PixelSimHelper::NOISE_CLEAR
@ NOISE_CLEAR
Definition: PixelSimHelper.h:59
master.flag
bool flag
Definition: master.py:29
InDetSimData
Definition: InDetSimData.h:42
InDetSimData.h
PixelSimHelper::isBelowThreshold
static bool isBelowThreshold(const InDetSimData &sdo)
Definition: PixelSimHelper.h:114
PixelSimHelper::isRejected
static bool isRejected(const InDetSimData &sdo, bool rejectOutOfBunch, bool rejectUnconnected, bool rejectBelowThreshold, bool rejectDisabled, bool rejectLostInReadout, bool rejectNotTrack, bool rejectExtraNoise, bool rejectBadTOT)
Definition: PixelSimHelper.h:129
PixelSimHelper::BADTOT_CLEAR
@ BADTOT_CLEAR
Definition: PixelSimHelper.h:62
PixelSimHelper::badToT
static void badToT(InDetSimData &sdo, bool flag)
Definition: PixelSimHelper.h:96
PixelSimHelper::DISABLED_SET
@ DISABLED_SET
Definition: PixelSimHelper.h:61
PixelSimHelper
Definition: PixelSimHelper.h:28
InDetSimData::m_word
int m_word
Definition: InDetSimData.h:64
PixelSimHelper::belowThreshold
static void belowThreshold(InDetSimData &sdo, bool flag)
Definition: PixelSimHelper.h:72
PixelSimHelper::isDisabled
static bool isDisabled(const InDetSimData &sdo)
Definition: PixelSimHelper.h:119
PixelSimHelper::DISABLED_CLEAR
@ DISABLED_CLEAR
Definition: PixelSimHelper.h:61
PixelSimHelper::BT_CLEAR
@ BT_CLEAR
Definition: PixelSimHelper.h:60
PixelSimHelper::BADTOT_SET
@ BADTOT_SET
Definition: PixelSimHelper.h:62