Belle II Software  release-06-01-15
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 <tracking/trackFindingCDC/topology/CDCWireLayer.h>
11 #include <tracking/trackFindingCDC/topology/WireNeighborPair.h>
12 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
13 #include <tracking/trackFindingCDC/topology/ILayer.h>
14 #include <tracking/trackFindingCDC/topology/IWire.h>
15 #include <tracking/trackFindingCDC/topology/WireNeighborKind.h>
16 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
17 #include <tracking/trackFindingCDC/utilities/VectorRange.h>
18 #include <tracking/trackFindingCDC/utilities/MayBePtr.h>
19 
20 namespace Belle2 {
25  namespace TrackFindingCDC {
26 
44  : public ConstVectorRange<CDCWireLayer> {
45 
46  public:
49 
51  explicit CDCWireSuperLayer(const ConstVectorRange<CDCWireLayer>& wireLayers);
52 
54  CDCWireSuperLayer(const CDCWireSuperLayer& wireSuperLayer) = delete;
55 
57  CDCWireSuperLayer(CDCWireSuperLayer&& wireSuperLayer) = default;
58 
60  void operator=(const CDCWireSuperLayer& wireSuperLayer) = delete;
61 
62  public:
64  void initialize();
65 
72  ISuperLayer getISuperLayer() const
73  { return front().getISuperLayer(); }
82  bool isValidILayer(ILayer iLayer) const
83  { return 0 <= iLayer and iLayer < int(size()); }
84 
86  const CDCWireLayer& getWireLayer(ILayer iLayer) const
87  {
88  // cppcheck-suppress returnTempReference
89  return at(iLayer);
90  }
99  bool isValidIWire(ILayer iLayer, IWire iWire) const
100  { return isValidILayer(iLayer) and getWireLayer(iLayer).isValidIWire(iWire); }
101 
103  const CDCWire& getWire(ILayer iLayer, IWire iWire) const
104  { return getWireLayer(iLayer).getWire(iWire); }
114  bool isAxial() const
115  { return getStereoKind() == EStereoKind::c_Axial; }
116 
124  EStereoKind getStereoKind() const
125  { return front().getStereoKind(); }
126 
128  double getInnerCylindricalR() const
129  { return front().getInnerCylindricalR(); }
130 
132  double getOuterCylindricalR() const
133  { return back().getOuterCylindricalR(); }
134 
136  double getMiddleCylindricalR() const
137  { return (getOuterCylindricalR() + getInnerCylindricalR()) / 2.0; }
138 
139 
141  double getInnerRefZ() const
142  { return m_innerRefZ; }
143 
145  double getOuterRefZ() const
146  { return m_outerRefZ; }
147 
149  double getRefTanLambda() const
150  { return m_refTanLambda; }
166  WireNeighborKind getNeighborKind(ILayer iLayer,
167  IWire iWire,
168  ILayer iOtherLayer,
169  IWire iOtherWire) const;
170 
175  MayBePtr<const CDCWire> getPrimaryNeighbor(short oClockDirection,
176  ILayer iLayer,
177  IWire iWire) const
178  {
179  oClockDirection = modulo(oClockDirection, 12);
180  switch (oClockDirection) {
181  case 1:
182  return getNeighborCWOutwards(iLayer, iWire);
183  case 3:
184  return getNeighborCW(iLayer, iWire);
185  case 5:
186  return getNeighborCWInwards(iLayer, iWire);
187  case 7:
188  return getNeighborCCWInwards(iLayer, iWire);
189  case 9:
190  return getNeighborCCW(iLayer, iWire);
191  case 11:
192  return getNeighborCCWOutwards(iLayer, iWire);
193  default:
194  return nullptr;
195  }
196  }
197 
199  WireNeighborPair getNeighborsOutwards(ILayer iLayer, IWire iWire) const;
200 
202  WireNeighborPair getNeighborsInwards(ILayer iLayer, IWire iWire) const;
203 
205  MayBePtr<const CDCWire> getNeighborCCWOutwards(ILayer iLayer, IWire iWire) const
206  { return getNeighborsOutwards(iLayer, iWire).first; } // not optimal since a second wire gets fetched additionally
207 
209  MayBePtr<const CDCWire> getNeighborCWOutwards(ILayer iLayer, IWire iWire) const
210  { return getNeighborsOutwards(iLayer, iWire).second; } // not optimal since a second wire gets fetched additionally
211 
213  MayBePtr<const CDCWire> getNeighborCW(ILayer iLayer, IWire iWire) const
214  { return &(getWireLayer(iLayer).getNeighborCW(iWire)); }
215 
217  MayBePtr<const CDCWire> getNeighborCCW(ILayer iLayer, IWire iWire) const
218  { return &(getWireLayer(iLayer).getNeighborCCW(iWire)); }
219 
221  MayBePtr<const CDCWire> getNeighborCCWInwards(ILayer iLayer, IWire iWire) const
222  { return getNeighborsInwards(iLayer, iWire).first; } // not optimal since a second wire gets fetched additionally
223 
225  MayBePtr<const CDCWire> getNeighborCWInwards(ILayer iLayer, IWire iWire) const
226  { return getNeighborsInwards(iLayer, iWire).second; } // not optimal since a second wire gets fetched additionally
241  MayBePtr<const CDCWire> getSecondaryNeighbor(short oClockDirection,
242  ILayer iLayer,
243  IWire iWire) const
244  {
245  oClockDirection = modulo(oClockDirection, 12);
246  switch (oClockDirection) {
247  case 0:
248  return getSecondNeighborTwelveOClock(iLayer, iWire);
249  case 1:
250  return getSecondNeighborOneOClock(iLayer, iWire);
251  case 2:
252  return getSecondNeighborTwoOClock(iLayer, iWire);
253  case 3:
254  return getSecondNeighborThreeOClock(iLayer, iWire);
255  case 4:
256  return getSecondNeighborFourOClock(iLayer, iWire);
257  case 5:
258  return getSecondNeighborFiveOClock(iLayer, iWire);
259  case 6:
260  return getSecondNeighborSixOClock(iLayer, iWire);
261  case 7:
262  return getSecondNeighborSevenOClock(iLayer, iWire);
263  case 8:
264  return getSecondNeighborEightOClock(iLayer, iWire);
265  case 9:
266  return getSecondNeighborNineOClock(iLayer, iWire);
267  case 10:
268  return getSecondNeighborTenOClock(iLayer, iWire);
269  case 11:
270  return getSecondNeighborElevenOClock(iLayer, iWire);
271  default:
272  return nullptr;
273  }
274  }
275 
277  MayBePtr<const CDCWire> getSecondNeighborOneOClock(ILayer iLayer, IWire iWire) const
278  { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire - 1)) : nullptr; }
279 
280 
282  MayBePtr<const CDCWire> getSecondNeighborTwoOClock(ILayer iLayer, IWire iWire) const
283  { return getNeighborCWOutwards(iLayer, iWire - 1); }
284 
286  MayBePtr<const CDCWire> getSecondNeighborThreeOClock(ILayer iLayer, IWire iWire) const
287  { return getNeighborCW(iLayer, iWire - 1); }
288 
290  MayBePtr<const CDCWire> getSecondNeighborFourOClock(ILayer iLayer, IWire iWire) const
291  { return getNeighborCWInwards(iLayer, iWire - 1); }
292 
293 
295  MayBePtr<const CDCWire> getSecondNeighborFiveOClock(ILayer iLayer, IWire iWire) const
296  { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire - 1)) : nullptr; }
297 
299  MayBePtr<const CDCWire> getSecondNeighborSixOClock(ILayer iLayer, IWire iWire) const
300  { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire)) : nullptr; }
301 
303  MayBePtr<const CDCWire> getSecondNeighborSevenOClock(ILayer iLayer, IWire iWire) const
304  { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire + 1)) : nullptr; }
305 
306 
308  MayBePtr<const CDCWire> getSecondNeighborEightOClock(ILayer iLayer, IWire iWire) const
309  { return getNeighborCCWInwards(iLayer, iWire + 1); }
310 
312  MayBePtr<const CDCWire> getSecondNeighborNineOClock(ILayer iLayer, IWire iWire) const
313  { return getNeighborCCW(iLayer, iWire + 1); }
314 
316  MayBePtr<const CDCWire> getSecondNeighborTenOClock(ILayer iLayer, IWire iWire) const
317  { return getNeighborCCWOutwards(iLayer, iWire + 1); }
318 
319 
321  MayBePtr<const CDCWire> getSecondNeighborElevenOClock(ILayer iLayer, IWire iWire) const
322  { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire + 1)) : nullptr; }
323 
325  MayBePtr<const CDCWire> getSecondNeighborTwelveOClock(ILayer iLayer, IWire iWire) const
326  { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire)) : nullptr; }
329  private:
331  double m_innerRefZ;
332 
334  double m_outerRefZ;
335 
338 
339  };
340 
341  }
343 }
Class representating a sense wire layer in the central drift chamber.
Definition: CDCWireLayer.h:42
const CDCWire & getWireWrappedAround(IWire iWire) const
Returns the wire by its id in the layer.
Definition: CDCWireLayer.h:161
bool isValidIWire(IWire iWire) const
Checks if the given wire id belongs to a valid wire in this layer.
Definition: CDCWireLayer.h:134
const CDCWire & getNeighborCW(IWire iWire) const
Getter for the first clockwise neighbor by wire id in the layer.
Definition: CDCWireLayer.h:169
const CDCWire & getNeighborCCW(IWire iWire) const
Getter for the first counterclockwise neighbor by wire id in the layer.
Definition: CDCWireLayer.h:165
const CDCWire & getWire(IWire iWire) const
Gives the wire by its id in the layer.
Definition: CDCWireLayer.h:138
Class representating a sense wire superlayer in the central drift chamber.
MayBePtr< const CDCWire > getSecondNeighborTwoOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the two o'clock position.
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 ...
double m_refTanLambda
Memory for (fitted) proporitionality factor between the increasing cylindrical radius and the refernc...
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.
void initialize()
Intializes the superlayer variables of according the layer range. Set the numbering shift of containe...
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...
bool isAxial() const
Indicates if the wire is axial or stereo.
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 ...
MayBePtr< const CDCWire > getSecondNeighborFourOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the four o'clock position.
double m_innerRefZ
Memory for the (fitted) z of the reference wire reference points at the inner cylindricalR of this su...
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.
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 retrived 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.
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.
CDCWireSuperLayer(const ConstVectorRange< CDCWireLayer > &wireLayers)
Constructor taking the range of layers the superlayer shall contain. Use rather getInstance() to avoi...
CDCWireSuperLayer(const CDCWireSuperLayer &wireSuperLayer)=delete
Disallow copy construction of wire super layers.
MayBePtr< const CDCWire > getSecondNeighborThreeOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the three o'clock position.
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 ...
MayBePtr< const CDCWire > getSecondNeighborFiveOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the five o'clock position.
MayBePtr< const CDCWire > getSecondNeighborTwelveOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the twelve o'clock position.
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.
const CDCWireLayer & getWireLayer(ILayer iLayer) const
Gives the layer by its layer id within the superlayer.
MayBePtr< const CDCWire > getSecondNeighborElevenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the elven o'clock position.
bool isValidILayer(ILayer iLayer) const
Checks if the given layer id belongs to a valid layer in this superlayer.
MayBePtr< const CDCWire > getSecondNeighborSixOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the six o'clock position.
MayBePtr< const CDCWire > getSecondNeighborOneOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the one o'clock position.
double getRefTanLambda() const
Getter for (fitted) proporitionality factor between the increasing cylindrical radius and the refernc...
MayBePtr< const CDCWire > getSecondNeighborEightOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the eight o'clock position.
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.
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.
MayBePtr< const CDCWire > getSecondNeighborNineOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the nine o'clock position.
double getOuterCylindricalR() const
Getter for the outer radius of the layer as retrived from the CDCGeometryPar by the outer most layer.
double getInnerRefZ() const
Getter for the (fitted) z of the reference wire reference points at the inner cylindricalR of this su...
MayBePtr< const CDCWire > getSecondaryNeighbor(short oClockDirection, ILayer iLayer, IWire iWire) const
@getSecondaryNeighbor Secondary neighborhood The secondary neighbors are numbered like positions on t...
MayBePtr< const CDCWire > getSecondNeighborSevenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the seven o'clock position.
WireNeighborPair getNeighborsInwards(ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the layer inwards of the given on.
MayBePtr< const CDCWire > getSecondNeighborTenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the ten o'clock position.
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
A pair of iterators usable with the range base for loop.
Definition: Range.h:25
Reference back() const
Returns the derefenced iterator before end()
Definition: Range.h:84
Reference front() const
Returns the derefenced 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
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...
Abstract base class for different kinds of events.