Skip to content

Commit b290cb9

Browse files
authored
ITS workflows to generate and parse ADAPOS data (#11800)
* ITS workflows to generate and parse ADAPOS data for strobe length: first basic workflows * fixed code indentation errors * macro to generate in CCDB the DCS DPs from ADAPOS needed for dcs-config-proxy * updateFromString added for the AlpideParam modification * changed logic for SL upload to CCDB: compare with current ccdb object in ITS/Config/AlpideParam * copyright added to new CMakeLists * update local ccdb every 10s + other minor changes * dummy commit to retrigger checks
1 parent 4ad0855 commit b290cb9

14 files changed

Lines changed: 772 additions & 0 deletions

Detectors/ITSMFT/ITS/macros/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111

1212
add_subdirectory(EVE)
1313
add_subdirectory(test)
14+
add_subdirectory(DCS)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
o2_add_test_root_macro(
13+
makeITSCCDBEntryForDCS.C
14+
PUBLIC_LINK_LIBRARIES O2::DetectorsDCS O2::CCDB)
15+
16+
install(
17+
FILES makeITSCCDBEntryForDCS.C
18+
DESTINATION share/macro/)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
#if !defined(__CLING__) || defined(__ROOTCLING__)
13+
#include "CommonUtils/NameConf.h"
14+
#endif
15+
#include <vector>
16+
#include <string>
17+
#include "TFile.h"
18+
#include "DetectorsDCS/AliasExpander.h"
19+
#include "DetectorsDCS/DeliveryType.h"
20+
#include "DetectorsDCS/DataPointIdentifier.h"
21+
#include <unordered_map>
22+
#include <chrono>
23+
#include "CCDB/CcdbApi.h"
24+
25+
using DPID = o2::dcs::DataPointIdentifier;
26+
27+
int makeITSCCDBEntryForDCS(std::string ccdb_path = o2::base::NameConf::getCCDBServer())
28+
{
29+
30+
std::unordered_map<DPID, std::string> dpid2DataDesc;
31+
std::vector<std::string> aliases;
32+
33+
// fill aliases
34+
int nStaves[] = {12, 16, 20, 24, 30, 42, 48};
35+
for (int iL = 0; iL < 7; iL++) {
36+
for (int iS = 0; iS < nStaves[iL]; iS++) {
37+
std::string stv = iS > 9 ? std::to_string(iS) : std::string(1, '0').append(std::to_string(iS));
38+
aliases.push_back("ITS_L" + std::to_string(iL) + "_" + stv + "_STROBE");
39+
}
40+
}
41+
42+
std::vector<std::string> expaliases = o2::dcs::expandAliases(aliases);
43+
44+
DPID dpidtmp;
45+
for (size_t i = 0; i < expaliases.size(); ++i) {
46+
DPID::FILL(dpidtmp, expaliases[i], o2::dcs::DeliveryType::DPVAL_INT);
47+
dpid2DataDesc[dpidtmp] = "ITSDATAPOINTS";
48+
}
49+
50+
o2::ccdb::CcdbApi api;
51+
api.init(ccdb_path);
52+
std::map<std::string, std::string> md;
53+
md["comment"] = "uploaded with O2 makeITSCCDBEntryForDCS.C";
54+
long ts = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
55+
api.storeAsTFileAny(&dpid2DataDesc, "ITS/Config/DCSDPconfig", md, ts, ts + 365L * 10 * 24 * 3600 * 1000); // validity is 10 years
56+
57+
return 0;
58+
}

Detectors/ITSMFT/ITS/workflow/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ o2_add_library(ITSWorkflow
2525
src/ThresholdAggregatorSpec.cxx
2626
src/DCSParserWorkflow.cxx
2727
src/DCSParserSpec.cxx
28+
src/DCSAdaposParserWorkflow.cxx
29+
src/DCSAdaposParserSpec.cxx
30+
src/DCSDataGeneratorWorkflow.cxx
31+
src/DCSGeneratorSpec.cxx
2832
PUBLIC_LINK_LIBRARIES O2::Framework
2933
O2::SimConfig
34+
O2::DetectorsDCS
3035
O2::DataFormatsITS
3136
O2::DataFormatsDCS
3237
O2::DataFormatsTRD
@@ -73,6 +78,16 @@ o2_add_executable(dcs-parser-workflow
7378
COMPONENT_NAME its
7479
PUBLIC_LINK_LIBRARIES O2::ITSWorkflow)
7580

81+
o2_add_executable(dcs-generator-workflow
82+
SOURCES src/its-dcs-generator-workflow.cxx
83+
COMPONENT_NAME its
84+
PUBLIC_LINK_LIBRARIES O2::ITSWorkflow)
85+
86+
o2_add_executable(dcs-adapos-parser-workflow
87+
SOURCES src/its-dcs-adapos-parser-workflow.cxx
88+
COMPONENT_NAME its
89+
PUBLIC_LINK_LIBRARIES O2::ITSWorkflow)
90+
7691
if (OpenMP_CXX_FOUND)
7792
target_compile_definitions(${targetName} PRIVATE WITH_OPENMP)
7893
target_link_libraries(${targetName} PRIVATE OpenMP::OpenMP_CXX)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
/// @file DCSAdaposParserSpec.h
13+
14+
#ifndef O2_ITS_DCS_PARSER_SPEC_H
15+
#define O2_ITS_DCS_PARSER_SPEC_H
16+
17+
#include <string>
18+
#include <vector>
19+
#include <iostream>
20+
#include <fstream>
21+
#include <map>
22+
23+
#include "Framework/ConfigParamRegistry.h"
24+
#include "Framework/WorkflowSpec.h"
25+
#include "Framework/Task.h"
26+
#include "Framework/InputRecordWalker.h"
27+
#include <fairmq/Device.h>
28+
29+
#include <ITSMFTReconstruction/RawPixelDecoder.h>
30+
31+
#include "Framework/RawDeviceService.h"
32+
#include "Headers/DataHeader.h"
33+
#include "DetectorsCalibration/Utils.h"
34+
#include "CCDB/CcdbObjectInfo.h"
35+
#include "CCDB/CcdbApi.h"
36+
37+
#include "DetectorsDCS/DataPointIdentifier.h"
38+
#include "DetectorsDCS/DataPointValue.h"
39+
#include "DetectorsDCS/DataPointCompositeObject.h"
40+
#include "ITSMFTBase/DPLAlpideParam.h"
41+
#include "CCDB/BasicCCDBManager.h"
42+
43+
using namespace o2::framework;
44+
using namespace o2::itsmft;
45+
46+
namespace o2
47+
{
48+
namespace its
49+
{
50+
51+
using DPCOM = o2::dcs::DataPointCompositeObject;
52+
using DPID = o2::dcs::DataPointIdentifier;
53+
using DPVAL = o2::dcs::DataPointValue;
54+
55+
class ITSDCSAdaposParser : public Task
56+
{
57+
public:
58+
ITSDCSAdaposParser();
59+
~ITSDCSAdaposParser() override = default;
60+
61+
void init(InitContext& ic) final;
62+
void run(ProcessingContext& pc) final;
63+
64+
//////////////////////////////////////////////////////////////////
65+
private:
66+
// Helper functions
67+
void process(const gsl::span<const DPCOM> dps);
68+
void processDP(const DPCOM& dpcom);
69+
void pushToCCDB(ProcessingContext&);
70+
void getCurrentCcdbAlpideParam();
71+
72+
// Ccdb url for ccdb upload withing the wf
73+
std::string mCcdbUrl = "";
74+
75+
// store the strobe length for each DPID = stave
76+
std::unordered_map<DPID, DPVAL> mDPstrobe;
77+
double mStrobeToUpload = 0.;
78+
bool doStrobeUpload = false;
79+
80+
std::string mSelfName;
81+
bool mVerboseOutput = false;
82+
83+
// for ccdb alpide param fetching
84+
o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>* mCcdbAlpideParam;
85+
std::string mCcdbFetchUrl = "http://ccdb-test.cern.ch:8080";
86+
o2::ccdb::BasicCCDBManager& mMgr = o2::ccdb::BasicCCDBManager::instance();
87+
long int startTime;
88+
};
89+
90+
// Create a processor spec
91+
o2::framework::DataProcessorSpec getITSDCSAdaposParserSpec();
92+
93+
} // namespace its
94+
} // namespace o2
95+
96+
#endif
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
/// @file DCSAdaposParserWorkflow.h
13+
14+
#ifndef O2_ITS_DCS_ADAPOS_PARSER_WORKFLOW_H
15+
#define O2_ITS_DCS_ADAPOS_PARSER_WORKFLOW_H
16+
17+
#include "Framework/WorkflowSpec.h"
18+
19+
namespace o2
20+
{
21+
namespace its
22+
{
23+
24+
namespace dcs_adapos_parser_workflow
25+
{
26+
27+
framework::WorkflowSpec getWorkflow();
28+
29+
}
30+
31+
} // namespace its
32+
} // namespace o2
33+
#endif
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
/// @file DCSDataGeneratorWorkflow.h
13+
14+
#ifndef O2_ITS_DCS_PARSER_WORKFLOW_H
15+
#define O2_ITS_DCS_PARSER_WORKFLOW_H
16+
17+
#include "Framework/WorkflowSpec.h"
18+
19+
namespace o2
20+
{
21+
namespace its
22+
{
23+
24+
namespace dcs_generator_workflow
25+
{
26+
27+
framework::WorkflowSpec getWorkflow();
28+
29+
} // namespace dcs_generator_workflow
30+
31+
} // namespace its
32+
} // namespace o2
33+
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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_ITS_WORKFLOW_DCS_DATA_GENERATOR_SPEC_H
13+
#define O2_ITS_WORKFLOW_DCS_DATA_GENERATOR_SPEC_H
14+
15+
#include "DetectorsDCS/DCSDataPointHint.h"
16+
#include "Framework/DataProcessorSpec.h"
17+
#include <variant>
18+
#include <string>
19+
#include <vector>
20+
#include <cstdint>
21+
22+
using namespace o2::framework;
23+
24+
namespace o2::its
25+
{
26+
o2::framework::DataProcessorSpec getITSDCSDataGeneratorSpec(const char* detName = "ITS");
27+
} // namespace o2::its
28+
29+
#endif

0 commit comments

Comments
 (0)