Project
Loading...
Searching...
No Matches
TimeStamp.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef ALICEO2_COMMON_TIMESTAMP_H
13#define ALICEO2_COMMON_TIMESTAMP_H
14
15#include "GPUCommonRtypes.h"
16#include "GPUCommonDef.h"
17
18namespace o2
19{
20namespace dataformats
21{
22// A minimal TimeStamp class for simulation in the spirit of FairTimeStamp
23// but without having FairLinks attached
24template <typename T>
26{
27 public:
28 GPUhdDefault() TimeStamp() = default;
29 GPUhdDefault() ~TimeStamp() = default;
30 GPUdi() TimeStamp(T time) { mTimeStamp = time; }
31 GPUhdi() T getTimeStamp() const { return mTimeStamp; }
32 GPUdi() void setTimeStamp(T t) { mTimeStamp = t; }
33 GPUdi() bool operator==(const TimeStamp<T>& t) const { return mTimeStamp == t.mTimeStamp; }
34
35 private:
36 T mTimeStamp = 0;
38};
39
40template <typename T, typename E>
42{
43 public:
45 GPUd() TimeStampWithError(T t, E te) : TimeStamp<T>(t), mTimeStampError(te) {}
46 GPUdi() E getTimeStampError() const { return mTimeStampError; }
47 GPUdi() E getTimeStampError2() const { return mTimeStampError * mTimeStampError; }
48 GPUdi() void setTimeStampError(E te) { mTimeStampError = te; }
49
50 private:
51 E mTimeStampError = 0;
52 ClassDefNV(TimeStampWithError, 1);
53};
54
55#ifndef GPUCA_GPUCODE
56template <typename T>
57std::ostream& operator<<(std::ostream& os, const TimeStamp<T>& t)
58{
59 // stream itself
60 os << t.getTimeStamp();
61 return os;
62}
63
64template <typename T, typename E>
65std::ostream& operator<<(std::ostream& os, const TimeStampWithError<T, E>& t)
66{
67 // stream itself
68 os << t.getTimeStamp() << " +/- " << t.getTimeStampError();
69 return os;
70}
71#endif
72} // namespace dataformats
73} // namespace o2
74
75#endif /* ALICEO2_COMMON_TIMESTAMP_H */
int16_t time
Definition RawEventData.h:4
GPUdi() void setTimeStampError(E te)
Definition TimeStamp.h:48
GPUdi() E getTimeStampError2() const
Definition TimeStamp.h:47
GPUdDefault() TimeStampWithError()=default
GPUdi() E getTimeStampError() const
Definition TimeStamp.h:46
GPUd() TimeStampWithError(T t
GPUhdi() T getTimeStamp() const
Definition TimeStamp.h:31
GPUdi() void setTimeStamp(T t)
Definition TimeStamp.h:32
GPUdi() TimeStamp(T time)
Definition TimeStamp.h:30
GPUhdDefault() TimeStamp()=default
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
std::ostream & operator<<(std::ostream &os, const o2::dataformats::MeanVertexObject &o)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...