ATLAS Offline Software
Loading...
Searching...
No Matches
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 -------------------
7begin : 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
28class MsgStream;
31
32namespace Trk {
71{
72 friend class ::TrackCollectionCnv;
73 friend class ::TrackStateOnSurfaceCnv_p3;
74
75public:
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
118
123
128 Hole = 6,
129
133
136
141
146
151
153 };
154
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
212 {
215 Align = 2,
216 };
217
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
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
363private:
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{};
372protected:
373 uint16_t m_typeFlags{};
374 mutable std::atomic<uint8_t> m_hints{};
375};
376
378MsgStream&
379operator<<(MsgStream& sl, const TrackStateOnSurface& tsos);
380
382std::ostream&
383operator<<(std::ostream& sl, const TrackStateOnSurface& tsos);
384}
385
387
388#endif
std::pair< std::vector< unsigned int >, bool > res
Class to represent misalignments or 'discontinuities' on tracks These have a surface where the z axis...
base class to integrate material effects on Trk::Track in a flexible way.
This class is the pure abstract base class for all fittable tracking measurements.
Abstract Base Class for tracking surfaces.
represents the track state (measurement, material, fit parameters and quality) at a surface.
const std::bitset< NumberOfTrackStateOnSurfaceTypes > types() const
returns a bitset with the types of this bitset.
virtual TrackStateOnSurface * clone() const
Pseudo-constructor: needed to avoid excessive RTTI.
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
std::unique_ptr< TrackParameters > m_trackParameters
std::unique_ptr< MeasurementBase > m_measurementOnTrack
MeasurementBase * measurementOnTrack()
returns MeasurementBase non-const overload
void setFlags()
set sensible default flags
virtual Trk::TrackStateOnSurface::Variety variety() const
Use this method to find if this is a Single, Multi or Align TrackStateOnsurface.
TrackStateOnSurface()
Default ctor for POOL.
std::unique_ptr< MaterialEffectsBase > m_materialEffectsOnTrack
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
const std::bitset< NumberOfPersistencyHints > hints() const
Use this method to get the persistification hints.
virtual ~TrackStateOnSurface()=default
destructor
std::string dumpType() const
returns a string with the expanded type of the object (i.e.
AlignmentEffectsOnTrack * alignmentEffectsOnTrack()
return the the alignment effects non-const overload
void setHints(const uint8_t hints) const
Use this method to set persistification hints.
static unsigned int long joinBitsets(const std::bitset< NumberOfTrackStateOnSurfaceTypes > &types, const std::bitset< NumberOfPersistencyHints > &hints)
FitQualityOnSurface & fitQualityOnSurface()
return FitQuality On Surface non-const overload
const FitQualityOnSurface & fitQualityOnSurface() const
return FitQuality On Surface const overload
Trk::TrackStateOnSurface & operator=(const Trk::TrackStateOnSurface &rhs)
std::atomic< uint8_t > m_hints
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
@ PersistifySlimCaloDeposit
Mark track parameters for persisitification.
@ PersistifyMeasurement
Mark the measuremenet for persistification.
@ PersistifyTrackParameters
Mark track parameters for persisitification.
static void splitToBitsets(const unsigned int long input, std::bitset< NumberOfTrackStateOnSurfaceTypes > &types, std::bitset< NumberOfPersistencyHints > &hints)
@ Unknown
For some reason this does not fall into any of the other categories PLEASE DO NOT USE THIS - DEPRECAT...
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
@ BremPoint
This represents a brem point on the track, and so will contain TrackParameters and MaterialEffectsBas...
@ Parameter
This TSOS contains a Trk::ParameterBase.
@ Alignment
This TSOS contains a Trk::AlignmentEffectsOnTrack.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ InertMaterial
This represents inert material, and so will contain MaterialEffectsBase.
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
@ Hole
A hole on the track - this is defined in the following way.
@ CaloDeposit
This TSOS contains a CaloEnergy object.
@ FitQuality
This TSOS contains a Trk::FitQualityOnSurface.
std::unique_ptr< AlignmentEffectsOnTrack > m_alignmentEffectsOnTrack
MaterialEffectsBase * materialEffectsOnTrack()
return material effects non-const overload
const MaterialEffectsBase * materialEffectsOnTrack() const
return material effects const overload
TrackParameters * trackParameters()
return ptr to trackparameters non-const overload
FitQualityOnSurface m_fitQualityOnSurface
const Trk::Surface & surface() const
return associated surface
const AlignmentEffectsOnTrack * alignmentEffectsOnTrack() const
return the the alignment effects const overload
Ensure that the ATLAS eigen extensions are properly loaded.
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
ParametersBase< TrackParametersDim, Charged > TrackParameters