Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:23

0001 
0002 #include "Alignment/CocoaFit/interface/Fit.h"
0003 #include "Alignment/CocoaModel/interface/Model.h"
0004 #include "Alignment/CocoaUtilities/interface/ALIFileOut.h"
0005 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
0006 #include <cassert>
0007 //#include "Analysis/FittedEntriesRoot/interface/FERootDump.h"

0008 #include "Alignment/CocoaToDDL/interface/CocoaToDDLMgr.h"
0009 #include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
0010 
0011 #include <ctime>
0012 
0013 int main(int argc, char** argv) {
0014   char* nam = getenv("COCOA_SDF_FILENAME");
0015   if (nam != nullptr)
0016     Model::setSDFName(nam);
0017   nam = getenv("COCOA_REPORT_FILENAME");
0018   if (nam != nullptr)
0019     Model::setReportFName(nam);
0020   nam = getenv("COCOA_MATRICES_FILENAME");
0021   if (nam != nullptr)
0022     Model::setMatricesFName(nam);
0023 
0024   ALIstring COCOA_ver = "COCOA_3_2_4";
0025   //---------- Read the input arguments to set file names

0026   switch (argc) {
0027     case 1:
0028       break;
0029     case 4:
0030       if (ALIstring(argv[3]) != "!")
0031         Model::setMatricesFName(argv[3]);
0032       [[fallthrough]];
0033     case 3:
0034       if (ALIstring(argv[2]) != "!")
0035         Model::setReportFName(argv[2]);
0036       [[fallthrough]];
0037     case 2:
0038       if (ALIstring(argv[1]) != "!")
0039         Model::setSDFName(argv[1]);
0040       if (ALIstring(argv[1]) == "-v") {
0041         std::cerr << "COCOA version = " << COCOA_ver << std::endl;
0042         exit(0);
0043       }
0044       break;
0045     default:
0046       std::cerr << "WARNING: more than two arguments, from third on will not be taken into account " << std::endl;
0047       break;
0048   }
0049 
0050   //---------- Build the Model out of the system description text file

0051   GlobalOptionMgr::getInstance()->setDefaultGlobalOptions();
0052 
0053   Model::getInstance();
0054 
0055   time_t now, time_start;
0056   now = clock();
0057   time_start = now;
0058   if (ALIUtils::debug >= 0)
0059     std::cout << "TIME:START_READING  : " << now << " " << difftime(now, ALIUtils::time_now()) / 1.E6 << "   "
0060               << ALIUtils::debug << std::endl;
0061   ALIUtils::set_time_now(now);
0062 
0063   Model::readSystemDescription();
0064   now = clock();
0065   if (ALIUtils::debug >= 0)
0066     std::cout << "TIME:ENDED_READING  : " << now << " " << difftime(now, ALIUtils::time_now()) / 1.E6 << "   "
0067               << ALIUtils::debug << std::endl;
0068   ALIUtils::set_time_now(now);
0069 
0070   ALIdouble go;
0071   GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
0072   gomgr->getGlobalOptionValue("writeXML", go);
0073 
0074   if (ALIint(go) == 1) {
0075     ALIstring xmlfname = Model::SDFName();
0076     xmlfname += ALIstring(".xml");
0077     CocoaToDDLMgr::getInstance()->writeDDDFile(xmlfname);
0078   }
0079 
0080   Fit::getInstance();
0081 
0082   Fit::startFit();
0083   // scan entries

0084   //t    std::cout << " ScanMgr::getInstance()->scanEntries " << std::endl;

0085   //t    ScanMgr::getInstance()->scanEntries();

0086   //    ScanMgr::getInstance()->dumpResultMeas( std::cout );

0087 
0088   //analysis code

0089 
0090   //  FERootDump fehistos;

0091   //  std::cout << " call  fehistos.MakeHistos " << std::endl;

0092   //  fehistos.MakeHistos();

0093 
0094   if (ALIUtils::debug >= 0)
0095     std::cout << "............ program ended OK" << std::endl;
0096   if (ALIUtils::report >= 1) {
0097     ALIFileOut& fileout = ALIFileOut::getInstance(Model::ReportFName());
0098     fileout << "............ program ended OK" << std::endl;
0099   }
0100   now = clock();
0101   if (ALIUtils::debug >= 0)
0102     std::cout << "TIME:PROGRAM ENDED  : " << now << " " << difftime(now, ALIUtils::time_now()) / 1.E6 << std::endl;
0103   if (ALIUtils::debug >= 0)
0104     std::cout << "TIME:TOTAL PROGRAM  : " << now << " " << difftime(now, time_start) / 1.E6 << std::endl;
0105 
0106   exit(0);
0107 }