Project
Loading...
Searching...
No Matches
DataSamplingConditionNConsecutive.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
20#include "Framework/Logger.h"
21
22#include <boost/property_tree/ptree.hpp>
23
24using namespace o2::framework;
25
26namespace o2::utilities
27{
28
29using namespace o2::header;
30
32// always increments by one.
34{
35
36 public:
41
43 void configure(const boost::property_tree::ptree& config) override
44 {
45 mSamplesNumber = config.get<size_t>("samplesNumber");
46 mCycleSize = config.get<size_t>("cycleSize");
47 if (mSamplesNumber > mCycleSize) {
48 LOG(warn) << "Consecutive number of samples is higher than cycle size.";
49 }
50 };
52 bool decide(const o2::framework::DataRef& dataRef) override
53 {
54 const auto* dpHeader = get<DataProcessingHeader*>(dataRef.header);
55 assert(dpHeader);
56
57 // strongly relying on assumption, that timesliceID always increments by one.
58 return dpHeader->startTime % mCycleSize < mSamplesNumber;
59 }
60
61 private:
62 size_t mSamplesNumber;
63 size_t mCycleSize;
64};
65
67{
68 return std::make_unique<DataSamplingConditionNConsecutive>();
69}
70
71} // 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 > createDataSamplingConditionNConsecutive()
Getter for DataSamplingConditionNConsecutive.
A DataSamplingCondition which approves n consecutive samples in defined cycle. It assumes that timesl...
~DataSamplingConditionNConsecutive() override=default
Default destructor.
bool decide(const o2::framework::DataRef &dataRef) override
Makes a positive decision if 'timeslice ID % cycleSize < samplesNumber' is true.
void configure(const boost::property_tree::ptree &config) override
Reads 'samplesNumber' and 'cycleSize'.
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.
const char * header
Definition DataRef.h:27
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"