Belle II Software  release-06-01-15
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 
20 using namespace std;
21 
22 namespace Belle2 {
30  9999,
31  9999,
32  9999,
33  9999,
34  0,
35  0,
36  9999,
37  9999,
38  0,
39  0);
40 
41  TRGCDCLayer::TRGCDCLayer(unsigned id,
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  {
85  }
86 
87  void
88  TRGCDCLayer::dump(const string&, const string& pre) const
89  {
90  cout << pre;
91  cout << "layer " << _id;
92  cout << ", " << stereoType();
93  cout << ", super layer " << _superLayerId;
94  cout << ", local layer " << _localLayerId;
95  if (axial()) cout << ", axial ";
96  else cout << ", stereo ";
97  cout << _axialStereoLayerId;
98  if (axial()) cout << ", axial super ";
99  else cout << ", stereo super ";
100  cout << _axialStereoSuperLayerId;
101  cout << ", " << _nCells << " wires";
102  cout << endl;
103  // for (int i=0;i<_nCells;++i) wire(i)->dump(pre);
104  }
105 
106  const TRGCDCCell&
107  TRGCDCLayer::cell(int id) const
108  {
109  if (_nCells == 0) {
110  cout << "TRGCDCLayer !!! This has no cell member : " << name() << endl;
111  return * dynamic_cast<const TRGCDCCell*>(TRGCDCUndefinedLayer);
112  }
113 
114  if (id < 0)
115  while (id < 0)
116  id += _nCells;
117 
118  if (id >= (int) _nCells)
119  id %= (int) _nCells;
120 
121  return * (* this)[id];
122  }
123 
125 } // namespace Belle2
126 
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:116
const unsigned _axialStereoLayerId
ID in whole CDC counting only axial or stereo.
Definition: Layer.h:125
const unsigned _nCells
# of cells
Definition: Layer.h:140
const unsigned _superLayerId
Super layer ID.
Definition: Layer.h:119
const unsigned _localLayerId
ID in a super layer.
Definition: Layer.h:122
const unsigned _axialStereoSuperLayerId
Super layer ID counting only axial or stereo.
Definition: Layer.h:128
virtual ~TRGCDCLayer()
Destructor.
Definition: Layer.cc:83
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
const TRGCDCLayer * TRGCDCUndefinedLayer
TRGCDCUndefinedLayer declaration.
Definition: Layer.cc:29
const std::string & name(void) const
return name.
Definition: Layer.h:261
const std::string stereoType(void) const
returns "A" or "U" or "V" depending on stereo type.
Definition: Layer.h:235
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
Abstract base class for different kinds of events.