Project
Loading...
Searching...
No Matches
CTFCoderBase.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
15
16
#include "
DetectorsBase/CTFCoderBase.h
"
17
#include "
Framework/ControlService.h
"
18
#include "
Framework/ProcessingContext.h
"
19
#include "
Framework/InputRecord.h
"
20
#include "
Framework/TimingInfo.h
"
21
22
using namespace
o2::ctf
;
23
using namespace
o2::framework
;
24
25
void
CTFCoderBase::checkDictVersion
(
const
CTFDictHeader
&
h
)
const
26
{
27
if
(
h
.isValidDictTimeStamp()) {
// external dictionary was used
28
if
(
h
.isValidDictTimeStamp() &&
h
!=
mExtHeader
) {
29
throw
std::runtime_error(fmt::format(
"Mismatch in {} CTF dictionary: need {}, provided {}"
,
mDet
.
getName
(),
h
.asString(),
mExtHeader
.
asString
()));
30
}
31
}
32
}
33
34
// Assign version of the dictionary which will be stored in the data (including dictionary data during dictionary creation)
35
// In case detector CTFCoder uses non-defaul dict. version, it should redefine this method in order to assign the version
36
// it needs ONLY when the external dictionary is not provided
37
void
CTFCoderBase::assignDictVersion
(
CTFDictHeader
&
h
)
const
38
{
39
if
(
mExtHeader
.
isValidDictTimeStamp
()) {
40
h
=
mExtHeader
;
41
}
42
// detector code may exten it by
43
// else {
44
// h.majorVersion = <A>;
45
// h.minorVersion = <B>;
46
// }
47
}
48
49
void
CTFCoderBase::updateTimeDependentParams
(
ProcessingContext
& pc,
bool
askTree)
50
{
51
setFirstTFOrbit
(pc.
services
().
get
<
o2::framework::TimingInfo
>().
firstTForbit
);
52
if
(pc.
services
().
get
<
o2::framework::TimingInfo
>().
globalRunNumberChanged
) {
// this params need to be queried only once
53
if
(
mOpType
==
OpType::Decoder
) {
54
pc.
inputs
().
get
<
o2::ctp::TriggerOffsetsParam
*>(
mTrigOffsBinding
);
// this is a configurable param
55
}
56
if
(
mLoadDictFromCCDB
) {
57
if
(askTree) {
58
pc.
inputs
().
get
<TTree*>(
mDictBinding
);
// just to trigger the finaliseCCDB
59
}
else
{
60
pc.
inputs
().
get
<std::vector<char>*>(
mDictBinding
);
// just to trigger the finaliseCCDB
61
}
62
}
63
}
64
}
65
66
bool
CTFCoderBase::isTreeDictionary
(
const
void
* buff)
const
67
{
68
// heuristic check for the dictionary being a tree
69
const
char
* patt[] = {
"ccdb_object"
,
"ctf_dictionary"
};
70
const
char
*
ptr
=
reinterpret_cast<
const
char
*
>
(buff);
71
bool
found =
false
;
72
int
i
= 0, np =
sizeof
(patt) /
sizeof
(
char
*);
73
while
(
i
< 50 && !found) {
74
for
(
int
ip = 0; ip < np; ip++) {
75
const
auto
*p = patt[ip], *s = &
ptr
[
i
];
76
while
(*p && *s == *p) {
77
p++;
78
s++;
79
}
80
if
(!*p) {
81
found =
true
;
82
break
;
83
}
84
}
85
i
++;
86
}
87
return
found;
88
}
89
90
void
CTFCoderBase::reportIRFrames
()
91
{
92
static
bool
repDone =
false
;
93
if
(!repDone) {
94
LOGP(info,
"IRFrames will be selected with shift {}, forward {} margin and backward {} margin (in BCs)"
,
mIRFrameSelShift
,
mIRFrameSelMarginBwd
,
mIRFrameSelMarginFwd
);
95
repDone =
true
;
96
}
97
}
CTFCoderBase.h
Declarations for CTFCoderBase class (support of external dictionaries)
ControlService.h
i
int32_t i
Definition
GPUCommonAlgorithm.h:443
InputRecord.h
ProcessingContext.h
ptr
TBranch * ptr
Definition
TTreePlugin.cxx:832
TimingInfo.h
h
Class for time synchronization of RawReader instances.
o2::ctf::CTFCoderBase::mDictBinding
std::string mDictBinding
Definition
CTFCoderBase.h:192
o2::ctf::CTFCoderBase::updateTimeDependentParams
void updateTimeDependentParams(o2::framework::ProcessingContext &pc, bool askTree=false)
Definition
CTFCoderBase.cxx:49
o2::ctf::CTFCoderBase::mIRFrameSelMarginFwd
size_t mIRFrameSelMarginFwd
Definition
CTFCoderBase.h:204
o2::ctf::CTFCoderBase::reportIRFrames
void reportIRFrames()
Definition
CTFCoderBase.cxx:90
o2::ctf::CTFCoderBase::mOpType
OpType mOpType
Definition
CTFCoderBase.h:199
o2::ctf::CTFCoderBase::mTrigOffsBinding
std::string mTrigOffsBinding
Definition
CTFCoderBase.h:193
o2::ctf::CTFCoderBase::isTreeDictionary
bool isTreeDictionary(const void *buff) const
Definition
CTFCoderBase.cxx:66
o2::ctf::CTFCoderBase::mIRFrameSelShift
long mIRFrameSelShift
Definition
CTFCoderBase.h:205
o2::ctf::CTFCoderBase::mDet
DetID mDet
Definition
CTFCoderBase.h:191
o2::ctf::CTFCoderBase::checkDictVersion
void checkDictVersion(const CTFDictHeader &h) const
Definition
CTFCoderBase.cxx:25
o2::ctf::CTFCoderBase::mLoadDictFromCCDB
bool mLoadDictFromCCDB
Definition
CTFCoderBase.h:197
o2::ctf::CTFCoderBase::mExtHeader
CTFDictHeader mExtHeader
Definition
CTFCoderBase.h:194
o2::ctf::CTFCoderBase::mIRFrameSelMarginBwd
size_t mIRFrameSelMarginBwd
Definition
CTFCoderBase.h:203
o2::ctf::CTFCoderBase::OpType::Decoder
@ Decoder
o2::ctf::CTFCoderBase::setFirstTFOrbit
void setFirstTFOrbit(uint32_t n)
Definition
CTFCoderBase.h:150
o2::ctf::CTFCoderBase::assignDictVersion
virtual void assignDictVersion(CTFDictHeader &h) const
Definition
CTFCoderBase.cxx:37
o2::detectors::DetID::getName
static constexpr const char * getName(ID id)
names of defined detectors
Definition
DetID.h:145
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::ServiceRegistryRef::get
T & get() const
Definition
ServiceRegistryRef.h:85
o2::ctf
pair of input and output size
Definition
ANSHeader.h:25
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::ctf::CTFDictHeader
Detector header base.
Definition
CTFDictHeader.h:29
o2::ctf::CTFDictHeader::isValidDictTimeStamp
bool isValidDictTimeStamp() const
Definition
CTFDictHeader.h:35
o2::ctf::CTFDictHeader::asString
std::string asString() const
Definition
CTFDictHeader.cxx:23
o2::ctp::TriggerOffsetsParam
Definition
TriggerOffsetsParam.h:24
o2::framework::TimingInfo
Definition
TimingInfo.h:24
o2::framework::TimingInfo::firstTForbit
uint32_t firstTForbit
Definition
TimingInfo.h:31
o2::framework::TimingInfo::globalRunNumberChanged
bool globalRunNumberChanged
Definition
TimingInfo.h:38
Detectors
Base
src
CTFCoderBase.cxx
Generated on Tue Feb 25 2025 17:02:54 for Project by
1.9.8