Belle II Software  release-05-02-19
CDCWireSuperLayer.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/topology/CDCWireLayer.h>
13 #include <tracking/trackFindingCDC/topology/WireNeighborPair.h>
14 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
15 #include <tracking/trackFindingCDC/topology/ILayer.h>
16 #include <tracking/trackFindingCDC/topology/IWire.h>
17 #include <tracking/trackFindingCDC/topology/WireNeighborKind.h>
18 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
19 #include <tracking/trackFindingCDC/utilities/VectorRange.h>
20 #include <tracking/trackFindingCDC/utilities/MayBePtr.h>
21 
22 namespace Belle2 {
27  namespace TrackFindingCDC {
28 
45  class CDCWireSuperLayer
46  : public ConstVectorRange<CDCWireLayer> {
47 
48  public:
50  using Super = ConstVectorRange<CDCWireLayer>;
51 
54 
56  CDCWireSuperLayer(const CDCWireSuperLayer& wireSuperLayer) = delete;
57 
59  CDCWireSuperLayer(CDCWireSuperLayer&& wireSuperLayer) = default;
60 
62  void operator=(const CDCWireSuperLayer& wireSuperLayer) = delete;
63 
64  public:
66  void initialize();
67 
73  ISuperLayer getISuperLayer() const
75  { return front().getISuperLayer(); }
83  bool isValidILayer(ILayer iLayer) const
85  { return 0 <= iLayer and iLayer < int(size()); }
86 
88  const CDCWireLayer& getWireLayer(ILayer iLayer) const
89  {
90  // cppcheck-suppress returnTempReference
91  return at(iLayer);
92  }
100  bool isValidIWire(ILayer iLayer, IWire iWire) const
102  { return isValidILayer(iLayer) and getWireLayer(iLayer).isValidIWire(iWire); }
103 
105  const CDCWire& getWire(ILayer iLayer, IWire iWire) const
106  { return getWireLayer(iLayer).getWire(iWire); }
115  bool isAxial() const
117  { return getStereoKind() == EStereoKind::c_Axial; }
118 
126  EStereoKind getStereoKind() const
127  { return front().getStereoKind(); }
128 
130  double getInnerCylindricalR() const
131  { return front().getInnerCylindricalR(); }
132 
134  double getOuterCylindricalR() const
135  { return back().getOuterCylindricalR(); }
136 
138  double getMiddleCylindricalR() const
139  { return (getOuterCylindricalR() + getInnerCylindricalR()) / 2.0; }
140 
141 
143  double getInnerRefZ() const
144  { return m_innerRefZ; }
145 
147  double getOuterRefZ() const
148  { return m_outerRefZ; }
149 
151  double getRefTanLambda() const
152  { return m_refTanLambda; }
168  WireNeighborKind getNeighborKind(ILayer iLayer,
169  IWire iWire,
170  ILayer iOtherLayer,
171  IWire iOtherWire) const;
172 
177  MayBePtr<const CDCWire> getPrimaryNeighbor(short oClockDirection,
178  ILayer iLayer,
179  IWire iWire) const
180  {
181  oClockDirection = modulo(oClockDirection, 12);
182  switch (oClockDirection) {
183  case 1:
184  return getNeighborCWOutwards(iLayer, iWire);
185  case 3:
186  return getNeighborCW(iLayer, iWire);
187  case 5:
188  return getNeighborCWInwards(iLayer, iWire);
189  case 7:
190  return getNeighborCCWInwards(iLayer, iWire);
191  case 9:
192  return getNeighborCCW(iLayer, iWire);
193  case 11:
194  return getNeighborCCWOutwards(iLayer, iWire);
195  default:
196  return nullptr;
197  }
198  }
199 
201  WireNeighborPair getNeighborsOutwards(ILayer iLayer, IWire iWire) const;
202 
204  WireNeighborPair getNeighborsInwards(ILayer iLayer, IWire iWire) const;
205 
207  MayBePtr<const CDCWire> getNeighborCCWOutwards(ILayer iLayer, IWire iWire) const
208  { return getNeighborsOutwards(iLayer, iWire).first; } // not optimal since a second wire gets fetched additionally
209 
211  MayBePtr<const CDCWire> getNeighborCWOutwards(ILayer iLayer, IWire iWire) const
212  { return getNeighborsOutwards(iLayer, iWire).second; } // not optimal since a second wire gets fetched additionally
213 
215  MayBePtr<const CDCWire> getNeighborCW(ILayer iLayer, IWire iWire) const
216  { return &(getWireLayer(iLayer).getNeighborCW(iWire)); }
217 
219  MayBePtr<const CDCWire> getNeighborCCW(ILayer iLayer, IWire iWire) const
220  { return &(getWireLayer(iLayer).getNeighborCCW(iWire)); }
221 
223  MayBePtr<const CDCWire> getNeighborCCWInwards(ILayer iLayer, IWire iWire) const
224  { return getNeighborsInwards(iLayer, iWire).first; } // not optimal since a second wire gets fetched additionally
225 
227  MayBePtr<const CDCWire> getNeighborCWInwards(ILayer iLayer, IWire iWire) const
228  { return getNeighborsInwards(iLayer, iWire).second; } // not optimal since a second wire gets fetched additionally
243  MayBePtr<const CDCWire> getSecondaryNeighbor(short oClockDirection,
244  ILayer iLayer,
245  IWire iWire) const
246  {
247  oClockDirection = modulo(oClockDirection, 12);
248  switch (oClockDirection) {
249  case 0:
250  return getSecondNeighborTwelveOClock(iLayer, iWire);
251  case 1:
252  return getSecondNeighborOneOClock(iLayer, iWire);
253  case 2:
254  return getSecondNeighborTwoOClock(iLayer, iWire);
255  case 3:
256  return getSecondNeighborThreeOClock(iLayer, iWire);
257  case 4:
258  return getSecondNeighborFourOClock(iLayer, iWire);
259  case 5:
260  return getSecondNeighborFiveOClock(iLayer, iWire);
261  case 6:
262  return getSecondNeighborSixOClock(iLayer, iWire);
263  case 7:
264  return getSecondNeighborSevenOClock(iLayer, iWire);
265  case 8:
266  return getSecondNeighborEightOClock(iLayer, iWire);
267  case 9:
268  return getSecondNeighborNineOClock(iLayer, iWire);
269  case 10:
270  return getSecondNeighborTenOClock(iLayer, iWire);
271  case 11:
272  return getSecondNeighborElevenOClock(iLayer, iWire);
273  default:
274  return nullptr;
275  }
276  }
277 
279  MayBePtr<const CDCWire> getSecondNeighborOneOClock(ILayer iLayer, IWire iWire) const
280  { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire - 1)) : nullptr; }
281 
282 
284  MayBePtr<const CDCWire> getSecondNeighborTwoOClock(ILayer iLayer, IWire iWire) const
285  { return getNeighborCWOutwards(iLayer, iWire - 1); }
286 
288  MayBePtr<const CDCWire> getSecondNeighborThreeOClock(ILayer iLayer, IWire iWire) const
289  { return getNeighborCW(iLayer, iWire - 1); }
290 
292  MayBePtr<const CDCWire> getSecondNeighborFourOClock(ILayer iLayer, IWire iWire) const
293  { return getNeighborCWInwards(iLayer, iWire - 1); }
294 
295 
297  MayBePtr<const CDCWire> getSecondNeighborFiveOClock(ILayer iLayer, IWire iWire) const
298  { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire - 1)) : nullptr; }
299 
301  MayBePtr<const CDCWire> getSecondNeighborSixOClock(ILayer iLayer, IWire iWire) const
302  { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire)) : nullptr; }
303 
305  MayBePtr<const CDCWire> getSecondNeighborSevenOClock(ILayer iLayer, IWire iWire) const
306  { return isValidILayer(iLayer - 2) ? &(getWireLayer(iLayer - 2).getWireWrappedAround(iWire + 1)) : nullptr; }
307 
308 
310  MayBePtr<const CDCWire> getSecondNeighborEightOClock(ILayer iLayer, IWire iWire) const
311  { return getNeighborCCWInwards(iLayer, iWire + 1); }
312 
314  MayBePtr<const CDCWire> getSecondNeighborNineOClock(ILayer iLayer, IWire iWire) const
315  { return getNeighborCCW(iLayer, iWire + 1); }
316 
318  MayBePtr<const CDCWire> getSecondNeighborTenOClock(ILayer iLayer, IWire iWire) const
319  { return getNeighborCCWOutwards(iLayer, iWire + 1); }
320 
321 
323  MayBePtr<const CDCWire> getSecondNeighborElevenOClock(ILayer iLayer, IWire iWire) const
324  { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire + 1)) : nullptr; }
325 
327  MayBePtr<const CDCWire> getSecondNeighborTwelveOClock(ILayer iLayer, IWire iWire) const
328  { return isValidILayer(iLayer + 2) ? &(getWireLayer(iLayer + 2).getWireWrappedAround(iWire)) : nullptr; }
331  private:
333  double m_innerRefZ;
334 
336  double m_outerRefZ;
337 
339  double m_refTanLambda;
340 
341  };
342 
343  }
345 }
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborsOutwards
WireNeighborPair getNeighborsOutwards(ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the layer outwards of the given on.
Definition: CDCWireSuperLayer.cc:100
Belle2::TrackFindingCDC::Range::back
Reference back() const
Returns the derefenced iterator before end()
Definition: Range.h:94
Belle2::TrackFindingCDC::CDCWireLayer::getNeighborCCW
const CDCWire & getNeighborCCW(IWire iWire) const
Getter for the first counterclockwise neighbor by wire id in the layer.
Definition: CDCWireLayer.h:175
Belle2::TrackFindingCDC::Range::size
std::size_t size() const
Returns the total number of objects in this range.
Definition: Range.h:86
Belle2::TrackFindingCDC::CDCWireSuperLayer::m_innerRefZ
double m_innerRefZ
Memory for the (fitted) z of the reference wire reference points at the inner cylindricalR of this su...
Definition: CDCWireSuperLayer.h:341
Belle2::TrackFindingCDC::CDCWireLayer::isValidIWire
bool isValidIWire(IWire iWire) const
Checks if the given wire id belongs to a valid wire in this layer.
Definition: CDCWireLayer.h:144
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborCCWOutwards
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 ...
Definition: CDCWireSuperLayer.h:215
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborFourOClock
MayBePtr< const CDCWire > getSecondNeighborFourOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the four o'clock position.
Definition: CDCWireSuperLayer.h:300
Belle2::TrackFindingCDC::CDCWireLayer::getNeighborCW
const CDCWire & getNeighborCW(IWire iWire) const
Getter for the first clockwise neighbor by wire id in the layer.
Definition: CDCWireLayer.h:179
Belle2::TrackFindingCDC::CDCWireSuperLayer::m_refTanLambda
double m_refTanLambda
Memory for (fitted) proporitionality factor between the increasing cylindrical radius and the refernc...
Definition: CDCWireSuperLayer.h:347
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborEightOClock
MayBePtr< const CDCWire > getSecondNeighborEightOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the eight o'clock position.
Definition: CDCWireSuperLayer.h:318
Belle2::TrackFindingCDC::CDCWireSuperLayer::getOuterRefZ
double getOuterRefZ() const
Getter for the (fitted) z of the reference wire reference points at the outer cylindricalR of this su...
Definition: CDCWireSuperLayer.h:155
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborCW
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.
Definition: CDCWireSuperLayer.h:223
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborCCW
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.
Definition: CDCWireSuperLayer.h:227
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborCWInwards
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 ...
Definition: CDCWireSuperLayer.h:235
Belle2::TrackFindingCDC::CDCWireSuperLayer::getISuperLayer
ISuperLayer getISuperLayer() const
Getter for the super layer id.
Definition: CDCWireSuperLayer.h:82
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborKind
WireNeighborKind getNeighborKind(ILayer iLayer, IWire iWire, ILayer iOtherLayer, IWire iOtherWire) const
Checks if two wires are closest neighbors.
Definition: CDCWireSuperLayer.cc:30
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborElevenOClock
MayBePtr< const CDCWire > getSecondNeighborElevenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the elven o'clock position.
Definition: CDCWireSuperLayer.h:331
Belle2::TrackFindingCDC::CDCWireSuperLayer::Super
ConstVectorRange< CDCWireLayer > Super
Type of the base class.
Definition: CDCWireSuperLayer.h:58
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborCWOutwards
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 ...
Definition: CDCWireSuperLayer.h:219
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborThreeOClock
MayBePtr< const CDCWire > getSecondNeighborThreeOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the three o'clock position.
Definition: CDCWireSuperLayer.h:296
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborNineOClock
MayBePtr< const CDCWire > getSecondNeighborNineOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the nine o'clock position.
Definition: CDCWireSuperLayer.h:322
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborOneOClock
MayBePtr< const CDCWire > getSecondNeighborOneOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the one o'clock position.
Definition: CDCWireSuperLayer.h:287
Belle2::TrackFindingCDC::CDCWireSuperLayer::isValidIWire
bool isValidIWire(ILayer iLayer, IWire iWire) const
Checks if the given wire id belongs to a valid wire in this superlayer.
Definition: CDCWireSuperLayer.h:109
Belle2::TrackFindingCDC::CDCWireSuperLayer::CDCWireSuperLayer
CDCWireSuperLayer(const ConstVectorRange< CDCWireLayer > &wireLayers)
Constructor taking the range of layers the superlayer shall contain. Use rather getInstance() to avoi...
Definition: CDCWireSuperLayer.cc:17
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborCCWInwards
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 ...
Definition: CDCWireSuperLayer.h:231
Belle2::TrackFindingCDC::CDCWireSuperLayer::getPrimaryNeighbor
MayBePtr< const CDCWire > getPrimaryNeighbor(short oClockDirection, ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the given o'clock direction.
Definition: CDCWireSuperLayer.h:185
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborSixOClock
MayBePtr< const CDCWire > getSecondNeighborSixOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the six o'clock position.
Definition: CDCWireSuperLayer.h:309
Belle2::TrackFindingCDC::CDCWireSuperLayer::operator=
void operator=(const CDCWireSuperLayer &wireSuperLayer)=delete
Disallow copy assignment of wire super layers.
Belle2::TrackFindingCDC::CDCWireSuperLayer::getMiddleCylindricalR
double getMiddleCylindricalR() const
Getter for the radius in the middle of the layer.
Definition: CDCWireSuperLayer.h:146
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCWireLayer::getWireWrappedAround
const CDCWire & getWireWrappedAround(IWire iWire) const
Returns the wire by its id in the layer.
Definition: CDCWireLayer.h:171
Belle2::TrackFindingCDC::CDCWireLayer::getWire
const CDCWire & getWire(IWire iWire) const
Gives the wire by its id in the layer.
Definition: CDCWireLayer.h:148
Belle2::TrackFindingCDC::CDCWireSuperLayer::getRefTanLambda
double getRefTanLambda() const
Getter for (fitted) proporitionality factor between the increasing cylindrical radius and the refernc...
Definition: CDCWireSuperLayer.h:159
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborTwelveOClock
MayBePtr< const CDCWire > getSecondNeighborTwelveOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the twelve o'clock position.
Definition: CDCWireSuperLayer.h:335
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborFiveOClock
MayBePtr< const CDCWire > getSecondNeighborFiveOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the five o'clock position.
Definition: CDCWireSuperLayer.h:305
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborSevenOClock
MayBePtr< const CDCWire > getSecondNeighborSevenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the seven o'clock position.
Definition: CDCWireSuperLayer.h:313
Belle2::TrackFindingCDC::CDCWireSuperLayer::m_outerRefZ
double m_outerRefZ
Memory for the (fitted) z of the reference wire reference points at the outer cylindricalR of this su...
Definition: CDCWireSuperLayer.h:344
Belle2::TrackFindingCDC::Range
A pair of iterators usable with the range base for loop.
Definition: Range.h:35
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborTenOClock
MayBePtr< const CDCWire > getSecondNeighborTenOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the ten o'clock position.
Definition: CDCWireSuperLayer.h:326
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondaryNeighbor
MayBePtr< const CDCWire > getSecondaryNeighbor(short oClockDirection, ILayer iLayer, IWire iWire) const
@getSecondaryNeighbor Secondary neighborhood The secondary neighbors are numbered like positions on t...
Definition: CDCWireSuperLayer.h:251
Belle2::TrackFindingCDC::CDCWireSuperLayer
Class representating a sense wire superlayer in the central drift chamber.
Definition: CDCWireSuperLayer.h:53
Belle2::TrackFindingCDC::CDCWireSuperLayer::getNeighborsInwards
WireNeighborPair getNeighborsInwards(ILayer iLayer, IWire iWire) const
Getter for the two closest neighbors in the layer inwards of the given on.
Definition: CDCWireSuperLayer.cc:78
Belle2::TrackFindingCDC::CDCWireSuperLayer::isValidILayer
bool isValidILayer(ILayer iLayer) const
Checks if the given layer id belongs to a valid layer in this superlayer.
Definition: CDCWireSuperLayer.h:92
Belle2::TrackFindingCDC::CDCWireSuperLayer::getWireLayer
const CDCWireLayer & getWireLayer(ILayer iLayer) const
Gives the layer by its layer id within the superlayer.
Definition: CDCWireSuperLayer.h:96
Belle2::TrackFindingCDC::Range::at
Reference at(std::size_t i) const
Returns the object at index i.
Definition: Range.h:102
Belle2::TrackFindingCDC::WireNeighborKind
Type for the neighbor relationship from one wire to another.
Definition: WireNeighborKind.h:35
Belle2::TrackFindingCDC::CDCWireSuperLayer::isAxial
bool isAxial() const
Indicates if the wire is axial or stereo.
Definition: CDCWireSuperLayer.h:124
Belle2::TrackFindingCDC::CDCWireSuperLayer::getInnerCylindricalR
double getInnerCylindricalR() const
Getter for the inner radius of the layer as retrived from the CDCGeometryPar by the inner most layer.
Definition: CDCWireSuperLayer.h:138
Belle2::TrackFindingCDC::CDCWireSuperLayer::initialize
void initialize()
Intializes the superlayer variables of according the layer range. Set the numbering shift of containe...
Definition: CDCWireSuperLayer.cc:26
Belle2::TrackFindingCDC::CDCWireSuperLayer::getStereoKind
EStereoKind getStereoKind() const
Getter for the stereo type of the wire layer Gives the stereo type of the wire.
Definition: CDCWireSuperLayer.h:134
Belle2::TrackFindingCDC::CDCWireSuperLayer::getWire
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.
Definition: CDCWireSuperLayer.h:113
Belle2::TrackFindingCDC::CDCWireSuperLayer::getInnerRefZ
double getInnerRefZ() const
Getter for the (fitted) z of the reference wire reference points at the inner cylindricalR of this su...
Definition: CDCWireSuperLayer.h:151
Belle2::TrackFindingCDC::CDCWireSuperLayer::getOuterCylindricalR
double getOuterCylindricalR() const
Getter for the outer radius of the layer as retrived from the CDCGeometryPar by the outer most layer.
Definition: CDCWireSuperLayer.h:142
Belle2::TrackFindingCDC::CDCWireSuperLayer::getSecondNeighborTwoOClock
MayBePtr< const CDCWire > getSecondNeighborTwoOClock(ILayer iLayer, IWire iWire) const
Getter for secondary neighbor at the two o'clock position.
Definition: CDCWireSuperLayer.h:292
Belle2::TrackFindingCDC::Range::front
Reference front() const
Returns the derefenced iterator at begin()
Definition: Range.h:90