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

Fix Issue 875 #936

Merged
merged 6 commits into from
Jul 26, 2022
Merged
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
4 changes: 2 additions & 2 deletions DDCond/src/plugins/ConditionsPlugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static int ddcond_detelement_dump(Detector& description, int argc, char** argv)
Actor actor(printer);
int ret = actor.process(description.world(),0,true);
slice->manager.clean(pool->validity().iovType, 20);
return ret;
return ret > 0 ? 1 : 0;
}
DECLARE_APPLY(DD4hep_DetElementConditionsDump,ddcond_detelement_dump)

Expand Down Expand Up @@ -324,7 +324,7 @@ static int ddcond_detelement_processor(Detector& description, int argc, char** a
processor->setPool(pool);
int ret = Actor(processor).process(description.world(),0,true);
slice->manager.clean(pool->validity().iovType, 20);
return ret;
return ret > 0 ? 1 : 0;
}
DECLARE_APPLY(DD4hep_DetElementConditionsProcessor,ddcond_detelement_processor)
#endif
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/BitField64.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define DD4HEP_BITFIELD64_H

// Framework include files
#include "DDSegmentation/BitField64.h"
#include <DDSegmentation/BitField64.h>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/BitFieldCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define DD4HEP_BITFIELDCODER_H

// Framework include files
#include "DDSegmentation/BitFieldCoder.h"
#include <DDSegmentation/BitFieldCoder.h>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/CartesianGridXY.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define DD4HEP_CARTESIANGRIDXY_H 1

// Framework include files
#include "DD4hep/Segmentations.h"
#include <DD4hep/Segmentations.h>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/ComponentProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define DD4HEP_COMPONENTPROPERTIES_H

// Framework include files
#include "DD4hep/Grammar.h"
#include <DD4hep/Grammar.h>

// C/C++ include files
#include <algorithm>
Expand Down
20 changes: 10 additions & 10 deletions DDCore/include/DD4hep/DD4hepRootPersistency.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define DD4HEP_DD4HEPROOTPERSISTENCY_H

// Framework include files
#include "DD4hep/DetectorData.h"
#include <DD4hep/DetectorData.h>


/// Helper class to support ROOT persistency of Detector objects
Expand Down Expand Up @@ -120,23 +120,23 @@ class DD4hepRootCheck {
/// Call to theck the DD4hep fields
size_t checkFields() const;
/// Call to check a Region object
size_t checkRegions() const;
std::pair<std::size_t, std::size_t> checkRegions() const;
/// Call to check a Readout object
size_t checkReadouts() const;
std::pair<std::size_t, std::size_t> checkReadouts() const;
/// Call to check an ID specification
size_t checkIdSpecs() const;
std::pair<std::size_t, std::size_t> checkIdSpecs() const;
/// Call to check a sensitive detector
size_t checkSensitives() const;
std::pair<std::size_t, std::size_t> checkSensitives() const;
/// Call to check a limit-set object
size_t checkLimitSets() const;
std::pair<std::size_t, std::size_t> checkLimitSets() const;
/// Call to check the volume manager hierarchy
size_t checkVolManager() const;
std::pair<std::size_t, std::size_t> checkVolManager() const;
/// Call to check the nominal alignments in the DetElement hierarchy
size_t checkNominals() const;
std::pair<std::size_t, std::size_t> checkNominals() const;
/// Call to check a top level Detector element (subdetector)
size_t checkDetectors() const;
std::pair<std::size_t, std::size_t> checkDetectors() const;
/// Call to check segmentations starting from the top level Detector element
size_t checkSegmentations() const;
std::pair<std::size_t, std::size_t> checkSegmentations() const;
/// Check all of the above
size_t checkAll() const;
};
Expand Down
28 changes: 14 additions & 14 deletions DDCore/include/DD4hep/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
#ifndef DD4HEP_DETECTOR_H
#define DD4HEP_DETECTOR_H

#include "DD4hep/Version.h"
#include <DD4hep/Version.h>

// Framework includes
#include "DD4hep/Handle.h"
#include "DD4hep/Fields.h"
#include "DD4hep/Objects.h"
#include "DD4hep/Shapes.h"
#include "DD4hep/Volumes.h"
#include "DD4hep/Readout.h"
#include "DD4hep/DetElement.h"
#include "DD4hep/NamedObject.h"
#include "DD4hep/Segmentations.h"
#include "DD4hep/VolumeManager.h"
#include "DD4hep/OpticalSurfaceManager.h"
#include "DD4hep/ExtensionEntry.h"
#include "DD4hep/BuildType.h"
#include <DD4hep/Handle.h>
#include <DD4hep/Fields.h>
#include <DD4hep/Objects.h>
#include <DD4hep/Shapes.h>
#include <DD4hep/Volumes.h>
#include <DD4hep/Readout.h>
#include <DD4hep/DetElement.h>
#include <DD4hep/NamedObject.h>
#include <DD4hep/Segmentations.h>
#include <DD4hep/VolumeManager.h>
#include <DD4hep/OpticalSurfaceManager.h>
#include <DD4hep/ExtensionEntry.h>
#include <DD4hep/BuildType.h>

// C/C++ include files
#include <map>
Expand Down
22 changes: 15 additions & 7 deletions DDCore/include/DD4hep/Factories.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#define DD4HEP_FACTORIES_H

