Project
Loading...
Searching...
No Matches
DigitParserSpec.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
15
16#include <iostream>
17#include <vector>
18#include <string>
19#include <cstdlib>
22#include "Framework/Logger.h"
36
37using namespace o2::framework;
38
39namespace o2
40{
41namespace zdc
42{
43
45{
46 mTimer.Stop();
47 mTimer.Reset();
48}
49
51{
52 mTimer.Stop();
53 mTimer.Reset();
54}
55
57{
58 mWorker.setOutput(ic.options().get<std::string>("parser-output"));
59 mWorker.setRejectPileUp((ic.options().get<int>("reject-pileup")) != 0);
60}
61
63{
64 // we call these methods just to trigger finaliseCCDB callback
65 pc.inputs().get<o2::zdc::ModuleConfig*>("moduleconfig");
66}
67
69{
70 if (matcher == ConcreteDataMatcher("ZDC", "MODULECONFIG", 0)) {
71 auto* config = (const o2::zdc::ModuleConfig*)obj;
72 if (mVerbosity > DbgZero) {
73 config->print();
74 }
75 mWorker.setModuleConfig(config);
76 }
77}
78
80{
81 if (!mInitialized) {
82 LOG(info) << "DigitParserSpec::run initialization";
83 mInitialized = true;
85 mWorker.setVerbosity(mVerbosity);
86 mWorker.init();
87 }
88 auto cput = mTimer.CpuTime();
89 mTimer.Start(false);
90
91 auto bcdata = pc.inputs().get<gsl::span<o2::zdc::BCData>>("trig");
92 auto chans = pc.inputs().get<gsl::span<o2::zdc::ChannelData>>("chan");
93 auto peds = pc.inputs().get<gsl::span<o2::zdc::OrbitData>>("peds");
94
95 int rval = mWorker.process(peds, bcdata, chans);
96 if (rval != 0) {
97 LOG(warning) << bcdata.size() << " BC " << chans.size() << " CH " << peds.size() << " OD -> processing ended in ERROR @ line " << rval;
98 }
99 mTimer.Stop();
100}
101
103{
104 mWorker.eor();
105 LOGF(info, "ZDC digits parsing total time: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
106}
107
109{
110 std::vector<InputSpec> inputs;
111 inputs.emplace_back("trig", "ZDC", "DIGITSBC", 0, Lifetime::Timeframe);
112 inputs.emplace_back("chan", "ZDC", "DIGITSCH", 0, Lifetime::Timeframe);
113 inputs.emplace_back("peds", "ZDC", "DIGITSPD", 0, Lifetime::Timeframe);
114 inputs.emplace_back("moduleconfig", "ZDC", "MODULECONFIG", 0, Lifetime::Condition, o2::framework::ccdbParamSpec(o2::zdc::CCDBPathConfigModule.data()));
115
116 std::vector<OutputSpec> outputs;
117
118 return DataProcessorSpec{
119 "zdc-digi-parser",
120 inputs,
121 outputs,
122 AlgorithmSpec{adaptFromTask<DigitParserSpec>(verbosity)},
123 o2::framework::Options{{"parser-output", o2::framework::VariantType::String, "ZDCDigiParser.root", {"Output file name"}},
124 {"reject-pileup", o2::framework::VariantType::Int, 1, {"Reject pile-up for signal shapes 0/1"}}}};
125}
126
127} // namespace zdc
128} // namespace o2
#define verbosity
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
Definition of the Names Generator class.
Class to describe pedestal data accumulated over the orbit.
Container class to store NTimeBinsPerBC ADC values of single ZDC channel.
ConfigParamRegistry const & options()
Definition InitContext.h:33
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
void setVerbosity(int v)
Definition DigiParser.h:54
int process(const gsl::span< const o2::zdc::OrbitData > &orbitdata, const gsl::span< const o2::zdc::BCData > &bcdata, const gsl::span< const o2::zdc::ChannelData > &chdata)
void setModuleConfig(const ModuleConfig *moduleConfig)
Definition DigiParser.h:69
void setOutput(std::string output)
Definition DigiParser.h:59
void setRejectPileUp(bool op=true)
Definition DigiParser.h:63
void init(o2::framework::InitContext &ic) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void run(o2::framework::ProcessingContext &pc) final
void updateTimeDependentParams(o2::framework::ProcessingContext &pc)
GLboolean * data
Definition glcorearb.h:298
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
struct o2::upgrades_utils::@463 zdc
structure to keep FT0 information
framework::DataProcessorSpec getDigitParserSpec(const int verbosity)
create a processor spec
constexpr int DbgZero
Definition Constants.h:207
const std::string CCDBPathConfigModule
Definition Constants.h:219
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"