File indexing completed on 2024-04-06 12:27:06
0001
0002
0003
0004
0005
0006
0007 #include "RecoMuon/MuonSeedGenerator/plugins/MuonSeedProducer.h"
0008 #include "RecoMuon/MuonSeedGenerator/src/MuonSeedBuilder.h"
0009
0010
0011 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0012
0013
0014 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0015 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0016
0017
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Framework/interface/ESHandle.h"
0022 #include <DataFormats/Common/interface/Handle.h>
0023
0024 #include <vector>
0025
0026
0027
0028
0029 MuonSeedProducer::MuonSeedProducer(const edm::ParameterSet& pset) {
0030
0031 produces<TrajectorySeedCollection>();
0032
0033
0034 debug = pset.getParameter<bool>("DebugMuonSeed");
0035
0036 edm::ConsumesCollector iC = consumesCollector();
0037
0038
0039 muonSeedBuilder_ = new MuonSeedBuilder(pset, iC);
0040
0041 muonLayersToken_ = esConsumes<MuonDetLayerGeometry, MuonRecoGeometryRecord>();
0042 magFieldToken_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
0043 }
0044
0045
0046
0047
0048 MuonSeedProducer::~MuonSeedProducer() { delete muonSeedBuilder_; }
0049
0050
0051
0052
0053 void MuonSeedProducer::produce(edm::Event& event, const edm::EventSetup& eSetup) {
0054
0055 edm::ESHandle<MuonDetLayerGeometry> muonLayers = eSetup.getHandle(muonLayersToken_);
0056 const MuonDetLayerGeometry* lgeom = &*muonLayers;
0057 muonSeedBuilder_->setGeometry(lgeom);
0058
0059
0060 edm::ESHandle<MagneticField> field = eSetup.getHandle(magFieldToken_);
0061 const MagneticField* theField = &*field;
0062 muonSeedBuilder_->setBField(theField);
0063
0064
0065
0066 auto output = std::make_unique<TrajectorySeedCollection>();
0067
0068
0069
0070 muonSeedBuilder_->build(event, eSetup, *output);
0071
0072
0073 event.put(std::move(output));
0074 }