|
35 | 35 | #include "CommonUtils/NameConf.h" |
36 | 36 | #include "DetectorsCommonDataFormats/CTFHeader.h" |
37 | 37 | #include "Headers/STFHeader.h" |
| 38 | +#include "DataFormatsITSMFT/DPLAlpideParam.h" |
38 | 39 | #include "DataFormatsITSMFT/CTF.h" |
39 | 40 | #include "DataFormatsTPC/CTF.h" |
40 | 41 | #include "DataFormatsTRD/CTF.h" |
@@ -188,6 +189,50 @@ void CTFReaderSpec::init(InitContext& ic) |
188 | 189 | } |
189 | 190 | } |
190 | 191 |
|
| 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 | + |
191 | 236 | void CTFReaderSpec::runTimeRangesToIRFrameSelector(const o2::framework::TimingInfo& timingInfo) |
192 | 237 | { |
193 | 238 | // 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 |
562 | 607 | dph->creation = ctfHeader.creationTime; |
563 | 608 | } |
564 | 609 |
|
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 | | - |
581 | 610 | ///_______________________________________ |
582 | 611 | void CTFReaderSpec::tryToFixCTFHeader(CTFHeader& ctfHeader) const |
583 | 612 | { |
@@ -636,7 +665,21 @@ DataProcessorSpec getCTFReaderSpec(const CTFReaderInp& inp) |
636 | 665 | for (auto id = DetID::First; id <= DetID::Last; id++) { |
637 | 666 | if (inp.detMask[id]) { |
638 | 667 | 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 | + } |
640 | 683 | } |
641 | 684 | } |
642 | 685 | if (!inp.fileIRFrames.empty() || !inp.fileRunTimeSpans.empty()) { |
|
0 commit comments