Belle II Software development
CDCWireSuperLayer.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#pragma once
9
10#include <cdc/topology/CDCWireLayer.h>
11#include <cdc/topology/WireNeighborPair.h>
12#include <cdc/topology/ISuperLayer.h>
13#include <cdc/topology/ILayer.h>
14#include <cdc/topology/IWire.h>
15#include <cdc/topology/WireNeighborKind.h>
16#include <cdc/topology/EStereoKind.h>
17#include <tracking/trackingUtilities/utilities/VectorRange.h>
18#include <tracking/trackingUtilities/utilities/MayBePtr.h>
19
20namespace Belle2 {
25 namespace CDC {
26
44 : public TrackingUtilities::ConstVectorRange<CDCWireLayer> {
45
46 public:
48 using Super = TrackingUtilities::ConstVectorRange<CDCWireLayer>;
49
53
55 explicit CDCWireSuperLayer(const TrackingUtilities::ConstVectorRange<CDCWireLayer>& wireLayers);
56
58 CDCWireSuperLayer(const CDCWireSuperLayer& wireSuperLayer) = delete;
59
61 CDCWireSuperLayer(CDCWireSuperLayer&& wireSuperLayer) = default;
62
64 void operator=(const CDCWireSuperLayer& wireSuperLayer) = delete;
65
66 public:
68 static void initialize();
69
74
77 { return front().getISuperLayer(); }
78
79
84
86 bool isValidILayer(ILayer iLayer) const
87 { return 0 <= iLayer and iLayer < int(size()); }
88
90 const CDCWireLayer& getWireLayer(ILayer iLayer) const
91 {
92 return at(iLayer);
93 }
94
95
100
102 bool isValidIWire(ILayer iLayer, IWire iWire) const
103 { return isValidILayer(iLayer) and getWireLayer(iLayer).isValidIWire(iWire); }
104
106 const CDCWire& getWire(ILayer iLayer, IWire iWire) const
107 { return getWireLayer(iLayer).getWire(iWire); }
108
109
110
115
117 bool isAxial() const
118 { return getStereoKind() == EStereoKind::c_Axial; }
119
128 { return front().getStereoKind(); }
129
131 double getInnerCylindricalR() const
132 { return front().getInnerCylindricalR(); }
133
135 double getOuterCylindricalR() const
136 { return back().getOuterCylindricalR(); }
137
140 { return (getOuterCylindricalR() + getInnerCylindricalR()) / 2.0; }
141
142
144 double getInnerRefZ() const
145 { return m_innerRefZ; }
146
148 double getOuterRefZ() const
149 { return m_outerRefZ; }
150
152 double getRefTanLambda() const
153 { return m_refTanLambda; }
154
155
163
170 IWire iWire,
171 ILayer iOtherLayer,
172 IWire iOtherWire) const;
173
178 TrackingUtilities::MayBePtr<const CDCWire> getPrimaryNeighbor(short oClockDirection,
179 ILayer iLayer,
180 IWire iWire) const
181 {
182 oClockDirection = TrackingUtilities::modulo(oClockDirection, 12);
183 switch (oClockDirection) {
184 case 1:
185 return getNeighborCWOutwards(iLayer, iWire);
186 case 3:
187 return getNeighborCW(iLayer, iWire);
188 case 5:
189 return getNeighborCWInwards(iLayer, iWire);
190 case 7:
191 return getNeighborCCWInwards(iLayer, iWire);
192 case 9:
193 return getNeighborCCW(iLayer, iWire);
194 case 11:
195 return getNeighborCCWOutwards(iLayer, iWire);
196 default:
197 return nullptr;
198 }
199 }
200
203
206
208 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCCWOutwards(ILayer iLayer, IWire iWire) const
209 { return getNeighborsOutwards(iLayer, iWire).first; } // not optimal since a second wire gets fetched additionally
210
212 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCWOutwards(ILayer iLayer, IWire iWire) const
213 { return getNeighborsOutwards(iLayer, iWire).second; } // not optimal since a second wire gets fetched additionally
214
216 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCW(ILayer iLayer, IWire iWire) const
217 { return &(getWireLayer(iLayer).getNeighborCW(iWire)); }
218
220 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCCW(ILayer iLayer, IWire iWire) const
221 { return &(getWireLayer(iLayer).getNeighborCCW(iWire)); }
222
224 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCCWInwards(ILayer iLayer, IWire iWire) const
225 { return getNeighborsInwards(iLayer, iWire).first; } // not optimal since a second wire gets fetched additionally
226
228 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCWInwards(ILayer iLayer, IWire iWire) const
229 { return getNeighborsInwards(iLayer, iWire).second; } // not optimal since a second wire gets fetched additionally
230
231
244 TrackingUtilities::MayBePtr<const CDCWire> getSecondaryNeighbor(short oClockDirection,
245 ILayer iLayer,
246 IWire iWire) const
247 {
248 oClockDirection = TrackingUtilities::modulo(oClockDirection, 12);
249 switch (oClockDirection) {
250 case 0:
251 return getSecondNeighborTwelveOClock(iLayer, iWire);
252 case 1:
253 return getSecondNeighborOneOClock(iLayer, iWire);
254 case 2:
255 return getSecondNeighborTwoOClock(iLayer, iWire);
256 case 3:
257 return getSecondNeighborThreeOClock(iLayer, iWire);
258 case 4:
259 return getSecondNeighborFourOClock(iLayer, iWire);
260 case 5:
261 return getSecondNeighborFiveOClock(iLayer, iWire);
262 case 6:
263 return getSecondNeighborSixOClock(iLayer, iWire);
264 case 7:
265 return getSecondNeighborSevenOClock(iLayer, iWire);
266 case 8:
267 return getSecondNeighborEightOClock(iLayer, iWire);
268 case 9:
269 return getSecondNeighborNineOClock(iLayer, iWire);
270 case 10:
271 return getSecondNeighborTenOClock(iLayer, iWire);
272 case 11:
273 return getSecondNeighborElevenOClock(iLayer, iWire);
274 default:
275 return nullptr;
276 }
277 }
278
280 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborOneOClock(ILayer iLayer, IWire iWire) const
281 { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire - 1)) : nullptr; }
282
283
285 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborTwoOClock(ILayer iLayer, IWire iWire) const
286 { return getNeighborCWOutwards(iLayer, iWire - 1); }
287
289 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborThreeOClock(ILayer iLayer, IWire iWire) const
290 { return getNeighborCW(iLayer, iWire - 1); }
291
293 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborFourOClock(ILayer iLayer, IWire iWire) const
294 { return getNeighborCWInwards(iLayer, iWire - 1); }
295
296
298 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborFiveOClock(ILayer iLayer, IWire iWire) const
299 { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire - 1)) : nullptr; }
300
302 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborSixOClock(ILayer iLayer, IWire iWire) const
303 { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire)) : nullptr; }
304
306 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborSevenOClock(ILayer iLayer, IWire iWire) const
307 { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire + 1)) : nullptr; }
308
309
311 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborEightOClock(ILayer iLayer, IWire iWire) const
312 { return getNeighborCCWInwards(iLayer, iWire + 1); }
313
315 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborNineOClock(ILayer iLayer, IWire iWire) const
316 { return getNeighborCCW(iLayer, iWire + 1); }
317
319 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborTenOClock(ILayer iLayer, IWire iWire) const
320 { return getNeighborCCWOutwards(iLayer, iWire + 1); }
321
322
324 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborElevenOClock(ILayer iLayer, IWire iWire) const
325 { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire + 1)) : nullptr; }
326
328 TrackingUtilities::MayBePtr<const CDCWire> getSecondNeighborTwelveOClock(ILayer iLayer, IWire iWire) const
329 { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire)) : nullptr; }
330
331
332 private:
335
338
341
342 };
343
344 }
346}
Class representing a sense wire layer in the central drift chamber.
const CDCWire & getWire(IWire iWire) const
Gives the wire by its id in the layer.
bool isValidIWire(IWire iWire) const
Checks if the given wire id belongs to a valid wire in this layer.
const CDCWire & getNeighborCCW(IWire iWire) const
Getter for the first counterclockwise neighbor by wire id in the layer.
const CDCWire & getWireWrappedAround(IWire iWire) const
Returns the wire by its id in the layer.
const CDCWire & getNeighborCW(IWire iWire) const
Getter for the first clockwise neighbor by wire id in the layer.
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCCW(ILayer iLayer, IWire iWire) const
Getter for the nearest counterclockwise neighbor by wire id and layer id with in this superlayer.
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCCWInwards(ILayer iLayer, IWire iWire) const
Getter for the nearest clockwise neighbor in the next layer outwards by wire id and layer id with in ...
double m_refTanLambda
Memory for (fitted) proportionality factor between the increasing cylindrical radius and the referenc...
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborSixOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the six o'clock position.
TrackingUtilities::MayBePtr< const CDCWire > getPrimaryNeighbor(short oClockDirection, ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the given o'clock direction.
double getMiddleCylindricalR() const
Getter for the radius in the middle of the layer.
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCCWOutwards(ILayer iLayer, IWire iWire) const
Getter for the nearest clockwise neighbor in the next layer outwards by wire id and layer id with in ...
static void initialize()
Initializes the superlayer variables of according the layer range. Set the numbering shift of contain...
ISuperLayer getISuperLayer() const
Getter for the super layer id.
double m_outerRefZ
Memory for the (fitted) z of the reference wire reference points at the outer cylindricalR of this su...
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborElevenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the elven o'clock position.
bool isAxial() const
Indicates if the wire is axial or stereo.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborThreeOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the three o'clock position.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborFourOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the four o'clock position.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborTwelveOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the twelve o'clock position.
double m_innerRefZ
Memory for the (fitted) z of the reference wire reference points at the inner cylindricalR of this su...
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCW(ILayer iLayer, IWire iWire) const
Getter for the nearest clockwise neighbor by wire id and layer id with in this superlayer.
CDCWireSuperLayer(CDCWireSuperLayer &&wireSuperLayer)=default
Allow move construction of wire super layers for use in std::vector.
double getInnerCylindricalR() const
Getter for the inner radius of the layer as retrieved from the CDCGeometryPar by the inner most layer...
WireNeighborPair getNeighborsOutwards(ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the layer outwards of the given on.
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCWInwards(ILayer iLayer, IWire iWire) const
Getter for the nearest clockwise neighbor in the next layer outwards by wire id and layer id with in ...
void operator=(const CDCWireSuperLayer &wireSuperLayer)=delete
Disallow copy assignment of wire super layers.
double getOuterRefZ() const
Getter for the (fitted) z of the reference wire reference points at the outer cylindricalR of this su...
bool isValidIWire(ILayer iLayer, IWire iWire) const
Checks if the given wire id belongs to a valid wire in this superlayer.
TrackingUtilities::MayBePtr< const CDCWire > getSecondaryNeighbor(short oClockDirection, ILayer iLayer, IWire iWire) const
getSecondaryNeighbor Secondary neighborhood The secondary neighbors are numbered like positions on th...
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborOneOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the one o'clock position.
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCWOutwards(ILayer iLayer, IWire iWire) const
Getter for the nearest clockwise neighbor in the next layer outwards by wire id and layer id with in ...
CDCWireSuperLayer(const CDCWireSuperLayer &wireSuperLayer)=delete
Disallow copy construction of wire super layers.
CDCWireSuperLayer()
Empty constructor for creating an empty dummy CDCWireSuperLayer for studies with a CDC with missing s...
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborTenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the ten o'clock position.
bool isValidILayer(ILayer iLayer) const
Checks if the given layer id belongs to a valid layer in this superlayer.
const CDCWireLayer & getWireLayer(ILayer iLayer) const
Gives the layer by its layer id within the superlayer.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborSevenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the seven o'clock position.
double getRefTanLambda() const
Getter for (fitted) proportionality factor between the increasing cylindrical radius and the referenc...
WireNeighborKind getNeighborKind(ILayer iLayer, IWire iWire, ILayer iOtherLayer, IWire iOtherWire) const
Checks if two wires are closest neighbors.
EStereoKind getStereoKind() const
Getter for the stereo type of the wire layer Gives the stereo type of the wire.
double getOuterCylindricalR() const
Getter for the outer radius of the layer as retrieved from the CDCGeometryPar by the outer most layer...
TrackingUtilities::ConstVectorRange< CDCWireLayer > Super
Type of the base class.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborEightOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the eight o'clock position.
double getInnerRefZ() const
Getter for the (fitted) z of the reference wire reference points at the inner cylindricalR of this su...
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborNineOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the nine o'clock position.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborFiveOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the five o'clock position.
const CDCWire & getWire(ILayer iLayer, IWire iWire) const
Gives the wire by its layer id within the superlayer and the wire id in the layer.
TrackingUtilities::MayBePtr< const CDCWire > getSecondNeighborTwoOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the two o'clock position.
WireNeighborPair getNeighborsInwards(ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the layer inwards of the given on.
Class representing a sense wire in the central drift chamber.
Definition CDCWire.h:50
Type for the neighbor relationship from one wire to another.
Class representing a pair of neighbors in the CDC in a single layer For certain circumstances it is a...
Reference back() const
Returns the dereferenced iterator before end()
Definition Range.h:84
Reference front() const
Returns the dereferenced iterator at begin()
Definition Range.h:80
std::size_t size() const
Returns the total number of objects in this range.
Definition Range.h:76
Reference at(std::size_t i) const
Returns the object at index i.
Definition Range.h:92
signed short IWire
The type of the wire ids enumerating wires within a given layer.
Definition IWire.h:20
signed short ILayer
The type of the layer ids enumerating layers within a superlayer.
Definition ILayer.h:18
EStereoKind
Type for the stereo property of the wire.
Definition EStereoKind.h:20
@ c_Axial
Constant for an axial wire.
Definition EStereoKind.h:22
signed short ISuperLayer
The type of the layer and superlayer ids.
Definition ISuperLayer.h:24
Abstract base class for different kinds of events.