Project
Loading...
Searching...
No Matches
CTPDigitizerSpec.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "CTPDigitizerSpec.h"
17#include "Framework//Task.h"
20#include "Steer/HitProcessingManager.h" // for DigitizationContext
26
27#include <TStopwatch.h>
28#include <gsl/span>
29
30using namespace o2::framework;
31namespace o2
32{
33namespace ctp
34{
36{
38
39 public:
40 CTPDPLDigitizerTask(const std::vector<o2::detectors::DetID>& detList) : o2::base::BaseDPLDigitizer(), mDigitizer(), mDetList(detList) {}
41 ~CTPDPLDigitizerTask() override = default;
43 {
45 }
47 {
48 // read collision context from input
49 // auto context = pc.inputs().get<o2::steer::DigitizationContext*>("collisioncontext");
50 // const bool withQED = context->isQEDProvided();
51 // auto& timesview = context->getEventRecords(withQED);
52 // read ctp inputs from input
53
54 std::vector<o2::ctp::CTPInputDigit> finputs;
55 TStopwatch timer;
56 timer.Start();
57 pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
58 LOG(info) << "CALLING CTP DIGITIZATION";
59 // Input order: T0, V0, ... but O need also position of inputs DETInputs
60 // fv0
61 if (std::find(mDetList.begin(), mDetList.end(), o2::detectors::DetID::FT0) != mDetList.end()) {
62 auto ft0inputs = pc.inputs().get<gsl::span<o2::ft0::DetTrigInput>>("ft0");
63 for (const auto& inp : ft0inputs) {
64 finputs.emplace_back(CTPInputDigit{inp.mIntRecord, inp.mInputs, o2::detectors::DetID::FT0});
65 }
66 }
67 // fv0
68 if (std::find(mDetList.begin(), mDetList.end(), o2::detectors::DetID::FV0) != mDetList.end()) {
69 auto fv0inputs = pc.inputs().get<gsl::span<o2::fv0::DetTrigInput>>("fv0");
70 for (const auto& inp : fv0inputs) {
71 finputs.emplace_back(CTPInputDigit{inp.mIntRecord, inp.mInputs, o2::detectors::DetID::FV0});
72 }
73 }
74 // emc
75 if (std::find(mDetList.begin(), mDetList.end(), o2::detectors::DetID::EMC) != mDetList.end()) {
76 auto emcinputs = pc.inputs().get<gsl::span<o2::ctp::CTPInputDigit>>("emc");
77 for (const auto& inp : emcinputs) {
78 finputs.emplace_back(inp);
79 }
80 }
81 gsl::span<CTPInputDigit> ginputs(finputs);
82 auto digits = mDigitizer.process(ginputs);
83 // send out to next stage
84 LOG(info) << "CTP DIGITS being sent.";
85 pc.outputs().snapshot(Output{"CTP", "DIGITS", 0}, digits);
86 LOG(info) << "CTP PRESENT being sent.";
87 pc.outputs().snapshot(Output{"CTP", "ROMode", 0}, mROMode);
88 timer.Stop();
89 LOG(info) << "CTP Digitization took " << timer.CpuTime() << "s";
90 }
91
93 {
94
95 if (matcher == o2::framework::ConcreteDataMatcher("CTP", "CTPCONFIG", 0)) {
96 LOG(info) << "Loading CTP configuration" << std::endl;
98 }
99 }
100
101 protected:
104 std::vector<o2::detectors::DetID> mDetList;
105};
106o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2::detectors::DetID>& detList, bool mctruth)
107{
108 std::vector<InputSpec> inputs;
109 std::vector<OutputSpec> output;
110
111 if (std::find(detList.begin(), detList.end(), o2::detectors::DetID::FT0) != detList.end()) {
112 inputs.emplace_back("ft0", "FT0", "TRIGGERINPUT", 0, Lifetime::Timeframe);
113 }
114 if (std::find(detList.begin(), detList.end(), o2::detectors::DetID::FV0) != detList.end()) {
115 inputs.emplace_back("fv0", "FV0", "TRIGGERINPUT", 0, Lifetime::Timeframe);
116 }
117 if (std::find(detList.begin(), detList.end(), o2::detectors::DetID::EMC) != detList.end()) {
118 inputs.emplace_back("emc", "EMC", "TRIGGERINPUT", 0, Lifetime::Timeframe);
119 }
120 inputs.emplace_back("ctpconfig", "CTP", "CTPCONFIG", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/Config", true));
121 output.emplace_back("CTP", "DIGITS", 0, Lifetime::Timeframe);
122 output.emplace_back("CTP", "ROMode", 0, Lifetime::Timeframe);
123 return DataProcessorSpec{
124 "CTPDigitizer",
125 inputs,
126 output,
127 AlgorithmSpec{adaptFromTask<CTPDPLDigitizerTask>(detList)},
128 Options{{"pileup", VariantType::Int, 1, {"whether to run in continuous time mode"}},
129 {"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}}};
130}
131} // namespace ctp
132} // namespace o2
Definition of the base digitizer task class.
definition of CTPConfiguration and related CTP structures
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
definition of CTPDigit, CTPInputDigit
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
std::vector< o2::detectors::DetID > mDetList
void run(framework::ProcessingContext &pc)
CTPDPLDigitizerTask(const std::vector< o2::detectors::DetID > &detList)
void initDigitizerTask(framework::InitContext &ic) override
~CTPDPLDigitizerTask() override=default
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
o2::parameters::GRPObject::ROMode mROMode
o2::ctp::Digitizer mDigitizer
Digitizer.
std::vector< CTPDigit > process(const gsl::span< o2::ctp::CTPInputDigit > detinputs)
Definition Digitizer.cxx:27
void setCTPConfiguration(o2::ctp::CTPConfiguration *config)
static constexpr ID FV0
Definition DetID.h:76
static constexpr ID FT0
Definition DetID.h:75
static constexpr ID EMC
Definition DetID.h:69
void snapshot(const Output &spec, T const &object)
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector< o2::detectors::DetID > &detList, bool mctruth)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits