Skip to content

Commit 00e49d9

Browse files
committed
ITSMFT: runtime staggering option
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 7e038b4 commit 00e49d9

File tree

56 files changed

+549
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+549
-348
lines changed

DataFormats/Detectors/ITSMFT/common/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
1+
# Copyright 2019-2026 CERN and copyright holders of ALICE O2.
22
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
33
# All rights not expressly granted are reserved.
44
#
@@ -21,6 +21,7 @@ o2_add_library(DataFormatsITSMFT
2121
src/TimeDeadMap.cxx
2222
src/CTF.cxx
2323
src/DPLAlpideParam.cxx
24+
src/DPLAlpideParamInitializer.cxx
2425
PUBLIC_LINK_LIBRARIES O2::ITSMFTBase
2526
O2::DetectorsCommonDataFormats
2627
O2::ReconstructionDataFormats

DataFormats/Detectors/ITSMFT/common/include/DataFormatsITSMFT/DPLAlpideParam.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ struct DPLAlpideParam : public o2::conf::ConfigurableParamHelper<DPLAlpideParam<
4646
int roFrameLayerBiasInBC[getNLayers()] = {}; ///< staggering ROF bias in BC for continuous mode per layer
4747
int roFrameLayerDelayInBC[getNLayers()] = {}; ///< staggering ROF delay in BC for continuous mode per layer
4848

49-
static constexpr bool supportsStaggering() noexcept { return (N == o2::detectors::DetID::ITS) ? true : false; }
50-
5149
// get ROF length for any layer
5250
int getROFLengthInBC(int layer) const noexcept { return roFrameLayerLengthInBC[layer] ? roFrameLayerLengthInBC[layer] : roFrameLengthInBC; }
5351
int getROFBiasInBC(int layer) const noexcept { return roFrameLayerBiasInBC[layer] ? roFrameLayerBiasInBC[layer] : roFrameBiasInBC; }
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2019-2026 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_ITSMFTALPIDEPARAM_INITIALIZER_H_
13+
#define ALICEO2_ITSMFTALPIDEPARAM_INITIALIZER_H_
14+
#include <vector>
15+
16+
namespace o2
17+
{
18+
namespace framework
19+
{
20+
class ConfigParamSpec;
21+
class ConfigContext;
22+
} // namespace framework
23+
namespace itsmft
24+
{
25+
26+
struct DPLAlpideParamInitializer {
27+
static constexpr char stagITSOpt[] = "enable-its-staggering";
28+
static constexpr char stagMFTOpt[] = "enable-mft-staggering";
29+
static constexpr bool stagDef = false;
30+
31+
// DPL workflow options for staggering
32+
static void addConfigOption(std::vector<o2::framework::ConfigParamSpec>& opts);
33+
static void addITSConfigOption(std::vector<o2::framework::ConfigParamSpec>& opts);
34+
static bool isITSStaggeringEnabled(o2::framework::ConfigContext const& cfgc);
35+
static void addMFTConfigOption(std::vector<o2::framework::ConfigParamSpec>& opts);
36+
static bool isMFTStaggeringEnabled(o2::framework::ConfigContext const& cfgc);
37+
};
38+
39+
} // namespace itsmft
40+
} // namespace o2
41+
42+
#endif
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
1+
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
22
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
33
// All rights not expressly granted are reserved.
44
//
@@ -11,13 +11,10 @@
1111

1212
#include "DataFormatsITSMFT/DPLAlpideParam.h"
1313

14-
namespace o2
15-
{
16-
namespace itsmft
14+
namespace o2::itsmft
1715
{
1816
// this makes sure that the constructor of the parameters is statically called
1917
// so that these params are part of the parameter database
2018
static auto& sAlpideParamITS = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
2119
static auto& sAlpideParamMFT = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::MFT>::Instance();
22-
} // namespace itsmft
23-
} // namespace o2
20+
} // namespace o2::itsmft
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2019-2026 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 "DataFormatsITSMFT/DPLAlpideParamInitializer.h"
13+
#include "Framework/ConfigParamsHelper.h"
14+
#include "Framework/ConfigParamSpec.h"
15+
#include "Framework/ConfigContext.h"
16+
17+
namespace o2::itsmft
18+
{
19+
20+
void DPLAlpideParamInitializer::addConfigOption(std::vector<o2::framework::ConfigParamSpec>& opts)
21+
{
22+
addITSConfigOption(opts);
23+
addMFTConfigOption(opts);
24+
}
25+
26+
void DPLAlpideParamInitializer::addITSConfigOption(std::vector<o2::framework::ConfigParamSpec>& opts)
27+
{
28+
o2::framework::ConfigParamsHelper::addOptionIfMissing(opts, {stagITSOpt, o2::framework::VariantType::Bool, stagDef, {"enable per layer ITS in&out-put for staggered readout"}});
29+
}
30+
31+
void DPLAlpideParamInitializer::addMFTConfigOption(std::vector<o2::framework::ConfigParamSpec>& opts)
32+
{
33+
o2::framework::ConfigParamsHelper::addOptionIfMissing(opts, {stagMFTOpt, o2::framework::VariantType::Bool, stagDef, {"enable per layer MFT in&out-put for staggered readout"}});
34+
}
35+
36+
bool DPLAlpideParamInitializer::isITSStaggeringEnabled(const o2::framework::ConfigContext& cfgc)
37+
{
38+
return cfgc.options().get<bool>(stagITSOpt);
39+
}
40+
41+
bool DPLAlpideParamInitializer::isMFTStaggeringEnabled(const o2::framework::ConfigContext& cfgc)
42+
{
43+
return cfgc.options().get<bool>(stagMFTOpt);
44+
}
45+
46+
} // namespace o2::itsmft

