Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:32

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 
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/Framework/interface/ESHandle.h"
0011 #include "FWCore/Framework/interface/ModuleFactory.h"
0012 #include "FWCore/Framework/interface/ESProducer.h"
0013 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 #include <memory>
0018 #include <string>
0019 
0020 class TrackerRecoGeometryESProducer : public edm::ESProducer {
0021 public:
0022   TrackerRecoGeometryESProducer(const edm::ParameterSet &p);
0023 
0024   std::unique_ptr<GeometricSearchTracker> produce(const TrackerRecoGeometryRecord &);
0025 
0026   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0027 
0028 private:
0029   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0030   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopToken_;
0031   bool usePhase2Stacks_;
0032 };
0033 
0034 using namespace edm;
0035 
0036 TrackerRecoGeometryESProducer::TrackerRecoGeometryESProducer(const edm::ParameterSet &p)
0037     : usePhase2Stacks_(p.getParameter<bool>("usePhase2Stacks")) {
0038   auto c = setWhatProduced(this);
0039 
0040   // 08-Oct-2007 - Patrick Janot
0041   // Allow several reco geometries to be created, corresponding to the labelled
0042   // TrackerDigiGeometry's - that must created beforehand. Useful to handle an
0043   // aligned and a misaligned geometry in the same job.
0044   // The default parameter ("") makes this change transparent to the user
0045   // See FastSimulation/Configuration/data/ for examples of cfi's.
0046   tTopToken_ = c.consumes();
0047   geomToken_ = c.consumes(edm::ESInputTag("", p.getUntrackedParameter<std::string>("trackerGeometryLabel")));
0048 }
0049 
0050 std::unique_ptr<GeometricSearchTracker> TrackerRecoGeometryESProducer::produce(
0051     const TrackerRecoGeometryRecord &iRecord) {
0052   TrackerGeometry const &tG = iRecord.get(geomToken_);
0053 
0054   GeometricSearchTrackerBuilder builder;
0055   return std::unique_ptr<GeometricSearchTracker>(
0056       builder.build(tG.trackerDet(), &tG, &iRecord.get(tTopToken_), usePhase2Stacks_));
0057 }
0058 
0059 void TrackerRecoGeometryESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0060   edm::ParameterSetDescription desc;
0061 
0062   desc.add<bool>("usePhase2Stacks", false);
0063   desc.addUntracked<std::string>("trackerGeometryLabel", "");
0064   descriptions.addDefault(desc);
0065 }
0066 
0067 DEFINE_FWK_EVENTSETUP_MODULE(TrackerRecoGeometryESProducer);