Project
Loading...
Searching...
No Matches
FilteringBCSpec.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
18
19#include <vector>
20#include <gsl/gsl>
21#include <fmt/format.h>
23#include "Framework/Output.h"
24#include "Framework/Task.h"
35
36namespace of = o2::framework;
37
38namespace o2
39{
40namespace mid
41{
42
44{
45 public:
46 FilteringBCDeviceDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC, std::vector<of::OutputSpec> outputSpecs) : mGGCCDBRequest(gr), mUseMC(useMC)
47 {
48 mOutputs = specs::buildOutputs(outputSpecs);
49 }
50
52 {
54 mFiltererBC.setBCDiffLow(FiltererBCParam::Instance().maxBCDiffLow);
55 mFiltererBC.setBCDiffHigh(FiltererBCParam::Instance().maxBCDiffHigh);
56 mFiltererBC.setSelectOnly(FiltererBCParam::Instance().selectOnly);
57 }
58
59 void finaliseCCDB(of::ConcreteDataMatcher matcher, void* obj)
60 {
62 LOG(info) << "Update Bunch Filling for MID";
63 mFiltererBC.setBunchFilling(o2::base::GRPGeomHelper::instance().getGRPLHCIF()->getBunchFilling());
64 }
65 }
66
68 {
69 updateTimeDependentParams(pc);
70
71 auto data = specs::getData(pc, "mid_filter_BC_in", EventType::Standard);
72 auto inROFRecords = specs::getRofs(pc, "mid_filter_BC_in", EventType::Standard);
73
74 auto inMCContainer = mUseMC ? specs::getLabels(pc, "mid_filter_BC_in") : nullptr;
75
76 auto filteredROFs = mFiltererBC.process(inROFRecords);
77 mDigitsMerger.process(data, filteredROFs, inMCContainer.get());
78
79 pc.outputs().snapshot(mOutputs[0], mDigitsMerger.getColumnData());
80 pc.outputs().snapshot(mOutputs[1], mDigitsMerger.getROFRecords());
81 if (mUseMC) {
82 pc.outputs().snapshot(mOutputs[2], mDigitsMerger.getMCContainer());
83 }
84 }
85
86 private:
87 void updateTimeDependentParams(o2::framework::ProcessingContext& pc)
88 {
89 // Triggers finalizeCCDB
91 }
92
93 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
94 bool mUseMC{false};
95 FiltererBC mFiltererBC;
96 DigitsMerger mDigitsMerger;
97 std::vector<of::Output> mOutputs;
98};
99
100of::DataProcessorSpec getFilteringBCSpec(bool useMC, std::string_view inDesc)
101{
102
103 auto inputSpecs = specs::buildInputSpecs("mid_filter_BC_in", inDesc, useMC);
104 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
105 false, // GRPECS=true
106 true, // GRPLHCIF
107 false, // GRPMagField
108 false, // askMatLUT
110 inputSpecs,
111 false);
112
113 auto outputSpecs = specs::buildStandardOutputSpecs("mid_filter_BC_out", "BDATA", useMC);
114
116 "MIDFilteringBC",
117 {inputSpecs},
118 {outputSpecs},
119 of::AlgorithmSpec{of::adaptFromTask<o2::mid::FilteringBCDeviceDPL>(ggRequest, useMC, outputSpecs)}};
120}
121} // namespace mid
122} // namespace o2
Utilities for MID Column Data Specs.
Strip pattern (aka digits)
Label for MID.
Digits merger for MID.
BC filterer for MID.
MID filtering spec.
Helper for geometry and GRP related CCDB requests.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the MID event record.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
void snapshot(const Output &spec, T const &object)
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
const std::vector< ColumnData > & getColumnData() const
Gets the merged column data.
void process(const std::vector< ColumnData > &inDigitStore, const o2::dataformats::MCTruthContainer< MCLabel > &inMCContainer, const std::vector< ROFRecord > &inROFRecords, bool mergeInBunchPileup=true)
Merges the MC digits that are provided per hit into the format that we expect from data.
const o2::dataformats::MCTruthContainer< MCLabel > & getMCContainer() const
Gets the merged MC labels.
const std::vector< ROFRecord > & getROFRecords() const
Gets the merged RO frame records.
void setBCDiffLow(int bcDiffLow)
Set the maximum BC diff in the lower side.
Definition FiltererBC.h:40
void setBunchFilling(const BunchFilling &bunchFilling)
Sets the bunch filling scheme.
Definition FiltererBC.h:52
std::vector< ROFRecord > process(gsl::span< const ROFRecord > rofRecords)
Filters the data BC.
void setSelectOnly(bool selectOnly)
Only selects BCs but do not merge them.
Definition FiltererBC.h:48
void setBCDiffHigh(int bcDiffHigh)
Set the maximum BC diff in the upper side.
Definition FiltererBC.h:44
void finaliseCCDB(of::ConcreteDataMatcher matcher, void *obj)
void run(of::ProcessingContext &pc)
void init(of::InitContext &ic)
FilteringBCDeviceDPL(std::shared_ptr< o2::base::GRPGeomRequest > gr, bool useMC, std::vector< of::OutputSpec > outputSpecs)
GLboolean * data
Definition glcorearb.h:298
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< framework::InputSpec > buildInputSpecs(std::string_view dataBind, std::string_view dataDesc, bool useMC)
std::vector< framework::OutputSpec > buildStandardOutputSpecs(std::string_view dataBind, std::string_view dataDesc, bool useMC)
std::vector< framework::Output > buildOutputs(std::vector< framework::OutputSpec > outputSpecs)
std::array< gsl::span< const ColumnData >, NEvTypes > getData(framework::ProcessingContext &pc, std::string_view dataBind)
std::unique_ptr< const o2::dataformats::MCTruthContainer< MCLabel > > getLabels(framework::ProcessingContext &pc, std::string_view dataBind)
std::array< gsl::span< const ROFRecord >, NEvTypes > getRofs(framework::ProcessingContext &pc, std::string_view dataBind)
framework::DataProcessorSpec getFilteringBCSpec(bool useMC=true, std::string_view inDesc="FDATA")
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"