Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-01 23:54:11

0001 #include "L1Trigger/VertexFinder/interface/AlgoSettings.h"
0002 
0003 namespace l1tVertexFinder {
0004 
0005   ///=== Get configuration parameters
0006 
0007   AlgoSettings::AlgoSettings(const edm::ParameterSet& iConfig)
0008       : vertex_(iConfig.getParameter<edm::ParameterSet>("VertexReconstruction")),
0009         vx_distance_(vertex_.getParameter<double>("VertexDistance")),
0010         vx_resolution_(vertex_.getParameter<double>("VertexResolution")),
0011         vx_distanceType_(vertex_.getParameter<unsigned int>("DistanceType")),
0012         vx_minTracks_(vertex_.getParameter<unsigned int>("MinTracks")),
0013         vx_weightedmean_(vertex_.getParameter<unsigned int>("WeightedMean")),
0014         vx_chi2cut_(vertex_.getParameter<double>("AVR_chi2cut")),
0015         vx_DoQualityCuts_(vertex_.getParameter<bool>("EM_DoQualityCuts")),
0016         vx_DoPtComp_(vertex_.getParameter<bool>("FH_DoPtComp")),
0017         vx_DoTightChi2_(vertex_.getParameter<bool>("FH_DoTightChi2")),
0018         vx_histogram_parameters_(vertex_.getParameter<std::vector<double> >("FH_HistogramParameters")),
0019         vx_nvtx_(vertex_.getParameter<unsigned int>("FH_NVtx")),
0020         vx_width_(vertex_.getParameter<double>("FH_VertexWidth")),
0021         vx_windowSize_(vertex_.getParameter<unsigned int>("FH_WindowSize")),
0022         vx_TrackMinPt_(vertex_.getParameter<double>("VxMinTrackPt")),
0023         vx_TrackMaxPt_(vertex_.getParameter<double>("VxMaxTrackPt")),
0024         vx_TrackMaxPtBehavior_(vertex_.getParameter<int>("VxMaxTrackPtBehavior")),
0025         vx_TrackMaxChi2_(vertex_.getParameter<double>("VxMaxTrackChi2")),
0026         vx_NStubMin_(vertex_.getParameter<unsigned int>("VxMinNStub")),
0027         vx_NStubPSMin_(vertex_.getParameter<unsigned int>("VxMinNStubPS")),
0028         vx_dbscan_pt_(vertex_.getParameter<double>("DBSCANPtThreshold")),
0029         vx_dbscan_mintracks_(vertex_.getParameter<unsigned int>("DBSCANMinDensityTracks")),
0030         vx_kmeans_iterations_(vertex_.getParameter<unsigned int>("KmeansIterations")),
0031         vx_kmeans_nclusters_(vertex_.getParameter<unsigned int>("KmeansNumClusters")),
0032         // Debug printout
0033         debug_(iConfig.getParameter<unsigned int>("debug")) {
0034     const std::string algoName(vertex_.getParameter<std::string>("Algorithm"));
0035     const auto algoMapIt = algoNameMap.find(algoName);
0036     if (algoMapIt != algoNameMap.end())
0037       vx_algo_ = algoMapIt->second;
0038     else {
0039       std::ostringstream validAlgoNames;
0040       for (auto it = algoNameMap.begin(); it != algoNameMap.end(); it++) {
0041         validAlgoNames << '"' << it->first << '"';
0042         if (it != (--algoNameMap.end()))
0043           validAlgoNames << ", ";
0044       }
0045       throw cms::Exception("Invalid algo name '" + algoName +
0046                            "' specified for L1T vertex producer. Valid algo names are: " + validAlgoNames.str());
0047     }
0048 
0049     const auto algoPrecisionMapIt = algoPrecisionMap.find(vx_algo_);
0050     if (algoPrecisionMapIt != algoPrecisionMap.end()) {
0051       vx_precision_ = algoPrecisionMapIt->second;
0052     } else {
0053       throw cms::Exception("Unknown precision {Simulation, Emulation} for algo name " + algoName);
0054     }
0055   }
0056 
0057   const std::map<std::string, Algorithm> AlgoSettings::algoNameMap = {
0058       {"fastHisto", Algorithm::fastHisto},
0059       {"fastHistoEmulation", Algorithm::fastHistoEmulation},
0060       {"fastHistoLooseAssociation", Algorithm::fastHistoLooseAssociation},
0061       {"GapClustering", Algorithm::GapClustering},
0062       {"agglomerative", Algorithm::agglomerativeHierarchical},
0063       {"DBSCAN", Algorithm::DBSCAN},
0064       {"PVR", Algorithm::PVR},
0065       {"adaptive", Algorithm::adaptiveVertexReconstruction},
0066       {"HPV", Algorithm::HPV},
0067       {"K-means", Algorithm::Kmeans}};
0068 
0069   const std::map<Algorithm, Precision> AlgoSettings::algoPrecisionMap = {
0070       {Algorithm::fastHisto, Precision::Simulation},
0071       {Algorithm::fastHistoEmulation, Precision::Emulation},
0072       {Algorithm::fastHistoLooseAssociation, Precision::Simulation},
0073       {Algorithm::GapClustering, Precision::Simulation},
0074       {Algorithm::agglomerativeHierarchical, Precision::Simulation},
0075       {Algorithm::DBSCAN, Precision::Simulation},
0076       {Algorithm::PVR, Precision::Simulation},
0077       {Algorithm::adaptiveVertexReconstruction, Precision::Simulation},
0078       {Algorithm::HPV, Precision::Simulation},
0079       {Algorithm::Kmeans, Precision::Simulation}};
0080 
0081 }  // end namespace l1tVertexFinder