Project
Loading...
Searching...
No Matches
ProcessingHelpers.cxx
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
#include <string>
13
14
#include <fairmq/Device.h>
15
#include "
Headers/DataHeader.h
"
16
#include "
Framework/Logger.h
"
17
#include "
Framework/ProcessingContext.h
"
18
#include "
Framework/TimingInfo.h
"
19
#include "
Framework/RawDeviceService.h
"
20
#include "
Framework/DataRefUtils.h
"
21
#include "
Framework/InputRecord.h
"
22
#include "
Framework/ServiceRegistry.h
"
23
#include "
CommonConstants/LHCConstants.h
"
24
25
#include "
TPCWorkflow/ProcessingHelpers.h
"
26
27
using namespace
o2::framework
;
28
using namespace
o2::tpc
;
29
30
// taken from CTFWriterSpec, TODO: should this be put to some more general location?
31
uint64_t
processing_helpers::getRunNumber
(
ProcessingContext
& pc)
32
{
33
const
std::string NAStr =
"NA"
;
34
35
uint64_t run = 0;
36
const
auto
& tinfo = pc.
services
().
get
<
o2::framework::TimingInfo
>();
37
if
(tinfo.runNumber != 0) {
38
run = tinfo.
runNumber
;
39
}
40
// check runNumber with FMQ property, if set, override DH number
41
{
42
auto
runNStr = pc.
services
().
get
<
RawDeviceService
>().device()->fConfig->GetProperty<std::string>(
"runNumber"
, NAStr);
43
if
(runNStr != NAStr) {
44
size_t
nc = 0;
45
long
runNProp = 0;
46
try
{
47
runNProp = std::stol(runNStr, &nc);
48
}
catch
(...) {
49
nc = (size_t)-1;
// makes the next check fail if stol throws when it cannot parse the number
50
}
51
if
(nc != runNStr.size()) {
52
LOGP(error,
"Property runNumber={} is provided but is not a number, ignoring"
, runNStr);
53
}
else
{
54
run = runNProp;
55
}
56
}
57
}
58
59
return
run;
60
}
61
62
uint32_t
processing_helpers::getCurrentTF
(
o2::framework::ProcessingContext
& pc)
63
{
64
return
pc.
services
().
get
<
o2::framework::TimingInfo
>().tfCounter;
65
}
66
67
uint32_t
processing_helpers::getFirstTForbit
(
o2::framework::ProcessingContext
& pc)
68
{
69
return
pc.
services
().
get
<
o2::framework::TimingInfo
>().firstTForbit;
70
}
71
72
uint64_t
processing_helpers::getCreationTime
(
o2::framework::ProcessingContext
& pc)
73
{
74
return
pc.
services
().
get
<
o2::framework::TimingInfo
>().creation;
75
}
76
77
uint64_t
processing_helpers::getTimeStamp
(
o2::framework::ProcessingContext
& pc,
const
Long64_t orbitReset)
78
{
79
return
getTimeStamp
(orbitReset,
getFirstTForbit
(pc));
80
}
81
82
uint64_t
processing_helpers::getTimeStamp
(
const
Long64_t orbitReset,
const
uint32_t tfOrbitFirst)
83
{
84
const
long
tPrec = orbitReset + tfOrbitFirst *
o2::constants::lhc::LHCOrbitMUS
;
// microsecond-precise time stamp
85
return
tPrec;
86
}
87
88
uint64_t
processing_helpers::getTimeStamp
(
o2::framework::ProcessingContext
& pc)
89
{
90
return
getTimeStamp
(pc,
getOrbitReset
(pc));
91
}
92
93
Long64_t
processing_helpers::getOrbitReset
(
o2::framework::ProcessingContext
& pc)
94
{
95
auto
tv = pc.
inputs
().
get
<std::vector<Long64_t>*>(
"orbitreset"
);
96
const
auto
orbitReset = tv->front();
97
return
orbitReset;
98
}
DataHeader.h
DataRefUtils.h
InputRecord.h
LHCConstants.h
Header to collect LHC related constants.
Logger.h
ProcessingContext.h
ProcessingHelpers.h
RawDeviceService.h
ServiceRegistry.h
TimingInfo.h
o2::framework::InputRecord::get
decltype(auto) get(R binding, int part=0) const
Definition
InputRecord.h:248
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
o2::framework::ProcessingContext::inputs
InputRecord & inputs()
The inputs associated with this processing context.
Definition
ProcessingContext.h:37
o2::framework::ProcessingContext::services
ServiceRegistryRef services()
The services registry associated with this processing context.
Definition
ProcessingContext.h:39
o2::framework::RawDeviceService
Definition
RawDeviceService.h:28
o2::framework::ServiceRegistryRef::get
T & get() const
Definition
ServiceRegistryRef.h:85
o2::constants::lhc::LHCOrbitMUS
constexpr double LHCOrbitMUS
Definition
LHCConstants.h:37
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::tpc::processing_helpers::getCurrentTF
uint32_t getCurrentTF(o2::framework::ProcessingContext &pc)
Definition
ProcessingHelpers.cxx:62
o2::tpc::processing_helpers::getOrbitReset
Long64_t getOrbitReset(o2::framework::ProcessingContext &pc)
Definition
ProcessingHelpers.cxx:93
o2::tpc::processing_helpers::getFirstTForbit
uint32_t getFirstTForbit(o2::framework::ProcessingContext &pc)
Definition
ProcessingHelpers.cxx:67
o2::tpc::processing_helpers::getTimeStamp
uint64_t getTimeStamp(o2::framework::ProcessingContext &pc)
Definition
ProcessingHelpers.cxx:88
o2::tpc::processing_helpers::getRunNumber
uint64_t getRunNumber(o2::framework::ProcessingContext &pc)
Definition
ProcessingHelpers.cxx:31
o2::tpc::processing_helpers::getCreationTime
uint64_t getCreationTime(o2::framework::ProcessingContext &pc)
Definition
ProcessingHelpers.cxx:72
o2::tpc
Global TPC definitions and constants.
Definition
SimTraits.h:167
o2::framework::TimingInfo
Definition
TimingInfo.h:24
o2::framework::TimingInfo::runNumber
uint32_t runNumber
Definition
TimingInfo.h:33
Detectors
TPC
workflow
src
ProcessingHelpers.cxx
Generated on Tue Feb 25 2025 23:16:31 for Project by
1.9.8