Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-12 23:30:36

0001 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0002 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0003 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0004 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0005 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTrackerBuilder.h"
0006 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0007 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0008 #include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h"
0009 #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h"
0010 #include "Geometry/Records/interface/MTDTopologyRcd.h"
0011 #include "Geometry/Records/interface/MTDDigiGeometryRecord.h"
0012 
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "FWCore/Framework/interface/ModuleFactory.h"
0016 #include "FWCore/Framework/interface/ESProducer.h"
0017 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include <memory>
0022 #include <string>
0023 
0024 class TrackerMTDRecoGeometryESProducer : public edm::ESProducer {
0025 public:
0026   TrackerMTDRecoGeometryESProducer(const edm::ParameterSet &p);
0027 
0028   std::unique_ptr<GeometricSearchTracker> produce(const TrackerRecoGeometryRecord &);
0029 
0030   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0031 
0032 private:
0033   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0034   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopToken_;
0035   edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtdgeomToken_;
0036   edm::ESGetToken<MTDTopology, MTDTopologyRcd> mtdTopToken_;
0037   bool usePhase2Stacks_;
0038 };
0039 
0040 using namespace edm;
0041 
0042 TrackerMTDRecoGeometryESProducer::TrackerMTDRecoGeometryESProducer(const edm::ParameterSet &p)
0043     : usePhase2Stacks_(p.getParameter<bool>("usePhase2Stacks")) {
0044   auto c = setWhatProduced(this);
0045 
0046   tTopToken_ = c.consumes();
0047   geomToken_ = c.consumes(edm::ESInputTag("", p.getUntrackedParameter<std::string>("trackerGeometryLabel")));
0048   mtdgeomToken_ = c.consumes();
0049   mtdTopToken_ = c.consumes();
0050 }
0051 
0052 std::unique_ptr<GeometricSearchTracker> TrackerMTDRecoGeometryESProducer::produce(
0053     const TrackerRecoGeometryRecord &iRecord) {
0054   TrackerGeometry const &tG = iRecord.get(geomToken_);
0055   MTDGeometry const &mG = iRecord.get(mtdgeomToken_);
0056 
0057   GeometricSearchTrackerBuilder builder;
0058   return std::unique_ptr<GeometricSearchTracker>(
0059       builder.build(tG.trackerDet(), &tG, &iRecord.get(tTopToken_), &mG, &iRecord.get(mtdTopToken_), usePhase2Stacks_));
0060 }
0061 
0062 void TrackerMTDRecoGeometryESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0063   edm::ParameterSetDescription desc;
0064 
0065   desc.add<bool>("usePhase2Stacks", false);
0066   desc.addUntracked<std::string>("trackerGeometryLabel", "");
0067   descriptions.addDefault(desc);
0068 }
0069 
0070 DEFINE_FWK_EVENTSETUP_MODULE(TrackerMTDRecoGeometryESProducer);