Project
Loading...
Searching...
No Matches
phos-calib-workflow.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
22
23using namespace o2::framework;
24
25// // we need to add workflow options before including Framework/runDataProcessing
26void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
27{
28 // option allowing to set parameters
29 // which method should be called
30 workflowOptions.push_back(ConfigParamSpec{"pedestals", o2::framework::VariantType::Bool, false, {"do pedestal calculation"}});
31 workflowOptions.push_back(ConfigParamSpec{"hglgratio", o2::framework::VariantType::Bool, false, {"do HG/LG ratio calculation"}});
32 workflowOptions.push_back(ConfigParamSpec{"turnon", o2::framework::VariantType::Bool, false, {"scan trigger turn-on curves"}});
33 workflowOptions.push_back(ConfigParamSpec{"runbyrun", o2::framework::VariantType::Bool, false, {"do run by run correction calculation"}});
34 workflowOptions.push_back(ConfigParamSpec{"energy", o2::framework::VariantType::Bool, false, {"collect tree for E calib"}});
35 workflowOptions.push_back(ConfigParamSpec{"badmap", o2::framework::VariantType::Bool, false, {"do bad map calculation"}});
36 workflowOptions.push_back(ConfigParamSpec{"l1phase", o2::framework::VariantType::Bool, false, {"do L1phase calculation"}});
37
38 workflowOptions.push_back(ConfigParamSpec{"phoscalib-output-dir", o2::framework::VariantType::String, "./", {"ROOT files output directory"}});
39 workflowOptions.push_back(ConfigParamSpec{"phoscalib-meta-output-dir", o2::framework::VariantType::String, "/dev/null", {"metafile output directory"}});
40 workflowOptions.push_back(ConfigParamSpec{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writers"}});
41
42 workflowOptions.push_back(ConfigParamSpec{"not-use-ccdb", o2::framework::VariantType::Bool, false, {"enable access to ccdb phos calibration objects"}});
43 workflowOptions.push_back(ConfigParamSpec{"forceupdate", o2::framework::VariantType::Bool, false, {"update ccdb even difference to previous object large"}});
44
45 // BadMap
46 workflowOptions.push_back(ConfigParamSpec{"mode", o2::framework::VariantType::Int, 0, {"operation mode: 0: occupancy, 1: chi2, 2: pedestals"}});
47
48 workflowOptions.push_back(ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}});
49}
50
51// ------------------------------------------------------------------
52// we need to add workflow options before including Framework/runDataProcessing
54
56{
57 WorkflowSpec specs;
58 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
59 auto doPedestals = configcontext.options().get<bool>("pedestals");
60 auto doHgLgRatio = configcontext.options().get<bool>("hglgratio");
61 auto doTurnOn = configcontext.options().get<bool>("turnon");
62 auto doRunbyrun = configcontext.options().get<bool>("runbyrun");
63 auto doEnergy = configcontext.options().get<bool>("energy");
64 auto doBadMap = configcontext.options().get<bool>("badmap");
65 auto doL1phase = configcontext.options().get<bool>("l1phase");
66 auto useCCDB = !configcontext.options().get<bool>("not-use-ccdb");
67 auto forceUpdate = configcontext.options().get<bool>("forceupdate");
68
69 bool writeRootOutput = !configcontext.options().get<bool>("disable-root-output");
70 std::string outputDir = configcontext.options().get<std::string>("phoscalib-output-dir");
71 if (!outputDir.compare("/dev/null")) {
72 writeRootOutput = false;
73 }
74 std::string metaFileDir = configcontext.options().get<std::string>("phoscalib-meta-output-dir");
75
76 if (doPedestals && doHgLgRatio) {
77 LOG(fatal) << "Can not run pedestal and HG/LG calibration simulteneously";
78 }
79
80 LOG(info) << "PHOS Calibration workflow: options";
81 LOG(info) << "useCCDB = " << useCCDB;
82 if (doPedestals) {
83 LOG(info) << "pedestals ";
84 specs.emplace_back(o2::phos::getPedestalCalibSpec(useCCDB, forceUpdate));
85 } else {
86 if (doHgLgRatio) {
87 LOG(info) << "hglgratio ";
88 specs.emplace_back(o2::phos::getHGLGRatioCalibSpec(useCCDB, forceUpdate));
89 }
90 }
91 if (doEnergy) {
92 specs.emplace_back(o2::phos::getPHOSEnergyCalibDeviceSpec(useCCDB, outputDir, metaFileDir, writeRootOutput));
93 }
94 if (doTurnOn) {
95 LOG(info) << "TurnOn curves calculation";
96 specs.emplace_back(o2::phos::getPHOSTurnonCalibDeviceSpec(useCCDB));
97 }
98 if (doRunbyrun) {
99 LOG(info) << "Run by run correction calculation on ";
100 specs.emplace_back(o2::phos::getPHOSRunbyrunCalibDeviceSpec(useCCDB, outputDir, metaFileDir, writeRootOutput));
101 }
102 if (doBadMap) {
103 LOG(info) << "bad map calculation ";
104 int mode = configcontext.options().get<int>("mode");
105 specs.emplace_back(o2::phos::getBadMapCalibSpec(mode));
106 }
107 if (doL1phase) {
108 LOG(info) << "L1phase corrections calculation on ";
109 specs.emplace_back(o2::phos::getPHOSL1phaseCalibDeviceSpec());
110 }
111 return specs;
112}
Definition of the Names Generator class.
Device to collect histos and digits for PHOS energy and time calibration.
Device to calculate PHOS time shift (L1phase)
Device to calculate PHOS time shift (L1phase)
Device to calculate PHOS turn-on curves and trigger map.
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
GLenum mode
Definition glcorearb.h:266
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
o2::framework::DataProcessorSpec getPHOSEnergyCalibDeviceSpec(bool useCCDB, const std::string &outputDir, const std::string &metaFileDir, bool writeRootOutput)
DataProcessorSpec getHGLGRatioCalibSpec(bool useCCDB, bool forceUpdate)
o2::framework::DataProcessorSpec getPedestalCalibSpec(bool useCCDB, bool forceUpdate)
o2::framework::DataProcessorSpec getPHOSL1phaseCalibDeviceSpec()
o2::framework::DataProcessorSpec getPHOSTurnonCalibDeviceSpec(bool useCCDB)
o2::framework::DataProcessorSpec getPHOSRunbyrunCalibDeviceSpec(bool useCCDB, const std::string &outputDir, const std::string &metaFileDir, bool writeRootOutput)
o2::framework::DataProcessorSpec getBadMapCalibSpec(int mode)
void customize(std::vector< o2::framework::ConfigParamSpec > &workflowOptions)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"