Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <iostream>
0002 #include <fstream>
0003 
0004 #include "DetectorDescription/Parser/interface/DDLParser.h"
0005 #include "DetectorDescription/RegressionTest/src/DDCheck.h"
0006 #include "DetectorDescription/Core/interface/DDRoot.h"
0007 #include "DetectorDescription/Core/interface/DDException.h"
0008 #include "DetectorDescription/Core/interface/DDFilter.h"
0009 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0010 #include "DetectorDescription/Core/interface/DDValue.h"
0011 #include "DetectorDescription/Core/interface/DDCompactView.h"
0012 #include "DetectorDescription/RegressionTest/src/ddstats.h"
0013 
0014 using namespace std;
0015 int main(int argc, char *argv[])
0016 {
0017 try { // DDD Prototype can throw DDException defined in DetectorDescription/Core/interface/DDException.h
0018   
0019   // Initialize a DDL Schema aware parser for DDL-documents
0020   // (DDL ... Detector Description Language)
0021   cout << "initialize DDL parser" << endl;
0022   DDLParser* myP = DDLParser::Instance();
0023 
0024   cout << "about to set configuration" << endl;
0025   /* The configuration file tells the parser what to parse.
0026      The sequence of files to be parsed does not matter but for one exception:
0027      XML containing SpecPar-tags must be parsed AFTER all corresponding
0028      PosPart-tags were parsed. (Simply put all SpecPars-tags into seperate
0029      files and mention them at end of configuration.xml. Functional SW 
0030     will not suffer from this restriction).
0031   */  
0032   if (argc==1) {
0033   myP->SetConfig("configuration.xml");
0034   } else
0035     myP->SetConfig(*(argv+1));
0036  
0037   //LINUX ONLY!!!!
0038   //ifstream proc("/proc/self/status") ;
0039   //cout << proc << endl;
0040   //proc.close();
0041   string nix;
0042   cout << "about to start parsing" << endl;
0043   cout << " check process size now, and press \'c\'+<return> to continue .." << endl;
0044   cin >> nix;
0045   int parserResult = myP->StartParsing();
0046   if (parserResult != 0) {
0047     cout << " problem encountered during parsing. exiting ... " << endl;
0048     exit(1);
0049   }
0050   cout << " parsing completed" << endl;
0051   cout << " check process size now, and press \'c\'+<return> to continue .." << endl;
0052   cin >> nix;
0053   
0054   cout << endl << endl << "Start checking!" << endl << endl;
0055   
0056   /* Currently only materials are checked.
0057      (Checking means that additional consitency test are done which
0058       can not be guaranteed to be ok by simple Schema conformance)
0059       Functional SW will automatically call various Tests after parsing 
0060       is finished)
0061   */    
0062 
0063 
0064   //DDCheckMaterials(cout);
0065   DDCheck(cout);
0066 
0067   //Statistics
0068   ddstats(cout);
0069   cout << " check process size now, and press \'c\'+<return> to continue .." << endl;
0070   cin >> nix;
0071   cout << "Clearing CompactView ..." << endl;
0072   DDCompactView cpv;
0073   cpv.clear();
0074   cout << " check process size now, and press \'c\'+<return> to continue .." << endl;
0075   cin >> nix;
0076     
0077   return 0;
0078   
0079 }
0080 catch (DDException& e) // DDD-Exceptions are simple string for the Prototype
0081 {
0082    cerr << "DDD-PROBLEM:" << endl 
0083         << e << endl;
0084 }  
0085 
0086 }