CompareDDCompactViews

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/RegressionTest/src/DDCheck.h"
#include "DetectorDescription/Parser/interface/DDLParser.h"
#include "DetectorDescription/Parser/interface/FIPConfiguration.h"
#include "DetectorDescription/RegressionTest/interface/DDCompareTools.h"

class CompareDDCompactViews : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
public:
  explicit CompareDDCompactViews(const edm::ParameterSet&);
  ~CompareDDCompactViews() override {}

  void beginJob() override {}
  void beginRun(edm::Run const&, edm::EventSetup const&) override;
  void analyze(edm::Event const&, edm::EventSetup const&) override {}
  void endRun(edm::Run const&, edm::EventSetup const&) override {}
  void endJob() override {}

private:
  std::string m_fname1;
  std::string m_fname2;
};

CompareDDCompactViews::CompareDDCompactViews(const edm::ParameterSet& iConfig) {
  m_fname1 = iConfig.getUntrackedParameter<std::string>("XMLFileName1");
  m_fname2 = iConfig.getUntrackedParameter<std::string>("XMLFileName2");
}

void CompareDDCompactViews::beginRun(const edm::Run&, edm::EventSetup const& es) {
  DDCompactView cpv1;
  DDLParser parser1(cpv1);
  parser1.parseOneFile(m_fname1);
  DDCheckMaterials(std::cout);
  cpv1.lockdown();

  DDCompactView cpv2;
  DDLParser parser2(cpv2);
  parser2.parseOneFile(m_fname2);
  DDCheckMaterials(std::cout);
  cpv2.lockdown();

  DDCompOptions ddco;
  bool graphmatch = DDCompareCPV(cpv1, cpv2, ddco);

  if (graphmatch) {
    std::cout << "DDCompactView graphs match" << std::endl;
  } else {
    std::cout << "DDCompactView graphs do NOT match" << std::endl;
  }
}

DEFINE_FWK_MODULE(CompareDDCompactViews);