// Framework include files
#include "DD4hep/Plugins.h"
#include "DD4hep/DetElement.h"
#include "DD4hep/NamedObject.h"
#include <DD4hep/Plugins.h>
#include <DD4hep/DetElement.h>
#include <DD4hep/NamedObject.h>

// C/C++ include files
#include <cstdarg>
Expand Down Expand Up @@ -218,17 +218,25 @@ namespace {
DD4HEP_PLUGIN_FACTORY_ARGS_3(void*,dd4hep::Detector*,int,char**)
{ return dd4hep::DetectorConstructionFactory<P>::create(*a0,a1,a2); }

DD4HEP_PLUGIN_FACTORY_ARGS_3(long,dd4hep::Detector*,int,char**)
{ return make_return<long>(dd4hep::ApplyFactory<P>::create(*a0,a1,a2)); }
DD4HEP_PLUGIN_FACTORY_ARGS_3(long,dd4hep::Detector*,int,char**) {
static long ret;
long result = dd4hep::ApplyFactory<P>::create(*a0,a1,a2);
ret = result;
return long(&ret);
}

DD4HEP_PLUGIN_FACTORY_ARGS_2(ns::Named*,dd4hep::Detector*,ns::xml_h*)
{ return dd4hep::XMLElementFactory<P>::create(*a0,*a1).ptr(); }

DD4HEP_PLUGIN_FACTORY_ARGS_2(TObject*,dd4hep::Detector*,ns::xml_h*)
{ return dd4hep::XMLObjectFactory<P>::create(*a0,*a1).ptr(); }

DD4HEP_PLUGIN_FACTORY_ARGS_2(long,dd4hep::Detector*,ns::xml_h*)
{ return make_return<long>(dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1)); }
DD4HEP_PLUGIN_FACTORY_ARGS_2(long,dd4hep::Detector*,ns::xml_h*) {
static long ret;
long result = dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1);
ret = result;
return long(&ret);
}

DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,dd4hep::Detector*,ns::xml_h*,ns::ref_t*)
{ return dd4hep::XmlDetElementFactory<P>::create(*a0,*a1,*a2).ptr(); }
Expand Down
7 changes: 5 additions & 2 deletions DDCore/include/DD4hep/IDDescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ namespace dd4hep {
*/
class IDDescriptor: public Handle<IDDescriptorObject> {
public:
typedef std::vector<std::pair<std::string, const BitFieldElement*> > FieldMap;
typedef std::vector<std::pair<size_t, std::string> > FieldIDs;
typedef BitFieldElement Field;
typedef std::vector<std::pair<std::string, const Field*> > FieldMap;
typedef std::vector<std::pair<size_t, std::string> > FieldIDs;

public:
/// Default constructor
Expand All @@ -61,6 +62,8 @@ namespace dd4hep {
/// Get the field descriptor of one field by its identifier
const BitFieldElement* field(size_t identifier) const;
#ifndef __MAKECINT__
/// Encode partial volume identifiers to a volumeID.
static VolumeID encode(const Field* fld, VolumeID value);
/// Encode a set of volume identifiers (corresponding to this description of course!) to a volumeID.
VolumeID encode(const std::vector<std::pair<std::string, int> >& ids) const;
/// Encode a set of volume identifiers to a volumeID with the system ID on the top bits
Expand Down
8 changes: 2 additions & 6 deletions DDCore/include/DD4hep/Plugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace dd4hep {
template <typename T> static T val(const T* _p) { return T(*_p); }
template <typename T> static T value(const void* _p) { return (T)_p; }
static const char* value(const void* _p) { return (const char*)(_p); }
template <typename T> static T make_return(const T& _p) { return _p; }
};
template <> inline int PluginFactoryBase::value<int>(const void* _p) { return *(int*)(_p); }
template <> inline long PluginFactoryBase::value<long>(const void* _p) { return *(long*)(_p); }
Expand Down Expand Up @@ -99,7 +98,8 @@ namespace dd4hep {
return (*fptr.fcn)(std::forward<Args>(args)...);
#elif DD4HEP_PLUGINSVC_VERSION==2
f = getCreator(id,typeid(R(Args...)));
return std::any_cast<func>(f)(std::forward<Args>(args)...);
if ( std::any_cast<func>(f) )
return std::any_cast<func>(f)(std::forward<Args>(args)...);
#endif
}
catch(const std::bad_any_cast& e) {
Expand Down Expand Up @@ -142,10 +142,6 @@ namespace {
template <typename P, typename S> class Factory {};
}

namespace dd4hep {
template <> inline long PluginFactoryBase::make_return(const long& value)
{ static long stored=value; return (long)&stored; }
}
#define DD4HEP_FACTORY_CALL(type,name,signature) dd4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::call)
#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(X,Y)

Expand Down
12 changes: 6 additions & 6 deletions DDCore/include/DD4hep/VolumeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#define DD4HEP_VOLUMEMANAGER_H

// Framework include files
#include "DD4hep/Volumes.h"
#include "DD4hep/DetElement.h"
#include "DD4hep/NamedObject.h"
#include "DD4hep/IDDescriptor.h"
#include "DD4hep/ConditionsMap.h"
#include <DD4hep/Volumes.h>
#include <DD4hep/DetElement.h>
#include <DD4hep/NamedObject.h>
#include <DD4hep/IDDescriptor.h>
#include <DD4hep/ConditionsMap.h>

// ROOT include files
#include "TGeoMatrix.h"
#include <TGeoMatrix.h>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
Expand Down
Loading