Project
Loading...
Searching...
No Matches
ZDCDCSConfigProcessorSpec.h
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
12#ifndef O2_ZDC_DCSCONFIGPROCESSOR_H
13#define O2_ZDC_DCSCONFIGPROCESSOR_H
14
17
20#include "CCDB/CcdbObjectInfo.h"
21#include "CCDB/CcdbApi.h"
22
27#include "Framework/Task.h"
28#include "Framework/Logger.h"
29
30#include <chrono>
31
32using namespace o2::framework;
34using HighResClock = std::chrono::high_resolution_clock;
35using Duration = std::chrono::duration<double, std::ratio<1, 1>>;
36
37namespace o2
38{
39namespace zdc
40{
41
43{
44 public:
46 {
47 mVerbose = ic.options().get<bool>("use-verbose-mode");
48 LOG(info) << " ************************* Verbose?" << mVerbose;
49 }
50
51 //---------------------------------------------------------
52
54 {
55 auto configBuff = pc.inputs().get<gsl::span<char>>("inputConfig");
56 auto configFileName = pc.inputs().get<std::string>("inputConfigFileName");
57 auto timer = std::chrono::duration_cast<std::chrono::milliseconds>(HighResClock::now().time_since_epoch()).count();
58 LOG(info) << "got input file " << configFileName << " of size " << configBuff.size();
59 // auto tfcounter = o2::header::get<o2::framework::DataProcessingHeader*>(pc.inputs().getFirstValid(true).header)->startTime;
60 sendOutput(pc.outputs(), timer);
61 }
62
63 //---------------------------------------------------------
64
68
69 private:
70 void sendOutput(DataAllocator& output, long tf)
71 {
72 // sending output to CCDB
73
74 constexpr uint64_t INFINITE_TF = 0xffffffffffffffff;
75
76 /*using clbUtils = o2::calibration::Utils;
77 const auto& payload = mCalibrator->getNoiseMap();
78 std::map<std::string, std::string> md;
79 md.emplace("created by", "dpl");
80 o2::ccdb::CcdbObjectInfo info("ZDC/Calib/Mapping", "ZDCMapping", "mapping.root", md, tf, INFINITE_TF);
81 auto image = o2::ccdb::CcdbApi::createObjectImage(&payload, &info);
82 LOG(info) << "Sending object " << info.getPath() << "/" << info.getFileName() << " of size " << image->size()
83 << " bytes, valid for " << info.getStartValidityTimestamp() << " : " << info.getEndValidityTimestamp();*/
84 }
85 //________________________________________________________________
86
87 bool mVerbose = false; // to enable verbose mode
88}; // end class
89} // namespace zdc
90
91namespace framework
92{
93
94DataProcessorSpec getZDCDCSConfigProcessorSpec()
95{
96
97 std::vector<OutputSpec> outputs;
98
99 return DataProcessorSpec{
100 "zdc-dcs-config-processor",
101 Inputs{{"inputConfig", o2::header::gDataOriginZDC, "DCS_CONFIG_FILE", Lifetime::Sporadic},
102 {"inputConfigFileName", o2::header::gDataOriginZDC, "DCS_CONFIG_NAME", Lifetime::Sporadic}},
103 outputs,
104 AlgorithmSpec{adaptFromTask<o2::zdc::ZDCDCSConfigProcessor>()},
105 Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}}}};
106}
107
108} // namespace framework
109} // namespace o2
110
111#endif
Utils and constants for calibration and related workflows.
std::chrono::duration< double, std::ratio< 1, 1 > > Duration
std::chrono::high_resolution_clock HighResClock
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
uint64_t TFType
void run(o2::framework::ProcessingContext &pc) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void init(o2::framework::InitContext &ic) final
constexpr o2::header::DataOrigin gDataOriginZDC
Definition DataHeader.h:581
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< InputSpec > Inputs
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"