|
| 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 | +/// \brief A tutorial task to retrieve objects from CCDB given a time stamp. |
| 13 | +/// \author Daiki Sekihata |
| 14 | +/// \since 2026-03-01 |
| 15 | + |
| 16 | +#include "Framework/runDataProcessing.h" |
| 17 | +#include "Framework/AnalysisTask.h" |
| 18 | +#include "CCDB/BasicCCDBManager.h" |
| 19 | +#include "DataFormatsCalibration/MeanVertexObject.h" |
| 20 | +#include "DataFormatsParameters/GRPMagField.h" |
| 21 | +#include "DataFormatsParameters/GRPObject.h" |
| 22 | +#include "CommonDataFormat/InteractionRecord.h" |
| 23 | + |
| 24 | +#include <chrono> |
| 25 | + |
| 26 | +using namespace o2::framework; |
| 27 | +using namespace o2::header; |
| 28 | +using namespace o2; |
| 29 | + |
| 30 | +namespace o2::aod |
| 31 | +{ |
| 32 | +namespace testccdb |
| 33 | +{ |
| 34 | +DECLARE_SOA_CCDB_COLUMN(GRPObject, grpObject, o2::parameters::GRPObject, "GLO/GRP/GRP"); //! |
| 35 | +DECLARE_SOA_CCDB_COLUMN(GRPMagField, grpMagField, o2::parameters::GRPMagField, "GLO/Config/GRPMagField"); //! |
| 36 | +} // namespace testccdb |
| 37 | + |
| 38 | +DECLARE_SOA_TIMESTAMPED_TABLE(MyCCDBObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 1, "MYCCDBOBJ", //! |
| 39 | + testccdb::GRPObject, testccdb::GRPMagField); |
| 40 | +} // namespace o2::aod |
| 41 | + |
| 42 | +struct TestCCDBTable { |
| 43 | + |
| 44 | + void init(o2::framework::InitContext&) {} |
| 45 | + |
| 46 | + using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::MyCCDBObjects>; |
| 47 | + // using MyBCs = soa::Join<aod::BCs, aod::MyCCDBObjects>; |
| 48 | + |
| 49 | + void process(MyBCs const& bcs) |
| 50 | + { |
| 51 | + for (const auto& bc: bcs) { |
| 52 | + float bz = bc.grpObject().getNominalL3Field(); |
| 53 | + float l3current = bc.grpMagField().getL3Current(); |
| 54 | + LOGF(info, "bc.timestamp() = %lld, bz = %f kG, %f A", bc.timestamp(), bz, l3current); |
| 55 | + } |
| 56 | + } |
| 57 | +}; |
| 58 | + |
| 59 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 60 | +{ |
| 61 | + return WorkflowSpec{ |
| 62 | + adaptAnalysisTask<TestCCDBTable>(cfgc), |
| 63 | + }; |
| 64 | +} |
0 commit comments