Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eic_container
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
containers
eic_container
Commits
dd50d80c
Commit
dd50d80c
authored
3 years ago
by
Sylvester Joosten
Browse files
Options
Downloads
Patches
Plain Diff
revert to a patch approach
parent
5cebb689
No related branches found
No related tags found
1 merge request
!111
Backported patches to DD4hep master
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
spack.yaml
+1
-1
1 addition, 1 deletion
spack.yaml
spack/packages/dd4hep/2021-07-21.patch
+153
-0
153 additions, 0 deletions
spack/packages/dd4hep/2021-07-21.patch
spack/packages/dd4hep/package.py
+11
-13
11 additions, 13 deletions
spack/packages/dd4hep/package.py
with
165 additions
and
14 deletions
spack.yaml
+
1
−
1
View file @
dd50d80c
...
...
@@ -24,7 +24,7 @@ spack:
-
cairo@1.16.0 +fc+ft+X+pdf+gobject
-
podio@0.13.1
-
geant4@10.7.1 cxxstd=17 +opengl +vecgeom +x11 +qt +threads ^qt +opengl
-
dd4hep@
2021-07-2
1 +geant4 +assimp +hepmc3 +ipo +lcio
-
dd4hep@
1.17p
1 +geant4 +assimp +hepmc3 +ipo +lcio
# - acts@8.03.0p1 +dd4hep +digitization +identification +json +tgeo +ipo
# - genfit@2.00.00
# - gaudi@36.0
...
...
This diff is collapsed.
Click to expand it.
spack/packages/dd4hep/2021-07-21.patch
0 → 100644
+
153
−
0
View file @
dd50d80c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 618812f7..8316ba67 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,7 @@
ENDIF()
#############################################################
ENABLE_LANGUAGE(CXX)
+ENABLE_LANGUAGE(C)
# Set C++ standard
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for compiling")
diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index fab6267f..581f535f 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -805,21 +805,48 @@
template <> void Converter<PropertyTable>::operator()(xml_h e) const {
}
#endif
-/** Convert compact visualization attribute to Detector visualization attribute
+/** Convert compact visualization attribute to Detector visualization attribute.
*
* <vis name="SiVertexBarrelModuleVis"
* alpha="1.0" r="1.0" g="0.75" b="0.76"
* drawingStyle="wireframe"
* showDaughters="false"
* visible="true"/>
+ *
+ * Optionally inherit an already defined VisAttr and override other properties.
+ *
+ * <vis name="SiVertexEndcapModuleVis"
+ * ref="SiVertexBarrelModuleVis"
+ * alpha="0.5"/>
*/
template <> void Converter<VisAttr>::operator()(xml_h e) const {
VisAttr attr(e.attr<string>(_U(name)));
+ float alpha = 1.0;
+ float red = 1.0;
+ float green = 1.0;
+ float blue = 1.0;
+ bool use_ref = false;
+ if(e.hasAttr(_U(ref))) {
+ use_ref = true;
+ auto refName = e.attr<string>(_U(ref));
+ const auto refAttr = description.visAttributes(refName);
+ if(!refAttr.isValid() ) {
+ throw runtime_error("reference VisAttr " + refName + " does not exist");
+ }
+ // Just copying things manually.
+ // I think a handle's copy constructor/assignment would reuse the underlying pointer... maybe?
+ refAttr.argb(alpha,red,green,blue);
+ attr.setColor(alpha,red,green,blue);
+ attr.setDrawingStyle( refAttr.drawingStyle());
+ attr.setLineStyle( refAttr.lineStyle());
+ attr.setShowDaughters(refAttr.showDaughters());
+ attr.setVisible(refAttr.visible());
+ }
xml_dim_t dim(e);
- float alpha = dim.alpha(1.0);
- float red = dim.r(1.0);
- float green = dim.g(1.0);
- float blue = dim.b(1.0);
+ alpha = dim.alpha(alpha);
+ red = dim.r(red );
+ green = dim.g(green);
+ blue = dim.b(blue );
printout(s_debug.visattr ? ALWAYS : DEBUG, "Compact",
"++ Converting VisAttr structure: %-16s. Alpha=%.2f R=%.3f G=%.3f B=%.3f",
@@ -835,7 +862,8 @@
template <> void Converter<VisAttr>::operator()(xml_h e) const {
attr.setLineStyle(VisAttr::DASHED);
}
else {
- attr.setLineStyle(VisAttr::SOLID);
+ if (!use_ref)
+ attr.setLineStyle(VisAttr::SOLID);
}
if (e.hasAttr(_U(drawingStyle))) {
string ds = e.attr<string>(_U(drawingStyle));
@@ -845,12 +873,15 @@
template <> void Converter<VisAttr>::operator()(xml_h e) const {
attr.setDrawingStyle(VisAttr::SOLID);
}
else {
- attr.setDrawingStyle(VisAttr::SOLID);
+ if (!use_ref)
+ attr.setDrawingStyle(VisAttr::SOLID);
}
if (e.hasAttr(_U(showDaughters)))
attr.setShowDaughters(e.attr<bool>(_U(showDaughters)));
- else
- attr.setShowDaughters(true);
+ else {
+ if (!use_ref)
+ attr.setShowDaughters(true);
+ }
description.addVisAttribute(attr);
}
diff --git a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
index 555e4e52..504fb8e4 100644
--- a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
+++ b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
@@ -20,6 +20,7 @@
#include "DDG4/Geant4HitCollection.h"
#include "DDG4/Geant4OutputAction.h"
#include "DDG4/Geant4SensDetAction.h"
+#include "DDG4/Geant4DataConversion.h"
#include "DDG4/EventParameters.h"
// Geant4 headers
@@ -563,16 +564,23 @@
void Geant4Output2EDM4hep::createCollections(OutputContext<G4Event>& ctxt){
continue ;
}
+ Geant4Sensitive* sd = coll->sensitive();
+ string sd_enc = dd4hep::sim::Geant4ConversionHelper::encoding(sd->sensitiveDetector());
+
if( typeid( Geant4Tracker::Hit ) == coll->type().type() ){
- m_store->create<edm4hep::SimTrackerHitCollection>(colName);
+ auto& sthc = m_store->create<edm4hep::SimTrackerHitCollection>(colName);
m_file->registerForWrite(colName);
+ auto& sthc_md = m_store->getCollectionMetaData( sthc.getID() );
+ sthc_md.setValue("CellIDEncodingString", sd_enc);
printout(DEBUG,"Geant4Output2EDM4hep","+++ created collection %s",colName.c_str() );
}
else if( typeid( Geant4Calorimeter::Hit ) == coll->type().type() ){
- m_store->create<edm4hep::SimCalorimeterHitCollection>(colName);
+ auto& schc = m_store->create<edm4hep::SimCalorimeterHitCollection>(colName);
m_file->registerForWrite(colName);
+ auto& schc_md = m_store->getCollectionMetaData( schc.getID() );
+ schc_md.setValue("CellIDEncodingString", sd_enc);
printout(DEBUG,"Geant4Output2EDM4hep","+++ created collection %s",colName.c_str() );
colName += "Contributions" ;
diff --git a/DDG4/src/Geant4ShapeConverter.cpp b/DDG4/src/Geant4ShapeConverter.cpp
index 2a79a69a..6f4af522 100644
--- a/DDG4/src/Geant4ShapeConverter.cpp
+++ b/DDG4/src/Geant4ShapeConverter.cpp
@@ -205,8 +205,9 @@
namespace dd4hep {
template <> G4VSolid* convertShape<TGeoSphere>(const TGeoShape* shape) {
const TGeoSphere* sh = (const TGeoSphere*) shape;
- return new G4Sphere(sh->GetName(), sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetPhi1() * DEGREE_2_RAD,
- sh->GetPhi2() * DEGREE_2_RAD, sh->GetTheta1() * DEGREE_2_RAD, sh->GetTheta2() * DEGREE_2_RAD);
+ return new G4Sphere(sh->GetName(), sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM,
+ sh->GetPhi1() * DEGREE_2_RAD, (sh->GetPhi2()-sh->GetPhi1()) * DEGREE_2_RAD,
+ sh->GetTheta1() * DEGREE_2_RAD, (sh->GetTheta2()- sh->GetTheta1()) * DEGREE_2_RAD);
}
template <> G4VSolid* convertShape<TGeoTorus>(const TGeoShape* shape) {
This diff is collapsed.
Click to expand it.
spack/packages/dd4hep/package.py
+
11
−
13
View file @
dd50d80c
...
...
@@ -24,9 +24,7 @@ class Dd4hep(CMakePackage):
tags
=
[
'
hep
'
]
version
(
'
master
'
,
branch
=
'
master
'
)
version
(
'
2021-07-27
'
,
sha256
=
'
e472500345d02695f0403911f29e95676fd84e6dcba7180299c37378f0ff8125
'
,
url
=
'
https://github.com/AIDASoft/DD4hep/archive/f2da87ba9366e5ad1a4ff0369788d61e05c62dd0.tar.gz
'
)
version
(
'
1.17p1
'
,
sha256
=
'
036a9908aaf1e13eaf5f2f43b6f5f4a8bdda8183ddc5befa77a4448dbb485826
'
)
version
(
'
1.17
'
,
sha256
=
'
036a9908aaf1e13eaf5f2f43b6f5f4a8bdda8183ddc5befa77a4448dbb485826
'
)
version
(
'
1.16.1
'
,
sha256
=
'
c8b1312aa88283986f89cc008d317b3476027fd146fdb586f9f1fbbb47763f1a
'
)
version
(
'
1.16
'
,
sha256
=
'
ea9755cd255cf1b058e0e3cd743101ca9ca5ff79f4c60be89f9ba72b1ae5ec69
'
)
...
...
@@ -51,7 +49,12 @@ class Dd4hep(CMakePackage):
# Workaround for failing build file generation in some cases
# See https://github.com/spack/spack/issues/24232
patch
(
'
cmake_language.patch
'
,
when
=
'
@:1.17
'
)
patch
(
'
cmake_language.patch
'
,
when
=
'
@2021-07-27
'
)
patch
(
'
cmake_language.patch
'
,
when
=
'
1.17p1
'
)
# custom hash for the 2021-07-27 version, needed to include
# https://github.com/AIDASoft/DD4hep/pull/849
# https://github.com/AIDASoft/DD4hep/pull/851
patch
(
'
2021-07-27.patch
'
,
when
=
'
1.17p1
'
)
variant
(
'
xercesc
'
,
default
=
False
,
description
=
"
Enable
'
Detector Builders
'
based on XercesC
"
)
variant
(
'
geant4
'
,
default
=
False
,
description
=
"
Enable the simulation part based on Geant4
"
)
...
...
@@ -114,18 +117,13 @@ class Dd4hep(CMakePackage):
env
.
set
(
"
DD4hep_ROOT
"
,
self
.
prefix
)
def
url_for_version
(
self
,
version
):
# remove extra patch qualifiers
if
version
[
-
2
]
==
'
p
'
:
version
=
version
[:
-
2
]
# dd4hep releases are dashes and padded with a leading zero
# the patch version is omitted when 0
# so for example v01-12-01, v01-12 ...
if
not
isinstance
(
version
,
Version
):
version
=
Version
(
version
)
# If we have a specific URL for this version, don't extrapolate.
version_urls
=
self
.
version_urls
()
if
version
in
version_urls
:
return
version_urls
[
version
]
base_url
=
self
.
url
.
rsplit
(
'
/
'
,
1
)[
0
]
if
len
(
version
)
==
1
:
major
=
version
[
0
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment