From f4fd17f7afa1152cfd1d00095d50849541ec8972 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 14 Jul 2022 11:01:59 +0200 Subject: [PATCH] Fix tabs --- DDG4/plugins/Geant4SDActions.cpp | 2 +- examples/ClientTests/src/Property_test.cpp | 55 +++++++++++++++++++ .../src/ConditionAnyExampleObjects.cpp | 2 - 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 examples/ClientTests/src/Property_test.cpp diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp index b2788a182..f4951a86e 100644 --- a/DDG4/plugins/Geant4SDActions.cpp +++ b/DDG4/plugins/Geant4SDActions.cpp @@ -21,7 +21,7 @@ /// Namespace for the AIDA detector description toolkit namespace dd4hep { - + /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit namespace sim { diff --git a/examples/ClientTests/src/Property_test.cpp b/examples/ClientTests/src/Property_test.cpp new file mode 100644 index 000000000..ded1e1ddb --- /dev/null +++ b/examples/ClientTests/src/Property_test.cpp @@ -0,0 +1,55 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files +#include <DD4hep/ComponentProperties.h> +#include <DD4hep/Factories.h> +#include <iostream> + +using namespace std; +using namespace dd4hep; + +/// Plugin function: Condition program example +/** + * Factory: DD4hep_Conditions_dynamic + * + * \author M.Frank + * \version 1.0 + * \date 01/12/2016 + */ + +template <typename T> T _test_read(const std::string& tag, const std::string& data) { + T value; + Property prop(value); + prop.str(data); + for(const auto& p : value) + std::cout << std::setw(32) << std::left << tag << " " << p.first << " = " << p.second << std::endl; + return value; +} + +static int property_test(Detector& /* description */, int /* argc */, char** /* argv */) { + + _test_read<std::map<std::string, int> > ("map_str_int", "{'a': 10, 'b': 100, 'c': 1000}"); + _test_read<std::map<std::string, double> > ("map_str_double", "{'a': 1.0, 'b': 200.5, 'c': 3000.9}"); + _test_read<std::map<std::string, std::string> >("map_str_str", "{'a': '10', 'b': '100', 'c': '1000'}"); + _test_read<std::map<std::string, std::string> >("map_str_strdouble", "{'a': 1.0, 'b': 200.5, 'c': 3000.9}"); + + //_test_read<std::map<std::string, double> > ("map_str_eval", "{'a': 1.0*GeV, 'b': 200.5*MeV, 'c': 3000.9*TeV}"); + + cout << endl << "Test PASSED" << endl << endl; + // All done. + return 1; +} + +// first argument is the type from the xml file +DECLARE_APPLY(DD4hep_property_test,property_test) diff --git a/examples/Conditions/src/ConditionAnyExampleObjects.cpp b/examples/Conditions/src/ConditionAnyExampleObjects.cpp index c11656b71..365af3dcc 100644 --- a/examples/Conditions/src/ConditionAnyExampleObjects.cpp +++ b/examples/Conditions/src/ConditionAnyExampleObjects.cpp @@ -79,8 +79,6 @@ void ConditionAnyUpdate2::resolve(Condition target, ConditionUpdateContext& cont vector<int>& c1 = cond1.as<vector<int> >(); data.insert(data.end(), c1.begin(), c1.end()); } -<<<<<<< HEAD - /// Interface to client Callback in order to update the condition Condition ConditionAnyUpdate3::operator()(const ConditionKey& key, ConditionUpdateContext&) { -- GitLab