File indexing completed on 2023-03-17 11:22:40
0001 #include "RecoTracker/MkFitCore/standalone/ConfigStandalone.h"
0002 #include "RecoTracker/MkFitCore/interface/TrackerInfo.h"
0003 #include "RecoTracker/MkFitCore/interface/IterationConfig.h"
0004
0005
0006 #include <dlfcn.h>
0007 #include <sys/stat.h>
0008 #include <cstdlib>
0009
0010 namespace mkfit {
0011
0012 namespace Config {
0013
0014 TrackerInfo TrkInfo;
0015 IterationsInfo ItrInfo;
0016
0017 std::string geomPlugin = "CylCowWLids";
0018
0019 int nTracks = 10000;
0020 int nEvents = 20;
0021 int nItersCMSSW = 0;
0022 bool loopOverFile = false;
0023
0024 seedOpts seedInput = simSeeds;
0025 cleanOpts seedCleaning = noCleaning;
0026
0027 bool readCmsswTracks = false;
0028
0029 bool dumpForPlots = false;
0030
0031 bool cf_seeding = false;
0032 bool cf_fitting = false;
0033
0034 bool quality_val = false;
0035 bool sim_val_for_cmssw = false;
0036 bool sim_val = false;
0037 bool cmssw_val = false;
0038 bool fit_val = false;
0039 bool readSimTrackStates = false;
0040 bool inclusiveShorts = false;
0041 bool keepHitInfo = false;
0042 bool tryToSaveSimInfo = false;
0043 matchOpts cmsswMatchingFW = hitBased;
0044 matchOpts cmsswMatchingBK = trkParamBased;
0045
0046 bool useDeadModules = false;
0047
0048
0049 int numHitsPerTask = 32;
0050
0051 bool mtvLikeValidation = false;
0052 bool mtvRequireSeeds = false;
0053 int cmsSelMinLayers = 12;
0054 int nMinFoundHits = 10;
0055
0056 bool kludgeCmsHitErrors = false;
0057 bool backwardFit = false;
0058 bool backwardSearch = true;
0059
0060 int numThreadsSimulation = 12;
0061
0062 int finderReportBestOutOfN = 1;
0063
0064 bool includePCA = false;
0065
0066
0067
0068 bool silent = false;
0069 bool json_verbose = false;
0070 bool json_dump_before = false;
0071 bool json_dump_after = false;
0072 std::vector<std::string> json_patch_filenames;
0073 std::vector<std::string> json_load_filenames;
0074 std::string json_save_iters_fname_fmt;
0075 bool json_save_iters_include_iter_info_preamble = false;
0076
0077
0078
0079 void recalculateDependentConstants() {}
0080
0081 }
0082
0083
0084
0085
0086
0087 namespace {
0088 const char *search_path[] = {"", "../Geoms/", "Geoms/", "../", nullptr};
0089 typedef void (*TrackerInfoCreator_foo)(TrackerInfo &, IterationsInfo &, bool verbose);
0090 }
0091
0092 void execTrackerInfoCreatorPlugin(const std::string &base, TrackerInfo &ti, IterationsInfo &ii, bool verbose) {
0093 const std::string soname = base + ".so";
0094 const std::string binname = base + ".bin";
0095 struct stat st;
0096
0097 int si = 0;
0098 while (search_path[si]) {
0099 std::string path;
0100 const char *envpath = std::getenv("MKFIT_BASE");
0101 if (envpath != nullptr) {
0102 path += envpath;
0103 path += "/";
0104 }
0105 path += search_path[si];
0106 std::string sopath = path + soname;
0107 if (stat(sopath.c_str(), &st) == 0) {
0108 printf("execTrackerInfoCreatorPlugin processing '%s'\n", sopath.c_str());
0109
0110 void *h = dlopen(sopath.c_str(), RTLD_LAZY);
0111 if (!h) {
0112 perror("dlopen failed");
0113 exit(2);
0114 }
0115
0116 long long *p2f = (long long *)dlsym(h, "TrackerInfoCreator_ptr");
0117 if (!p2f) {
0118 perror("dlsym failed");
0119 exit(2);
0120 }
0121
0122 std::string binpath = path + binname;
0123 int binsr = stat(binpath.c_str(), &st);
0124 printf("execTrackerInfoCreatorPlugin has%s found TrackerInfo binary file '%s'\n",
0125 binsr ? " NOT" : "",
0126 binpath.c_str());
0127 if (binsr == 0)
0128 ti.read_bin_file(binpath);
0129
0130 TrackerInfoCreator_foo foo = (TrackerInfoCreator_foo)(*p2f);
0131 foo(ti, ii, verbose);
0132
0133 return;
0134 }
0135
0136 ++si;
0137 }
0138
0139 fprintf(stderr, "TrackerInfo plugin '%s' not found in search path.\n", soname.c_str());
0140 exit(2);
0141 }
0142
0143 }