Project
Loading...
Searching...
No Matches
DigitsPrinterSpec.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 <vector>
13#include <iostream>
14
15#include <fairlogger/Logger.h>
16
23
24using namespace o2::cpv::reco_workflow;
25
29
31{
32 // Get the CPV block header and check whether it contains digits
33 LOG(debug) << "[CPVDigitsPrinter - process] called";
34 auto dataref = pc.inputs().get("digits");
35 auto const* cpvheader = o2::framework::DataRefUtils::getHeader<o2::cpv::CPVBlockHeader*>(dataref);
36 if (!cpvheader->mHasPayload) {
37 LOG(debug) << "[CPVDigitsPrinter - process] No more digits" << std::endl;
40 return;
41 }
42
43 auto digits = pc.inputs().get<std::vector<o2::cpv::Digit>>("digits");
44 std::cout << "[CPVDigitsPrinter - process] receiveed " << digits.size() << " digits ..." << std::endl;
45 if (digits.size()) {
46 for (const auto& d : digits) {
47 std::cout << "[CPVDigitsPrinter - process] Channel(" << d.getAbsId() << ") energy: " << d.getAmplitude() << std::endl;
48 }
49 }
50}
51
53{
54
55 return o2::framework::DataProcessorSpec{"CPVDigitsPrinter",
56 {{"digits", o2::header::gDataOriginCPV, "DIGITS", 0, o2::framework::Lifetime::Timeframe}},
57 {},
58 o2::framework::adaptFromTask<o2::cpv::reco_workflow::DigitsPrinterSpec>()};
59}
std::ostringstream debug
void run(framework::ProcessingContext &ctx) final
Printing digit-related information.
void init(framework::InitContext &ctx) final
Initializing the digits printer task.
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
virtual void endOfStream(EndOfStreamContext &context)
This is invoked whenever we have an EndOfStream event.
Definition Task.h:43
constexpr o2::header::DataOrigin gDataOriginCPV
Definition DataHeader.h:563
o2::framework::DataProcessorSpec getPhosDigitsPrinterSpec()
Creating digits printer spec.
@ Me
Only quit this data processor.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits