ATLAS Offline Software
TrackStateOnSurface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 /***************************************************************************
5  TrackStateOnSurface.h - description
6  -------------------
7 begin : Wed Jan 21 2004
8 ***************************************************************************/
9 
10 #ifndef TRKTRACKSTATEONSURFACE_H
11 #define TRKTRACKSTATEONSURFACE_H
12 
13 //
20 //
21 //
22 #include <atomic>
23 #include <cstdint>
24 #include <bitset>
25 #include <iostream>
26 #include <memory>
27 
28 class MsgStream;
29 class TrackCollectionCnv;
31 
32 namespace Trk {
71 {
72  friend class ::TrackCollectionCnv;
73  friend class ::TrackStateOnSurfaceCnv_p3;
74 
75 public:
76  /*
77  * Historically, we had a single bitset.
78  *
79  * for types and hints.
80  * The relevant indices in the bitset were controlled
81  * by a single enum.
82  *
83  * For MT we split the hints from the types.
84  * So we have two enums controlling two
85  * bitsets.
86  *
87  * The types can be queried as before
88  * from user code.
89  *
90  * The Hints exist only for
91  * interacting with persistification
92  * In order to support existing code
93  * They are atomic and are to be set
94  * only once for each TSOS.
95  * they had to remain part of TSOS.
96  */
98  {
102 
106 
110 
114 
117  Perigee = 4,
118 
122  Outlier = 5,
123 
128  Hole = 6,
129 
132  Unknown = 7,
133 
136 
141 
146 
150  Alignment = 11,
151 
153  };
154 
156  {
157 
163 
168 
173 
175  };
176 
177  /*
178  * Helpers to join and split the bitsets
179  * for the types and hints
180  * Needed in order to keep the same T/P separation.
181  * Note that in the Persistent side we keep a single ulong
182  */
183  static unsigned int long joinBitsets(
184  const std::bitset<NumberOfTrackStateOnSurfaceTypes>& types,
185  const std::bitset<NumberOfPersistencyHints>& hints)
186  {
187  //put hints in place
188  unsigned int long res = hints.to_ulong();
189  //shift them up
191  //Add type
192  res += types.to_ulong();
193  return res;
194  }
195 
196  static void splitToBitsets(
197  const unsigned int long input,
198  std::bitset<NumberOfTrackStateOnSurfaceTypes>& types,
199  std::bitset<NumberOfPersistencyHints>& hints)
200  {
201  // mask with NumberOfTrackStateOnSurfaceTypes bits set to 1
202  constexpr unsigned int long maskTypesSet =
204  //keep just the Type part of the input
205  types = std::bitset<NumberOfTrackStateOnSurfaceTypes>(input & maskTypesSet);
206  //keep the upper Hints part of the input
207  hints = std::bitset<NumberOfPersistencyHints>(
209  }
210 
211  enum Variety
212  {
215  Align = 2,
216  };
221 
230  explicit TrackStateOnSurface(
231  const FitQualityOnSurface& fitQoS,
232  std::unique_ptr<MeasurementBase> meas,
233  std::unique_ptr<TrackParameters> trackParameters,
234  std::unique_ptr<MaterialEffectsBase> materialEffects = nullptr,
235  std::unique_ptr<AlignmentEffectsOnTrack> alignmentEffectsOnTrack = nullptr);
236 
237  explicit TrackStateOnSurface(
238  std::unique_ptr<MeasurementBase> meas,
239  std::unique_ptr<TrackParameters> trackParameters,
240  std::unique_ptr<MaterialEffectsBase> materialEffects = nullptr,
241  std::unique_ptr<AlignmentEffectsOnTrack> alignmentEffectsOnTrack = nullptr);
242 
257  explicit TrackStateOnSurface(
258  const FitQualityOnSurface& fitQoS,
259  std::unique_ptr<MeasurementBase> meas,
260  std::unique_ptr<TrackParameters> trackParameters,
261  std::unique_ptr<MaterialEffectsBase> materialEffectsOnTrack,
262  const std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>& typePattern,
263  std::unique_ptr<AlignmentEffectsOnTrack> alignmentEffectsOnTrack = nullptr);
264 
265  explicit TrackStateOnSurface(
266  std::unique_ptr<MeasurementBase> meas,
267  std::unique_ptr<TrackParameters> trackParameters,
268  std::unique_ptr<MaterialEffectsBase> materialEffectsOnTrack,
269  const std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>& typePattern,
270  std::unique_ptr<AlignmentEffectsOnTrack> alignmentEffectsOnTrack = nullptr);
271 
275  virtual TrackStateOnSurface* clone() const;
276 
278  TrackStateOnSurface(const TrackStateOnSurface& trackStateOnSurface);
280  TrackStateOnSurface(TrackStateOnSurface&& trackStateOnSurface) noexcept;
281 
282  /* Assignment */
286  virtual ~TrackStateOnSurface() = default;
287 
292 
297 
302 
307 
312 
318  bool type(const TrackStateOnSurfaceType type) const;
319 
324 
327  std::string dumpType() const;
328 
341  const std::bitset<NumberOfTrackStateOnSurfaceTypes> types() const;
342 
349  void setHints(const uint8_t hints) const;
353  const std::bitset<NumberOfPersistencyHints> hints() const;
354 
358  const Trk::Surface& surface() const;
361  bool isSane() const;
362 
363 private:
365  void setFlags();
366 
368  std::unique_ptr<TrackParameters> m_trackParameters{};
369  std::unique_ptr<MeasurementBase> m_measurementOnTrack{};
370  std::unique_ptr<MaterialEffectsBase> m_materialEffectsOnTrack{};
371  std::unique_ptr<AlignmentEffectsOnTrack> m_alignmentEffectsOnTrack{};
372 protected:
374  mutable std::atomic<uint8_t> m_hints{};
375 };
376 
378 MsgStream&
379 operator<<(MsgStream& sl, const TrackStateOnSurface& tsos);
380 
382 std::ostream&
383 operator<<(std::ostream& sl, const TrackStateOnSurface& tsos);
384 }
385 
387 
388 #endif
Trk::TrackStateOnSurface::trackParameters
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
Trk::TrackStateOnSurface::m_fitQualityOnSurface
FitQualityOnSurface m_fitQualityOnSurface
Definition: TrackStateOnSurface.h:367
Trk::TrackStateOnSurface::CaloDeposit
@ CaloDeposit
This TSOS contains a CaloEnergy object.
Definition: TrackStateOnSurface.h:135
Trk::TrackStateOnSurface::operator=
Trk::TrackStateOnSurface & operator=(const Trk::TrackStateOnSurface &rhs)
Definition: TrackStateOnSurface.cxx:110
AlignmentEffectsOnTrack.h
Trk::TrackStateOnSurface::NumberOfPersistencyHints
@ NumberOfPersistencyHints
Definition: TrackStateOnSurface.h:174
Trk::TrackStateOnSurface::TrackStateOnSurfaceType
TrackStateOnSurfaceType
Definition: TrackStateOnSurface.h:98
TrackParameters.h
MeasurementBase.h
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Trk::TrackStateOnSurface::TrackStateOnSurface
TrackStateOnSurface()
Default ctor for POOL.
Trk::TrackStateOnSurface::surface
const Trk::Surface & surface() const
return associated surface
Definition: TrackStateOnSurface.cxx:188
Trk::TrackStateOnSurface::clone
virtual TrackStateOnSurface * clone() const
Pseudo-constructor: needed to avoid excessive RTTI.
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Trk::TrackStateOnSurface::PersistifyTrackParameters
@ PersistifyTrackParameters
Mark track parameters for persisitification.
Definition: TrackStateOnSurface.h:167
Trk::TrackStateOnSurface::m_materialEffectsOnTrack
std::unique_ptr< MaterialEffectsBase > m_materialEffectsOnTrack
Definition: TrackStateOnSurface.h:370
Trk::TrackStateOnSurface::dumpType
std::string dumpType() const
returns a string with the expanded type of the object (i.e.
Definition: TrackStateOnSurface.cxx:147
Trk::TrackStateOnSurface::~TrackStateOnSurface
virtual ~TrackStateOnSurface()=default
destructor
Trk::TrackStateOnSurface::measurementOnTrack
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
Trk::TrackStateOnSurface::types
const std::bitset< NumberOfTrackStateOnSurfaceTypes > types() const
returns a bitset with the types of this bitset.
Trk::TrackStateOnSurface::setFlags
void setFlags()
set sensible default flags
FitQualityOnSurface.h
Trk::TrackStateOnSurface::PersistifyMeasurement
@ PersistifyMeasurement
Mark the measuremenet for persistification.
Definition: TrackStateOnSurface.h:162
Trk::MaterialEffectsBase
base class to integrate material effects on Trk::Track in a flexible way.
Definition: MaterialEffectsBase.h:35
Trk::AlignmentEffectsOnTrack
Class to represent misalignments or 'discontinuities' on tracks These have a surface where the z axis...
Definition: AlignmentEffectsOnTrack.h:24
Trk::TrackStateOnSurface::materialEffectsOnTrack
MaterialEffectsBase * materialEffectsOnTrack()
return material effects non-const overload
MaterialEffectsBase.h
Trk::TrackStateOnSurface::Alignment
@ Alignment
This TSOS contains a Trk::AlignmentEffectsOnTrack.
Definition: TrackStateOnSurface.h:150
Trk::TrackStateOnSurface::fitQualityOnSurface
const FitQualityOnSurface & fitQualityOnSurface() const
return FitQuality On Surface const overload
Trk::TrackStateOnSurface::isSane
bool isSane() const
Definition: TrackStateOnSurface.cxx:203
Trk::TrackStateOnSurface::Outlier
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Definition: TrackStateOnSurface.h:122
Trk::TrackStateOnSurface::fitQualityOnSurface
FitQualityOnSurface & fitQualityOnSurface()
return FitQuality On Surface non-const overload
Trk::FitQualityOnSurface
Definition: FitQualityOnSurface.h:19
Trk::TrackStateOnSurface::type
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
Trk::TrackStateOnSurface::Hole
@ Hole
A hole on the track - this is defined in the following way.
Definition: TrackStateOnSurface.h:128
Trk::TrackStateOnSurface::materialEffectsOnTrack
const MaterialEffectsBase * materialEffectsOnTrack() const
return material effects const overload
Trk::TrackStateOnSurface::joinBitsets
static unsigned int long joinBitsets(const std::bitset< NumberOfTrackStateOnSurfaceTypes > &types, const std::bitset< NumberOfPersistencyHints > &hints)
Definition: TrackStateOnSurface.h:183
TrackCollectionCnv
Definition: TrackCollectionCnv.h:47
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
Trk::TrackStateOnSurface::SingleComponent
@ SingleComponent
Definition: TrackStateOnSurface.h:213
TrackStateOnSurface.icc
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::TrackStateOnSurface::PersistifySlimCaloDeposit
@ PersistifySlimCaloDeposit
Mark track parameters for persisitification.
Definition: TrackStateOnSurface.h:172
Trk::TrackStateOnSurface::Parameter
@ Parameter
This TSOS contains a Trk::ParameterBase.
Definition: TrackStateOnSurface.h:140
Trk::TrackStateOnSurface::BremPoint
@ BremPoint
This represents a brem point on the track, and so will contain TrackParameters and MaterialEffectsBas...
Definition: TrackStateOnSurface.h:109
Trk::TrackStateOnSurface::alignmentEffectsOnTrack
const AlignmentEffectsOnTrack * alignmentEffectsOnTrack() const
return the the alignment effects const overload
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::TrackStateOnSurface::m_trackParameters
std::unique_ptr< TrackParameters > m_trackParameters
Definition: TrackStateOnSurface.h:368
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TrackStateOnSurface::Variety
Variety
Definition: TrackStateOnSurface.h:212
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
Trk::TrackStateOnSurface::InertMaterial
@ InertMaterial
This represents inert material, and so will contain MaterialEffectsBase.
Definition: TrackStateOnSurface.h:105
TrackStateOnSurfaceCnv_p3
Definition: TrackStateOnSurfaceCnv_p3.h:28
Trk::TrackStateOnSurface::splitToBitsets
static void splitToBitsets(const unsigned int long input, std::bitset< NumberOfTrackStateOnSurfaceTypes > &types, std::bitset< NumberOfPersistencyHints > &hints)
Definition: TrackStateOnSurface.h:196
Trk::TrackStateOnSurface::setHints
void setHints(const uint8_t hints) const
Use this method to set persistification hints.
Definition: TrackStateOnSurface.cxx:235
Trk::TrackStateOnSurface::hints
const std::bitset< NumberOfPersistencyHints > hints() const
Use this method to get the persistification hints.
Trk::TrackStateOnSurface::MultiComponent
@ MultiComponent
Definition: TrackStateOnSurface.h:214
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
Trk::TrackStateOnSurface::m_hints
std::atomic< uint8_t > m_hints
Definition: TrackStateOnSurface.h:374
Trk::TrackStateOnSurface::Scatterer
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
Definition: TrackStateOnSurface.h:113
Trk::TrackStateOnSurface::trackParameters
TrackParameters * trackParameters()
return ptr to trackparameters non-const overload
Trk::TrackStateOnSurface::alignmentEffectsOnTrack
AlignmentEffectsOnTrack * alignmentEffectsOnTrack()
return the the alignment effects non-const overload
Trk::TrackStateOnSurface::m_measurementOnTrack
std::unique_ptr< MeasurementBase > m_measurementOnTrack
Definition: TrackStateOnSurface.h:369
Trk::TrackStateOnSurface::m_alignmentEffectsOnTrack
std::unique_ptr< AlignmentEffectsOnTrack > m_alignmentEffectsOnTrack
Definition: TrackStateOnSurface.h:371
Trk::TrackStateOnSurface::Align
@ Align
Definition: TrackStateOnSurface.h:215
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::TrackStateOnSurface::Unknown
@ Unknown
For some reason this does not fall into any of the other categories PLEASE DO NOT USE THIS - DEPRECAT...
Definition: TrackStateOnSurface.h:132
Trk::TrackStateOnSurface::PartialPersistification
@ PartialPersistification
Definition: TrackStateOnSurface.h:158
Trk::TrackStateOnSurface::PersistencyHint
PersistencyHint
Definition: TrackStateOnSurface.h:156
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes
@ NumberOfTrackStateOnSurfaceTypes
Definition: TrackStateOnSurface.h:152
Trk::TrackStateOnSurface::m_typeFlags
uint16_t m_typeFlags
Definition: TrackStateOnSurface.h:373
Trk::TrackStateOnSurface::variety
virtual Trk::TrackStateOnSurface::Variety variety() const
Use this method to find if this is a Single, Multi or Align TrackStateOnsurface.
Trk::TrackStateOnSurface::measurementOnTrack
MeasurementBase * measurementOnTrack()
returns MeasurementBase non-const overload