Project
Loading...
Searching...
No Matches
DataSamplingConditionPayloadSize.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
16
19#include "Headers/DataHeader.h"
20#include "Framework/Logger.h"
22#include <boost/property_tree/ptree.hpp>
23
24using namespace o2::framework;
25
26namespace o2::utilities
27{
28
29using namespace o2::header;
30
33{
34
35 public:
37 DataSamplingConditionPayloadSize() : DataSamplingCondition(), mLowerLimit(1), mUpperLimit(0){};
40
42 void configure(const boost::property_tree::ptree& config) override
43 {
44 mLowerLimit = config.get<size_t>("lowerLimit");
45 mUpperLimit = config.get<size_t>("upperLimit");
46 if (mLowerLimit > mUpperLimit) {
47 LOG(warn) << "Lower limit is higher than upper limit.";
48 }
49 };
51 bool decide(const o2::framework::DataRef& dataRef) override
52 {
53 auto payloadSize = o2::framework::DataRefUtils::getPayloadSize(dataRef);
54
55 return payloadSize >= mLowerLimit && payloadSize <= mUpperLimit;
56 }
57
58 private:
59 size_t mLowerLimit;
60 size_t mUpperLimit;
61};
62
64{
65 return std::make_unique<DataSamplingConditionPayloadSize>();
66}
67
68} // namespace o2::utilities
A definition of DataSamplingConditionFactory.
A standarised data sampling condition, to decide if given data sample should be passed forward.
static std::unique_ptr< DataSamplingCondition > createDataSamplingConditionPayloadSize()
Getter for DataSamplingConditionPayloadSize.
A DataSamplingCondition which makes decisions based on payload size.
~DataSamplingConditionPayloadSize() override=default
Default destructor.
bool decide(const o2::framework::DataRef &dataRef) override
Makes a positive decision if the payload size is within given limits.
void configure(const boost::property_tree::ptree &config) override
Reads 'lowerLimit' and 'UpperLimit' of allowed payload size.
A standardised data sampling condition, to decide if given data sample should be passed forward.
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
O2 data header classes and API, v0.1.
Definition DetID.h:49
A header which contains some meta-data generated by Data Sampling.
static o2::header::DataHeader::PayloadSizeType getPayloadSize(const DataRef &ref)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"