File indexing completed on 2025-01-09 23:33:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.h"
0012 #include "RecoMuon/MuonSeedGenerator/interface/MuonSeedFinder.h"
0013 #include "RecoMuon/MuonSeedGenerator/interface/MuonSeedOrcaPatternRecognition.h"
0014 #include "RecoMuon/MuonSeedGenerator/interface/MuonSeedFinder.h"
0015 #include "RecoMuon/MuonSeedGenerator/interface/MuonSeedSimpleCleaner.h"
0016
0017
0018 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
0019 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0020
0021 #include "DataFormats/Common/interface/Handle.h"
0022
0023 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0024 #include "RecoMuon/Records/interface/MuonRecoGeometryRecord.h"
0025
0026
0027 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0028 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0029
0030 #include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h"
0031 #include "RecoMuon/DetLayers/interface/MuonDetLayerGeometry.h"
0032 #include "RecoMuon/Records/interface/MuonRecoGeometryRecord.h"
0033
0034
0035 #include "FWCore/Framework/interface/EventSetup.h"
0036 #include "FWCore/Framework/interface/Event.h"
0037 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0038 #include "FWCore/Framework/interface/ESHandle.h"
0039 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0040 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0041
0042
0043 #include <vector>
0044
0045 using namespace std;
0046
0047 typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
0048 typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
0049 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
0050
0051
0052 MuonSeedGenerator::MuonSeedGenerator(const edm::ParameterSet& pset)
0053 : theSeedFinder(new MuonSeedFinder(pset)),
0054 theSeedCleaner(new MuonSeedSimpleCleaner()),
0055 theBeamSpotTag(pset.getParameter<edm::InputTag>("beamSpotTag")) {
0056 produces<TrajectorySeedCollection>();
0057
0058 edm::ConsumesCollector iC = consumesCollector();
0059 thePatternRecognition = new MuonSeedOrcaPatternRecognition(pset, iC);
0060
0061 beamspotToken = consumes<reco::BeamSpot>(theBeamSpotTag);
0062 magFieldToken = esConsumes<MagneticField, IdealMagneticFieldRecord>();
0063 }
0064
0065
0066 MuonSeedGenerator::~MuonSeedGenerator() {
0067 delete thePatternRecognition;
0068 delete theSeedFinder;
0069 delete theSeedCleaner;
0070 }
0071
0072
0073 void MuonSeedGenerator::produce(edm::Event& event, const edm::EventSetup& eSetup) {
0074
0075 auto output = std::make_unique<TrajectorySeedCollection>();
0076
0077 edm::ESHandle<MagneticField> field = eSetup.getHandle(magFieldToken);
0078 theSeedFinder->setBField(&*field);
0079
0080 reco::BeamSpot beamSpot;
0081 edm::Handle<reco::BeamSpot> beamSpotHandle;
0082 event.getByToken(beamspotToken, beamSpotHandle);
0083 if (beamSpotHandle.isValid()) {
0084 beamSpot = *beamSpotHandle;
0085
0086 } else {
0087 edm::LogInfo("MuonSeedGenerator") << "No beam spot available from EventSetup \n";
0088 }
0089
0090
0091 GlobalVector gv(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
0092 theSeedFinder->setBeamSpot(gv);
0093
0094 std::vector<MuonRecHitContainer> patterns;
0095 thePatternRecognition->produce(event, eSetup, patterns);
0096
0097 for (std::vector<MuonRecHitContainer>::const_iterator seedSegments = patterns.begin(); seedSegments != patterns.end();
0098 ++seedSegments) {
0099 theSeedFinder->seeds(*seedSegments, *output);
0100 }
0101
0102 theSeedCleaner->clean(*output);
0103
0104 event.put(std::move(output));
0105 }
0106
0107 void MuonSeedGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0108 edm::ParameterSetDescription desc;
0109 desc.setAllowAnything();
0110 desc.add<edm::InputTag>("beamSpotTag", edm::InputTag("offlineBeamSpot"));
0111 desc.add<bool>("scaleDT", true);
0112 desc.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("cscSegments"));
0113 desc.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("dt4DSegments"));
0114 desc.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments"));
0115 desc.add<bool>("EnableDTMeasurement", true);
0116 desc.add<bool>("EnableCSCMeasurement", true);
0117 desc.add<bool>("EnableME0Measurement", false);
0118 desc.add<std::vector<double>>("crackEtas", {0.2, 1.6, 1.7});
0119 desc.add<double>("crackWindow", 0.04);
0120 desc.add<double>("deltaPhiSearchWindow", 0.25);
0121 desc.add<double>("deltaEtaSearchWindow", 0.2);
0122 desc.add<double>("deltaEtaCrackSearchWindow", 0.25);
0123 descriptions.add("muonSeedGenerator", desc);
0124 }
0125
0126 #include "FWCore/Framework/interface/MakerMacros.h"
0127 DEFINE_FWK_MODULE(MuonSeedGenerator);