Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Detectors/ITSMFT/ITS/macros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@

add_subdirectory(EVE)
add_subdirectory(test)
add_subdirectory(DCS)
18 changes: 18 additions & 0 deletions Detectors/ITSMFT/ITS/macros/DCS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

o2_add_test_root_macro(
makeITSCCDBEntryForDCS.C
PUBLIC_LINK_LIBRARIES O2::DetectorsDCS O2::CCDB)

install(
FILES makeITSCCDBEntryForDCS.C
DESTINATION share/macro/)
58 changes: 58 additions & 0 deletions Detectors/ITSMFT/ITS/macros/DCS/makeITSCCDBEntryForDCS.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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.

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "CommonUtils/NameConf.h"
#endif
#include <vector>
#include <string>
#include "TFile.h"
#include "DetectorsDCS/AliasExpander.h"
#include "DetectorsDCS/DeliveryType.h"
#include "DetectorsDCS/DataPointIdentifier.h"
#include <unordered_map>
#include <chrono>
#include "CCDB/CcdbApi.h"

using DPID = o2::dcs::DataPointIdentifier;

int makeITSCCDBEntryForDCS(std::string ccdb_path = o2::base::NameConf::getCCDBServer())
{

std::unordered_map<DPID, std::string> dpid2DataDesc;
std::vector<std::string> aliases;

// fill aliases
int nStaves[] = {12, 16, 20, 24, 30, 42, 48};
for (int iL = 0; iL < 7; iL++) {
for (int iS = 0; iS < nStaves[iL]; iS++) {
std::string stv = iS > 9 ? std::to_string(iS) : std::string(1, '0').append(std::to_string(iS));
aliases.push_back("ITS_L" + std::to_string(iL) + "_" + stv + "_STROBE");
}
}

std::vector<std::string> expaliases = o2::dcs::expandAliases(aliases);

DPID dpidtmp;
for (size_t i = 0; i < expaliases.size(); ++i) {
DPID::FILL(dpidtmp, expaliases[i], o2::dcs::DeliveryType::DPVAL_INT);
dpid2DataDesc[dpidtmp] = "ITSDATAPOINTS";
}

o2::ccdb::CcdbApi api;
api.init(ccdb_path);
std::map<std::string, std::string> md;
md["comment"] = "uploaded with O2 makeITSCCDBEntryForDCS.C";
long ts = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
api.storeAsTFileAny(&dpid2DataDesc, "ITS/Config/DCSDPconfig", md, ts, ts + 365L * 10 * 24 * 3600 * 1000); // validity is 10 years

return 0;
}
15 changes: 15 additions & 0 deletions Detectors/ITSMFT/ITS/workflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ o2_add_library(ITSWorkflow
src/ThresholdAggregatorSpec.cxx
src/DCSParserWorkflow.cxx
src/DCSParserSpec.cxx
src/DCSAdaposParserWorkflow.cxx
src/DCSAdaposParserSpec.cxx
src/DCSDataGeneratorWorkflow.cxx
src/DCSGeneratorSpec.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2::SimConfig
O2::DetectorsDCS
O2::DataFormatsITS
O2::DataFormatsDCS
O2::DataFormatsTRD
Expand Down Expand Up @@ -73,6 +78,16 @@ o2_add_executable(dcs-parser-workflow
COMPONENT_NAME its
PUBLIC_LINK_LIBRARIES O2::ITSWorkflow)

o2_add_executable(dcs-generator-workflow
SOURCES src/its-dcs-generator-workflow.cxx
COMPONENT_NAME its
PUBLIC_LINK_LIBRARIES O2::ITSWorkflow)

o2_add_executable(dcs-adapos-parser-workflow
SOURCES src/its-dcs-adapos-parser-workflow.cxx
COMPONENT_NAME its
PUBLIC_LINK_LIBRARIES O2::ITSWorkflow)

if (OpenMP_CXX_FOUND)
target_compile_definitions(${targetName} PRIVATE WITH_OPENMP)
target_link_libraries(${targetName} PRIVATE OpenMP::OpenMP_CXX)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// 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.

/// @file DCSAdaposParserSpec.h

#ifndef O2_ITS_DCS_PARSER_SPEC_H
#define O2_ITS_DCS_PARSER_SPEC_H

#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <map>

#include "Framework/ConfigParamRegistry.h"
#include "Framework/WorkflowSpec.h"
#include "Framework/Task.h"
#include "Framework/InputRecordWalker.h"
#include <fairmq/Device.h>

#include <ITSMFTReconstruction/RawPixelDecoder.h>

#include "Framework/RawDeviceService.h"
#include "Headers/DataHeader.h"
#include "DetectorsCalibration/Utils.h"
#include "CCDB/CcdbObjectInfo.h"
#include "CCDB/CcdbApi.h"

#include "DetectorsDCS/DataPointIdentifier.h"
#include "DetectorsDCS/DataPointValue.h"
#include "DetectorsDCS/DataPointCompositeObject.h"
#include "ITSMFTBase/DPLAlpideParam.h"
#include "CCDB/BasicCCDBManager.h"

using namespace o2::framework;
using namespace o2::itsmft;

namespace o2
{
namespace its
{

using DPCOM = o2::dcs::DataPointCompositeObject;
using DPID = o2::dcs::DataPointIdentifier;
using DPVAL = o2::dcs::DataPointValue;

class ITSDCSAdaposParser : public Task
{
public:
ITSDCSAdaposParser();
~ITSDCSAdaposParser() override = default;

void init(InitContext& ic) final;
void run(ProcessingContext& pc) final;

//////////////////////////////////////////////////////////////////
private:
// Helper functions
void process(const gsl::span<const DPCOM> dps);
void processDP(const DPCOM& dpcom);
void pushToCCDB(ProcessingContext&);
void getCurrentCcdbAlpideParam();

// Ccdb url for ccdb upload withing the wf
std::string mCcdbUrl = "";

// store the strobe length for each DPID = stave
std::unordered_map<DPID, DPVAL> mDPstrobe;
double mStrobeToUpload = 0.;
bool doStrobeUpload = false;

std::string mSelfName;
bool mVerboseOutput = false;

// for ccdb alpide param fetching
o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>* mCcdbAlpideParam;
std::string mCcdbFetchUrl = "http://ccdb-test.cern.ch:8080";
o2::ccdb::BasicCCDBManager& mMgr = o2::ccdb::BasicCCDBManager::instance();
long int startTime;
};

// Create a processor spec
o2::framework::DataProcessorSpec getITSDCSAdaposParserSpec();

} // namespace its
} // namespace o2

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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.

/// @file DCSAdaposParserWorkflow.h

#ifndef O2_ITS_DCS_ADAPOS_PARSER_WORKFLOW_H
#define O2_ITS_DCS_ADAPOS_PARSER_WORKFLOW_H

#include "Framework/WorkflowSpec.h"

namespace o2
{
namespace its
{

namespace dcs_adapos_parser_workflow
{

framework::WorkflowSpec getWorkflow();

}

} // namespace its
} // namespace o2
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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.

/// @file DCSDataGeneratorWorkflow.h

#ifndef O2_ITS_DCS_PARSER_WORKFLOW_H
#define O2_ITS_DCS_PARSER_WORKFLOW_H

#include "Framework/WorkflowSpec.h"

namespace o2
{
namespace its
{

namespace dcs_generator_workflow
{

framework::WorkflowSpec getWorkflow();

} // namespace dcs_generator_workflow

} // namespace its
} // namespace o2
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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.

#ifndef O2_ITS_WORKFLOW_DCS_DATA_GENERATOR_SPEC_H
#define O2_ITS_WORKFLOW_DCS_DATA_GENERATOR_SPEC_H

#include "DetectorsDCS/DCSDataPointHint.h"
#include "Framework/DataProcessorSpec.h"
#include <variant>
#include <string>
#include <vector>
#include <cstdint>

using namespace o2::framework;

namespace o2::its
{
o2::framework::DataProcessorSpec getITSDCSDataGeneratorSpec(const char* detName = "ITS");
} // namespace o2::its

#endif
Loading