Skip to content
Draft
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
5 changes: 5 additions & 0 deletions Tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ o2physics_add_dpl_workflow(ccdbaccess
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::CCDB O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(ccdbtableaccess
SOURCES src/ccdbtableaccess.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::CCDB O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(weak-decay-iteration
SOURCES src/weakDecayIteration.cxx
COMPONENT_NAME AnalysisTutorial)
Expand Down
64 changes: 64 additions & 0 deletions Tutorials/src/ccdbtableaccess.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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.
///
/// \brief A tutorial task to retrieve objects from CCDB given a time stamp.
/// \author Daiki Sekihata
/// \since 2026-03-01

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsCalibration/MeanVertexObject.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "CommonDataFormat/InteractionRecord.h"

#include <chrono>

using namespace o2::framework;
using namespace o2::header;
using namespace o2;

namespace o2::aod
{
namespace testccdb
{
DECLARE_SOA_CCDB_COLUMN(GRPObject, grpObject, o2::parameters::GRPObject, "GLO/GRP/GRP"); //!
DECLARE_SOA_CCDB_COLUMN(GRPMagField, grpMagField, o2::parameters::GRPMagField, "GLO/Config/GRPMagField"); //!
} // namespace testccdb

DECLARE_SOA_TIMESTAMPED_TABLE(MyCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "MYCCDBOBJ", //!
testccdb::GRPObject, testccdb::GRPMagField);
} // namespace o2::aod

struct TestCCDBTable {

void init(o2::framework::InitContext&) {}

using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::MyCCDBObjects>;
// using MyBCs = soa::Join<aod::BCs, aod::MyCCDBObjects>;

void process(MyBCs const& bcs)
{
for (const auto& bc: bcs) {
float bz = bc.grpObject().getNominalL3Field();
float l3current = bc.grpMagField().getL3Current();
LOGF(info, "bc.timestamp() = %lld, bz = %f kG, %f A", bc.timestamp(), bz, l3current);
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<TestCCDBTable>(cfgc),
};
}
Loading