Skip to content

Commit

Permalink
Condensed commit for mf geom builder migration to DD4hep
Browse files Browse the repository at this point in the history
  • Loading branch information
cvuosalo committed Sep 5, 2019
1 parent 411b633 commit 957d80d
Show file tree
Hide file tree
Showing 44 changed files with 2,393 additions and 891 deletions.
1 change: 1 addition & 0 deletions DetectorDescription/DDCMS/data/cms-mf-geometry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<Include ref='Geometry/CMSCommonData/data/cms.xml'/>
<Include ref='DetectorDescription/DDCMS/data/cmsMagneticField.xml'/>
<Include ref='MagneticField/GeomBuilder/data/MagneticFieldVolumes_160812_1.xml'/>
<Include ref='MagneticField/GeomBuilder/data/MagneticFieldVolumes_160812_2.xml'/>
<Include ref='Geometry/CMSCommonData/data/materials.xml'/>
</IncludeSection>

Expand Down
1 change: 1 addition & 0 deletions DetectorDescription/DDCMS/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</library>

<library name="DetectorDescriptionDD4HepPlugins" file="dd4hep/*.cc" >
<use name="MagneticField/Records"/>
<use name="rootgeom"/>
<flags DD4HEP_PLUGIN="1"/>
</library>
70 changes: 70 additions & 0 deletions DetectorDescription/DDCMS/plugins/DDCompactViewMFESProducer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// -*- C++ -*-
//
// Package: DetectorDescription/Core
// Class: DDCompactViewMFESProducer
//
/**\class DDCompactViewMFESProducer
Description: Produce DDCompactView
Implementation:
Allow users view a DDDetector as a legacy compact view
*/
//
// Original Author: Ianna Osborne
//
//

#include <memory>

#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "DetectorDescription/DDCMS/interface/DDCompactView.h"
#include "Geometry/Records/interface/GeometryFileRcd.h"
#include "DetectorDescription/DDCMS/interface/DDDetector.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "DD4hep/Detector.h"

using namespace std;
using namespace cms;

class DDCompactViewMFESProducer : public edm::ESProducer {
public:
DDCompactViewMFESProducer(const edm::ParameterSet&);
~DDCompactViewMFESProducer() override;

using ReturnType = unique_ptr<DDCompactView>;

static void fillDescriptions(edm::ConfigurationDescriptions&);

ReturnType produce(const IdealMagneticFieldRecord&);

private:
const string m_label;
};

DDCompactViewMFESProducer::DDCompactViewMFESProducer(const edm::ParameterSet& iConfig)
: m_label(iConfig.getParameter<std::string>("appendToDataLabel")) {
setWhatProduced(this);
}

DDCompactViewMFESProducer::~DDCompactViewMFESProducer() {}

void DDCompactViewMFESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
descriptions.addDefault(desc);
}

DDCompactViewMFESProducer::ReturnType DDCompactViewMFESProducer::produce(const IdealMagneticFieldRecord& iRecord) {
edm::ESHandle<DDDetector> det;
iRecord.getRecord<GeometryFileRcd>().get(m_label, det);

auto product = std::make_unique<DDCompactView>(*det);
return product;
}

DEFINE_FWK_EVENTSETUP_MODULE(DDCompactViewMFESProducer);
7 changes: 7 additions & 0 deletions MagneticField/GeomBuilder/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
<library file="*.cc" name="MagneticFieldGeomBuilderPlugins">
<flags EDM_PLUGIN="1"/>
</library>

<library name="DD4hep_MagGeometryPlugins" file="dd4hep/*.cc">
<use name="DetectorDescription/DDCMS"/>
<use name="dd4hep"/>
<lib name="Geom"/>
<flags EDM_PLUGIN="1"/>
</library>
Loading

0 comments on commit 957d80d

Please sign in to comment.