Skip to content

Commit 353a5ec

Browse files
committed
Make assignHeaderVersion virtual to allow to detector to change version
1 parent 8d37ba8 commit 353a5ec

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Detectors/Base/include/DetectorsBase/CTFCoderBase.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class CTFCoderBase
5757

5858
virtual void createCoders(const std::vector<char>& bufVec, o2::ctf::CTFCoderBase::OpType op) = 0;
5959

60+
// detector coder need to redefine this method if uses no default version, see comment in the cxx file
61+
virtual void assignDictVersion(CTFDictHeader& h) const;
62+
6063
template <typename CTF>
6164
std::vector<char> readDictionaryFromFile(const std::string& dictPath, bool mayFail = false);
6265

@@ -112,12 +115,6 @@ class CTFCoderBase
112115

113116
protected:
114117
std::string getPrefix() const { return o2::utils::Str::concat_string(mDet.getName(), "_CTF: "); }
115-
void assignDictVersion(CTFDictHeader& h) const
116-
{
117-
if (mExtHeader.isValidDictTimeStamp()) {
118-
h = mExtHeader;
119-
}
120-
}
121118

122119
void checkDictVersion(const CTFDictHeader& h) const;
123120

Detectors/Base/src/CTFCoderBase.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ void CTFCoderBase::checkDictVersion(const CTFDictHeader& h) const
3030
}
3131
}
3232

33+
// Assign version of the dictionary which will be stored in the data (including dictionary data during dictionary creation)
34+
// In case detector CTFCoder uses non-defaul dict. version, it should redefine this method in order to assign the version
35+
// it needs ONLY when the external dictionary is not provided
36+
void CTFCoderBase::assignDictVersion(CTFDictHeader& h) const
37+
{
38+
if (mExtHeader.isValidDictTimeStamp()) {
39+
h = mExtHeader;
40+
}
41+
// detector code may exten it by
42+
// else {
43+
// h.majorVersion = <A>;
44+
// h.minorVersion = <B>;
45+
// }
46+
}
47+
3348
void CTFCoderBase::updateTimeDependentParams(ProcessingContext& pc)
3449
{
3550
if (mLoadDictFromCCDB) {

0 commit comments

Comments
 (0)