Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:01

0001 
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/ESHandle.h"
0004 #include "FWCore/Framework/interface/ModuleFactory.h"
0005 #include "FWCore/Framework/interface/ESProducer.h"
0006 #include "FWCore/Utilities/interface/EDMException.h"
0007 #include "RecoLocalTracker/Records/interface/TkPhase2OTCPERecord.h"
0008 #include "RecoTracker/Record/interface/CkfComponentsRecord.h"
0009 
0010 #include "FWCore/Framework/interface/ESProducer.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "RecoLocalTracker/SiPhase2VectorHitBuilder/interface/VectorHitBuilderAlgorithm.h"
0013 #include <memory>
0014 
0015 class SiPhase2RecHitMatcherESProducer : public edm::ESProducer {
0016 public:
0017   SiPhase2RecHitMatcherESProducer(const edm::ParameterSet&);
0018   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0019   std::unique_ptr<VectorHitBuilderAlgorithm> produce(const TkPhase2OTCPERecord&);
0020 
0021 private:
0022   std::string name_;
0023   edm::ParameterSet pset_;
0024   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geometryToken_;
0025   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopoToken_;
0026   edm::ESGetToken<ClusterParameterEstimator<Phase2TrackerCluster1D>, TkPhase2OTCPERecord> cpeToken_;
0027 };
0028 
0029 SiPhase2RecHitMatcherESProducer::SiPhase2RecHitMatcherESProducer(const edm::ParameterSet& p) {
0030   name_ = p.getParameter<std::string>("ComponentName");
0031   if (!(name_ == "SiPhase2VectorHitMatcher")) {
0032     throw cms::Exception("ConfigurationError") << "Configuration specifies unknown ComponentName .\n"
0033                                                << "Currently only 'SiPhase2VectorHitMatcher' is supported\n";
0034   }
0035   pset_ = p;
0036   auto cc = setWhatProduced(this, name_);
0037   geometryToken_ = cc.consumes();
0038   trackerTopoToken_ = cc.consumes();
0039   cpeToken_ = cc.consumes(p.getParameter<edm::ESInputTag>("CPE"));
0040 }
0041 
0042 std::unique_ptr<VectorHitBuilderAlgorithm> SiPhase2RecHitMatcherESProducer::produce(const TkPhase2OTCPERecord& iRecord) {
0043   std::unique_ptr<VectorHitBuilderAlgorithm> matcher = std::make_unique<VectorHitBuilderAlgorithm>(
0044       pset_,
0045       &iRecord.get(geometryToken_),
0046       &iRecord.getRecord<TrackerDigiGeometryRecord>().get(trackerTopoToken_),
0047       &iRecord.get(cpeToken_));
0048 
0049   return matcher;
0050 }
0051 
0052 void SiPhase2RecHitMatcherESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0053   edm::ParameterSetDescription desc;
0054   desc.add<std::string>("offlinestubs", "vectorHits");
0055   desc.add<int>("maxVectorHits", 999999999);
0056   desc.add<std::string>("Algorithm", "VectorHitBuilderAlgorithm");
0057   desc.add<std::string>("ComponentName", "SiPhase2VectorHitMatcher");
0058   desc.add<edm::ESInputTag>("CPE", edm::ESInputTag("", "Phase2StripCPE"));
0059   desc.add<std::vector<double>>("BarrelCut",
0060                                 {
0061                                     0.0,
0062                                     0.05,
0063                                     0.06,
0064                                     0.08,
0065                                     0.09,
0066                                     0.12,
0067                                     0.2,
0068                                 });
0069   desc.add<std::string>("Phase2CPE_name", "Phase2StripCPE");
0070   desc.add<std::string>("Clusters", "siPhase2Clusters");
0071   desc.add<int>("maxVectorHitsInAStack", 999);
0072   desc.add<std::vector<double>>("EndcapCut",
0073                                 {
0074                                     0.0,
0075                                     0.1,
0076                                     0.1,
0077                                     0.1,
0078                                     0.1,
0079                                     0.1,
0080                                 });
0081   descriptions.add("siPhase2RecHitMatcher", desc);
0082 }
0083 
0084 DEFINE_FWK_EVENTSETUP_MODULE(SiPhase2RecHitMatcherESProducer);