BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
FTGeom.h
Go to the documentation of this file.
1#pragma once
2
3#include <tuple>
4#include <vector>
5
6using std::tuple;
7using std::vector;
8
9#include "FTLayer.h"
10#include "FTSuperLayer.h"
11#include "FTWire.h"
12
19
20 const int layerId;
21 const int superLayerId;
22 const int wire_start;
23 const int wire_end;
24};
25
41
42class FTGeom {
43public:
44 static FTGeom* instance();
45 void init();
46
47 FTWire* getVirtualWire() { return m_virtualWire; }
48 FTWire* getWire( const int wire_id ) { return m_wires[wire_id]; }
49 FTLayer* getLayer( const int layer_id ) { return m_layers[layer_id]; }
50 FTSuperLayer* getSuperLayer( const int superLayer_id ) {
51 return m_superLayers[superLayer_id];
52 }
53
54 // ########################################## //
55 // ############# input: wire_id ############# //
56 // ########################################## //
57 // get layer id from wire id
58 inline const int wire2layer( const int wire_id ) {
59 return std::get<1>( m_geom_relationship[wire_id] );
60 }
61
62 // get super layer id from wire id
63 inline const int wire2superLayer( const int wire_id ) {
64 return std::get<2>( m_geom_relationship[wire_id] );
65 }
66
67 // get first wire id in its layer
68 inline const int wire2wireStartLayer( const int wire_id ) {
69 return m_layerGeomInfo[wire2layer( wire_id )].wire_start;
70 }
71
72 // get last wire id in its layer
73 inline const int wire2wireEndLayer( const int wire_id ) {
74 return m_layerGeomInfo[wire2layer( wire_id )].wire_end;
75 }
76
77 // get index in its layer
78 inline const int wire2wireIndexLayer( const int wire_id ) {
79 return wire_id - wire2wireStartLayer( wire_id );
80 }
81
82 // get first wire id in its super layer
83 inline const int wire2wireStartSuperLayer( const int wire_id ) {
84 return m_superLayerGeomInfo[wire2superLayer( wire_id )].wire_start;
85 }
86
87 // get last wire id in its super layer
88 inline const int wire2wireEndSuperLayer( const int wire_id ) {
89 return m_superLayerGeomInfo[wire2superLayer( wire_id )].wire_end;
90 }
91
92 // ########################################### //
93 // ############# input: layer_id ############# //
94 // ########################################### //
95 // get layer id from super layer id
96 inline const int layer2superLayer( const int layer_id ) {
97 return m_layerGeomInfo[layer_id].superLayerId;
98 }
99
100 // get first wire id in layer
101 inline const int layer2wireStart( const int layer_id ) {
102 return m_layerGeomInfo[layer_id].wire_start;
103 }
104
105 // get last wire id in layer
106 inline const int layer2wireEnd( const int layer_id ) {
107 return m_layerGeomInfo[layer_id].wire_end;
108 }
109
110 // get first layer id in its super layer
111 inline const int layer2layerStart( const int layer_id ) {
112 return m_superLayerGeomInfo[layer2superLayer( layer_id )].layer_start;
113 }
114
115 // get index in its super layer
116 inline const int layer2layerIndex( const int layer_id ) {
117 return layer_id - layer2layerStart( layer_id );
118 }
119
120 // get number of wires in layer
121 inline const int layer2nWires( const int layer_id ) {
122 return m_layerGeomInfo[layer_id].wire_end - m_layerGeomInfo[layer_id].wire_start + 1;
123 }
124
125 // ########################################## //
126 // ########## input: superLayer_id ########## //
127 // ########################################## //
128
129 // get first layer id in super layer
130 inline const int superLayer2layerStart( const int superLayer_id ) {
131 return m_superLayerGeomInfo[superLayer_id].layer_start;
132 }
133
134 // get last layer id in super layer
135 inline const int superLayer2layerEnd( const int superLayer_id ) {
136 return m_superLayerGeomInfo[superLayer_id].layer_end;
137 }
138
139 // get first wire id in super layer
140 inline const int superLayer2wireStart( const int superLayer_id ) {
141 return m_superLayerGeomInfo[superLayer_id].wire_start;
142 }
143
144 // get last wire id in super layer
145 inline const int superLayer2wireEnd( const int superLayer_id ) {
146 return m_superLayerGeomInfo[superLayer_id].wire_end;
147 }
148
149 // get number of layers in super layer
150 inline const int superLayer2nLayers( const int superLayer_id ) {
151 return m_superLayerGeomInfo[superLayer_id].layer_end -
152 m_superLayerGeomInfo[superLayer_id].layer_start + 1;
153 }
154
155 // get number of wires in super layer
156 inline const int superLayer2nWires( const int superLayer_id ) {
157 return m_superLayerGeomInfo[superLayer_id].wire_end -
158 m_superLayerGeomInfo[superLayer_id].wire_start + 1;
159 }
160
161private:
162 FTGeom();
163 ~FTGeom() {
164 for ( auto w : m_wires ) delete w;
165 for ( auto l : m_layers ) delete l;
166 for ( auto s : m_superLayers ) delete s;
167 delete m_virtualWire;
168 }
169
170 // wire, layer, superlayer containers
171 FTWire* m_virtualWire;
172 FTList<FTWire*> m_wires;
173 FTList<FTLayer*> m_layers;
174 FTList<FTSuperLayer*> m_superLayers;
175
176 // geometry information
177 FTList<tuple<int, int, int>> m_geom_relationship; // [wireId, layerId, superLayerId]
178 FTList<FTLayerGeomInfo> m_layerGeomInfo;
179 FTList<FTSuperLayerGeomInfo> m_superLayerGeomInfo;
180};
double w
XmlRpcServer s
static FTGeom * instance()
Definition FTGeom.cxx:162
const int layer2layerIndex(const int layer_id)
Definition FTGeom.h:116
const int layer2layerStart(const int layer_id)
Definition FTGeom.h:111
const int layer2wireEnd(const int layer_id)
Definition FTGeom.h:106
const int superLayer2nWires(const int superLayer_id)
Definition FTGeom.h:156
const int layer2superLayer(const int layer_id)
Definition FTGeom.h:96
const int superLayer2wireStart(const int superLayer_id)
Definition FTGeom.h:140
FTWire * getWire(const int wire_id)
Definition FTGeom.h:48
const int wire2wireStartLayer(const int wire_id)
Definition FTGeom.h:68
const int superLayer2nLayers(const int superLayer_id)
Definition FTGeom.h:150
const int layer2wireStart(const int layer_id)
Definition FTGeom.h:101
FTLayer * getLayer(const int layer_id)
Definition FTGeom.h:49
const int wire2wireEndSuperLayer(const int wire_id)
Definition FTGeom.h:88
FTWire * getVirtualWire()
Definition FTGeom.h:47
const int wire2wireStartSuperLayer(const int wire_id)
Definition FTGeom.h:83
const int superLayer2layerStart(const int superLayer_id)
Definition FTGeom.h:130
const int wire2superLayer(const int wire_id)
Definition FTGeom.h:63
const int wire2wireEndLayer(const int wire_id)
Definition FTGeom.h:73
FTSuperLayer * getSuperLayer(const int superLayer_id)
Definition FTGeom.h:50
const int superLayer2wireEnd(const int superLayer_id)
Definition FTGeom.h:145
const int wire2wireIndexLayer(const int wire_id)
Definition FTGeom.h:78
const int layer2nWires(const int layer_id)
Definition FTGeom.h:121
const int wire2layer(const int wire_id)
Definition FTGeom.h:58
const int superLayer2layerEnd(const int superLayer_id)
Definition FTGeom.h:135
void init()
Definition FTGeom.cxx:147
const int layerId
Definition FTGeom.h:20
const int wire_start
Definition FTGeom.h:22
const int wire_end
Definition FTGeom.h:23
FTLayerGeomInfo(int layerId, int superLayerId, int wire_start, int wire_end)
Definition FTGeom.h:14
const int superLayerId
Definition FTGeom.h:21
const int layer_start
Definition FTGeom.h:36
const int layer_end
Definition FTGeom.h:37
const int wire_start
Definition FTGeom.h:38
const int superLayerId
Definition FTGeom.h:35
FTSuperLayerGeomInfo(int superLayerId, int layer_start, int layer_end, int wire_start, int wire_end)
Definition FTGeom.h:27
const int wire_end
Definition FTGeom.h:39