|
| 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 | +#include "Framework/Plugins.h" |
| 13 | +#include "Framework/ServiceHandle.h" |
| 14 | +#include "Framework/ServiceSpec.h" |
| 15 | +#include "Framework/CommonServices.h" |
| 16 | +#include "TDatabasePDG.h" |
| 17 | +#include "SimulationDataFormat/O2DatabasePDG.h" |
| 18 | + |
| 19 | +using namespace o2::framework; |
| 20 | + |
| 21 | +struct PDGSupport : o2::framework::ServicePlugin { |
| 22 | + o2::framework::ServiceSpec* create() final |
| 23 | + { |
| 24 | + return new ServiceSpec{ |
| 25 | + .name = "database-pdg", |
| 26 | + .init = [](ServiceRegistry&, DeviceState&, fair::mq::ProgOptions&) -> ServiceHandle { |
| 27 | + auto* ptr = new TDatabasePDG(); |
| 28 | + o2::O2DatabasePDG::addALICEParticles(ptr); |
| 29 | + return ServiceHandle{TypeIdHelpers::uniqueId<TDatabasePDG>(), ptr, ServiceKind::Serial, "database-pdg"}; |
| 30 | + }, |
| 31 | + .configure = CommonServices::noConfiguration(), |
| 32 | + .exit = [](ServiceRegistry&, void* service) { reinterpret_cast<TDatabasePDG*>(service)->Delete(); }, |
| 33 | + .kind = ServiceKind::Serial}; |
| 34 | + } |
| 35 | +}; |
| 36 | + |
| 37 | +DEFINE_DPL_PLUGINS_BEGIN |
| 38 | +DEFINE_DPL_PLUGIN_INSTANCE(PDGSupport, CustomService); |
| 39 | +DEFINE_DPL_PLUGINS_END |
0 commit comments