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
21
22using namespace o2::ctf;
23using namespace o2::framework;
24
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
38{
40 h = mExtHeader;
41 }
42 // detector code may exten it by
43 // else {
44 // h.majorVersion = <A>;
45 // h.minorVersion = <B>;
46 // }
47}
48
50{
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 }
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
66bool 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
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}
Declarations for CTFCoderBase class (support of external dictionaries)
int32_t i
TBranch * ptr
Class for time synchronization of RawReader instances.
void updateTimeDependentParams(o2::framework::ProcessingContext &pc, bool askTree=false)
std::string mTrigOffsBinding
bool isTreeDictionary(const void *buff) const
void checkDictVersion(const CTFDictHeader &h) const
CTFDictHeader mExtHeader
void setFirstTFOrbit(uint32_t n)
virtual void assignDictVersion(CTFDictHeader &h) const
static constexpr const char * getName(ID id)
names of defined detectors
Definition DetID.h:145
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
pair of input and output size
Definition ANSHeader.h:25
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
Detector header base.
bool isValidDictTimeStamp() const
std::string asString() const