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
[DD4hep] DDDetector ES producer from DB #34167
Merged
Merged
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", | ||
geomXMLFiles = cms.vstring('DetectorDescription/Core/test/data/materials.xml', | ||
'DetectorDescription/Core/test/data/world.xml', | ||
'DetectorDescription/Core/test/data/assembly.xml'), | ||
rootNodeName = cms.string('world:MotherOfAllBoxes') | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "DetectorDescription/Core/src/Assembly.h" | ||
|
||
#include "DetectorDescription/Core/interface/DDSolidShapes.h" | ||
#include "DetectorDescription/Core/src/Solid.h" | ||
|
||
DDI::Assembly::Assembly() : Solid(DDSolidShape::ddassembly) {} | ||
|
||
void DDI::Assembly::stream(std::ostream& os) const {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef DDD_DDI_ASSEMBLY_H | ||
#define DDD_DDI_ASSEMBLY_H | ||
|
||
#include <iostream> | ||
#include "Solid.h" | ||
|
||
namespace DDI { | ||
|
||
class Assembly : public Solid { | ||
public: | ||
Assembly(); | ||
|
||
double volume() const override { return -1; } | ||
|
||
void stream(std::ostream& os) const override; | ||
}; | ||
} // namespace DDI | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0"?> | ||
<DDDefinition> | ||
<SolidSection> | ||
<Assembly name="AssemblyVolume"/> | ||
<TruncTubs name="ChildVolume" rMin="6.9551*m" rMax="9*m" cutAtStart="6.9551*m" cutAtDelta="7.20045*m" cutInside="true" | ||
startPhi="0*deg" deltaPhi="15*deg" zHalf="6.57005*m"/> | ||
</SolidSection> | ||
<LogicalPartSection> | ||
<LogicalPart name="AssemblyVolume" category="unspecified"> | ||
<rSolid name="AssemblyVolume"/> | ||
<rMaterial name="materials:Air"/> | ||
</LogicalPart> | ||
<LogicalPart name="ChildVolume" category="unspecified"> | ||
<rSolid name="ChildVolume"/> | ||
<rMaterial name="materials:Air"/> | ||
</LogicalPart> | ||
</LogicalPartSection> | ||
<PosPartSection label=""> | ||
<PosPart copyNumber="1"> | ||
<rParent name="AssemblyVolume"/> | ||
<rChild name="ChildVolume"/> | ||
<Translation z="17.4299*m" y="0.*m" x="0."/> | ||
</PosPart> | ||
<PosPart copyNumber="2"> | ||
<rParent name="AssemblyVolume"/> | ||
<rChild name="ChildVolume"/> | ||
<Translation z="-17.4299*m" y="0.*m" x="0."/> | ||
</PosPart> | ||
<PosPart copyNumber="13"> | ||
<rParent name="world:MotherOfAllBoxes"/> | ||
<rChild name="AssemblyVolume"/> | ||
<Translation z="0*m" y="0.*m" x="0."/> | ||
</PosPart> | ||
</PosPartSection> | ||
</DDDefinition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("DDAssemblyTest") | ||
process.load("DetectorDescription.Core.test.DDAssemblyXML_cfi") | ||
|
||
process.source = cms.Source("EmptySource") | ||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.test = cms.EDAnalyzer("PerfectGeometryAnalyzer", | ||
dumpPosInfo = cms.untracked.bool(True), | ||
label = cms.untracked.string(''), | ||
isMagField = cms.untracked.bool(False), | ||
dumpSpecs = cms.untracked.bool(False), | ||
dumpGeoHistory = cms.untracked.bool(True), | ||
outFileName = cms.untracked.string('DDAssembly.out'), | ||
numNodesToDump = cms.untracked.uint32(0), | ||
fromDB = cms.untracked.bool(False), | ||
ddRootNodeName = cms.untracked.string('world:MotherOfAllBoxes') | ||
) | ||
|
||
process.Timing = cms.Service("Timing") | ||
|
||
process.p = cms.Path(process.test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "DetectorDescription/Parser/src/DDLAssembly.h" | ||
#include "DetectorDescription/Core/interface/DDSolid.h" | ||
#include "DetectorDescription/Parser/interface/DDLElementRegistry.h" | ||
#include "DetectorDescription/Parser/src/DDLSolid.h" | ||
#include "DetectorDescription/Parser/src/DDXMLElement.h" | ||
|
||
class DDCompactView; | ||
|
||
DDLAssembly::DDLAssembly(DDLElementRegistry* myreg) : DDLSolid(myreg) {} | ||
|
||
void DDLAssembly::preProcessElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) { | ||
myRegistry_->getElement("rSolid")->clear(); | ||
} | ||
|
||
// Upon ending a ShapelessSolid element, call DDCore giving the box name, and dimensions. | ||
void DDLAssembly::processElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) { | ||
DDSolid dds = DDSolidFactory::shapeless(getDDName(nmspace)); | ||
|
||
DDLSolid::setReference(nmspace, cpv); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef DDL_Assembly_H | ||
#define DDL_Assembly_H | ||
|
||
#include <string> | ||
|
||
#include "DDLSolid.h" | ||
|
||
class DDCompactView; | ||
class DDLElementRegistry; | ||
|
||
/// DDLAssembly processes Assembly elements. | ||
/** @class DDLAssembly | ||
* @author Ianna Osborne | ||
* | ||
* DDLAssembly.h - description | ||
* | ||
* This is the Assembly processor. | ||
* | ||
*/ | ||
|
||
class DDLAssembly final : public DDLSolid { | ||
public: | ||
DDLAssembly(DDLElementRegistry* myreg); | ||
|
||
void processElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) override; | ||
void preProcessElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) override; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the existence of parameters to control module behavior is generally considered as undesirable behavior. How about adding an explicit parameter to control whether the XML file is used or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, the parameter is already declared as optional in the
fillDescriptions()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, coming back. Guessing a bit the desired behavior based on the
fillDescriptions()
, if theconfGeomXMLFiles
is required whenfromDB == False
, how about?
If this is the case the
fillDescriptions()
could also be enhanced along (untested)https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideConfigurationValidationAndHelp#A_Switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd think, the latter is not needed, because there are two configurations produced: one for DB and another for XML files. It seems clear which one needs the
confGeomXMLFiles
.