Belle II Software  release-08-01-10
CDCHit.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 #include <framework/logging/Logger.h>
12 #include <cdc/dataobjects/WireID.h>
13 #include <framework/dataobjects/DigitBase.h>
14 
15 namespace Belle2 {
40  class CDCHit : public DigitBase {
41  public:
43  CDCHit() :
45  {
46  B2DEBUG(29, "Empty CDCHit Constructor called.");
47  }
48 
64  CDCHit(unsigned short tdcCount, unsigned short adcCount,
65  unsigned short iSuperLayer, unsigned short iLayer, unsigned short iWire, unsigned short status = 0, unsigned short tot = 0,
66  signed short otherHitIndex = -1, unsigned short leadingEdgeADC = 0);
67 
69  CDCHit(unsigned short tdcCount, unsigned short adcCount, const WireID& wireID, unsigned short status = 0, unsigned short tot = 0,
70  signed short otherHitIndex = -1, unsigned short leadingEdgeADC = 0)
71  {
72  setTDCCount(tdcCount);
73  setADCCount(adcCount);
74  setWireID(wireID);
75  setStatus(status);
76  setTOT(tot);
77  setOtherHitIndex(otherHitIndex);
78  setADCCountAtLeadingEdge(leadingEdgeADC);
79  }
80 
90  void setWireID(unsigned short iSuperLayer, unsigned short iLayer, unsigned short iWire)
91  {
92  B2DEBUG(29, "setWireId called with" << iSuperLayer << ", " << iLayer << ", " << iWire);
93  m_eWire = WireID(iSuperLayer, iLayer, iWire).getEWire();
94  }
95 
97  void setWireID(const WireID& wireID)
98  {
99  m_eWire = wireID.getEWire();
100  }
101 
106  void setStatus(unsigned short status)
107  {
108  B2DEBUG(29, "setStatus called with " << status);
109  m_status = status;
110  }
111 
114  {
115  m_status |= 0x01;
116  }
117 
120  {
121  m_status |= 0x02;
122  }
123 
128  void setTDCCount(short tdcCount)
129  {
130  B2DEBUG(29, "setTDCCount called with " << tdcCount);
131  m_tdcCount = tdcCount;
132  }
133 
135  void setADCCount(unsigned short adcCount)
136  {
137  m_adcCount = adcCount;
138  }
139 
141  void setOtherHitIndex(signed short index)
142  {
143  m_otherHitIndex = index;
144  }
145 
147  void setOtherHitIndices(CDCHit* otherHit)
148  {
149  m_otherHitIndex = otherHit->getArrayIndex();
150  otherHit->setOtherHitIndex(this->getArrayIndex());
151  }
152 
154  void setADCCountAtLeadingEdge(unsigned short adcCount)
155  {
156  m_adcCountAtLeadingEdge = adcCount;
157  }
158 
160  void setTOT(unsigned short tot)
161  {
162  m_tot = tot;
163  }
164 
166  unsigned short getIWire() const
167  {
168  return WireID(m_eWire).getIWire();
169  }
170 
172  unsigned short getILayer() const
173  {
174  return WireID(m_eWire).getILayer();
175  }
176 
178  unsigned short getICLayer() const
179  {
180  return WireID(m_eWire).getICLayer();
181  }
182 
184  unsigned short getISuperLayer() const
185  {
186  return WireID(m_eWire).getISuperLayer();
187  }
188 
193  unsigned short getID() const
194  {
195  return m_eWire;
196  }
197 
199  unsigned short getStatus() const
200  {
201  return m_status;
202  }
203 
205  bool is2ndHit() const
206  {
207  bool tOrf = (m_status & 0x01) ? true : false;
208  return tOrf;
209  }
210 
212  bool isAlreadyChecked() const
213  {
214  bool tOrf = (m_status & 0x02) ? true : false;
215  return tOrf;
216  }
217 
219  short getTDCCount() const
220  {
221  return m_tdcCount;
222  }
223 
230  unsigned short getADCCount() const
231  {
232  return m_adcCount;
233  }
234 
236  signed short getOtherHitIndex() const
237  {
238  return m_otherHitIndex;
239  }
240 
242  unsigned short getADCCountAtLeadingEdge() const
243  {
245  }
246 
248  unsigned short getTOT() const
249  {
250  return m_tot;
251  }
252 
258  unsigned int getUniqueChannelID() const override {return static_cast<unsigned int>(m_eWire);}
259 
266  DigitBase::EAppendStatus addBGDigit(const DigitBase* bg) override;
267 
268 
269  protected:
270 
276  unsigned short m_eWire;
277 
279  unsigned short m_tdcCount;
280 
282  unsigned short m_adcCount;
283 
285  unsigned short m_status;
286 
288  unsigned short m_tot;
289 
291  signed short m_otherHitIndex;
292 
294  unsigned short m_adcCountAtLeadingEdge;
295 
296  private:
299  };
301 } // end namespace Belle2
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
void setADCCountAtLeadingEdge(unsigned short adcCount)
Setter for ADCcount at leading edge.
Definition: CDCHit.h:154
void setTDCCount(short tdcCount)
Setter for TDC count.
Definition: CDCHit.h:128
unsigned short m_status
Status of CDCHit.
Definition: CDCHit.h:285
DigitBase::EAppendStatus addBGDigit(const DigitBase *bg) override
Implementation of the base class function.
Definition: CDCHit.cc:32
void set2ndHitFlag()
Setter for 2nd hit flag.
Definition: CDCHit.h:113
ClassDefOverride(CDCHit, 8)
ROOT Macro.
bool isAlreadyChecked() const
Getter for already-checked flag.
Definition: CDCHit.h:212
unsigned short m_tdcCount
TDC count in ns.
Definition: CDCHit.h:279
bool is2ndHit() const
Getter for 2nd hit flag.
Definition: CDCHit.h:205
unsigned short m_eWire
Wire encoding.
Definition: CDCHit.h:276
void setAlreadyCheckedFlag()
Setter for already-checked flag.
Definition: CDCHit.h:119
void setWireID(const WireID &wireID)
Setter for Wire ID using the WireID object directly.
Definition: CDCHit.h:97
unsigned short m_adcCountAtLeadingEdge
ADC count at leading edge.
Definition: CDCHit.h:294
signed short getOtherHitIndex() const
Getter for otherHitIndex.
Definition: CDCHit.h:236
CDCHit()
Empty constructor for ROOT IO.
Definition: CDCHit.h:43
unsigned short getICLayer() const
Getter for iCLayer (0-55).
Definition: CDCHit.h:178
void setOtherHitIndex(signed short index)
Setter for the other hit index.
Definition: CDCHit.h:141
unsigned short m_adcCount
ADC count of the integrated charge in the cell.
Definition: CDCHit.h:282
unsigned short getIWire() const
Getter for iWire.
Definition: CDCHit.h:166
CDCHit(unsigned short tdcCount, unsigned short adcCount, const WireID &wireID, unsigned short status=0, unsigned short tot=0, signed short otherHitIndex=-1, unsigned short leadingEdgeADC=0)
Constructor using the WireID object.
Definition: CDCHit.h:69
short getTDCCount() const
Getter for TDC count.
Definition: CDCHit.h:219
unsigned int getUniqueChannelID() const override
Implementation of the base class function.
Definition: CDCHit.h:258
void setTOT(unsigned short tot)
Setter for TOT.
Definition: CDCHit.h:160
unsigned short getID() const
Getter for encoded wire number.
Definition: CDCHit.h:193
unsigned short getStatus() const
Getter for CDCHit status.
Definition: CDCHit.h:199
void setADCCount(unsigned short adcCount)
Setter for ADC count.
Definition: CDCHit.h:135
unsigned short getADCCountAtLeadingEdge() const
Getter for adcCountAtLeadingEdge.
Definition: CDCHit.h:242
signed short m_otherHitIndex
Index to the other hit.
Definition: CDCHit.h:291
unsigned short getADCCount() const
Getter for integrated charge.
Definition: CDCHit.h:230
unsigned short getISuperLayer() const
Getter for iSuperLayer.
Definition: CDCHit.h:184
unsigned short getTOT() const
Getter for TOT.
Definition: CDCHit.h:248
unsigned short getILayer() const
Getter for iLayer.
Definition: CDCHit.h:172
void setOtherHitIndices(CDCHit *otherHit)
Setter for the other hit indices.
Definition: CDCHit.h:147
void setWireID(unsigned short iSuperLayer, unsigned short iLayer, unsigned short iWire)
Setter for Wire ID.
Definition: CDCHit.h:90
unsigned short m_tot
Time over threshod.
Definition: CDCHit.h:288
void setStatus(unsigned short status)
Setter for CDCHit status.
Definition: CDCHit.h:106
A common base for subdetector Digits.
Definition: DigitBase.h:26
EAppendStatus
Enum for return state of addBGDigit function.
Definition: DigitBase.h:32
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
Class to identify a wire inside the CDC.
Definition: WireID.h:34
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:24
unsigned short getIWire() const
Getter for wire within the layer.
Definition: WireID.h:145
unsigned short getEWire() const
Getter for encoded wire number.
Definition: WireID.h:154
unsigned short getISuperLayer() const
Getter for Super-Layer.
Definition: WireID.h:130
unsigned short getILayer() const
Getter for layer within the Super-Layer.
Definition: WireID.h:136
Abstract base class for different kinds of events.