Skip to content

Commit 00fde1d

Browse files
shahor02f3sch
authored andcommitted
Adapt ITS/MFT CTF machinery to staggered data
1 parent 5941b66 commit 00fde1d

File tree

65 files changed

+480
-285
lines changed

Some content is hidden

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

65 files changed

+480
-285
lines changed

DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "ReconstructionDataFormats/TrackMCHMID.h"
3535
#include "DataFormatsITSMFT/TrkClusRef.h"
3636
#include "DataFormatsITSMFT/TopologyDictionary.h"
37-
#include "ITSMFTBase/DPLAlpideParam.h"
37+
#include "DataFormatsITSMFT/DPLAlpideParam.h"
3838
// FIXME: ideally, the data formats definition should be independent of the framework
3939
// collectData is using the input of ProcessingContext to extract the first valid
4040
// header and the TF orbit from it

DataFormats/Detectors/ITSMFT/common/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ o2_add_library(DataFormatsITSMFT
2020
src/TopologyDictionary.cxx
2121
src/TimeDeadMap.cxx
2222
src/CTF.cxx
23+
src/DPLAlpideParam.cxx
2324
PUBLIC_LINK_LIBRARIES O2::ITSMFTBase
25+
O2::DetectorsCommonDataFormats
2426
O2::ReconstructionDataFormats
27+
O2::CommonUtils
2528
Microsoft.GSL::GSL)
2629

2730
o2_target_root_dictionary(DataFormatsITSMFT
2831
HEADERS include/DataFormatsITSMFT/ROFRecord.h
2932
include/DataFormatsITSMFT/Digit.h
33+
include/DataFormatsITSMFT/DPLAlpideParam.h
3034
include/DataFormatsITSMFT/GBTCalibData.h
3135
include/DataFormatsITSMFT/NoiseMap.h
3236
include/DataFormatsITSMFT/TimeDeadMap.h

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ struct CTFHeader : public o2::ctf::CTFDictHeader {
3636
uint32_t nPatternBytes = 0; /// number of bytes for explict patterns
3737
uint32_t firstOrbit = 0; /// 1st orbit of TF
3838
uint16_t firstBC = 0; /// 1st BC of TF
39-
ClassDefNV(CTFHeader, 2);
39+
uint8_t maxStreams = 1; /// Number of streams per TF (== NLayers for staggered ITS/MFT readout, 1 for non-staggered one)
40+
uint8_t streamID = 0; /// ID of the stream (0:maxStreams-1)
41+
ClassDefNV(CTFHeader, 3);
4042
};
4143

4244
/// Compressed but not yet entropy-encoded clusters

Detectors/ITSMFT/common/base/include/ITSMFTBase/DPLAlpideParam.h renamed to DataFormats/Detectors/ITSMFT/common/include/DataFormatsITSMFT/DPLAlpideParam.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#ifndef ALICEO2_ITSMFTDPLBASEPARAM_H_
13-
#define ALICEO2_ITSMFTDPLBASEPARAM_H_
12+
#ifndef ALICEO2_ITSMFTALPIDEPARAM_H_
13+
#define ALICEO2_ITSMFTALPIDEPARAM_H_
1414

1515
#include "DetectorsCommonDataFormats/DetID.h"
1616
#include "CommonUtils/ConfigurableParam.h"

Detectors/ITSMFT/common/base/src/DPLAlpideParam.cxx renamed to DataFormats/Detectors/ITSMFT/common/src/DPLAlpideParam.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include "ITSMFTBase/DPLAlpideParam.h"
12+
#include "DataFormatsITSMFT/DPLAlpideParam.h"
1313

1414
namespace o2
1515
{

DataFormats/Detectors/ITSMFT/common/src/ITSMFTDataFormatsLinkDef.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
#pragma link off all classes;
1616
#pragma link off all functions;
1717

18+
#pragma link C++ class o2::itsmft::DPLAlpideParam < o2::detectors::DetID::ITS> + ;
19+
#pragma link C++ class o2::itsmft::DPLAlpideParam < o2::detectors::DetID::MFT> + ;
20+
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::itsmft::DPLAlpideParam < o2::detectors::DetID::ITS>> + ;
21+
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::itsmft::DPLAlpideParam < o2::detectors::DetID::MFT>> + ;
22+
1823
#pragma link C++ class o2::itsmft::Digit + ;
1924
#pragma link C++ class o2::itsmft::NoiseMap + ;
2025
#pragma link C++ class o2::itsmft::TimeDeadMap + ;

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#include "GlobalTracking/MatchGlobalFwd.h"
6161
#include "MCHTracking/TrackExtrap.h"
6262
#include "MCHTracking/TrackParam.h"
63-
#include "ITSMFTBase/DPLAlpideParam.h"
63+
#include "DataFormatsITSMFT/DPLAlpideParam.h"
6464
#include "DetectorsVertexing/PVertexerParams.h"
6565
#include "ReconstructionDataFormats/GlobalFwdTrack.h"
6666
#include "ReconstructionDataFormats/GlobalTrackID.h"

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#include "DataFormatsTPC/ClusterNative.h"
6565
#include "DataFormatsTPC/WorkflowHelper.h"
6666
#include "ITSBase/GeometryTGeo.h"
67-
#include "ITSMFTBase/DPLAlpideParam.h"
67+
#include "DataFormatsITSMFT/DPLAlpideParam.h"
6868
*/
6969

7070
using namespace o2::framework;

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 coder(o2::ctf::CTFCoderBase::OpType::Encoder, o2::detectors::DetID::ITS);
84+
CTFCoder<o2::detectors::DetID::ITS> coder(o2::ctf::CTFCoderBase::OpType::Encoder);
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 coder(o2::ctf::CTFCoderBase::OpType::Decoder, o2::detectors::DetID::ITS);
123+
CTFCoder<o2::detectors::DetID::ITS> coder(o2::ctf::CTFCoderBase::OpType::Decoder);
124124
coder.decode(ctfImage, rofRecVecD, cclusVecD, pattVecD, nullptr, clPattLookup); // decompress
125125
}
126126
sw.Stop();

Detectors/CTF/workflow/src/CTFReaderSpec.cxx

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "CommonUtils/NameConf.h"
3636
#include "DetectorsCommonDataFormats/CTFHeader.h"
3737
#include "Headers/STFHeader.h"
38+
#include "DataFormatsITSMFT/DPLAlpideParam.h"
3839
#include "DataFormatsITSMFT/CTF.h"
3940
#include "DataFormatsTPC/CTF.h"
4041
#include "DataFormatsTRD/CTF.h"
@@ -188,6 +189,50 @@ void CTFReaderSpec::init(InitContext& ic)
188189
}
189190
}
190191

