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