Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:36

0001 #include <cstdlib>
0002 #include <iostream>
0003 
0004 #include "DetectorDescription/Core/interface/DDCompactView.h"
0005 #include "DetectorDescription/RegressionTest/src/DDCheck.h"
0006 #include "DetectorDescription/Parser/interface/DDLParser.h"
0007 #include "DetectorDescription/Parser/interface/FIPConfiguration.h"
0008 #include "FWCore/PluginManager/interface/PluginManager.h"
0009 #include "FWCore/PluginManager/interface/standard.h"
0010 #include "FWCore/Utilities/interface/Exception.h"
0011 
0012 int main(int argc, char* argv[]) {
0013   try {
0014     edmplugin::PluginManager::configure(edmplugin::standard::config());
0015 
0016     std::cout << "Get a hold of aDDLParser." << std::endl;
0017     DDCompactView cpv;
0018     DDLParser myP(cpv);
0019 
0020     std::cout << "main:: initialize" << std::endl;
0021 
0022     std::cout << "======================" << std::endl << std::endl;
0023 
0024     std::cout << "Defining my Document Provider, using the default one provided" << std::endl;
0025 
0026     FIPConfiguration cf(cpv);
0027 
0028     std::cout << "Make sure the provider is ready... you don't need this, it's just necessary for the default one."
0029               << std::endl;
0030     int errNumcf;
0031     errNumcf = cf.readConfig("DetectorDescription/Parser/test/config1.xml");
0032     if (!errNumcf) {
0033       std::cout << "about to call DumpFileList of configuration cf" << std::endl;
0034       cf.dumpFileList();
0035     } else {
0036       std::cout << "error in ReadConfig" << std::endl;
0037       return -1;
0038     }
0039 
0040     // Parse the files provided by the DDLDocumentProvider above.
0041     std::cout << " parse all the files provided by the DDLDocumentProvider" << std::endl;
0042     myP.parse(cf);
0043 
0044     std::cout << "===================" << std::endl << std::endl;
0045     std::cout << " parse just one file THAT WAS ALREADY PARSED (materials.xml).  We should get a WARNING message."
0046               << std::endl;
0047     myP.parseOneFile("DetectorDescription/Parser/test/materials.xml");
0048 
0049     std::cout << "===================" << std::endl << std::endl;
0050     std::cout << " parse just one file that has not been parsed (specpars.xml).  This should just go through."
0051               << std::endl;
0052     myP.parseOneFile("DetectorDescription/Parser/test/specpars.xml");
0053 
0054     std::cout << "===================" << std::endl << std::endl;
0055     std::cout << " make a new provider and read some other configuration" << std::endl;
0056 
0057     FIPConfiguration cf2(cpv);
0058     cf2.readConfig("DetectorDescription/Parser/test/config2.xml");
0059     myP.parse(cf2);
0060 
0061     std::cout << "Done Parsing" << std::endl;
0062     std::cout << "===================" << std::endl << std::endl;
0063 
0064     std::cout << std::endl << std::endl << "main::Start checking!" << std::endl << std::endl;
0065     DDCheckMaterials(std::cout);
0066 
0067     std::cout << "cleared DDCompactView.  " << std::endl;
0068 
0069     return EXIT_SUCCESS;
0070   } catch (cms::Exception& e) {
0071     std::cout << "main::PROBLEM:" << std::endl << "         " << e.what() << std::endl;
0072   }
0073 }