From 33a891a09f381225afb6fe2c95fcd806e0e66256 Mon Sep 17 00:00:00 2001 From: lietava Date: Wed, 17 Mar 2021 07:57:28 +0100 Subject: [PATCH 01/17] CTP with ID=18 added to DetID.h --- .../Detectors/Common/include/DetectorsCommonDataFormats/DetID.h | 1 + 1 file changed, 1 insertion(+) diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index 5db215c4457b7..56145152bc5de 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -68,6 +68,7 @@ class DetID static constexpr ID FV0 = 13; static constexpr ID FDD = 14; static constexpr ID ACO = 15; + static constexpr ID CTP = 18; #ifdef ENABLE_UPGRADES static constexpr ID IT3 = 16; static constexpr ID TRK = 17; From 66a939c2299968ed4f59b28aa906e41b6f64581e Mon Sep 17 00:00:00 2001 From: lietava Date: Thu, 18 Mar 2021 10:30:45 +0100 Subject: [PATCH 02/17] CTP digitizer development --- DataFormats/Detectors/CMakeLists.txt | 2 +- DataFormats/Detectors/CTP/CMakeLists.txt | 9 +++ .../CTP/include/DataFormatsCTP/Digits.h | 27 +++++++ .../Detectors/CTP/src/DataFormatsCTPLinkDef.h | 9 +++ DataFormats/Detectors/CTP/src/Digits.cxx | 12 +++ Detectors/CMakeLists.txt | 1 + Detectors/CTP/CMakeLists.txt | 1 + Detectors/CTP/simulation/CMakeLists.txt | 8 ++ .../include/CTPSimulation/Digitizer.h | 34 ++++++++ .../CTP/simulation/src/CTPSimulationLinkDef.h | 8 ++ Detectors/CTP/simulation/src/Digitizer.cxx | 30 +++++++ Steer/DigitizerWorkflow/CMakeLists.txt | 2 + .../src/CTPDigitizerSpec.cxx | 78 +++++++++++++++++++ .../DigitizerWorkflow/src/CTPDigitizerSpec.h | 21 +++++ 14 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 DataFormats/Detectors/CTP/CMakeLists.txt create mode 100644 DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h create mode 100644 DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h create mode 100644 DataFormats/Detectors/CTP/src/Digits.cxx create mode 100644 Detectors/CTP/CMakeLists.txt create mode 100644 Detectors/CTP/simulation/CMakeLists.txt create mode 100644 Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h create mode 100644 Detectors/CTP/simulation/src/CTPSimulationLinkDef.h create mode 100644 Detectors/CTP/simulation/src/Digitizer.cxx create mode 100644 Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx create mode 100644 Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h diff --git a/DataFormats/Detectors/CMakeLists.txt b/DataFormats/Detectors/CMakeLists.txt index 18b0ed448459c..a4ad99788afb7 100644 --- a/DataFormats/Detectors/CMakeLists.txt +++ b/DataFormats/Detectors/CMakeLists.txt @@ -21,7 +21,7 @@ add_subdirectory(ZDC) add_subdirectory(TRD) add_subdirectory(PHOS) add_subdirectory(CPV) - +add_subdirectory(CTP) if(ENABLE_UPGRADES) add_subdirectory(Upgrades) else() diff --git a/DataFormats/Detectors/CTP/CMakeLists.txt b/DataFormats/Detectors/CTP/CMakeLists.txt new file mode 100644 index 0000000000000..5bbaf87fcacf7 --- /dev/null +++ b/DataFormats/Detectors/CTP/CMakeLists.txt @@ -0,0 +1,9 @@ +o2_add_library(DataFormatsCTP + SOURCES src/Digits.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat + O2::Headers + O2::SimulationDataFormat + ) +o2_target_root_dictionary(DataFormatsCTP +HEADERS include/DataFormatsCTP/Digits.h + ) \ No newline at end of file diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h new file mode 100644 index 0000000000000..03f1c72cb2d0f --- /dev/null +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -0,0 +1,27 @@ +// +// Created by rl on 3/17/21. +// +#include "CommonDataFormat/InteractionRecord.h" +#include +#include + +#ifndef _CTP_DIGITS_H_ +#define _CTP_DIGITS_H_ +namespace o2 +{ +namespace ctp +{ +struct CTPdigit +{ + static constexpr uint64_t NCTPINPUTS=46; + static constexpr uint64_t NCTPCLASSES=64; + o2::InteractionRecord mIntRecord; + std::bitset mCTPInputMask; + std::bitset mCTPClassMask; + CTPdigit() = default; + void printStream(std::ostream& stream) const; + ClassDefNV(CTPdigit,1); +}; +} +} +#endif //_CTP_DIGITS_H diff --git a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h new file mode 100644 index 0000000000000..a01a2e22d4698 --- /dev/null +++ b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h @@ -0,0 +1,9 @@ +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; +#pragma link C++ class o2::ctp::CTPdigit + ; +#pragma link C++ class vector < o2::ctp::CTPdigit> + ; + +#endif diff --git a/DataFormats/Detectors/CTP/src/Digits.cxx b/DataFormats/Detectors/CTP/src/Digits.cxx new file mode 100644 index 0000000000000..c4bfd1b5d37c2 --- /dev/null +++ b/DataFormats/Detectors/CTP/src/Digits.cxx @@ -0,0 +1,12 @@ +// +// Created by rl on 3/17/21. +// +#include "DataFormatsCTP/Digits.h" + +using namespace o2::ctp; + +void CTPdigit::printStream(std::ostream& stream) const +{ + stream << "CTP Digit: BC " << mIntRecord.bc << " orbit " << mIntRecord.orbit << std::endl; + stream << "Input Mask: " << mCTPInputMask << " Class Mask: " << mCTPClassMask << std::endl; +} \ No newline at end of file diff --git a/Detectors/CMakeLists.txt b/Detectors/CMakeLists.txt index 1a5c7813cec03..41a3e8a0da254 100644 --- a/Detectors/CMakeLists.txt +++ b/Detectors/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory(CTF) add_subdirectory(Passive) # must be first as some detector's macros use it +add_subdirectory(CTP) add_subdirectory(PHOS) add_subdirectory(CPV) add_subdirectory(EMCAL) diff --git a/Detectors/CTP/CMakeLists.txt b/Detectors/CTP/CMakeLists.txt new file mode 100644 index 0000000000000..ea8cc25426a34 --- /dev/null +++ b/Detectors/CTP/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(simulation) diff --git a/Detectors/CTP/simulation/CMakeLists.txt b/Detectors/CTP/simulation/CMakeLists.txt new file mode 100644 index 0000000000000..1f3ec38e592e4 --- /dev/null +++ b/Detectors/CTP/simulation/CMakeLists.txt @@ -0,0 +1,8 @@ +o2_add_library(CTPSimulation + SOURCES src/Digitizer.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::Framework + O2::DataFormatsCTP + O2::Headers) +o2_target_root_dictionary(CTPSimulation HEADERS + include/CTPSimulation/Digitizer.h + ) \ No newline at end of file diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h new file mode 100644 index 0000000000000..77d0024dba00b --- /dev/null +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -0,0 +1,34 @@ +// +// Created by rl on 3/17/21. +// + +#ifndef ALICEO2_CTP_DIGITIZER_H +#define ALICEO2_CTP_DIGITIZER_H + +#include "CommonDataFormat/InteractionRecord.h" +#include "DataFormatsCTP/Digits.h" +#include + +namespace o2 +{ +namespace ctp +{ +class Digitizer +{ + public: + Digitizer() = default; + ~Digitizer()= default; + void setInteractionRecord(const o2::InteractionTimeRecord& src) { mIntRecord = src; } + void process(std::vector& digits ); + void flush(std::vector& digits); + void storeBC(o2::ctp::CTPdigit& cashe, std::vector& digits); + private: + Int_t mEventID; + o2::InteractionRecord firstBCinDeque = 0; + std::deque mCache; + o2::InteractionTimeRecord mIntRecord; + ClassDefNV(Digitizer,1); +}; +} +} +#endif //ALICEO2_CTP_DIGITIZER_H diff --git a/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h b/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h new file mode 100644 index 0000000000000..350aea83fbc20 --- /dev/null +++ b/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h @@ -0,0 +1,8 @@ +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::ctp::Digitizer + ; +#endif \ No newline at end of file diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx new file mode 100644 index 0000000000000..7d241b899a5e0 --- /dev/null +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -0,0 +1,30 @@ +// +// Created by rl on 3/17/21. +// +#include "CTPSimulation/Digitizer.h" +#include "TRandom.h" +#include + +using namespace o2::ctp; + +ClassImp(Digitizer); + +void Digitizer::process(std::vector& digits ) +{ + CTPdigit digit; + digit.mIntRecord = mIntRecord; + // Dummy inputs and classes + TRandom rnd; + digit.mCTPInputMask = (rnd.Integer(0xffffffff)); + digit.mCTPClassMask = (rnd.Integer(0xffffffff)); + mCache.push_back(digit); +} +void Digitizer::flush(std::vector& digits) +{ + assert(mCache.size() != 1); + storeBC(mCache.front(),digits); +} +void Digitizer::storeBC(o2::ctp::CTPdigit& cashe,std::vector& digits) +{ + digits.push_back(cashe); +} diff --git a/Steer/DigitizerWorkflow/CMakeLists.txt b/Steer/DigitizerWorkflow/CMakeLists.txt index ca2e6d516a84a..696398302320c 100644 --- a/Steer/DigitizerWorkflow/CMakeLists.txt +++ b/Steer/DigitizerWorkflow/CMakeLists.txt @@ -12,6 +12,7 @@ o2_add_executable(digitizer-workflow COMPONENT_NAME sim SOURCES src/EMCALDigitWriterSpec.cxx src/EMCALDigitizerSpec.cxx + src/CTPDigitizerSpec.cxx src/FT0DigitizerSpec.cxx src/FV0DigitizerSpec.cxx src/FDDDigitizerSpec.cxx @@ -35,6 +36,7 @@ o2_add_executable(digitizer-workflow O2::FT0Simulation O2::FV0Simulation O2::FDDSimulation + O2::CTPSimulation O2::FDDWorkflow O2::HMPIDSimulation O2::ITSMFTSimulation diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx new file mode 100644 index 0000000000000..b25484e0f15e4 --- /dev/null +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -0,0 +1,78 @@ +// +// Created by rl on 3/17/21. +// + +#include "CTPDigitizerSpec.h" +#include "Framework/ControlService.h" +#include "DetectorsBase/BaseDPLDigitizer.h" +#include "DataFormatsCTP/Digits.h" +#include "Steer/HitProcessingManager.h" // for DigitizationContext +#include "CTPSimulation/Digitizer.h" + +#include +#include + +using namespace o2::framework; +namespace o2 +{ +namespace ctp +{ +class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer +{ + using GRP = o2::parameters::GRPObject; + public: + CTPDPLDigitizerTask() : o2::base::BaseDPLDigitizer(), mDigitizer() {} + ~CTPDPLDigitizerTask() override = default; + void run(framework::ProcessingContext& pc) + { + if (mFinished) { + return; + } + // read collision context from input + auto context = pc.inputs().get("collisioncontext"); + context->initSimChains(o2::detectors::DetID::CTP, mSimChains); + const bool withQED = context->isQEDProvided() && !mDisableQED; + auto& timesview = context->getEventRecords(withQED); + // if there is nothing to do ... return + if (timesview.size() == 0) { + return; + } + + TStopwatch timer; + timer.Start(); + LOG(INFO) << "CALLING FT0 DIGITIZATION"; + for(const auto &coll: timesview){ + mDigitizer.setInteractionRecord(coll); + mDigitizer.process(mDigits); + mDigitizer.flush( mDigits); + } + // send out to next stage + pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); + timer.Stop(); + LOG(INFO) << "CTP Digitization took " << timer.CpuTime() << "s"; + // we should be only called once; tell DPL that this process is ready to exit + pc.services().get().readyToQuit(QuitRequest::Me); + mFinished = true; + } + protected: + bool mFinished = false; + std::vector mDigits; + + Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation + double mFairTimeUnitInNS = 1; ///< Fair time unit in ns + o2::ctp::Digitizer mDigitizer; ///< Digitizer + + // RS: at the moment using hardcoded flag for continuos readout + //o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode + + // + bool mDisableQED = false; + + std::vector mSimChains; +}; +o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth) +{ + +} +} +} \ No newline at end of file diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h new file mode 100644 index 0000000000000..fb7c331d57eae --- /dev/null +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h @@ -0,0 +1,21 @@ +// +// Created by rl on 3/17/21. +// + +#ifndef STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ +#define STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ + +#include "Framework/DataProcessorSpec.h" + +namespace o2 +{ +namespace ctp +{ + +o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth = true); + +} // namespace ctp +} // end namespace o2 + +#endif /* STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ */ + From 5df9143f1050aa321989cbb6c59d55514852e239 Mon Sep 17 00:00:00 2001 From: lietava Date: Thu, 18 Mar 2021 10:37:15 +0100 Subject: [PATCH 03/17] clang formatting --- .../Detectors/CTP/include/DataFormatsCTP/Digits.h | 15 +++++++-------- .../simulation/include/CTPSimulation/Digitizer.h | 13 +++++++------ Detectors/CTP/simulation/src/Digitizer.cxx | 6 +++--- Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx | 13 +++++++------ Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h | 1 - 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index 03f1c72cb2d0f..a3a504fbb3e1d 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -9,19 +9,18 @@ #define _CTP_DIGITS_H_ namespace o2 { -namespace ctp +namespace ctp { -struct CTPdigit -{ - static constexpr uint64_t NCTPINPUTS=46; - static constexpr uint64_t NCTPCLASSES=64; +struct CTPdigit { + static constexpr uint64_t NCTPINPUTS = 46; + static constexpr uint64_t NCTPCLASSES = 64; o2::InteractionRecord mIntRecord; std::bitset mCTPInputMask; std::bitset mCTPClassMask; CTPdigit() = default; void printStream(std::ostream& stream) const; - ClassDefNV(CTPdigit,1); + ClassDefNV(CTPdigit, 1); }; -} -} +} // namespace ctp +} // namespace o2 #endif //_CTP_DIGITS_H diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index 77d0024dba00b..3dfe1dafce9a6 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -11,24 +11,25 @@ namespace o2 { -namespace ctp +namespace ctp { class Digitizer { public: Digitizer() = default; - ~Digitizer()= default; + ~Digitizer() = default; void setInteractionRecord(const o2::InteractionTimeRecord& src) { mIntRecord = src; } - void process(std::vector& digits ); + void process(std::vector& digits); void flush(std::vector& digits); void storeBC(o2::ctp::CTPdigit& cashe, std::vector& digits); + private: Int_t mEventID; o2::InteractionRecord firstBCinDeque = 0; std::deque mCache; o2::InteractionTimeRecord mIntRecord; - ClassDefNV(Digitizer,1); + ClassDefNV(Digitizer, 1); }; -} -} +} // namespace ctp +} // namespace o2 #endif //ALICEO2_CTP_DIGITIZER_H diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 7d241b899a5e0..87e4e07ffc9e6 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -9,7 +9,7 @@ using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(std::vector& digits ) +void Digitizer::process(std::vector& digits) { CTPdigit digit; digit.mIntRecord = mIntRecord; @@ -22,9 +22,9 @@ void Digitizer::process(std::vector& digits ) void Digitizer::flush(std::vector& digits) { assert(mCache.size() != 1); - storeBC(mCache.front(),digits); + storeBC(mCache.front(), digits); } -void Digitizer::storeBC(o2::ctp::CTPdigit& cashe,std::vector& digits) +void Digitizer::storeBC(o2::ctp::CTPdigit& cashe, std::vector& digits) { digits.push_back(cashe); } diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index b25484e0f15e4..78f0a51d701db 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -12,7 +12,7 @@ #include #include -using namespace o2::framework; +using namespace o2::framework; namespace o2 { namespace ctp @@ -20,6 +20,7 @@ namespace ctp class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer { using GRP = o2::parameters::GRPObject; + public: CTPDPLDigitizerTask() : o2::base::BaseDPLDigitizer(), mDigitizer() {} ~CTPDPLDigitizerTask() override = default; @@ -41,10 +42,10 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer TStopwatch timer; timer.Start(); LOG(INFO) << "CALLING FT0 DIGITIZATION"; - for(const auto &coll: timesview){ + for (const auto& coll : timesview) { mDigitizer.setInteractionRecord(coll); mDigitizer.process(mDigits); - mDigitizer.flush( mDigits); + mDigitizer.flush(mDigits); } // send out to next stage pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); @@ -54,6 +55,7 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer pc.services().get().readyToQuit(QuitRequest::Me); mFinished = true; } + protected: bool mFinished = false; std::vector mDigits; @@ -72,7 +74,6 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer }; o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth) { - -} } -} \ No newline at end of file +} // namespace ctp +} // namespace o2 \ No newline at end of file diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h index fb7c331d57eae..0b2023878bc53 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h @@ -18,4 +18,3 @@ o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth = } // end namespace o2 #endif /* STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ */ - From 7a9471b89302555ccdff15845304892fc47a630c Mon Sep 17 00:00:00 2001 From: lietava Date: Sat, 20 Mar 2021 18:04:44 +0100 Subject: [PATCH 04/17] CTP digitizer development --- .../src/CTPDigitWriterSpec.h | 34 +++++++++++++++++++ .../src/SimpleDigitizerWorkflow.cxx | 13 ++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h diff --git a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h new file mode 100644 index 0000000000000..f3db889fcaf61 --- /dev/null +++ b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h @@ -0,0 +1,34 @@ +// +// Created by rl on 3/19/21. +// + +#ifndef STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H +#define STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H + +#include "Framework/DataProcessorSpec.h" +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "Framework/InputSpec.h" +#include "DataFormatsCTP/Digits.h" + +namespace o2 +{ +namespace ctp +{ + +template +using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; + +o2::framework::DataProcessorSpec getCTPDigitWriterSpec(bool mctruth) +{ + using InputSpec = framework::InputSpec; + using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; + return MakeRootTreeWriterSpec("CTPDigitWriter", + "CTPdigits.root", + "o2sim", + 1, + BranchDefinition>{InputSpec{"digit", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); +} + +} // namespace ctp +} // end namespace o2 +#endif //STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index ac7e755fd7eee..c9c419e35317a 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -43,6 +43,10 @@ #include "FT0DigitizerSpec.h" #include "FT0DigitWriterSpec.h" +// for CTP +#include "CTPDigitizerSpec.h" +#include "CTPDigitWriterSpec.h" + // for FV0 #include "FV0DigitizerSpec.h" #include "FV0DigitWriterSpec.h" @@ -496,7 +500,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // connect the FIT digit writer specs.emplace_back(o2::ft0::getFT0DigitWriterSpec(mctruth)); } - +// the CTP part + if (isEnabled(o2::detectors::DetID::CTP)) { + detList.emplace_back(o2::detectors::DetID::CTP); + // connect the CTP digitization + specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, mctruth)); + // connect the CTP digit writer + specs.emplace_back(o2::ctp::getCTPDigitWriterSpec(mctruth)); + } // the FV0 part if (isEnabled(o2::detectors::DetID::FV0)) { detList.emplace_back(o2::detectors::DetID::FV0); From 0a3e56d4310a67e3a3b0824f910db93b139a30d2 Mon Sep 17 00:00:00 2001 From: lietava Date: Sat, 20 Mar 2021 18:06:51 +0100 Subject: [PATCH 05/17] clang format --- Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index c9c419e35317a..8b8f681dd4a3b 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -500,7 +500,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // connect the FIT digit writer specs.emplace_back(o2::ft0::getFT0DigitWriterSpec(mctruth)); } -// the CTP part + // the CTP part if (isEnabled(o2::detectors::DetID::CTP)) { detList.emplace_back(o2::detectors::DetID::CTP); // connect the CTP digitization From d95ab52cd2d1e1adbcd894766d4b2890d2b6f4cb Mon Sep 17 00:00:00 2001 From: lietava Date: Sun, 21 Mar 2021 07:51:26 +0100 Subject: [PATCH 06/17] CTP ID=16, upgrades shifted --- .../Common/include/DetectorsCommonDataFormats/DetID.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index 56145152bc5de..fd534dc491bd4 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -68,11 +68,11 @@ class DetID static constexpr ID FV0 = 13; static constexpr ID FDD = 14; static constexpr ID ACO = 15; - static constexpr ID CTP = 18; + static constexpr ID CTP = 16; #ifdef ENABLE_UPGRADES - static constexpr ID IT3 = 16; - static constexpr ID TRK = 17; - static constexpr ID FT3 = 18; + static constexpr ID IT3 = 17; + static constexpr ID TRK = 18; + static constexpr ID FT3 = 19; static constexpr ID Last = FT3; #else static constexpr ID Last = ACO; ///< if extra detectors added, update this !!! From 4a348c67e8292637e9fcbeed72605f93f6322a05 Mon Sep 17 00:00:00 2001 From: lietava Date: Tue, 23 Mar 2021 20:14:33 +0100 Subject: [PATCH 07/17] straightforward ruben's comment implemented --- DataFormats/Detectors/CTP/CMakeLists.txt | 23 +++++++++++++------ .../CTP/include/DataFormatsCTP/Digits.h | 16 +++++++++---- .../Detectors/CTP/src/DataFormatsCTPLinkDef.h | 14 +++++++++-- DataFormats/Detectors/CTP/src/Digits.cxx | 12 ++++++++-- .../DetectorsCommonDataFormats/DetID.h | 6 ++--- Detectors/CTP/CMakeLists.txt | 10 ++++++++ Detectors/CTP/simulation/CMakeLists.txt | 21 ++++++++++++----- .../include/CTPSimulation/Digitizer.h | 10 ++++---- Detectors/CTP/simulation/src/Digitizer.cxx | 17 ++++++++++---- Steer/DigitizerWorkflow/CMakeLists.txt | 8 +++---- .../src/CTPDigitWriterSpec.h | 14 +++++++---- .../src/CTPDigitizerSpec.cxx | 22 ++++++++---------- .../DigitizerWorkflow/src/CTPDigitizerSpec.h | 8 ++++++- .../src/SimpleDigitizerWorkflow.cxx | 18 +++++++-------- 14 files changed, 133 insertions(+), 66 deletions(-) diff --git a/DataFormats/Detectors/CTP/CMakeLists.txt b/DataFormats/Detectors/CTP/CMakeLists.txt index 5bbaf87fcacf7..2477350c225f6 100644 --- a/DataFormats/Detectors/CTP/CMakeLists.txt +++ b/DataFormats/Detectors/CTP/CMakeLists.txt @@ -1,9 +1,18 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + o2_add_library(DataFormatsCTP - SOURCES src/Digits.cxx - PUBLIC_LINK_LIBRARIES O2::CommonDataFormat - O2::Headers - O2::SimulationDataFormat - ) + SOURCES src/Digits.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat + O2::Headers + O2::SimulationDataFormat) o2_target_root_dictionary(DataFormatsCTP -HEADERS include/DataFormatsCTP/Digits.h - ) \ No newline at end of file + HEADERS include/DataFormatsCTP/Digits.h) + diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index a3a504fbb3e1d..15a6efe7ac26a 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -1,9 +1,15 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/17/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. #include "CommonDataFormat/InteractionRecord.h" #include -#include +#include #ifndef _CTP_DIGITS_H_ #define _CTP_DIGITS_H_ @@ -11,15 +17,15 @@ namespace o2 { namespace ctp { -struct CTPdigit { +struct CTPDigit { static constexpr uint64_t NCTPINPUTS = 46; static constexpr uint64_t NCTPCLASSES = 64; o2::InteractionRecord mIntRecord; std::bitset mCTPInputMask; std::bitset mCTPClassMask; - CTPdigit() = default; + CTPDigit() = default; void printStream(std::ostream& stream) const; - ClassDefNV(CTPdigit, 1); + ClassDefNV(CTPDigit, 1); }; } // namespace ctp } // namespace o2 diff --git a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h index a01a2e22d4698..1c8102ab72cf3 100644 --- a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h +++ b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h @@ -1,9 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #ifdef __CLING__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::ctp::CTPdigit + ; -#pragma link C++ class vector < o2::ctp::CTPdigit> + ; +#pragma link C++ class o2::ctp::CTPDigit + ; +#pragma link C++ class vector < o2::ctp::CTPDigit> + ; #endif diff --git a/DataFormats/Detectors/CTP/src/Digits.cxx b/DataFormats/Detectors/CTP/src/Digits.cxx index c4bfd1b5d37c2..7b02a59f6312c 100644 --- a/DataFormats/Detectors/CTP/src/Digits.cxx +++ b/DataFormats/Detectors/CTP/src/Digits.cxx @@ -1,11 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/17/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "DataFormatsCTP/Digits.h" +#include using namespace o2::ctp; -void CTPdigit::printStream(std::ostream& stream) const +void CTPDigit::printStream(std::ostream& stream) const { stream << "CTP Digit: BC " << mIntRecord.bc << " orbit " << mIntRecord.orbit << std::endl; stream << "Input Mask: " << mCTPInputMask << " Class Mask: " << mCTPClassMask << std::endl; diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index fd534dc491bd4..3f2cbe25c6681 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -75,7 +75,7 @@ class DetID static constexpr ID FT3 = 19; static constexpr ID Last = FT3; #else - static constexpr ID Last = ACO; ///< if extra detectors added, update this !!! + static constexpr ID Last = CTP; ///< if extra detectors added, update this !!! #endif static constexpr ID First = ITS; @@ -136,9 +136,9 @@ class DetID static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names #ifdef ENABLE_UPGRADES - {"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "IT3", "TRK", "FT3", nullptr}; + {"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "CTP", "IT3", "TRK", "FT3", nullptr}; #else - {"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", nullptr}; + {"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "CTP", nullptr}; #endif // detector names, will be defined in DataSources static constexpr std::array sMasks = ///< detectot masks diff --git a/Detectors/CTP/CMakeLists.txt b/Detectors/CTP/CMakeLists.txt index ea8cc25426a34..80107a0b4906e 100644 --- a/Detectors/CTP/CMakeLists.txt +++ b/Detectors/CTP/CMakeLists.txt @@ -1 +1,11 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(simulation) diff --git a/Detectors/CTP/simulation/CMakeLists.txt b/Detectors/CTP/simulation/CMakeLists.txt index 1f3ec38e592e4..f54e0ff4d0814 100644 --- a/Detectors/CTP/simulation/CMakeLists.txt +++ b/Detectors/CTP/simulation/CMakeLists.txt @@ -1,8 +1,17 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + o2_add_library(CTPSimulation - SOURCES src/Digitizer.cxx - PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::Framework - O2::DataFormatsCTP - O2::Headers) + SOURCES src/Digitizer.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::Framework + O2::DataFormatsCTP + O2::Headers) o2_target_root_dictionary(CTPSimulation HEADERS - include/CTPSimulation/Digitizer.h - ) \ No newline at end of file + include/CTPSimulation/Digitizer.h) \ No newline at end of file diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index 3dfe1dafce9a6..ff7fce38a6bb9 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -19,14 +19,14 @@ class Digitizer Digitizer() = default; ~Digitizer() = default; void setInteractionRecord(const o2::InteractionTimeRecord& src) { mIntRecord = src; } - void process(std::vector& digits); - void flush(std::vector& digits); - void storeBC(o2::ctp::CTPdigit& cashe, std::vector& digits); + void process(std::vector& digits); + void flush(std::vector& digits); + void storeBC(const o2::ctp::CTPDigit& cashe, std::vector& digits); private: Int_t mEventID; - o2::InteractionRecord firstBCinDeque = 0; - std::deque mCache; + o2::InteractionRecord firstBCinDeque {}; + std::deque mCache; o2::InteractionTimeRecord mIntRecord; ClassDefNV(Digitizer, 1); }; diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 87e4e07ffc9e6..f9597b675ac4a 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -1,6 +1,13 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/17/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #include "CTPSimulation/Digitizer.h" #include "TRandom.h" #include @@ -9,9 +16,9 @@ using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(std::vector& digits) +void Digitizer::process(std::vector& digits) { - CTPdigit digit; + CTPDigit digit; digit.mIntRecord = mIntRecord; // Dummy inputs and classes TRandom rnd; @@ -19,12 +26,12 @@ void Digitizer::process(std::vector& digits) digit.mCTPClassMask = (rnd.Integer(0xffffffff)); mCache.push_back(digit); } -void Digitizer::flush(std::vector& digits) +void Digitizer::flush(std::vector& digits) { assert(mCache.size() != 1); storeBC(mCache.front(), digits); } -void Digitizer::storeBC(o2::ctp::CTPdigit& cashe, std::vector& digits) +void Digitizer::storeBC(const o2::ctp::CTPDigit& cashe, std::vector& digits) { digits.push_back(cashe); } diff --git a/Steer/DigitizerWorkflow/CMakeLists.txt b/Steer/DigitizerWorkflow/CMakeLists.txt index 696398302320c..591d68fdcabe4 100644 --- a/Steer/DigitizerWorkflow/CMakeLists.txt +++ b/Steer/DigitizerWorkflow/CMakeLists.txt @@ -12,7 +12,7 @@ o2_add_executable(digitizer-workflow COMPONENT_NAME sim SOURCES src/EMCALDigitWriterSpec.cxx src/EMCALDigitizerSpec.cxx - src/CTPDigitizerSpec.cxx + src/CTPDigitizerSpec.cxx src/FT0DigitizerSpec.cxx src/FV0DigitizerSpec.cxx src/FDDDigitizerSpec.cxx @@ -36,8 +36,8 @@ o2_add_executable(digitizer-workflow O2::FT0Simulation O2::FV0Simulation O2::FDDSimulation - O2::CTPSimulation - O2::FDDWorkflow + O2::CTPSimulation + O2::FDDWorkflow O2::HMPIDSimulation O2::ITSMFTSimulation O2::ITSSimulation @@ -64,7 +64,7 @@ o2_add_executable(digitizer-workflow o2_add_executable(mctruth-testworkflow COMPONENT_NAME sim SOURCES src/MCTruthTestWorkflow.cxx - src/MCTruthSourceSpec.cxx + src/MCTruthSourceSpec.cxx src/MCTruthWriterSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat) diff --git a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h index f3db889fcaf61..fba6b2b894ec4 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h @@ -1,7 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/19/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // - +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. #ifndef STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H #define STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H @@ -23,10 +28,9 @@ o2::framework::DataProcessorSpec getCTPDigitWriterSpec(bool mctruth) using InputSpec = framework::InputSpec; using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; return MakeRootTreeWriterSpec("CTPDigitWriter", - "CTPdigits.root", + "ctpdigits.root", "o2sim", - 1, - BranchDefinition>{InputSpec{"digit", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); + BranchDefinition>{InputSpec{"digit", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); } } // namespace ctp diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 78f0a51d701db..b71f6cfb1b350 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -1,6 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/17/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. #include "CTPDigitizerSpec.h" #include "Framework/ControlService.h" @@ -31,8 +37,8 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer } // read collision context from input auto context = pc.inputs().get("collisioncontext"); - context->initSimChains(o2::detectors::DetID::CTP, mSimChains); - const bool withQED = context->isQEDProvided() && !mDisableQED; + //context->initSimChains(o2::detectors::DetID::CTP, mSimChains); + const bool withQED = context->isQEDProvided(); auto& timesview = context->getEventRecords(withQED); // if there is nothing to do ... return if (timesview.size() == 0) { @@ -58,19 +64,11 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer protected: bool mFinished = false; - std::vector mDigits; + std::vector mDigits; Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation double mFairTimeUnitInNS = 1; ///< Fair time unit in ns o2::ctp::Digitizer mDigitizer; ///< Digitizer - - // RS: at the moment using hardcoded flag for continuos readout - //o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode - - // - bool mDisableQED = false; - - std::vector mSimChains; }; o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth) { diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h index 0b2023878bc53..cf57784c6d581 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h @@ -1,6 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/17/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. #ifndef STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ #define STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index 8b8f681dd4a3b..1188d5ea393f0 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -500,14 +500,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // connect the FIT digit writer specs.emplace_back(o2::ft0::getFT0DigitWriterSpec(mctruth)); } - // the CTP part - if (isEnabled(o2::detectors::DetID::CTP)) { - detList.emplace_back(o2::detectors::DetID::CTP); - // connect the CTP digitization - specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, mctruth)); - // connect the CTP digit writer - specs.emplace_back(o2::ctp::getCTPDigitWriterSpec(mctruth)); - } + // the FV0 part if (isEnabled(o2::detectors::DetID::FV0)) { detList.emplace_back(o2::detectors::DetID::FV0); @@ -604,7 +597,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // add PHOS writer specs.emplace_back(o2::cpv::getCPVDigitWriterSpec(mctruth)); } - + // the CTP part + if (isEnabled(o2::detectors::DetID::CTP)) { + detList.emplace_back(o2::detectors::DetID::CTP); + // connect the CTP digitization + specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, mctruth)); + // connect the CTP digit writer + specs.emplace_back(o2::ctp::getCTPDigitWriterSpec(mctruth)); + } // GRP updater: must come after all detectors since requires their list specs.emplace_back(o2::parameters::getGRPUpdaterSpec(grpfile, detList)); From e00678a653828124e7a421f87b2ccaa54e270548 Mon Sep 17 00:00:00 2001 From: lietava Date: Tue, 23 Mar 2021 20:19:50 +0100 Subject: [PATCH 08/17] clang format --- .../simulation/include/CTPSimulation/Digitizer.h | 2 +- .../src/SimpleDigitizerWorkflow.cxx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index ff7fce38a6bb9..b1e1ca192e8b1 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -25,7 +25,7 @@ class Digitizer private: Int_t mEventID; - o2::InteractionRecord firstBCinDeque {}; + o2::InteractionRecord firstBCinDeque{}; std::deque mCache; o2::InteractionTimeRecord mIntRecord; ClassDefNV(Digitizer, 1); diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index 1188d5ea393f0..588bc1349d08f 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -598,13 +598,13 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) specs.emplace_back(o2::cpv::getCPVDigitWriterSpec(mctruth)); } // the CTP part - if (isEnabled(o2::detectors::DetID::CTP)) { - detList.emplace_back(o2::detectors::DetID::CTP); - // connect the CTP digitization - specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, mctruth)); - // connect the CTP digit writer - specs.emplace_back(o2::ctp::getCTPDigitWriterSpec(mctruth)); - } + if (isEnabled(o2::detectors::DetID::CTP)) { + detList.emplace_back(o2::detectors::DetID::CTP); + // connect the CTP digitization + specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, mctruth)); + // connect the CTP digit writer + specs.emplace_back(o2::ctp::getCTPDigitWriterSpec(mctruth)); + } // GRP updater: must come after all detectors since requires their list specs.emplace_back(o2::parameters::getGRPUpdaterSpec(grpfile, detList)); From bdb8259038b3041ff1cc75cbebe1adb260a7e6df Mon Sep 17 00:00:00 2001 From: lietava Date: Sat, 27 Mar 2021 15:40:14 +0100 Subject: [PATCH 09/17] CTP digitization dev --- DataFormats/Detectors/CTP/CMakeLists.txt | 3 +- .../CTP/include/DataFormatsCTP/Digits.h | 35 ++++++-- .../Detectors/CTP/src/DataFormatsCTPLinkDef.h | 7 +- DataFormats/Detectors/CTP/src/Digits.cxx | 2 +- Detectors/CTP/CMakeLists.txt | 1 + .../include/CTPSimulation/Digitizer.h | 18 ++-- Detectors/CTP/simulation/src/Digitizer.cxx | 16 ++-- Detectors/CTP/workflow/CMakeLists.txt | 15 ++++ .../include/CTPWorkflow/CTPDigitWriterSpec.h | 29 ++++++ .../CTP/workflow/src/CTPDigitWriterSpec.cxx | 60 +++++++++++++ .../src/CTPDigitWriterSpec.h | 2 +- .../src/CTPDigitizerSpec.cxx | 90 ++++++++++++++++--- .../DigitizerWorkflow/src/CTPDigitizerSpec.h | 3 +- .../src/SimpleDigitizerWorkflow.cxx | 2 +- 14 files changed, 242 insertions(+), 41 deletions(-) create mode 100644 Detectors/CTP/workflow/CMakeLists.txt create mode 100644 Detectors/CTP/workflow/include/CTPWorkflow/CTPDigitWriterSpec.h create mode 100644 Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx diff --git a/DataFormats/Detectors/CTP/CMakeLists.txt b/DataFormats/Detectors/CTP/CMakeLists.txt index 2477350c225f6..5fb16dad4f15f 100644 --- a/DataFormats/Detectors/CTP/CMakeLists.txt +++ b/DataFormats/Detectors/CTP/CMakeLists.txt @@ -12,7 +12,8 @@ o2_add_library(DataFormatsCTP SOURCES src/Digits.cxx PUBLIC_LINK_LIBRARIES O2::CommonDataFormat O2::Headers - O2::SimulationDataFormat) + O2::SimulationDataFormat + O2::DataFormatsFT0) o2_target_root_dictionary(DataFormatsCTP HEADERS include/DataFormatsCTP/Digits.h) diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index 15a6efe7ac26a..72a5d795f2996 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -7,25 +7,46 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + +#ifndef _CTP_DIGITS_H_ +#define _CTP_DIGITS_H_ +#include "DetectorsCommonDataFormats/DetID.h" #include "CommonDataFormat/InteractionRecord.h" +#include "DataFormatsFT0/Digit.h" #include #include -#ifndef _CTP_DIGITS_H_ -#define _CTP_DIGITS_H_ namespace o2 { namespace ctp { -struct CTPDigit { - static constexpr uint64_t NCTPINPUTS = 46; - static constexpr uint64_t NCTPCLASSES = 64; +static constexpr uint64_t NCTPINPUTS = 46; +static constexpr uint64_t NCTPCLASSES = 64; +static constexpr uint32_t MAXCTPL0PERDET = 5; +struct CTPRawData { + o2::InteractionRecord mIntRecord; std::bitset mCTPInputMask; std::bitset mCTPClassMask; - CTPDigit() = default; + CTPRawData() = default; void printStream(std::ostream& stream) const; - ClassDefNV(CTPDigit, 1); + ClassDefNV(CTPRawData, 1); +}; +struct CTPInputDigit{ + std::bitset mInputsMask; + std::int32_t mDetector; + CTPInputDigit() = default; + CTPInputDigit(std::bitset InputsMask, uint32_t DetID) + { + mInputsMask = InputsMask; + mDetector=DetID; + } +}; +struct CTPDigit{ + o2::InteractionRecord mIntRecord; + std::vector mInputs; + CTPDigit() = default; + ClassDefNV(CTPDigit,1); }; } // namespace ctp } // namespace o2 diff --git a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h index 1c8102ab72cf3..fcae8537d57b7 100644 --- a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h +++ b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h @@ -13,7 +13,8 @@ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::ctp::CTPDigit + ; -#pragma link C++ class vector < o2::ctp::CTPDigit> + ; - +#pragma link C++ class o2::ctp::CTPRawData + ; +#pragma link C++ class vector < o2::ctp::CTPRawData> + ; +#pragma link C++ class o2::ctp::CTPInputDigit + ; +#pragma link C++ class vector < o2::ctp::CTPInputDigit> + ; #endif diff --git a/DataFormats/Detectors/CTP/src/Digits.cxx b/DataFormats/Detectors/CTP/src/Digits.cxx index 7b02a59f6312c..19c3e2a460384 100644 --- a/DataFormats/Detectors/CTP/src/Digits.cxx +++ b/DataFormats/Detectors/CTP/src/Digits.cxx @@ -13,7 +13,7 @@ using namespace o2::ctp; -void CTPDigit::printStream(std::ostream& stream) const +void CTPRawData::printStream(std::ostream& stream) const { stream << "CTP Digit: BC " << mIntRecord.bc << " orbit " << mIntRecord.orbit << std::endl; stream << "Input Mask: " << mCTPInputMask << " Class Mask: " << mCTPClassMask << std::endl; diff --git a/Detectors/CTP/CMakeLists.txt b/Detectors/CTP/CMakeLists.txt index 80107a0b4906e..2f0c018d5ebbc 100644 --- a/Detectors/CTP/CMakeLists.txt +++ b/Detectors/CTP/CMakeLists.txt @@ -9,3 +9,4 @@ # submit itself to any jurisdiction. add_subdirectory(simulation) +add_subdirectory(workflow) diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index b1e1ca192e8b1..9dd2d12cc38fb 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -1,12 +1,18 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". // -// Created by rl on 3/17/21. +// See http://alice-o2.web.cern.ch/license for full licensing information. // - +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. #ifndef ALICEO2_CTP_DIGITIZER_H #define ALICEO2_CTP_DIGITIZER_H #include "CommonDataFormat/InteractionRecord.h" #include "DataFormatsCTP/Digits.h" + #include namespace o2 @@ -18,16 +24,16 @@ class Digitizer public: Digitizer() = default; ~Digitizer() = default; - void setInteractionRecord(const o2::InteractionTimeRecord& src) { mIntRecord = src; } - void process(std::vector& digits); + void setInteractionRecord(const o2::InteractionRecord& intrec) { mIntRecord = intrec; } + void process(CTPDigit digit, std::vector& digits); void flush(std::vector& digits); void storeBC(const o2::ctp::CTPDigit& cashe, std::vector& digits); - + void init(); private: Int_t mEventID; o2::InteractionRecord firstBCinDeque{}; std::deque mCache; - o2::InteractionTimeRecord mIntRecord; + o2::InteractionRecord mIntRecord; ClassDefNV(Digitizer, 1); }; } // namespace ctp diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index f9597b675ac4a..3f7752c6484eb 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -11,19 +11,19 @@ #include "CTPSimulation/Digitizer.h" #include "TRandom.h" #include +#include "FairLogger.h" using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(std::vector& digits) +void Digitizer::process(CTPDigit digit,std::vector& digits) { - CTPDigit digit; - digit.mIntRecord = mIntRecord; + //digit.mIntRecord = mIntRecord; // Dummy inputs and classes - TRandom rnd; - digit.mCTPInputMask = (rnd.Integer(0xffffffff)); - digit.mCTPClassMask = (rnd.Integer(0xffffffff)); + //TRandom rnd; + //digit.mCTPInputMask = (rnd.Integer(0xffffffff)); + //digit.mCTPClassMask = (rnd.Integer(0xffffffff)); mCache.push_back(digit); } void Digitizer::flush(std::vector& digits) @@ -35,3 +35,7 @@ void Digitizer::storeBC(const o2::ctp::CTPDigit& cashe, std::vector +using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; + +framework::DataProcessorSpec getCTPDigitWriterSpec(bool raw ) +{ + using InputSpec = framework::InputSpec; + using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; + // Spectators for logging + auto logger = [](std::vector const& vecDigits) { + LOG(INFO) << "FT0DigitWriter pulled " << vecDigits.size() << " digits"; + }; + // the callback to be set as hook for custom action when the writer is closed + auto finishWriting = [](TFile* outputfile, TTree* outputtree) { + const auto* brArr = outputtree->GetListOfBranches(); + int64_t nent = 0; + for (const auto* brc : *brArr) { + int64_t n = ((const TBranch*)brc)->GetEntries(); + if (nent && (nent != n)) { + LOG(ERROR) << "Branches have different number of entries"; + } + nent = n; + } + outputtree->SetEntries(nent); + outputtree->Write(); + outputfile->Close(); + }; + if(raw){ + return MakeRootTreeWriterSpec("CTPDigitWriter", + "ctpdigits.root", + "o2sim", + MakeRootTreeWriterSpec::CustomClose(finishWriting), + BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); +} else { + return MakeRootTreeWriterSpec("CTPDigitWriter", + "o2_ctpdigits.root", + "o2sim", + MakeRootTreeWriterSpec::CustomClose(finishWriting), + BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); + } +} + +} +} + diff --git a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h index fba6b2b894ec4..fc09c6571d2bf 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h @@ -30,7 +30,7 @@ o2::framework::DataProcessorSpec getCTPDigitWriterSpec(bool mctruth) return MakeRootTreeWriterSpec("CTPDigitWriter", "ctpdigits.root", "o2sim", - BranchDefinition>{InputSpec{"digit", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); + BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); } } // namespace ctp diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index b71f6cfb1b350..57633b605a03c 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -10,12 +10,17 @@ #include "CTPDigitizerSpec.h" #include "Framework/ControlService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/DataProcessorSpec.h" +#include "Framework//Task.h" #include "DetectorsBase/BaseDPLDigitizer.h" #include "DataFormatsCTP/Digits.h" #include "Steer/HitProcessingManager.h" // for DigitizationContext +#include "DetectorsCommonDataFormats/DetID.h" #include "CTPSimulation/Digitizer.h" +#include "DataFormatsFT0/Digit.h" +#include "DataFormatsFV0/BCData.h" -#include #include using namespace o2::framework; @@ -30,28 +35,68 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer public: CTPDPLDigitizerTask() : o2::base::BaseDPLDigitizer(), mDigitizer() {} ~CTPDPLDigitizerTask() override = default; + void initDigitizerTask(framework::InitContext& ic) override + { + mDigitizer.init(); + } void run(framework::ProcessingContext& pc) { if (mFinished) { return; } // read collision context from input - auto context = pc.inputs().get("collisioncontext"); - //context->initSimChains(o2::detectors::DetID::CTP, mSimChains); - const bool withQED = context->isQEDProvided(); - auto& timesview = context->getEventRecords(withQED); - // if there is nothing to do ... return - if (timesview.size() == 0) { + //auto context = pc.inputs().get("collisioncontext"); + //const bool withQED = context->isQEDProvided(); + //auto& timesview = context->getEventRecords(withQED); + // read ctp inputs from input + auto ft0inputs = pc.inputs().get>("ft0"); + auto fv0inputs = pc.inputs().get>("fv0"); + + // if there is nothing to do ... return + if ((ft0inputs.size() == 0) && (fv0inputs.size() == 0)) { return; } - + std::map finputs; TStopwatch timer; timer.Start(); - LOG(INFO) << "CALLING FT0 DIGITIZATION"; - for (const auto& coll : timesview) { - mDigitizer.setInteractionRecord(coll); - mDigitizer.process(mDigits); - mDigitizer.flush(mDigits); + LOG(INFO) << "CALLING CTP DIGITIZATION"; + //for (const auto& coll : timesview) { + // mDigitizer.setInteractionRecord(coll); + // mDigitizer.process(mDigits); + // mDigitizer.flush(mDigits); + //} + for(const auto& inp: ft0inputs) + { + CTPInputDigit finpdigit; + finpdigit.mDetector=o2::detectors::DetID::FT0; + finpdigit.mInputsMask = inp.mInputs; + CTPDigit fctpdigit; + fctpdigit.mIntRecord=inp.mIntRecord; + fctpdigit.mInputs.push_back(finpdigit); + finputs[inp.mIntRecord]=fctpdigit; + } + for(const auto& inp: fv0inputs) + { + CTPInputDigit finpdigit; + finpdigit.mDetector=o2::detectors::DetID::FV0; + finpdigit.mInputsMask = inp.mInputs; + if(finputs.count(inp.mIntRecord)==0) + { + CTPDigit fctpdigit; + fctpdigit.mIntRecord = inp.mIntRecord; + fctpdigit.mInputs.push_back(finpdigit); + finputs[inp.mIntRecord]=fctpdigit; + } + else + { + finputs[inp.mIntRecord].mInputs.push_back(finpdigit); + } + } + for(const auto& inps: finputs) + { + mDigitizer.setInteractionRecord(inps.first); + mDigitizer.process(inps.second,mDigits); + mDigitizer.flush(mDigits); } // send out to next stage pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); @@ -70,8 +115,25 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer double mFairTimeUnitInNS = 1; ///< Fair time unit in ns o2::ctp::Digitizer mDigitizer; ///< Digitizer }; -o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth) +o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth) { + std::vector inputs; + std::vector output; + if (std::find(detList.begin(),detList.end(), o2::detectors::DetID::FT0) != detList.end()) { + inputs.emplace_back("ft0", "FT0", "TRIGGERINPUT", 0, Lifetime::Timeframe); + } + if (std::find(detList.begin(),detList.end(), o2::detectors::DetID::FV0) != detList.end()) { + inputs.emplace_back("fv0", "FV0", "TRIGGERINPUT", 0, Lifetime::Timeframe); + } + output.emplace_back("CTP", "DIGITSBC", 0, Lifetime::Timeframe); + return DataProcessorSpec{ + "CTPDigitizer", + inputs, + output, + AlgorithmSpec{adaptFromTask()}, + Options{{"pileup", VariantType::Int, 1, {"whether to run in continuous time mode"}}, + {"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}} + }; } } // namespace ctp } // namespace o2 \ No newline at end of file diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h index cf57784c6d581..ec54535616264 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h @@ -12,13 +12,14 @@ #define STEER_DIGITIZERWORKFLOW_CTPDIGITIZER_H_ #include "Framework/DataProcessorSpec.h" +#include "DetectorsCommonDataFormats/DetID.h" namespace o2 { namespace ctp { -o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, bool mctruth = true); +o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth = true); } // namespace ctp } // end namespace o2 diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index 588bc1349d08f..bf03acb282edf 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -601,7 +601,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) if (isEnabled(o2::detectors::DetID::CTP)) { detList.emplace_back(o2::detectors::DetID::CTP); // connect the CTP digitization - specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, mctruth)); + specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, detList)); // connect the CTP digit writer specs.emplace_back(o2::ctp::getCTPDigitWriterSpec(mctruth)); } From 436830b24172da2207016624eb3d63c76e5797c2 Mon Sep 17 00:00:00 2001 From: lietava Date: Sat, 27 Mar 2021 15:43:24 +0100 Subject: [PATCH 10/17] calng format --- .../CTP/include/DataFormatsCTP/Digits.h | 28 +++--- .../include/CTPSimulation/Digitizer.h | 1 + Detectors/CTP/simulation/src/Digitizer.cxx | 4 +- .../include/CTPWorkflow/CTPDigitWriterSpec.h | 5 +- .../CTP/workflow/src/CTPDigitWriterSpec.cxx | 55 ++++++------ .../src/CTPDigitizerSpec.cxx | 89 +++++++++---------- 6 files changed, 87 insertions(+), 95 deletions(-) diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index 72a5d795f2996..fb392717506b2 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -32,21 +32,21 @@ struct CTPRawData { void printStream(std::ostream& stream) const; ClassDefNV(CTPRawData, 1); }; -struct CTPInputDigit{ - std::bitset mInputsMask; - std::int32_t mDetector; - CTPInputDigit() = default; - CTPInputDigit(std::bitset InputsMask, uint32_t DetID) - { - mInputsMask = InputsMask; - mDetector=DetID; - } +struct CTPInputDigit { + std::bitset mInputsMask; + std::int32_t mDetector; + CTPInputDigit() = default; + CTPInputDigit(std::bitset InputsMask, uint32_t DetID) + { + mInputsMask = InputsMask; + mDetector = DetID; + } }; -struct CTPDigit{ - o2::InteractionRecord mIntRecord; - std::vector mInputs; - CTPDigit() = default; - ClassDefNV(CTPDigit,1); +struct CTPDigit { + o2::InteractionRecord mIntRecord; + std::vector mInputs; + CTPDigit() = default; + ClassDefNV(CTPDigit, 1); }; } // namespace ctp } // namespace o2 diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index 9dd2d12cc38fb..1b181690de68a 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -29,6 +29,7 @@ class Digitizer void flush(std::vector& digits); void storeBC(const o2::ctp::CTPDigit& cashe, std::vector& digits); void init(); + private: Int_t mEventID; o2::InteractionRecord firstBCinDeque{}; diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 3f7752c6484eb..e207a8d4a9134 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -17,7 +17,7 @@ using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(CTPDigit digit,std::vector& digits) +void Digitizer::process(CTPDigit digit, std::vector& digits) { //digit.mIntRecord = mIntRecord; // Dummy inputs and classes @@ -37,5 +37,5 @@ void Digitizer::storeBC(const o2::ctp::CTPDigit& cashe, std::vector using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; -framework::DataProcessorSpec getCTPDigitWriterSpec(bool raw ) +framework::DataProcessorSpec getCTPDigitWriterSpec(bool raw) { - using InputSpec = framework::InputSpec; - using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; - // Spectators for logging - auto logger = [](std::vector const& vecDigits) { - LOG(INFO) << "FT0DigitWriter pulled " << vecDigits.size() << " digits"; - }; - // the callback to be set as hook for custom action when the writer is closed - auto finishWriting = [](TFile* outputfile, TTree* outputtree) { - const auto* brArr = outputtree->GetListOfBranches(); - int64_t nent = 0; - for (const auto* brc : *brArr) { - int64_t n = ((const TBranch*)brc)->GetEntries(); - if (nent && (nent != n)) { - LOG(ERROR) << "Branches have different number of entries"; - } - nent = n; - } - outputtree->SetEntries(nent); - outputtree->Write(); - outputfile->Close(); - }; - if(raw){ + using InputSpec = framework::InputSpec; + using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; + // Spectators for logging + auto logger = [](std::vector const& vecDigits) { + LOG(INFO) << "FT0DigitWriter pulled " << vecDigits.size() << " digits"; + }; + // the callback to be set as hook for custom action when the writer is closed + auto finishWriting = [](TFile* outputfile, TTree* outputtree) { + const auto* brArr = outputtree->GetListOfBranches(); + int64_t nent = 0; + for (const auto* brc : *brArr) { + int64_t n = ((const TBranch*)brc)->GetEntries(); + if (nent && (nent != n)) { + LOG(ERROR) << "Branches have different number of entries"; + } + nent = n; + } + outputtree->SetEntries(nent); + outputtree->Write(); + outputfile->Close(); + }; + if (raw) { return MakeRootTreeWriterSpec("CTPDigitWriter", "ctpdigits.root", "o2sim", MakeRootTreeWriterSpec::CustomClose(finishWriting), BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); -} else { + } else { return MakeRootTreeWriterSpec("CTPDigitWriter", "o2_ctpdigits.root", "o2sim", MakeRootTreeWriterSpec::CustomClose(finishWriting), BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); - } -} - -} + } } +} // namespace ctp +} // namespace o2 diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 57633b605a03c..04942d22471a8 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -52,11 +52,11 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer auto ft0inputs = pc.inputs().get>("ft0"); auto fv0inputs = pc.inputs().get>("fv0"); - // if there is nothing to do ... return + // if there is nothing to do ... return if ((ft0inputs.size() == 0) && (fv0inputs.size() == 0)) { return; } - std::map finputs; + std::map finputs; TStopwatch timer; timer.Start(); LOG(INFO) << "CALLING CTP DIGITIZATION"; @@ -65,38 +65,32 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer // mDigitizer.process(mDigits); // mDigitizer.flush(mDigits); //} - for(const auto& inp: ft0inputs) - { - CTPInputDigit finpdigit; - finpdigit.mDetector=o2::detectors::DetID::FT0; - finpdigit.mInputsMask = inp.mInputs; + for (const auto& inp : ft0inputs) { + CTPInputDigit finpdigit; + finpdigit.mDetector = o2::detectors::DetID::FT0; + finpdigit.mInputsMask = inp.mInputs; + CTPDigit fctpdigit; + fctpdigit.mIntRecord = inp.mIntRecord; + fctpdigit.mInputs.push_back(finpdigit); + finputs[inp.mIntRecord] = fctpdigit; + } + for (const auto& inp : fv0inputs) { + CTPInputDigit finpdigit; + finpdigit.mDetector = o2::detectors::DetID::FV0; + finpdigit.mInputsMask = inp.mInputs; + if (finputs.count(inp.mIntRecord) == 0) { CTPDigit fctpdigit; - fctpdigit.mIntRecord=inp.mIntRecord; + fctpdigit.mIntRecord = inp.mIntRecord; fctpdigit.mInputs.push_back(finpdigit); - finputs[inp.mIntRecord]=fctpdigit; - } - for(const auto& inp: fv0inputs) - { - CTPInputDigit finpdigit; - finpdigit.mDetector=o2::detectors::DetID::FV0; - finpdigit.mInputsMask = inp.mInputs; - if(finputs.count(inp.mIntRecord)==0) - { - CTPDigit fctpdigit; - fctpdigit.mIntRecord = inp.mIntRecord; - fctpdigit.mInputs.push_back(finpdigit); - finputs[inp.mIntRecord]=fctpdigit; - } - else - { - finputs[inp.mIntRecord].mInputs.push_back(finpdigit); - } + finputs[inp.mIntRecord] = fctpdigit; + } else { + finputs[inp.mIntRecord].mInputs.push_back(finpdigit); + } } - for(const auto& inps: finputs) - { - mDigitizer.setInteractionRecord(inps.first); - mDigitizer.process(inps.second,mDigits); - mDigitizer.flush(mDigits); + for (const auto& inps : finputs) { + mDigitizer.setInteractionRecord(inps.first); + mDigitizer.process(inps.second, mDigits); + mDigitizer.flush(mDigits); } // send out to next stage pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); @@ -117,23 +111,22 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer }; o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth) { - std::vector inputs; - std::vector output; - if (std::find(detList.begin(),detList.end(), o2::detectors::DetID::FT0) != detList.end()) { - inputs.emplace_back("ft0", "FT0", "TRIGGERINPUT", 0, Lifetime::Timeframe); - } - if (std::find(detList.begin(),detList.end(), o2::detectors::DetID::FV0) != detList.end()) { - inputs.emplace_back("fv0", "FV0", "TRIGGERINPUT", 0, Lifetime::Timeframe); - } - output.emplace_back("CTP", "DIGITSBC", 0, Lifetime::Timeframe); - return DataProcessorSpec{ - "CTPDigitizer", - inputs, - output, - AlgorithmSpec{adaptFromTask()}, - Options{{"pileup", VariantType::Int, 1, {"whether to run in continuous time mode"}}, - {"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}} - }; + std::vector inputs; + std::vector output; + if (std::find(detList.begin(), detList.end(), o2::detectors::DetID::FT0) != detList.end()) { + inputs.emplace_back("ft0", "FT0", "TRIGGERINPUT", 0, Lifetime::Timeframe); + } + if (std::find(detList.begin(), detList.end(), o2::detectors::DetID::FV0) != detList.end()) { + inputs.emplace_back("fv0", "FV0", "TRIGGERINPUT", 0, Lifetime::Timeframe); + } + output.emplace_back("CTP", "DIGITSBC", 0, Lifetime::Timeframe); + return DataProcessorSpec{ + "CTPDigitizer", + inputs, + output, + AlgorithmSpec{adaptFromTask()}, + Options{{"pileup", VariantType::Int, 1, {"whether to run in continuous time mode"}}, + {"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}}}; } } // namespace ctp } // namespace o2 \ No newline at end of file From b640be54638e4ea1c3ab598b51d733d16cb87e19 Mon Sep 17 00:00:00 2001 From: lietava Date: Mon, 29 Mar 2021 17:13:01 +0200 Subject: [PATCH 11/17] CTP digitizer dev: Ruben's comments implemented. --- .../CTP/include/DataFormatsCTP/Digits.h | 27 ++++---- .../include/CTPSimulation/Digitizer.h | 12 +--- Detectors/CTP/simulation/src/Digitizer.cxx | 67 +++++++++++++++---- .../src/CTPDigitizerSpec.cxx | 57 +++++----------- 4 files changed, 84 insertions(+), 79 deletions(-) diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index fb392717506b2..090feae5d84b0 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -20,33 +20,32 @@ namespace o2 { namespace ctp { -static constexpr uint64_t NCTPINPUTS = 46; -static constexpr uint64_t NCTPCLASSES = 64; -static constexpr uint32_t MAXCTPL0PERDET = 5; +static constexpr uint32_t CTP_NINPUTS = 46; +static constexpr uint32_t CTP_NCLASSES = 64; +static constexpr uint32_t CTP_MAXL0PERDET = 5; +// Positions of CTP Detector inputs in CTPInputMask +static constexpr std::pair > CTP_INPUTMASK_FV0(0,0x1f); +static constexpr std::pair > CTP_INPUTMASK_FT0(5,0x1f); struct CTPRawData { - o2::InteractionRecord mIntRecord; - std::bitset mCTPInputMask; - std::bitset mCTPClassMask; + std::bitset mCTPInputMask; + std::bitset mCTPClassMask; CTPRawData() = default; void printStream(std::ostream& stream) const; ClassDefNV(CTPRawData, 1); }; struct CTPInputDigit { - std::bitset mInputsMask; + o2::InteractionRecord mIntRecord; + std::bitset mInputsMask; std::int32_t mDetector; CTPInputDigit() = default; - CTPInputDigit(std::bitset InputsMask, uint32_t DetID) + CTPInputDigit(o2::InteractionRecord IntRecord, std::bitset InputsMask, uint32_t DetID) { + mIntRecord = IntRecord; mInputsMask = InputsMask; mDetector = DetID; } -}; -struct CTPDigit { - o2::InteractionRecord mIntRecord; - std::vector mInputs; - CTPDigit() = default; - ClassDefNV(CTPDigit, 1); + ClassDefNV(CTPInputDigit, 1) }; } // namespace ctp } // namespace o2 diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index 1b181690de68a..268d51e73aa56 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -13,7 +13,7 @@ #include "CommonDataFormat/InteractionRecord.h" #include "DataFormatsCTP/Digits.h" -#include +#include namespace o2 { @@ -24,17 +24,11 @@ class Digitizer public: Digitizer() = default; ~Digitizer() = default; - void setInteractionRecord(const o2::InteractionRecord& intrec) { mIntRecord = intrec; } - void process(CTPDigit digit, std::vector& digits); - void flush(std::vector& digits); - void storeBC(const o2::ctp::CTPDigit& cashe, std::vector& digits); + void process(gsl::span digits, gsl::span rawdata); + void calculateClassMask(std::vector inputs, std::bitset& classmask); void init(); private: - Int_t mEventID; - o2::InteractionRecord firstBCinDeque{}; - std::deque mCache; - o2::InteractionRecord mIntRecord; ClassDefNV(Digitizer, 1); }; } // namespace ctp diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index e207a8d4a9134..09257800226c7 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -12,28 +12,67 @@ #include "TRandom.h" #include #include "FairLogger.h" +#include using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(CTPDigit digit, std::vector& digits) +void Digitizer::process(gsl::span digits,gsl::span rawdata) { - //digit.mIntRecord = mIntRecord; - // Dummy inputs and classes - //TRandom rnd; - //digit.mCTPInputMask = (rnd.Integer(0xffffffff)); - //digit.mCTPClassMask = (rnd.Integer(0xffffffff)); - mCache.push_back(digit); + std::map> prerawdata; + for(auto const& inp: digits) + { + if(prerawdata.count(inp.mIntRecord) == 0) + { + std::vector inputs; + inputs.push_back(&inp); + prerawdata[inp.mIntRecord]=inputs; + } + else + prerawdata[inp.mIntRecord].push_back(&inp); + } + std::vector vrawdata; + for(auto const& coll: prerawdata) + { + CTPRawData data; + data.mIntRecord=coll.first; + std::bitset inpmaskcoll = 0; + for(auto const inp: coll.second) + { + switch (inp->mDetector) { + case o2::detectors::DetID::FT0: { + std::bitset inpmask = std::bitset( + (inp->mInputsMask & CTP_INPUTMASK_FT0.second).to_ullong()); + inpmaskcoll |= inpmask << CTP_INPUTMASK_FT0.first; + break; + } + case o2::detectors::DetID::FV0: { + std::bitset inpmask = std::bitset( + (inp->mInputsMask & CTP_INPUTMASK_FT0.second).to_ullong()); + inpmaskcoll |= inpmask << CTP_INPUTMASK_FT0.first; + break; + } + default: + // Error + LOG(ERROR) << "CTP Digitizer: unknown detector:" << inp->mDetector; + break; + } + } + data.mCTPInputMask = inpmaskcoll; + calculateClassMask(coll.second, data.mCTPClassMask); + vrawdata.emplace_back(data); + } + rawdata = gsl::span(vrawdata); } -void Digitizer::flush(std::vector& digits) +void Digitizer::calculateClassMask(std::vector inputs, std::bitset& classmask) { - assert(mCache.size() != 1); - storeBC(mCache.front(), digits); -} -void Digitizer::storeBC(const o2::ctp::CTPDigit& cashe, std::vector& digits) -{ - digits.push_back(cashe); + // Example of Min Bias as V0 or T0 + classmask = 0; + if(inputs.size() > 1) + { + classmask = 1; + } } void Digitizer::init() { diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 04942d22471a8..6e71a738a24ff 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -22,6 +22,7 @@ #include "DataFormatsFV0/BCData.h" #include +#include using namespace o2::framework; namespace o2 @@ -41,72 +42,44 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer } void run(framework::ProcessingContext& pc) { - if (mFinished) { - return; - } // read collision context from input //auto context = pc.inputs().get("collisioncontext"); //const bool withQED = context->isQEDProvided(); //auto& timesview = context->getEventRecords(withQED); // read ctp inputs from input - auto ft0inputs = pc.inputs().get>("ft0"); - auto fv0inputs = pc.inputs().get>("fv0"); + auto ft0inputs = pc.inputs().get>("ft0"); + auto fv0inputs = pc.inputs().get>("fv0"); // if there is nothing to do ... return if ((ft0inputs.size() == 0) && (fv0inputs.size() == 0)) { return; } - std::map finputs; + std::vector finputs; TStopwatch timer; timer.Start(); LOG(INFO) << "CALLING CTP DIGITIZATION"; - //for (const auto& coll : timesview) { - // mDigitizer.setInteractionRecord(coll); - // mDigitizer.process(mDigits); - // mDigitizer.flush(mDigits); - //} for (const auto& inp : ft0inputs) { - CTPInputDigit finpdigit; - finpdigit.mDetector = o2::detectors::DetID::FT0; - finpdigit.mInputsMask = inp.mInputs; - CTPDigit fctpdigit; - fctpdigit.mIntRecord = inp.mIntRecord; - fctpdigit.mInputs.push_back(finpdigit); - finputs[inp.mIntRecord] = fctpdigit; + CTPInputDigit finpdigit(inp.mIntRecord, inp.mInputs,o2::detectors::DetID::FT0); + finputs.emplace_back(finpdigit); } for (const auto& inp : fv0inputs) { - CTPInputDigit finpdigit; - finpdigit.mDetector = o2::detectors::DetID::FV0; - finpdigit.mInputsMask = inp.mInputs; - if (finputs.count(inp.mIntRecord) == 0) { - CTPDigit fctpdigit; - fctpdigit.mIntRecord = inp.mIntRecord; - fctpdigit.mInputs.push_back(finpdigit); - finputs[inp.mIntRecord] = fctpdigit; - } else { - finputs[inp.mIntRecord].mInputs.push_back(finpdigit); - } - } - for (const auto& inps : finputs) { - mDigitizer.setInteractionRecord(inps.first); - mDigitizer.process(inps.second, mDigits); - mDigitizer.flush(mDigits); + CTPInputDigit finpdigit(inp.mIntRecord, inp.mInputs,o2::detectors::DetID::FT0); + finputs.emplace_back(finpdigit); } + gsl::span ginputs(finputs); + mDigitizer.process(ginputs,mDigits); // send out to next stage + LOG(INFO) << "CTP DIGITS being sent."; pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); + LOG(INFO) << "CTP PRESENT being sent."; + pc.outputs().snapshot(Output{"CTP","ROMode",0,Lifetime::Timeframe},mROMode); timer.Stop(); LOG(INFO) << "CTP Digitization took " << timer.CpuTime() << "s"; - // we should be only called once; tell DPL that this process is ready to exit - pc.services().get().readyToQuit(QuitRequest::Me); - mFinished = true; } protected: - bool mFinished = false; - std::vector mDigits; - - Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation - double mFairTimeUnitInNS = 1; ///< Fair time unit in ns + o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::PRESENT; + gsl::span mDigits; o2::ctp::Digitizer mDigitizer; ///< Digitizer }; o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth) From 4ea5747505af776e8c84d06ae3d5f33d0e455db5 Mon Sep 17 00:00:00 2001 From: lietava Date: Mon, 29 Mar 2021 17:15:10 +0200 Subject: [PATCH 12/17] clang format --- .../CTP/include/DataFormatsCTP/Digits.h | 4 +- Detectors/CTP/simulation/src/Digitizer.cxx | 88 +++++++++---------- .../src/CTPDigitizerSpec.cxx | 10 +-- 3 files changed, 48 insertions(+), 54 deletions(-) diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index 090feae5d84b0..66ff9813d4bca 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -24,8 +24,8 @@ static constexpr uint32_t CTP_NINPUTS = 46; static constexpr uint32_t CTP_NCLASSES = 64; static constexpr uint32_t CTP_MAXL0PERDET = 5; // Positions of CTP Detector inputs in CTPInputMask -static constexpr std::pair > CTP_INPUTMASK_FV0(0,0x1f); -static constexpr std::pair > CTP_INPUTMASK_FT0(5,0x1f); +static constexpr std::pair> CTP_INPUTMASK_FV0(0, 0x1f); +static constexpr std::pair> CTP_INPUTMASK_FT0(5, 0x1f); struct CTPRawData { o2::InteractionRecord mIntRecord; std::bitset mCTPInputMask; diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 09257800226c7..fde304202e569 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -18,61 +18,55 @@ using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(gsl::span digits,gsl::span rawdata) +void Digitizer::process(gsl::span digits, gsl::span rawdata) { - std::map> prerawdata; - for(auto const& inp: digits) - { - if(prerawdata.count(inp.mIntRecord) == 0) - { - std::vector inputs; - inputs.push_back(&inp); - prerawdata[inp.mIntRecord]=inputs; - } - else - prerawdata[inp.mIntRecord].push_back(&inp); + std::map> prerawdata; + for (auto const& inp : digits) { + if (prerawdata.count(inp.mIntRecord) == 0) { + std::vector inputs; + inputs.push_back(&inp); + prerawdata[inp.mIntRecord] = inputs; + } else + prerawdata[inp.mIntRecord].push_back(&inp); } std::vector vrawdata; - for(auto const& coll: prerawdata) - { - CTPRawData data; - data.mIntRecord=coll.first; - std::bitset inpmaskcoll = 0; - for(auto const inp: coll.second) - { - switch (inp->mDetector) { - case o2::detectors::DetID::FT0: { - std::bitset inpmask = std::bitset( - (inp->mInputsMask & CTP_INPUTMASK_FT0.second).to_ullong()); - inpmaskcoll |= inpmask << CTP_INPUTMASK_FT0.first; - break; - } - case o2::detectors::DetID::FV0: { - std::bitset inpmask = std::bitset( - (inp->mInputsMask & CTP_INPUTMASK_FT0.second).to_ullong()); - inpmaskcoll |= inpmask << CTP_INPUTMASK_FT0.first; - break; - } - default: - // Error - LOG(ERROR) << "CTP Digitizer: unknown detector:" << inp->mDetector; - break; - } + for (auto const& coll : prerawdata) { + CTPRawData data; + data.mIntRecord = coll.first; + std::bitset inpmaskcoll = 0; + for (auto const inp : coll.second) { + switch (inp->mDetector) { + case o2::detectors::DetID::FT0: { + std::bitset inpmask = std::bitset( + (inp->mInputsMask & CTP_INPUTMASK_FT0.second).to_ullong()); + inpmaskcoll |= inpmask << CTP_INPUTMASK_FT0.first; + break; + } + case o2::detectors::DetID::FV0: { + std::bitset inpmask = std::bitset( + (inp->mInputsMask & CTP_INPUTMASK_FT0.second).to_ullong()); + inpmaskcoll |= inpmask << CTP_INPUTMASK_FT0.first; + break; + } + default: + // Error + LOG(ERROR) << "CTP Digitizer: unknown detector:" << inp->mDetector; + break; } - data.mCTPInputMask = inpmaskcoll; - calculateClassMask(coll.second, data.mCTPClassMask); - vrawdata.emplace_back(data); + } + data.mCTPInputMask = inpmaskcoll; + calculateClassMask(coll.second, data.mCTPClassMask); + vrawdata.emplace_back(data); } rawdata = gsl::span(vrawdata); } -void Digitizer::calculateClassMask(std::vector inputs, std::bitset& classmask) +void Digitizer::calculateClassMask(std::vector inputs, std::bitset& classmask) { - // Example of Min Bias as V0 or T0 - classmask = 0; - if(inputs.size() > 1) - { - classmask = 1; - } + // Example of Min Bias as V0 or T0 + classmask = 0; + if (inputs.size() > 1) { + classmask = 1; + } } void Digitizer::init() { diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 6e71a738a24ff..2f91301f12dc7 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -59,20 +59,20 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer timer.Start(); LOG(INFO) << "CALLING CTP DIGITIZATION"; for (const auto& inp : ft0inputs) { - CTPInputDigit finpdigit(inp.mIntRecord, inp.mInputs,o2::detectors::DetID::FT0); + CTPInputDigit finpdigit(inp.mIntRecord, inp.mInputs, o2::detectors::DetID::FT0); finputs.emplace_back(finpdigit); } for (const auto& inp : fv0inputs) { - CTPInputDigit finpdigit(inp.mIntRecord, inp.mInputs,o2::detectors::DetID::FT0); - finputs.emplace_back(finpdigit); + CTPInputDigit finpdigit(inp.mIntRecord, inp.mInputs, o2::detectors::DetID::FT0); + finputs.emplace_back(finpdigit); } gsl::span ginputs(finputs); - mDigitizer.process(ginputs,mDigits); + mDigitizer.process(ginputs, mDigits); // send out to next stage LOG(INFO) << "CTP DIGITS being sent."; pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); LOG(INFO) << "CTP PRESENT being sent."; - pc.outputs().snapshot(Output{"CTP","ROMode",0,Lifetime::Timeframe},mROMode); + pc.outputs().snapshot(Output{"CTP", "ROMode", 0, Lifetime::Timeframe}, mROMode); timer.Stop(); LOG(INFO) << "CTP Digitization took " << timer.CpuTime() << "s"; } From 38b532544bf1f731a3a3347c9f8c4c7b53e180fc Mon Sep 17 00:00:00 2001 From: lietava Date: Tue, 30 Mar 2021 11:32:37 +0200 Subject: [PATCH 13/17] rubens suggestions - passing vectors/spans cleaned/fixed --- .../Detectors/CTP/include/DataFormatsCTP/Digits.h | 6 +++--- .../Detectors/CTP/src/DataFormatsCTPLinkDef.h | 4 ++-- DataFormats/Detectors/CTP/src/Digits.cxx | 2 +- .../simulation/include/CTPSimulation/Digitizer.h | 2 +- Detectors/CTP/simulation/src/Digitizer.cxx | 13 +++++++------ Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx | 4 ++-- Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h | 2 +- Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx | 5 ++--- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h index 66ff9813d4bca..1c2de16b31b92 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Digits.h @@ -26,13 +26,13 @@ static constexpr uint32_t CTP_MAXL0PERDET = 5; // Positions of CTP Detector inputs in CTPInputMask static constexpr std::pair> CTP_INPUTMASK_FV0(0, 0x1f); static constexpr std::pair> CTP_INPUTMASK_FT0(5, 0x1f); -struct CTPRawData { +struct CTPDigit { o2::InteractionRecord mIntRecord; std::bitset mCTPInputMask; std::bitset mCTPClassMask; - CTPRawData() = default; + CTPDigit() = default; void printStream(std::ostream& stream) const; - ClassDefNV(CTPRawData, 1); + ClassDefNV(CTPDigit, 1); }; struct CTPInputDigit { o2::InteractionRecord mIntRecord; diff --git a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h index fcae8537d57b7..c155641020168 100644 --- a/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h +++ b/DataFormats/Detectors/CTP/src/DataFormatsCTPLinkDef.h @@ -13,8 +13,8 @@ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::ctp::CTPRawData + ; -#pragma link C++ class vector < o2::ctp::CTPRawData> + ; +#pragma link C++ class o2::ctp::CTPDigit + ; +#pragma link C++ class vector < o2::ctp::CTPDigit> + ; #pragma link C++ class o2::ctp::CTPInputDigit + ; #pragma link C++ class vector < o2::ctp::CTPInputDigit> + ; #endif diff --git a/DataFormats/Detectors/CTP/src/Digits.cxx b/DataFormats/Detectors/CTP/src/Digits.cxx index 19c3e2a460384..7b02a59f6312c 100644 --- a/DataFormats/Detectors/CTP/src/Digits.cxx +++ b/DataFormats/Detectors/CTP/src/Digits.cxx @@ -13,7 +13,7 @@ using namespace o2::ctp; -void CTPRawData::printStream(std::ostream& stream) const +void CTPDigit::printStream(std::ostream& stream) const { stream << "CTP Digit: BC " << mIntRecord.bc << " orbit " << mIntRecord.orbit << std::endl; stream << "Input Mask: " << mCTPInputMask << " Class Mask: " << mCTPClassMask << std::endl; diff --git a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h index 268d51e73aa56..6bcfb29467da1 100644 --- a/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h +++ b/Detectors/CTP/simulation/include/CTPSimulation/Digitizer.h @@ -24,7 +24,7 @@ class Digitizer public: Digitizer() = default; ~Digitizer() = default; - void process(gsl::span digits, gsl::span rawdata); + std::vector process(const gsl::span digits); void calculateClassMask(std::vector inputs, std::bitset& classmask); void init(); diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index fde304202e569..5c528cc380682 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -18,20 +18,21 @@ using namespace o2::ctp; ClassImp(Digitizer); -void Digitizer::process(gsl::span digits, gsl::span rawdata) +std::vector Digitizer::process(const gsl::span digits) { std::map> prerawdata; for (auto const& inp : digits) { - if (prerawdata.count(inp.mIntRecord) == 0) { + auto res = prerawdata.find(inp.mIntRecord); + if (res == prerawdata.end() ) { std::vector inputs; inputs.push_back(&inp); prerawdata[inp.mIntRecord] = inputs; } else - prerawdata[inp.mIntRecord].push_back(&inp); + res->second.push_back(&inp); } - std::vector vrawdata; + std::vector vrawdata; for (auto const& coll : prerawdata) { - CTPRawData data; + CTPDigit data; data.mIntRecord = coll.first; std::bitset inpmaskcoll = 0; for (auto const inp : coll.second) { @@ -58,7 +59,7 @@ void Digitizer::process(gsl::span digits, gsl::span(vrawdata); + return std::move(vrawdata); } void Digitizer::calculateClassMask(std::vector inputs, std::bitset& classmask) { diff --git a/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx b/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx index 3583533ffe67b..1376245973d81 100644 --- a/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx +++ b/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx @@ -42,13 +42,13 @@ framework::DataProcessorSpec getCTPDigitWriterSpec(bool raw) }; if (raw) { return MakeRootTreeWriterSpec("CTPDigitWriter", - "ctpdigits.root", + "o2_ctpdigits.root", "o2sim", MakeRootTreeWriterSpec::CustomClose(finishWriting), BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); } else { return MakeRootTreeWriterSpec("CTPDigitWriter", - "o2_ctpdigits.root", + "ctpdigits.root", "o2sim", MakeRootTreeWriterSpec::CustomClose(finishWriting), BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); diff --git a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h index fc09c6571d2bf..b1d88e42abda4 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h @@ -30,7 +30,7 @@ o2::framework::DataProcessorSpec getCTPDigitWriterSpec(bool mctruth) return MakeRootTreeWriterSpec("CTPDigitWriter", "ctpdigits.root", "o2sim", - BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); + BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); } } // namespace ctp diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 2f91301f12dc7..411e1270b97a2 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -67,10 +67,10 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer finputs.emplace_back(finpdigit); } gsl::span ginputs(finputs); - mDigitizer.process(ginputs, mDigits); + auto digits = mDigitizer.process(ginputs); // send out to next stage LOG(INFO) << "CTP DIGITS being sent."; - pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, mDigits); + pc.outputs().snapshot(Output{"CTP", "DIGITS", 0, Lifetime::Timeframe}, digits); LOG(INFO) << "CTP PRESENT being sent."; pc.outputs().snapshot(Output{"CTP", "ROMode", 0, Lifetime::Timeframe}, mROMode); timer.Stop(); @@ -79,7 +79,6 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer protected: o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::PRESENT; - gsl::span mDigits; o2::ctp::Digitizer mDigitizer; ///< Digitizer }; o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth) From 368254fe09fda3c0757731ba7295c554b47c8f7c Mon Sep 17 00:00:00 2001 From: lietava Date: Tue, 30 Mar 2021 11:33:23 +0200 Subject: [PATCH 14/17] clang format --- Detectors/CTP/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 5c528cc380682..d60ac5a775480 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -23,7 +23,7 @@ std::vector Digitizer::process(const gsl::span std::map> prerawdata; for (auto const& inp : digits) { auto res = prerawdata.find(inp.mIntRecord); - if (res == prerawdata.end() ) { + if (res == prerawdata.end()) { std::vector inputs; inputs.push_back(&inp); prerawdata[inp.mIntRecord] = inputs; From db6f4376a6e1b4b38f9286677c8bdab0d643cb95 Mon Sep 17 00:00:00 2001 From: shahoian Date: Wed, 31 Mar 2021 00:45:44 +0200 Subject: [PATCH 15/17] some fixes --- .../DetectorsCommonDataFormats/DetID.h | 3 +- .../CTP/workflow/src/CTPDigitWriterSpec.cxx | 36 +++--------------- Steer/DigitizerWorkflow/CMakeLists.txt | 1 + .../src/CTPDigitWriterSpec.h | 38 ------------------- .../src/CTPDigitizerSpec.cxx | 5 ++- .../src/SimpleDigitizerWorkflow.cxx | 4 +- macro/o2sim.C | 5 +++ 7 files changed, 19 insertions(+), 73 deletions(-) delete mode 100644 Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h index 3f2cbe25c6681..d0152ee515eb8 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h @@ -156,7 +156,8 @@ class DetID sOrigins = ///< detector data origins {o2h::gDataOriginITS, o2h::gDataOriginTPC, o2h::gDataOriginTRD, o2h::gDataOriginTOF, o2h::gDataOriginPHS, o2h::gDataOriginCPV, o2h::gDataOriginEMC, o2h::gDataOriginHMP, o2h::gDataOriginMFT, o2h::gDataOriginMCH, - o2h::gDataOriginMID, o2h::gDataOriginZDC, o2h::gDataOriginFT0, o2h::gDataOriginFV0, o2h::gDataOriginFDD, o2h::gDataOriginACO + o2h::gDataOriginMID, o2h::gDataOriginZDC, o2h::gDataOriginFT0, o2h::gDataOriginFV0, o2h::gDataOriginFDD, + o2h::gDataOriginACO, o2h::gDataOriginCTP #ifdef ENABLE_UPGRADES , o2h::gDataOriginIT3, o2h::gDataOriginTRK, o2h::gDataOriginFT3 diff --git a/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx b/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx index 1376245973d81..7b956954bfe79 100644 --- a/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx +++ b/Detectors/CTP/workflow/src/CTPDigitWriterSpec.cxx @@ -22,37 +22,13 @@ framework::DataProcessorSpec getCTPDigitWriterSpec(bool raw) using InputSpec = framework::InputSpec; using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; // Spectators for logging - auto logger = [](std::vector const& vecDigits) { - LOG(INFO) << "FT0DigitWriter pulled " << vecDigits.size() << " digits"; + auto logger = [](std::vector const& vecDigits) { + LOG(INFO) << "CTPDigitWriter pulled " << vecDigits.size() << " digits"; }; - // the callback to be set as hook for custom action when the writer is closed - auto finishWriting = [](TFile* outputfile, TTree* outputtree) { - const auto* brArr = outputtree->GetListOfBranches(); - int64_t nent = 0; - for (const auto* brc : *brArr) { - int64_t n = ((const TBranch*)brc)->GetEntries(); - if (nent && (nent != n)) { - LOG(ERROR) << "Branches have different number of entries"; - } - nent = n; - } - outputtree->SetEntries(nent); - outputtree->Write(); - outputfile->Close(); - }; - if (raw) { - return MakeRootTreeWriterSpec("CTPDigitWriter", - "o2_ctpdigits.root", - "o2sim", - MakeRootTreeWriterSpec::CustomClose(finishWriting), - BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); - } else { - return MakeRootTreeWriterSpec("CTPDigitWriter", - "ctpdigits.root", - "o2sim", - MakeRootTreeWriterSpec::CustomClose(finishWriting), - BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC", "ctp-digits-branch-name", 1})(); - } + return MakeRootTreeWriterSpec(raw ? "ctp-digit-writer-dec" : "ctp-digit-writer", + raw ? "o2_ctpdigits.root" : "ctpdigits.root", + MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with CTP digits"}, + BranchDefinition>{InputSpec{"digit", "CTP", "DIGITS", 0}, "CTPDigits", logger})(); } } // namespace ctp diff --git a/Steer/DigitizerWorkflow/CMakeLists.txt b/Steer/DigitizerWorkflow/CMakeLists.txt index 591d68fdcabe4..60a487738a5ce 100644 --- a/Steer/DigitizerWorkflow/CMakeLists.txt +++ b/Steer/DigitizerWorkflow/CMakeLists.txt @@ -37,6 +37,7 @@ o2_add_executable(digitizer-workflow O2::FV0Simulation O2::FDDSimulation O2::CTPSimulation + O2::CTPWorkflow O2::FDDWorkflow O2::HMPIDSimulation O2::ITSMFTSimulation diff --git a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h deleted file mode 100644 index b1d88e42abda4..0000000000000 --- a/Steer/DigitizerWorkflow/src/CTPDigitWriterSpec.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -#ifndef STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H -#define STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H - -#include "Framework/DataProcessorSpec.h" -#include "DPLUtils/MakeRootTreeWriterSpec.h" -#include "Framework/InputSpec.h" -#include "DataFormatsCTP/Digits.h" - -namespace o2 -{ -namespace ctp -{ - -template -using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; - -o2::framework::DataProcessorSpec getCTPDigitWriterSpec(bool mctruth) -{ - using InputSpec = framework::InputSpec; - using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; - return MakeRootTreeWriterSpec("CTPDigitWriter", - "ctpdigits.root", - "o2sim", - BranchDefinition>{InputSpec{"digitBC", "CTP", "DIGITSBC"}, "CTPDIGITSBC"})(); -} - -} // namespace ctp -} // end namespace o2 -#endif //STEER_DIGITIZERWORKFLOW_CTPDIGITWRITERSPEC_H diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 411e1270b97a2..198e7cc074810 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -91,7 +91,8 @@ o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vectorGetDetId())); } + // CTP is not a physical detector, just flag in the GRP if requested + if (isActivated("CTP")) { + grp.addDetReadOut(o2::detectors::DetID::CTP); + } + grp.print(); printf("VMC: %p\n", TVirtualMC::GetMC()); auto field = dynamic_cast(run->GetField()); From f8e66be4cca3e811069de3a1104bad1862446619 Mon Sep 17 00:00:00 2001 From: lietava Date: Wed, 31 Mar 2021 16:08:06 +0200 Subject: [PATCH 16/17] fullCI fixes --- Detectors/CTP/simulation/src/CTPSimulationLinkDef.h | 9 +++++++++ Detectors/CTP/simulation/src/Digitizer.cxx | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h b/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h index 350aea83fbc20..af1e5c8043e99 100644 --- a/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h +++ b/Detectors/CTP/simulation/src/CTPSimulationLinkDef.h @@ -1,3 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. #ifdef __CLING__ #pragma link off all globals; diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index d60ac5a775480..98b915bf2b612 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -27,8 +27,9 @@ std::vector Digitizer::process(const gsl::span std::vector inputs; inputs.push_back(&inp); prerawdata[inp.mIntRecord] = inputs; - } else - res->second.push_back(&inp); + } else { + res->second.push_back(&inp); + } } std::vector vrawdata; for (auto const& coll : prerawdata) { From b0761c517812d07b7ad2dbf3735ee1a65a814758 Mon Sep 17 00:00:00 2001 From: lietava Date: Wed, 31 Mar 2021 16:13:36 +0200 Subject: [PATCH 17/17] clang format --- Detectors/CTP/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 98b915bf2b612..dceb22d2efb4d 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -28,7 +28,7 @@ std::vector Digitizer::process(const gsl::span inputs.push_back(&inp); prerawdata[inp.mIntRecord] = inputs; } else { - res->second.push_back(&inp); + res->second.push_back(&inp); } } std::vector vrawdata;