-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathDistSTFSenderSpec.cxx
More file actions
63 lines (55 loc) · 2.03 KB
/
DistSTFSenderSpec.cxx
File metadata and controls
63 lines (55 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "DetectorsRaw/DistSTFSenderSpec.h"
#include "Framework/ConfigContext.h"
#include "Framework/DeviceSpec.h"
#include "Framework/DataRefUtils.h"
#include "Framework/Task.h"
#include "Framework/ControlService.h"
#include "Framework/Logger.h"
#include "Headers/DataHeader.h"
#include "Headers/STFHeader.h"
using namespace o2::framework;
using namespace o2::header;
namespace o2::raw
{
class DistSTFSender : public Task
{
public:
DistSTFSender(int m, unsigned subsp) : mMaxTF(m), mSubSpec(subsp) {}
void run(ProcessingContext& ctx) final;
private:
int mMaxTF = 1;
unsigned mSubSpec = 0;
int mTFCount = 0;
};
//___________________________________________________________
void DistSTFSender::run(ProcessingContext& pc)
{
const auto& tinfo = pc.services().get<o2::framework::TimingInfo>();
STFHeader stfHeader{tinfo.tfCounter, tinfo.firstTForbit, tinfo.runNumber};
pc.outputs().snapshot(o2::framework::Output{gDataOriginFLP, gDataDescriptionDISTSTF, mSubSpec}, stfHeader);
if (++mTFCount >= mMaxTF) {
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
}
}
//_________________________________________________________
DataProcessorSpec getDistSTFSenderSpec(int maxTF, unsigned subsp)
{
return DataProcessorSpec{
"dist-stf-sender",
Inputs{},
Outputs{OutputSpec{gDataOriginFLP, gDataDescriptionDISTSTF, subsp}},
AlgorithmSpec{adaptFromTask<DistSTFSender>(maxTF, subsp)},
Options{}};
}
} // namespace o2::raw