Belle II Software development
Layer.cc
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 wire layer.
11//-----------------------------------------------------------------------------
12
13#define TRG_SHORT_NAMES
14#define TRGCDC_SHORT_NAMES
15
16#include <iostream>
17#include "trg/cdc/Cell.h"
18#include "trg/cdc/Layer.h"
19
20using namespace std;
21
22namespace Belle2 {
30 9999,
31 9999,
32 9999,
33 9999,
34 0,
35 0,
36 9999,
37 9999,
38 0,
39 0);
40
42 unsigned superLayerId,
43 unsigned localLayerId,
44 unsigned axialStereoLayerId,
45 unsigned axialStereoSuperLayerId,
46 float offset,
47 int nShifts,
48 float cellSize,
49 unsigned nCells,
50 float innerRadius,
51 float outerRadius)
52 : _name("unknown"),
53 _id(id),
54 _superLayerId(superLayerId),
55 _localLayerId(localLayerId),
56 _axialStereoLayerId(axialStereoLayerId),
57 _axialStereoSuperLayerId(axialStereoSuperLayerId),
58 _offset(offset),
59 _nShifts(nShifts),
60 _cellSize(cellSize),
61 _nCells(nCells),
62 _innerRadius(innerRadius),
63 _outerRadius(outerRadius)
64 {
65 }
66
68 const TRGCDCCell& w)
69 : _id(id),
70 _superLayerId(w.superLayerId()),
71 _localLayerId(0),
72 _axialStereoLayerId(0),
73 _axialStereoSuperLayerId(0),
74 _offset(w.layer().offset()),
75 _nShifts(w.layer().nShifts()),
76 _cellSize(w.cellSize()),
77 _nCells(w.layer().nCells()),
78 _innerRadius(), // 2019/07/31 by ytlai
79 _outerRadius()
80 {
81 }
82
84 : _id(0),
85 _superLayerId(0),
86 _localLayerId(0),
87 _axialStereoLayerId(0),
88 _axialStereoSuperLayerId(0),
89 _offset(0),
90 _nShifts(0),
91 _cellSize(0),
92 _nCells(0),
93 _innerRadius(0),
94 _outerRadius(0)
95 {
96 }
97
99 {
100 }
101
102 void
103 TRGCDCLayer::dump(const string&, const string& pre) const
104 {
105 cout << pre;
106 cout << "layer " << _id;
107 cout << ", " << stereoType();
108 cout << ", super layer " << _superLayerId;
109 cout << ", local layer " << _localLayerId;
110 if (axial()) cout << ", axial ";
111 else cout << ", stereo ";
112 cout << _axialStereoLayerId;
113 if (axial()) cout << ", axial super ";
114 else cout << ", stereo super ";
116 cout << ", " << _nCells << " wires";
117 cout << endl;
118 // for (int i=0;i<_nCells;++i) wire(i)->dump(pre);
119 }
120
121 const TRGCDCCell&
122 TRGCDCLayer::cell(int id) const
123 {
124 if (_nCells == 0) {
125 cout << "TRGCDCLayer !!! This has no cell member : " << name() << endl;
126 return * dynamic_cast<const TRGCDCCell*>(TRGCDCUndefinedLayer);
127 }
128
129 if (id < 0)
130 while (id < 0)
131 id += _nCells;
132
133 if (id >= (int) _nCells)
134 id %= (int) _nCells;
135
136 return * (* this)[id];
137 }
138
140} // namespace Belle2
141
A class to represent a wire in CDC.
Definition: Cell.h:40
A class to represent a cell layer.
Definition: Layer.h:33
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 unsigned _nCells
# of cells
Definition: Layer.h:143
const unsigned _superLayerId
Super layer ID.
Definition: Layer.h:122
const unsigned _localLayerId
ID in a super layer.
Definition: Layer.h:125
const unsigned _axialStereoSuperLayerId
Super layer ID counting only axial or stereo.
Definition: Layer.h:131
virtual ~TRGCDCLayer()
Destructor.
Definition: Layer.cc:98
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
const TRGCDCLayer * TRGCDCUndefinedLayer
TRGCDCUndefinedLayer declaration.
Definition: Layer.cc:29
const std::string & name(void) const
return name.
Definition: Layer.h:264
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
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
Abstract base class for different kinds of events.
STL namespace.