Belle II Software  release-06-00-14
Layer.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 //-----------------------------------------------------------------------------
10 // Description : A class to represent a cell layer.
11 //-----------------------------------------------------------------------------
12 
13 #ifndef TRGCDCLayer_FLAG_
14 #define TRGCDCLayer_FLAG_
15 
16 #include <string>
17 #include <vector>
18 
19 #ifdef TRGCDC_SHORT_NAMES
20 #define TCLayer TRGCDCLayer
21 #endif
22 
23 namespace Belle2 {
29  class TRGCDC;
30  class TRGCDCCell;
31 
33  class TRGCDCLayer : public std::vector<TRGCDCCell*> {
34 
35  public:
36 
38  TRGCDCLayer(unsigned id,
39  unsigned superLayerId,
40  unsigned localLayerId,
41  unsigned axialStereoLayerId,
42  unsigned axialStereoSuperLayerId,
43  float offset,
44  int nShifts,
45  float cellSize,
46  unsigned nCells,
47  float innerRadius,
48  float outerRadius);
49 
51  TRGCDCLayer(unsigned id, const TRGCDCCell& w);
52 
54  virtual ~TRGCDCLayer();
55 
56  public:// Selectors
57 
59  const std::string& name(void) const;
60 
62  unsigned id(void) const;
63 
65  unsigned superLayerId(void) const;
66 
68  unsigned localLayerId(void) const;
69 
71  unsigned axialStereoLayerId(void) const;
72 
74  unsigned axialStereoSuperLayerId(void) const;
75 
77  unsigned nCells(void) const;
78 
80  const TRGCDCCell& cell(int id) const;
81 
83  bool axial(void) const;
84 
86  bool stereo(void) const;
87 
89  float offset(void) const;
90 
92  int nShifts(void) const;
93 
95  float cellSize(void) const;
96 
98  float innerRadius(void) const;
99 
101  float outerRadius(void) const;
102 
104  void dump(const std::string& message = std::string(""),
105  const std::string& prefix = std::string("")) const;
106 
108  const std::string stereoType(void) const;
109 
110  private:
111 
113  const std::string _name;
114 
116  const unsigned _id;
117 
119  const unsigned _superLayerId;
120 
122  const unsigned _localLayerId;
123 
125  const unsigned _axialStereoLayerId;
126 
128  const unsigned _axialStereoSuperLayerId;
129 
131  const float _offset;
132 
134  const int _nShifts;
135 
137  const float _cellSize;
138 
140  const unsigned _nCells;
141 
144 
147 
149  friend class TRGCDC;
150  };
151 
152 //-----------------------------------------------------------------------------
153 
154  inline
155  unsigned
156  TRGCDCLayer::id(void) const
157  {
158  return _id;
159  }
160 
161  inline
162  unsigned
164  {
165  return _superLayerId;
166  }
167 
168  inline
169  unsigned
171  {
172  return _localLayerId;
173  }
174 
175  inline
176  float
178  {
179  return _offset;
180  }
181 
182  inline
183  int
185  {
186  return _nShifts;
187  }
188 
189  inline
190  unsigned
192  {
193  return _nCells;
194  }
195 
196  inline
197  bool
198  TRGCDCLayer::axial(void) const
199  {
200  if (! _nShifts) return true;
201  return false;
202  }
203 
204  inline
205  bool
207  {
208  if (_nShifts) return true;
209  return false;
210  }
211 
212  inline
213  unsigned
215  {
216  return _axialStereoLayerId;
217  }
218 
219  inline
220  unsigned
222  {
224  }
225 
226  inline
227  float
229  {
230  return _cellSize;
231  }
232 
233  inline
234  const std::string
236  {
237  if (axial())
238  return "A";
239  else if (nShifts() > 0)
240  return "U";
241  else
242  return "V";
243  }
244 
245  inline
246  float
248  {
249  return _innerRadius;
250  }
251 
252  inline
253  float
255  {
256  return _outerRadius;
257  }
258 
259  inline
260  const std::string&
261  TRGCDCLayer::name(void) const
262  {
263  return _name;
264  }
265 
267 } // namespace Belle2
268 
269 #endif /* TRGCDCLayer_FLAG_ */
A class to represent a wire in CDC.
Definition: Cell.h:40
A class to represent a cell layer.
Definition: Layer.h:33
const std::string _name
Layer name.
Definition: Layer.h:113
const unsigned _id
ID in whole CDC.
Definition: Layer.h:116
const unsigned _axialStereoLayerId
ID in whole CDC counting only axial or stereo.
Definition: Layer.h:125
const float _offset
Cell position offset from X axis in cell unit.
Definition: Layer.h:131
const unsigned _nCells
# of cells
Definition: Layer.h:140
const unsigned _superLayerId
Super layer ID.
Definition: Layer.h:119
const int _nShifts
Stereo angle in cell unit.
Definition: Layer.h:134
const unsigned _localLayerId
ID in a super layer.
Definition: Layer.h:122
float _innerRadius
Inner radius.
Definition: Layer.h:143
float _outerRadius
Outer radius.
Definition: Layer.h:146
const unsigned _axialStereoSuperLayerId
Super layer ID counting only axial or stereo.
Definition: Layer.h:128
const float _cellSize
Cell size.
Definition: Layer.h:137
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:69
virtual ~TRGCDCLayer()
Destructor.
Definition: Layer.cc:83
float innerRadius(void) const
sets and returns inner radius.
Definition: Layer.h:247
float cellSize(void) const
returns cell size.
Definition: Layer.h:228
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: Layer.cc:88
TRGCDCLayer(unsigned id, unsigned superLayerId, unsigned localLayerId, unsigned axialStereoLayerId, unsigned axialStereoSuperLayerId, float offset, int nShifts, float cellSize, unsigned nCells, float innerRadius, float outerRadius)
Constructor.
Definition: Layer.cc:41
unsigned id(void) const
returns id.
Definition: Layer.h:156
unsigned localLayerId(void) const
returns local layer id in a super layer.
Definition: Layer.h:170
const std::string & name(void) const
return name.
Definition: Layer.h:261
unsigned superLayerId(void) const
returns super layer id.
Definition: Layer.h:163
const std::string stereoType(void) const
returns "A" or "U" or "V" depending on stereo type.
Definition: Layer.h:235
unsigned axialStereoSuperLayerId(void) const
returns id of axial or stereo super layer id.
Definition: Layer.h:221
bool stereo(void) const
returns true if this is a stereo layer.
Definition: Layer.h:206
float offset(void) const
returns offset.
Definition: Layer.h:177
unsigned axialStereoLayerId(void) const
returns id of axial or stereo id.
Definition: Layer.h:214
int nShifts(void) const
returns shifts. (non-zero for stereo layers)
Definition: Layer.h:184
unsigned nCells(void) const
returns # of cells.
Definition: Layer.h:191
const TRGCDCCell & cell(int id) const
returns a pointer to a cell. 'id' can be negative or 'id' can be greater than 'nCells()'.
Definition: Layer.cc:107
bool axial(void) const
returns true if this is an axial layer.
Definition: Layer.h:198
float outerRadius(void) const
sets and returns outer radius.
Definition: Layer.h:254
Abstract base class for different kinds of events.