File indexing completed on 2024-04-06 12:05:34
0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/ESTransientHandle.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "DetectorDescription/Core/interface/DDCompactView.h"
0008 #include "DetectorDescription/RegressionTest/src/DDCheck.h"
0009 #include "DetectorDescription/Parser/interface/DDLParser.h"
0010 #include "DetectorDescription/Parser/interface/FIPConfiguration.h"
0011 #include "DetectorDescription/RegressionTest/interface/DDCompareTools.h"
0012
0013 class CompareDDCompactViews : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0014 public:
0015 explicit CompareDDCompactViews(const edm::ParameterSet&);
0016 ~CompareDDCompactViews() override {}
0017
0018 void beginJob() override {}
0019 void beginRun(edm::Run const&, edm::EventSetup const&) override;
0020 void analyze(edm::Event const&, edm::EventSetup const&) override {}
0021 void endRun(edm::Run const&, edm::EventSetup const&) override {}
0022 void endJob() override {}
0023
0024 private:
0025 std::string m_fname1;
0026 std::string m_fname2;
0027 };
0028
0029 CompareDDCompactViews::CompareDDCompactViews(const edm::ParameterSet& iConfig) {
0030 m_fname1 = iConfig.getUntrackedParameter<std::string>("XMLFileName1");
0031 m_fname2 = iConfig.getUntrackedParameter<std::string>("XMLFileName2");
0032 }
0033
0034 void CompareDDCompactViews::beginRun(const edm::Run&, edm::EventSetup const& es) {
0035 DDCompactView cpv1;
0036 DDLParser parser1(cpv1);
0037 parser1.parseOneFile(m_fname1);
0038 DDCheckMaterials(std::cout);
0039 cpv1.lockdown();
0040
0041 DDCompactView cpv2;
0042 DDLParser parser2(cpv2);
0043 parser2.parseOneFile(m_fname2);
0044 DDCheckMaterials(std::cout);
0045 cpv2.lockdown();
0046
0047 DDCompOptions ddco;
0048 bool graphmatch = DDCompareCPV(cpv1, cpv2, ddco);
0049
0050 if (graphmatch) {
0051 std::cout << "DDCompactView graphs match" << std::endl;
0052 } else {
0053 std::cout << "DDCompactView graphs do NOT match" << std::endl;
0054 }
0055 }
0056
0057 DEFINE_FWK_MODULE(CompareDDCompactViews);