Belle II Software  release-05-02-19
Cell.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : Cell.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a cell (a wire or a track segment) in CDC.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGCDCCell_FLAG_
15 #define TRGCDCCell_FLAG_
16 
17 #include "CLHEP/Geometry/Vector3D.h"
18 #include "CLHEP/Geometry/Point3D.h"
19 #include "trg/trg/Signal.h"
20 #include "trg/cdc/Layer.h"
21 
22 #ifdef TRGCDC_SHORT_NAMES
23 #define TCCell TRGCDCCell
24 #endif
25 
26 namespace Belle2 {
35  typedef HepGeom::Vector3D<double> Vector3D;
36 
37  class TRGCDC;
38  class TRGCDCCellHit;
39 
41  class TRGCDCCell {
42 
43  public:
45  TRGCDCCell(unsigned id,
46  unsigned localId,
47  const TRGCDCLayer& layer,
50 
52  virtual ~TRGCDCCell();
53 
54  public:// Selectors
55 
57  unsigned id(void) const;
58 
60  unsigned localId(void) const;
61 
63  unsigned layerId(void) const;
64 
66  unsigned localLayerId(void) const;
67 
69  unsigned superLayerId(void) const;
70 
72  unsigned axialStereoLayerId(void) const;
73 
75  unsigned axialStereoSuperLayerId(void) const;
76 
78  const TRGCDCLayer& layer(void) const;
79 
81  unsigned state(void) const;
82 
84  bool axial(void) const;
85 
87  bool stereo(void) const;
88 
89 // /// returns a pointer to a neighbor wire. This function is expensive.
90 // virtual const TRGCDCCell * const neighbor(unsigned) const = 0;
91 
93  int localIdDifference(const TRGCDCCell&) const;
94 
96  virtual std::string name(void) const = 0;
97 
99  virtual void dump(const std::string& message = std::string(""),
100  const std::string& prefix = std::string("")) const;
101 
103  virtual const TRGSignal& signal(void) const = 0;
104 
105  public:// Geometry
106 
108  const HepGeom::Point3D<double>& forwardPosition(void) const;
109 
111  const HepGeom::Point3D<double>& backwardPosition(void) const;
113  double* backwardPosition(double p[3]) const;
114 
116  const HepGeom::Point3D<double>& xyPosition(void) const;
118  double* xyPosition(double p[3]) const;
119 
121  const Vector3D& direction(void) const;
122 
124 // void wirePosition(float zPosition,
125 // HepGeom::Point3D<double> & xyPosition,
126 // HepGeom::Point3D<double> & backwardPosition,
127 // Vector3D & direction) const;
128 
130  float cellSize(void) const;
131 
132  public:// Utility functions
133 
135  virtual bool hasMember(const std::string& a) const;
136 
137  public:// event by event information.
138 
140  const TRGCDCCellHit* hit(void) const;
141 
142  public:// Obsolete functions from Belle
143 
145  bool innerPart(void) const;
146 
148  bool mainPart(void) const;
149 
150  public:// Modifiers
151 
153  unsigned state(unsigned newState);
154 
156  virtual void clear(void);
157 
159  const TRGCDCCellHit* hit(const TRGCDCCellHit*);
160 
161  private:
162 
164  const unsigned _id;
165 
167  const unsigned _localId;
168 
171 
174 
177 
180 
183 
185  unsigned _state;
186 
189 
191  friend class TRGCDC;
192  };
193 
194 //-----------------------------------------------------------------------------
195 
196  inline
197  unsigned
198  TRGCDCCell::id(void) const
199  {
200  return _id;
201  }
202 
203  inline
204  unsigned
206  {
207  return _localId;
208  }
209 
210  inline
211  unsigned
213  {
214  return _layer.id();
215  }
216 
217  inline
218  unsigned
220  {
221  return _layer.superLayerId();
222  }
223 
224  inline
225  unsigned
227  {
228  return _layer.localLayerId();
229  }
230 
231  inline
232  const TRGCDCLayer&
233  TRGCDCCell::layer(void) const
234  {
235  return _layer;
236  }
237 
238  inline
239  unsigned
240  TRGCDCCell::state(void) const
241  {
242  return _state;
243  }
244 
245  inline
246  unsigned
247  TRGCDCCell::state(unsigned a)
248  {
249  return _state = a;
250  }
251 
252  inline
253  bool
254  TRGCDCCell::axial(void) const
255  {
256  return _layer.axial();
257  }
258 
259  inline
260  bool
261  TRGCDCCell::stereo(void) const
262  {
263  return _layer.stereo();
264  }
265 
266  inline
267  unsigned
269  {
270  return _layer.axialStereoLayerId();
271  }
272 
273  inline
274  unsigned
276  {
278  }
279 
280  inline
281  bool
283  {
284  std::cout << "TRGCDCCell::innerPart ... position not defined" << std::endl;
285  if (layerId() < 14) return true;
286  return false;
287  }
288 
289  inline
290  bool
292  {
293  std::cout << "TRGCDCCell::mainPart ... position not defined" << std::endl;
294  if (layerId() > 13) return true;
295  return false;
296  }
297 
298  inline
299  float
301  {
302  return _layer.cellSize();
303  }
304 
305  inline
306  void
308  {
309  _state = 0;
310  _hit = 0;
311  }
312 
313  inline
316  {
317  return _forwardPosition;
318  }
319 
320  inline
323  {
324  return _backwardPosition;
325  }
326 
327  inline
328  double*
329  TRGCDCCell::backwardPosition(double p[3]) const
330  {
331  p[0] = _backwardPosition.x();
332  p[1] = _backwardPosition.y();
333  p[2] = _backwardPosition.z();
334  return p;
335  }
336 
337  inline
340  {
341  return _xyPosition;
342  }
343 
344  inline
345  double*
346  TRGCDCCell::xyPosition(double a[3]) const
347  {
348  a[0] = _xyPosition.x();
349  a[1] = _xyPosition.y();
350  a[2] = 0.;
351  return a;
352  }
353 
354  inline
355  const Vector3D&
357  {
358  return _direction;
359  }
360 
361  inline
362  const TRGCDCCellHit*
363  TRGCDCCell::hit(void) const
364  {
365  return _hit;
366  }
367 
368  inline
369  const TRGCDCCellHit*
371  {
372  return _hit = a;
373  }
374 
375  inline
376  bool
377  TRGCDCCell::hasMember(const std::string& a) const
378  {
379  return name() == a;
380  }
381 
383 } // namespace Belle2
384 
385 #endif /* TRGCDCCell_FLAG_ */
386 
Belle2::TRGCDCCell::backwardPosition
const HepGeom::Point3D< double > & backwardPosition(void) const
returns position in backward endplate.
Definition: Cell.h:322
Belle2::TRGCDCCell::localId
unsigned localId(void) const
returns local id in a layer.
Definition: Cell.h:205
Belle2::TRGSignal
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:28
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::TRGCDCCell::dump
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: Cell.cc:53
Belle2::TRGCDCCell::layer
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:233
Belle2::TRGCDCCell::state
unsigned state(void) const
returns state.
Definition: Cell.h:240
Belle2::TRGCDCCell::hit
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:363
Belle2::TRGCDCCell::_state
unsigned _state
Status in this event.
Definition: Cell.h:185
Belle2::TRGCDCCell::axialStereoSuperLayerId
unsigned axialStereoSuperLayerId(void) const
returns id of axial or stereo super layer id.
Definition: Cell.h:275
Belle2::TRGCDCCell::_xyPosition
const HepGeom::Point3D< double > _xyPosition
Wire center(?) position.
Definition: Cell.h:173
Belle2::TRGCDCCell::~TRGCDCCell
virtual ~TRGCDCCell()
Destructor.
Definition: Cell.cc:48
Belle2::TRGCDCCell::signal
virtual const TRGSignal & signal(void) const =0
returns trigger output. Null will returned if no signal.
Belle2::TRGCDCCell::localLayerId
unsigned localLayerId(void) const
returns local layer id in a super layer.
Definition: Cell.h:226
Belle2::TRGCDCCell::mainPart
bool mainPart(void) const
returns true if this wire is in the main part.
Definition: Cell.h:291
Belle2::TRGCDCLayer
A class to represent a cell layer.
Definition: Layer.h:34
Belle2::TRGCDCCell::localIdDifference
int localIdDifference(const TRGCDCCell &) const
returns local id difference.
Definition: Cell.cc:70
Belle2::TRGCDCCell::_hit
const TRGCDCCellHit * _hit
Cell hit.
Definition: Cell.h:188
Belle2::TRGCDCCell
A class to represent a wire in CDC.
Definition: Cell.h:41
Belle2::TRGCDCCellHit
A class to represent a wire hit in CDC.
Definition: CellHit.h:75
Belle2::TRGCDCCell::forwardPosition
const HepGeom::Point3D< double > & forwardPosition(void) const
returns position in forward endplate.
Definition: Cell.h:315
Belle2::TRGCDCCell::hasMember
virtual bool hasMember(const std::string &a) const
returns true this has member named a.
Definition: Cell.h:377
Belle2::TRGCDCCell::_id
const unsigned _id
ID.
Definition: Cell.h:164
Belle2::TRGCDCCell::_localId
const unsigned _localId
Local ID.
Definition: Cell.h:167
Belle2::TRGCDCCell::axial
bool axial(void) const
returns true if this wire is in an axial layer.
Definition: Cell.h:254
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCCell::name
virtual std::string name(void) const =0
returns name.
Belle2::TRGCDCCell::cellSize
float cellSize(void) const
calculates position and direction vector with sag correction.
Definition: Cell.h:300
Belle2::TRGCDCCell::superLayerId
unsigned superLayerId(void) const
returns super layer id.
Definition: Cell.h:219
Belle2::TRGCDCCell::axialStereoLayerId
unsigned axialStereoLayerId(void) const
returns id of axial or stereo layer id.
Definition: Cell.h:268
Belle2::TRGCDCCell::_forwardPosition
const HepGeom::Point3D< double > _forwardPosition
Wire forward position.
Definition: Cell.h:176
Belle2::TRGCDCCell::id
unsigned id(void) const
returns id.
Definition: Cell.h:198
Belle2::TRGCDC
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:70
Belle2::TRGCDCCell::stereo
bool stereo(void) const
returns true if this wire is in a stereo layer.
Definition: Cell.h:261
Belle2::TRGCDCCell::_backwardPosition
const HepGeom::Point3D< double > _backwardPosition
Wire backward position.
Definition: Cell.h:179
Belle2::TRGCDCCell::xyPosition
const HepGeom::Point3D< double > & xyPosition(void) const
returns middle position of a wire. z componet is 0.
Definition: Cell.h:339
Belle2::TRGCDCCell::direction
const Vector3D & direction(void) const
returns direction vector of the wire.
Definition: Cell.h:356
Belle2::TRGCDCCell::clear
virtual void clear(void)
clears information.
Definition: Cell.h:307
HepGeom::Point3D< double >
Belle2::TRGCDCCell::layerId
unsigned layerId(void) const
returns layer id.
Definition: Cell.h:212
Belle2::TRGCDCCell::_direction
const Vector3D _direction
Direction vector.
Definition: Cell.h:182
Belle2::TRGCDCCell::_layer
const TRGCDCLayer & _layer
Layer.
Definition: Cell.h:170
Belle2::Point3D
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:33
Belle2::TRGCDCCell::TRGCDCCell
TRGCDCCell(unsigned id, unsigned localId, const TRGCDCLayer &layer, const HepGeom::Point3D< double > &forwardPosition, const HepGeom::Point3D< double > &backwardPosition)
Constructor.
Definition: Cell.cc:31
Belle2::TRGCDCCell::innerPart
bool innerPart(void) const
returns true if this wire is in the inner part.
Definition: Cell.h:282