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

DD4hep: Sim Application Based on DD4hep #26823

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions Configuration/Geometry/python/DD4hep_GeometrySim_cff.py
@@ -0,0 +1,14 @@
import FWCore.ParameterSet.Config as cms

#
# Geometry master configuration
#
# Ideal geometry, needed for simulation
DDDetectorESProducer = cms.ESSource("DDDetectorESProducer",
confGeomXMLFiles = cms.FileInPath('DetectorDescription/DDCMS/data/cms-2015-muon-geometry.xml'),
appendToDataLabel = cms.string('')
)

DDSpecParRegistryESProducer = cms.ESProducer("DDSpecParRegistryESProducer",
appendToDataLabel = cms.string('')
)
@@ -0,0 +1,3 @@
import FWCore.ParameterSet.Config as cms

from Configuration.Geometry.DD4hep_GeometrySim_cff import *
7 changes: 7 additions & 0 deletions Configuration/StandardSequences/python/DD4hep_SimIdeal_cff.py
@@ -0,0 +1,7 @@
import FWCore.ParameterSet.Config as cms

# CMSSW/Geant4 interface
from SimG4Core.Configuration.DD4hep_SimG4Core_cff import *

psimTask = cms.Task(cms.TaskPlaceholder("randomEngineStateProducer"), g4SimHits)
psim = cms.Sequence(psimTask)
15 changes: 15 additions & 0 deletions DetectorDescription/DDCMS/interface/DDCompactView.h
@@ -0,0 +1,15 @@
#ifndef DETECTOR_DESCRIPTION_CORE_DD_COMPACT_VIEW_H
#define DETECTOR_DESCRIPTION_CORE_DD_COMPACT_VIEW_H

class DDCompactView
{
public:

DDCompactView(const cms::DDDetector& det)
: m_det(det) {}

private:
const cms::DDDetector& m_det;
};

#endif
1 change: 1 addition & 0 deletions DetectorDescription/DDCMS/interface/DDSpecParRegistry.h
Expand Up @@ -26,6 +26,7 @@ namespace cms {

struct DDSpecParRegistry {
void filter(DDSpecParRefs&, std::string_view, std::string_view) const;
void filter(DDSpecParRefs&, std::string_view) const;

DDSpecParMap specpars;
};
Expand Down
19 changes: 11 additions & 8 deletions DetectorDescription/DDCMS/plugins/DDTestSpecParsFilter.cc
Expand Up @@ -42,21 +42,24 @@ DDTestSpecParsFilter::analyze(const Event&, const EventSetup& iEventSetup)
LogVerbatim("Geometry") << "DD SpecPar Registry size: " << registry->specpars.size();

DDSpecParRefs myReg;
registry->filter(myReg, m_attribute, m_value);
if(m_value.empty())
registry->filter(myReg, m_attribute);
else
registry->filter(myReg, m_attribute, m_value);

LogVerbatim("Geometry").log([&myReg](auto& log) {
log << "Filtered DD SpecPar Registry size: " << myReg.size();
log << "Filtered DD SpecPar Registry size: " << myReg.size() << "\n";
for(const auto& t: myReg) {
log << " = { ";
log << "\nRegExps { ";
for(const auto& ki : t->paths)
log << ki << ", ";
log << " };\n ";
log << ki << " ";
log << "};\n ";
for(const auto& kl : t->spars) {
log << kl.first << " = { ";
log << kl.first << " = ";
for(const auto& kil : kl.second) {
log << kil << ", ";
log << kil << " ";
}
log << " };\n ";
log << "\n ";
}
}
});
Expand Down
19 changes: 19 additions & 0 deletions DetectorDescription/DDCMS/src/DDSpecparRegistry.cc
Expand Up @@ -53,3 +53,22 @@ DDSpecParRegistry::filter(DDSpecParRefs& refs,
}
});
}

void
DDSpecParRegistry::filter(DDSpecParRefs& refs,
string_view attribute) const {

bool found(false);
for_each(begin(specpars), end(specpars), [&refs, &attribute,
&found](const auto& k) {
found = false;
for_each(begin(k.second.spars), end(k.second.spars), [&](const auto& l) {
if(l.first == attribute) {
found = true;
}
});
if(found) {
refs.emplace_back(&k.second);
}
});
}