Detectors/CTF/test/test_ctf_io_itsmft.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ BOOST_DATA_TEST_CASE(CompressedClustersTest, boost_data::make(ANSVersions), ansV
8181
sw.Start();
8282
std::vector<o2::ctf::BufferType> vec;
8383
{
84-
CTFCoder<o2::detectors::DetID::ITS> coder(o2::ctf::CTFCoderBase::OpType::Encoder);
84+
CTFCoder<o2::detectors::DetID::ITS> coder(o2::ctf::CTFCoderBase::OpType::Encoder, false);
8585
coder.setANSVersion(ansVersion);
8686
coder.encode(vec, rofRecVec, cclusVec, pattVec, pattIdConverter, 0); // compress
8787
}
@@ -120,7 +120,7 @@ BOOST_DATA_TEST_CASE(CompressedClustersTest, boost_data::make(ANSVersions), ansV
120120
sw.Start();
121121
const auto ctfImage = o2::itsmft::CTF::getImage(vec.data());
122122
{
123-
CTFCoder<o2::detectors::DetID::ITS> coder(o2::ctf::CTFCoderBase::OpType::Decoder);
123+
CTFCoder<o2::detectors::DetID::ITS> coder(o2::ctf::CTFCoderBase::OpType::Decoder, false);
124124
coder.decode(ctfImage, rofRecVecD, cclusVecD, pattVecD, nullptr, clPattLookup); // decompress
125125
}
126126
sw.Stop();

Detectors/CTF/workflow/include/CTFWorkflow/CTFReaderSpec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ struct CTFReaderInp {
5050
int tfRateLimit = -999;
5151
size_t minSHM = 0;
5252
bool shuffle{false};
53+
bool doITSStaggering = false;
54+
bool doMFTStaggering = false;
5355
};
5456

5557
/// create a processor spec

Detectors/CTF/workflow/include/CTFWorkflow/CTFWriterSpec.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,23 @@
1515
#define O2_CTFWRITER_SPEC
1616

1717
#include "Framework/DataProcessorSpec.h"
18-
#include "Framework/Task.h"
1918
#include "DetectorsCommonDataFormats/DetID.h"
2019

2120
namespace o2
2221
{
2322
namespace ctf
2423
{
24+
struct CTFWriterInp {
25+
o2::detectors::DetID::mask_t detMask = o2::detectors::DetID::FullMask;
26+
int verbosity = 0;
27+
int reportInterval = 200;
28+
std::string outType = "";
29+
bool doITSStaggering = false;
30+
bool doMFTStaggering = false;
31+
};
2532

2633
/// create a processor spec
27-
framework::DataProcessorSpec getCTFWriterSpec(o2::detectors::DetID::mask_t dets, const std::string& outType, int verbosity, int reportInterval);
34+
framework::DataProcessorSpec getCTFWriterSpec(const o2::ctf::CTFWriterInp& inp);
2835

2936
} // namespace ctf
3037
} // namespace o2

Detectors/CTF/workflow/src/CTFReaderSpec.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,9 @@ void CTFReaderSpec::processDetector<o2::itsmft::CTF>(DetID det, const CTFHeader&
197197
std::string lbl = det.getName();
198198
int nLayers = 1;
199199
if (det == DetID::ITS) {
200-
const auto& par = o2::itsmft::DPLAlpideParam<DetID::ITS>::Instance();
201-
nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
200+
nLayers = mInput.doITSStaggering ? o2::itsmft::DPLAlpideParam<DetID::ITS>::getNLayers() : 1;
202201
} else if (det == DetID::MFT) {
203-
const auto& par = o2::itsmft::DPLAlpideParam<DetID::MFT>::Instance();
204-
nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
202+
nLayers = mInput.doMFTStaggering ? o2::itsmft::DPLAlpideParam<DetID::MFT>::getNLayers() : 1;
205203
} else {
206204
LOGP(fatal, "This specialization is define only for ITS and MFT detectors, {} provided", det.getName());
207205
}
@@ -666,14 +664,12 @@ DataProcessorSpec getCTFReaderSpec(const CTFReaderInp& inp)
666664
if (inp.detMask[id]) {
667665
DetID det(id);
668666
if (det == DetID::ITS) {
669-
const auto& par = o2::itsmft::DPLAlpideParam<DetID::ITS>::Instance();
670-
uint32_t nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
667+
uint32_t nLayers = inp.doITSStaggering ? o2::itsmft::DPLAlpideParam<DetID::ITS>::getNLayers() : 1;
671668
for (uint32_t iLayer = 0; iLayer < nLayers; iLayer++) {
672669
outputs.emplace_back(OutputLabel{det.getName()}, det.getDataOrigin(), "CTFDATA", inp.subspec * 100 + iLayer, Lifetime::Timeframe);
673670
}
674671
} else if (det == DetID::MFT) {
675-
const auto& par = o2::itsmft::DPLAlpideParam<DetID::MFT>::Instance();
676-
uint32_t nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
672+
uint32_t nLayers = inp.doMFTStaggering ? o2::itsmft::DPLAlpideParam<DetID::MFT>::getNLayers() : 1;
677673
for (uint32_t iLayer = 0; iLayer < nLayers; iLayer++) {
678674
outputs.emplace_back(OutputLabel{det.getName()}, det.getDataOrigin(), "CTFDATA", inp.subspec * 100 + iLayer, Lifetime::Timeframe);
679675
}

0 commit comments

Comments
 (0)