Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:13

0001 #include "FWCore/Framework/interface/ModuleFactory.h"
0002 #include "FWCore/Framework/interface/ESProducer.h"
0003 
0004 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0005 
0006 #include "RecoTracker/MkFit/interface/MkFitGeometry.h"
0007 
0008 // mkFit includes
0009 #include "RecoTracker/MkFitCore/interface/IterationConfig.h"
0010 
0011 class MkFitIterationConfigESProducer : public edm::ESProducer {
0012 public:
0013   MkFitIterationConfigESProducer(const edm::ParameterSet &iConfig);
0014 
0015   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0016 
0017   std::unique_ptr<mkfit::IterationConfig> produce(const TrackerRecoGeometryRecord &iRecord);
0018 
0019 private:
0020   const edm::ESGetToken<MkFitGeometry, TrackerRecoGeometryRecord> geomToken_;
0021   const std::string configFile_;
0022   const float minPtCut_;
0023   const unsigned int maxClusterSize_;
0024 };
0025 
0026 MkFitIterationConfigESProducer::MkFitIterationConfigESProducer(const edm::ParameterSet &iConfig)
0027     : geomToken_{setWhatProduced(this, iConfig.getParameter<std::string>("ComponentName")).consumes()},
0028       configFile_{iConfig.getParameter<edm::FileInPath>("config").fullPath()},
0029       minPtCut_{(float)iConfig.getParameter<double>("minPt")},
0030       maxClusterSize_{iConfig.getParameter<unsigned int>("maxClusterSize")} {}
0031 
0032 void MkFitIterationConfigESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0033   edm::ParameterSetDescription desc;
0034   desc.add<std::string>("ComponentName", "")->setComment("Product label");
0035   desc.add<edm::FileInPath>("config", edm::FileInPath())
0036       ->setComment("Path to the JSON file for the mkFit configuration parameters");
0037   desc.add<double>("minPt", 0.0)->setComment("min pT cut applied during track building");
0038   desc.add<unsigned int>("maxClusterSize", 8)->setComment("Max cluster size of SiStrip hits");
0039   descriptions.addWithDefaultLabel(desc);
0040 }
0041 
0042 std::unique_ptr<mkfit::IterationConfig> MkFitIterationConfigESProducer::produce(
0043     const TrackerRecoGeometryRecord &iRecord) {
0044   mkfit::ConfigJson cj;
0045   auto it_conf = cj.load_File(configFile_);
0046   it_conf->m_params.minPtCut = minPtCut_;
0047   it_conf->m_backward_params.minPtCut = minPtCut_;
0048   it_conf->m_params.maxClusterSize = maxClusterSize_;
0049   it_conf->m_backward_params.maxClusterSize = maxClusterSize_;
0050   it_conf->setupStandardFunctionsFromNames();
0051   return it_conf;
0052 }
0053 
0054 DEFINE_FWK_EVENTSETUP_MODULE(MkFitIterationConfigESProducer);