192+
///_______________________________________
193+
template <>
194+
void CTFReaderSpec::processDetector<o2::itsmft::CTF>(DetID det, const CTFHeader& ctfHeader, ProcessingContext& pc) const
195+
{
196+
if (mInput.detMask[det]) {
197+
std::string lbl = det.getName();
198+
int nLayers = 1;
199+
if (det == DetID::ITS) {
200+
const auto& par = o2::itsmft::DPLAlpideParam<DetID::ITS>::Instance();
201+
nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
202+
} else if (det == DetID::MFT) {
203+
const auto& par = o2::itsmft::DPLAlpideParam<DetID::MFT>::Instance();
204+
nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
205+
} else {
206+
LOGP(fatal, "This specialization is define only for ITS and MFT detectors, {} provided", det.getName());
207+
}
208+
for (int iLayer = 0; iLayer < nLayers; iLayer++) {
209+
auto& bufVec = pc.outputs().make<std::vector<o2::ctf::BufferType>>({lbl, mInput.subspec * 100 + iLayer}, ctfHeader.detectors[det] ? sizeof(o2::itsmft::CTF) : 0);
210+
if (ctfHeader.detectors[det]) {
211+
auto brName = nLayers == 1 ? lbl : fmt::format("{}_{}", lbl, iLayer);
212+
o2::itsmft::CTF::readFromTree(bufVec, *(mCTFTree.get()), brName, mCurrTreeEntry);
213+
} else if (!mInput.allowMissingDetectors) {
214+
throw std::runtime_error(fmt::format("Requested detector {} is missing in the CTF", lbl));
215+
}
216+
}
217+
}
218+
}
219+
220+
///_______________________________________
221+
template <typename C>
222+
void CTFReaderSpec::processDetector(DetID det, const CTFHeader& ctfHeader, ProcessingContext& pc) const
223+
{
224+
if (mInput.detMask[det]) {
225+
const auto lbl = det.getName();
226+
auto& bufVec = pc.outputs().make<std::vector<o2::ctf::BufferType>>({lbl, mInput.subspec}, ctfHeader.detectors[det] ? sizeof(C) : 0);
227+
if (ctfHeader.detectors[det]) {
228+
C::readFromTree(bufVec, *(mCTFTree.get()), lbl, mCurrTreeEntry);
229+
} else if (!mInput.allowMissingDetectors) {
230+
throw std::runtime_error(fmt::format("Requested detector {} is missing in the CTF", lbl));
231+
}
232+
// setMessageHeader(pc, ctfHeader, lbl);
233+
}
234+
}
235+
191236
void CTFReaderSpec::runTimeRangesToIRFrameSelector(const o2::framework::TimingInfo& timingInfo)
192237
{
193238
// convert entries in the runTimeRanges to IRFrameSelector, if needed, convert time to orbit
@@ -562,22 +607,6 @@ void CTFReaderSpec::setMessageHeader(ProcessingContext& pc, const CTFHeader& ctf
562607
dph->creation = ctfHeader.creationTime;
563608
}
564609

565-
///_______________________________________
566-
template <typename C>
567-
void CTFReaderSpec::processDetector(DetID det, const CTFHeader& ctfHeader, ProcessingContext& pc) const
568-
{
569-
if (mInput.detMask[det]) {
570-
const auto lbl = det.getName();
571-
auto& bufVec = pc.outputs().make<std::vector<o2::ctf::BufferType>>({lbl, mInput.subspec}, ctfHeader.detectors[det] ? sizeof(C) : 0);
572-
if (ctfHeader.detectors[det]) {
573-
C::readFromTree(bufVec, *(mCTFTree.get()), lbl, mCurrTreeEntry);
574-
} else if (!mInput.allowMissingDetectors) {
575-
throw std::runtime_error(fmt::format("Requested detector {} is missing in the CTF", lbl));
576-
}
577-
// setMessageHeader(pc, ctfHeader, lbl);
578-
}
579-
}
580-
581610
///_______________________________________
582611
void CTFReaderSpec::tryToFixCTFHeader(CTFHeader& ctfHeader) const
583612
{
@@ -636,7 +665,21 @@ DataProcessorSpec getCTFReaderSpec(const CTFReaderInp& inp)
636665
for (auto id = DetID::First; id <= DetID::Last; id++) {
637666
if (inp.detMask[id]) {
638667
DetID det(id);
639-
outputs.emplace_back(OutputLabel{det.getName()}, det.getDataOrigin(), "CTFDATA", inp.subspec, Lifetime::Timeframe);
668+
if (det == DetID::ITS) {
669+
const auto& par = o2::itsmft::DPLAlpideParam<DetID::ITS>::Instance();
670+
uint32_t nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
671+
for (uint32_t iLayer = 0; iLayer < nLayers; iLayer++) {
672+
outputs.emplace_back(OutputLabel{det.getName()}, det.getDataOrigin(), "CTFDATA", inp.subspec * 100 + iLayer, Lifetime::Timeframe);
673+
}
674+
} else if (det == DetID::MFT) {
675+
const auto& par = o2::itsmft::DPLAlpideParam<DetID::MFT>::Instance();
676+
uint32_t nLayers = par.supportsStaggering() ? par.getNLayers() : 1;
677+
for (uint32_t iLayer = 0; iLayer < nLayers; iLayer++) {
678+
outputs.emplace_back(OutputLabel{det.getName()}, det.getDataOrigin(), "CTFDATA", inp.subspec * 100 + iLayer, Lifetime::Timeframe);
679+
}
680+
} else {
681+
outputs.emplace_back(OutputLabel{det.getName()}, det.getDataOrigin(), "CTFDATA", inp.subspec, Lifetime::Timeframe);
682+
}
640683
}
641684
}
642685
if (!inp.fileIRFrames.empty() || !inp.fileRunTimeSpans.empty()) {

0 commit comments

Comments
 (0)