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
22
23using namespace o2::phos::reco_workflow;
24
28
30{
31 // Get the PHOS block header and check whether it contains digits
32 LOG(debug) << "[PHOSDigitsPrinter - process] called";
33 auto dataref = pc.inputs().get("digits");
34 auto const* phosheader = o2::framework::DataRefUtils::getHeader<o2::phos::PHOSBlockHeader*>(dataref);
35 if (!phosheader->mHasPayload) {
36 LOG(debug) << "[PHOSDigitsPrinter - process] No more digits" << std::endl;
38 return;
39 }
40
41 auto digits = pc.inputs().get<std::vector<o2::phos::Digit>>("digits");
42 std::cout << "[PHOSDigitsPrinter - process] receiveed " << digits.size() << " digits ..." << std::endl;
43 if (digits.size()) {
44 for (const auto& d : digits) {
45 std::cout << "[PHOSDigitsPrinter - process] Channel(" << d.getAbsId() << ") energy: " << d.getAmplitude() << std::endl;
46 }
47 }
48}
49
51{
52
53 return o2::framework::DataProcessorSpec{"PHOSDigitsPrinter",
54 {{"digits", o2::header::gDataOriginPHS, "DIGITS", 0, o2::framework::Lifetime::Timeframe}},
55 {},
56 o2::framework::adaptFromTask<o2::phos::reco_workflow::DigitsPrinterSpec>()};
57}
std::ostringstream debug
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.
void run(framework::ProcessingContext &ctx) final
Printing digit-related information.
void init(framework::InitContext &ctx) final
Initializing the digits printer task.
constexpr o2::header::DataOrigin gDataOriginPHS
Definition DataHeader.h:574
@ Me
Only quit this data processor.
o2::framework::DataProcessorSpec getPhosDigitsPrinterSpec()
Creating digits printer spec.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits