Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy possibility to store condition payloads as std::any #927

Merged
merged 9 commits into from Jul 12, 2022

Conversation

MarkusFrankATcernch
Copy link
Contributor

@MarkusFrankATcernch MarkusFrankATcernch commented Jul 9, 2022

BEGINRELEASENOTES
Easy possibility to store condition payloads as std::any.

  • Use of specialized handle class dd4hep::ConditionAny to support the functionality.
    The payload is automatically bound to an object of type std::any.
    Example code of constructor and how to access data:

    /// Emplacement construction
    std::vector<int> value;
    ... // fill data
    ConditionAny c2("name", "type", std::move(value));
    
    /// Construct conditions object with empty std::any	 
    ConditionAny c2("name", "type");
    /// Assign data (empty vector<int>) to the payload:
    c2.get() = vector<int>();
    
    /// Access data:
    vector<int>& data = c2.as<vector<int> >();
    

    as a corollary to this approach these conditions can only be stored and retrieved from ROOT storage
    if the requirement for ROOT are satisfied. Otherwise no other restrictions are imposed.
    The corresponding grammar instance is part of the library.

  • Add example to illustrate the functionality in example/conditions:
    o examples/Conditions/src/ConditionAnyExampleObjects.cpp
    o examples/Conditions/src/ConditionAnyExampleObjects.h
    o plugin: examples/Conditions/src/ConditionAnyExample_populate.cpp
    Invocation:

   $> geoPluginRun  -destroy -plugin DD4hep_ConditionAnyExample_populate \
        -input ../../DD4hep/examples/AlignDet/compact/Telescope.xml -iovs 1
  • Plugin example to test basic functionality and verify proper assignment works
    o examples/Conditions/src/Conditions_any_basic.cpp
    Invocation:
$> geoPluginRun -destroy -volmgr -plugin DD4hep_Conditions_any_basic

  • Add 2 tests illustrating this functionality.
    ENDRELEASENOTES

Comment on lines +13 to +14
#ifndef DD4HEP_CONDITIONANY_H
#define DD4HEP_CONDITIONANY_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using #pragma once rather than playing with names that will unavoidably collide one day ?

Comment on lines +109 to +117
/// Flag operations: Get condition flags
mask_type flags() const;
/// Flag operations: Set a conditons flag
void setFlag(mask_type option);
/// Flag operations: UN-Set a conditons flag
void unFlag(mask_type option);
/// Flag operations: Test for a given a conditons flag
bool testFlag(mask_type option) const;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what I see in this MR, these functions are never used. Is this correct ? If yes, why to add them ?

@@ -0,0 +1,107 @@
//==========================================================================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file really supposed to be included in this MR ? I do not see the relationship

@@ -0,0 +1,197 @@
//==========================================================================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file really supposed to be included in this MR ? I do not see the relationship

@@ -2,7 +2,7 @@
#define DDG4_PLUGINS_GEANT4_10_PHYSICSCONSTRUCTORS_H

//==========================================================================
// AIDA Detector description implementation
// AIDA Detector description implementation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file really supposed to be included in this MR ? I do not see the relationship

@@ -1,5 +1,5 @@
//==========================================================================
// AIDA Detector description implementation
// AIDA Detector description implementation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file really supposed to be included in this MR ? I do not see the relationship

@@ -10,7 +10,6 @@
// Author : M.Frank
//
//==========================================================================

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file really supposed to be included in this MR ? I do not see the relationship

@@ -116,8 +116,10 @@ namespace dd4hep {
Geant4PhysicsList(Geant4Context* context, const std::string& nam);
/// Default destructor
virtual ~Geant4PhysicsList();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file really supposed to be included in this MR ? I do not see the relationship

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants