File indexing completed on 2024-04-06 12:05:35
0001 #include <exception>
0002 #include <iostream>
0003 #include <memory>
0004 #include <string>
0005
0006 #include "DetectorDescription/Core/interface/DDCompactView.h"
0007 #include "DetectorDescription/Core/interface/DDExpandedNode.h"
0008 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0009 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0010 #include "DetectorDescription/Core/interface/DDName.h"
0011 #include "DetectorDescription/RegressionTest/src/DDCheck.h"
0012 #include "DetectorDescription/Parser/interface/DDLParser.h"
0013 #include "DetectorDescription/Parser/interface/FIPConfiguration.h"
0014 #include "FWCore/ParameterSetReader/interface/ParameterSetReader.h"
0015 #include "FWCore/PluginManager/interface/PresenceFactory.h"
0016 #include "FWCore/PluginManager/interface/ProblemTracker.h"
0017 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0018 #include "FWCore/ServiceRegistry/interface/ServiceToken.h"
0019 #include "FWCore/Utilities/interface/Exception.h"
0020 #include "FWCore/Utilities/interface/Presence.h"
0021
0022 int main(int argc, char* argv[]) {
0023
0024 std::string const kProgramName = argv[0];
0025 int rc = 0;
0026
0027 try {
0028
0029 edm::AssertHandler ah;
0030
0031
0032
0033
0034
0035 std::shared_ptr<edm::Presence> theMessageServicePresence;
0036 theMessageServicePresence =
0037 std::shared_ptr<edm::Presence>(edm::PresenceFactory::get()->makePresence("SingleThreadMSPresence").release());
0038
0039
0040 std::string config =
0041 "import FWCore.ParameterSet.Config as cms\n"
0042 "process = cms.Process('TEST')\n"
0043 "process.maxEvents = cms.untracked.PSet(\n"
0044 " input = cms.untracked.int32(5)\n"
0045 ")\n"
0046 "process.source = cms.Source('EmptySource')\n"
0047 "process.JobReportService = cms.Service('JobReportService')\n"
0048 "process.InitRootHandlers = cms.Service('InitRootHandlers')\n"
0049
0050 "process.m1 = cms.EDProducer('IntProducer',\n"
0051 " ivalue = cms.int32(11)\n"
0052 ")\n"
0053 "process.out = cms.OutputModule('PoolOutputModule',\n"
0054 " fileName = cms.untracked.string('testStandalone.root')\n"
0055 ")\n"
0056 "process.p = cms.Path(process.m1)\n"
0057 "process.e = cms.EndPath(process.out)\n";
0058
0059
0060 std::unique_ptr<edm::ParameterSet> params;
0061 edm::makeParameterSets(config, params);
0062 edm::ServiceToken tempToken(edm::ServiceRegistry::createServicesFromConfig(std::move(params)));
0063
0064
0065 edm::ServiceRegistry::Operate operate(tempToken);
0066
0067
0068
0069 std::cout << "main::initialize DDL parser" << std::endl;
0070 DDCompactView cpv;
0071
0072 DDLParser myP(cpv);
0073
0074 FIPConfiguration dp(cpv);
0075
0076 dp.readConfig("DetectorDescription/Parser/test/cmsIdealGeometryXML.xml");
0077
0078 std::cout << "main::about to start parsing" << std::endl;
0079
0080 myP.parse(dp);
0081
0082 std::cout << "main::completed Parser" << std::endl;
0083
0084 std::cout << std::endl << std::endl << "main::Start checking!" << std::endl << std::endl;
0085 DDCheckMaterials(std::cout);
0086
0087 DDExpandedView ev(cpv);
0088 std::cout << "== got the epv ==" << std::endl;
0089
0090 while (ev.next()) {
0091 if (ev.logicalPart().name().name() == "MBAT") {
0092 std::cout << ev.geoHistory() << std::endl;
0093 }
0094 if (ev.logicalPart().name().name() == "MUON") {
0095 std::cout << ev.geoHistory() << std::endl;
0096 }
0097 }
0098
0099 std::cout << "cleared DDCompactView. " << std::endl;
0100 }
0101
0102 catch (cms::Exception& e) {
0103 std::cout << "cms::Exception caught in " << kProgramName << "\n" << e.explainSelf();
0104 rc = 1;
0105 } catch (std::exception& e) {
0106 std::cout << "Standard library exception caught in " << kProgramName << "\n" << e.what();
0107 rc = 1;
0108 } catch (...) {
0109 std::cout << "Unknown exception caught in " << kProgramName;
0110 rc = 2;
0111 }
0112
0113 return rc;
0114 }