Belle II Software  release-05-02-19
Layer.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : Layer.cc
5 // Section : Tracking CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a wire layer.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #define TRG_SHORT_NAMES
15 #define TRGCDC_SHORT_NAMES
16 
17 #include <iostream>
18 #include "trg/cdc/Cell.h"
19 #include "trg/cdc/Layer.h"
20 
21 using namespace std;
22 
23 namespace Belle2 {
29  const TRGCDCLayer* TRGCDCUndefinedLayer = new TRGCDCLayer(9999,
31  9999,
32  9999,
33  9999,
34  9999,
35  0,
36  0,
37  9999,
38  9999,
39  0,
40  0);
41 
42  TRGCDCLayer::TRGCDCLayer(unsigned id,
43  unsigned superLayerId,
44  unsigned localLayerId,
45  unsigned axialStereoLayerId,
46  unsigned axialStereoSuperLayerId,
47  float offset,
48  int nShifts,
49  float cellSize,
50  unsigned nCells,
51  float innerRadius,
52  float outerRadius)
53  : _name("unknown"),
54  _id(id),
55  _superLayerId(superLayerId),
56  _localLayerId(localLayerId),
57  _axialStereoLayerId(axialStereoLayerId),
58  _axialStereoSuperLayerId(axialStereoSuperLayerId),
59  _offset(offset),
60  _nShifts(nShifts),
61  _cellSize(cellSize),
62  _nCells(nCells),
63  _innerRadius(innerRadius),
64  _outerRadius(outerRadius)
65  {
66  }
67 
69  const TRGCDCCell& w)
70  : _id(id),
71  _superLayerId(w.superLayerId()),
72  _localLayerId(0),
73  _axialStereoLayerId(0),
74  _axialStereoSuperLayerId(0),
75  _offset(w.layer().offset()),
76  _nShifts(w.layer().nShifts()),
77  _cellSize(w.cellSize()),
78  _nCells(w.layer().nCells()),
79  _innerRadius(), // 2019/07/31 by ytlai
80  _outerRadius()
81  {
82  }
83 
85  {
86  }
87 
88  void
89  TRGCDCLayer::dump(const string&, const string& pre) const
90  {
91  cout << pre;
92  cout << "layer " << _id;
93  cout << ", " << stereoType();
94  cout << ", super layer " << _superLayerId;
95  cout << ", local layer " << _localLayerId;
96  if (axial()) cout << ", axial ";
97  else cout << ", stereo ";
98  cout << _axialStereoLayerId;
99  if (axial()) cout << ", axial super ";
100  else cout << ", stereo super ";
101  cout << _axialStereoSuperLayerId;
102  cout << ", " << _nCells << " wires";
103  cout << endl;
104  // for (int i=0;i<_nCells;++i) wire(i)->dump(pre);
105  }
106 
107  const TRGCDCCell&
108  TRGCDCLayer::cell(int id) const
109  {
110  if (_nCells == 0) {
111  cout << "TRGCDCLayer !!! This has no cell member : " << name() << endl;
112  return * (TRGCDCCell*)(TRGCDCUndefinedLayer);
113  }
114 
115  if (id < 0)
116  while (id < 0)
117  id += _nCells;
118 
119  if (id >= (int) _nCells)
120  id %= (int) _nCells;
121 
122  return * (* this)[id];
123  }
124 
126 } // namespace Belle2
127 
Belle2::TRGCDCLayer::dump
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: Layer.cc:89
Belle2::TRGCDCLayer::_axialStereoLayerId
const unsigned _axialStereoLayerId
ID in whole CDC counting only axial or stereo.
Definition: Layer.h:126
Belle2::TRGCDCLayer::cell
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:108
Belle2::TRGCDCLayer::_nCells
const unsigned _nCells
# of cells
Definition: Layer.h:141
Belle2::TRGCDCLayer::_localLayerId
const unsigned _localLayerId
ID in a super layer.
Definition: Layer.h:123
Belle2::TRGCDCLayer::name
const std::string & name(void) const
return name.
Definition: Layer.h:262
Belle2::TRGCDCLayer::_superLayerId
const unsigned _superLayerId
Super layer ID.
Definition: Layer.h:120
Belle2::TRGCDCCell
A class to represent a wire in CDC.
Definition: Cell.h:41
Belle2::TRGCDCLayer::axial
bool axial(void) const
returns true if this is an axial layer.
Definition: Layer.h:199
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCLayer::id
unsigned id(void) const
returns id.
Definition: Layer.h:157
Belle2::TRGCDCLayer::~TRGCDCLayer
virtual ~TRGCDCLayer()
Destructor.
Definition: Layer.cc:84
Belle2::TRGCDCLayer::_axialStereoSuperLayerId
const unsigned _axialStereoSuperLayerId
Super layer ID counting only axial or stereo.
Definition: Layer.h:129
Belle2::TRGCDCLayer::_id
const unsigned _id
ID in whole CDC.
Definition: Layer.h:117
Belle2::TRGCDCUndefinedLayer
const TRGCDCLayer * TRGCDCUndefinedLayer
TRGCDCUndefinedLayer declaration.
Definition: Layer.cc:30
Belle2::TRGCDCLayer::stereoType
const std::string stereoType(void) const
returns "A" or "U" or "V" depending on stereo type.
Definition: Layer.h:236
Belle2::TRGCDCLayer::TRGCDCLayer
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:42