File indexing completed on 2025-01-08 03:36:30
0001 #ifndef MuonSeedGenerator_CosmicMuonSeedGenerator_H
0002 #define MuonSeedGenerator_CosmicMuonSeedGenerator_H
0003
0004
0005
0006
0007
0008
0009
0010 #include "FWCore/Framework/interface/stream/EDProducer.h"
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "FWCore/Utilities/interface/InputTag.h"
0013 #include "FWCore/Utilities/interface/ESGetToken.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0015 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0016
0017 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0018 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0019 #include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h"
0020 #include "RecoMuon/DetLayers/interface/MuonDetLayerGeometry.h"
0021 #include "RecoMuon/Records/interface/MuonRecoGeometryRecord.h"
0022 #include "MagneticField/Engine/interface/MagneticField.h"
0023 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0024
0025 #include <vector>
0026
0027 class MuonDetLayerGeometry;
0028
0029 struct TrajectoryStateTransform;
0030
0031 namespace edm {
0032 class ParameterSet;
0033 class Event;
0034 class EventSetup;
0035 }
0036
0037 class CosmicMuonSeedGenerator : public edm::stream::EDProducer<> {
0038 public:
0039
0040 CosmicMuonSeedGenerator(const edm::ParameterSet&);
0041
0042
0043 ~CosmicMuonSeedGenerator() override;
0044
0045
0046 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0047
0048
0049
0050
0051 void produce(edm::Event&, const edm::EventSetup&) override;
0052
0053 private:
0054 struct MuonRecHitPair {
0055 MuonRecHitPair(const MuonTransientTrackingRecHit::MuonRecHitPointer& a,
0056 const MuonTransientTrackingRecHit::MuonRecHitPointer& b,
0057 std::string c = "")
0058 : first(a), second(b), type(c) {}
0059
0060 MuonTransientTrackingRecHit::MuonRecHitPointer first;
0061 MuonTransientTrackingRecHit::MuonRecHitPointer second;
0062 std::string type;
0063 };
0064
0065 typedef std::vector<MuonRecHitPair> MuonRecHitPairVector;
0066
0067
0068 void createSeeds(TrajectorySeedCollection& results,
0069 const MuonTransientTrackingRecHit::MuonRecHitContainer& hits,
0070 const edm::EventSetup& eSetup) const;
0071
0072 void createSeeds(TrajectorySeedCollection& results,
0073 const CosmicMuonSeedGenerator::MuonRecHitPairVector& hits,
0074 const edm::EventSetup& eSetup) const;
0075
0076
0077 bool checkQuality(const MuonTransientTrackingRecHit::MuonRecHitPointer&) const;
0078
0079
0080 MuonTransientTrackingRecHit::MuonRecHitContainer selectSegments(
0081 const MuonTransientTrackingRecHit::MuonRecHitContainer&) const;
0082
0083
0084 std::vector<TrajectorySeed> createSeed(const MuonTransientTrackingRecHit::MuonRecHitPointer&,
0085 const edm::EventSetup&) const;
0086
0087 std::vector<MuonRecHitPair> makeSegPairs(const MuonTransientTrackingRecHit::MuonRecHitContainer&,
0088 const MuonTransientTrackingRecHit::MuonRecHitContainer&,
0089 std::string) const;
0090
0091
0092 std::vector<TrajectorySeed> createSeed(const MuonRecHitPair&, const edm::EventSetup&) const;
0093
0094 TrajectorySeed tsosToSeed(const TrajectoryStateOnSurface&, uint32_t) const;
0095 TrajectorySeed tsosToSeed(const TrajectoryStateOnSurface&, uint32_t, edm::OwnVector<TrackingRecHit>&) const;
0096
0097
0098 bool areCorrelated(const MuonTransientTrackingRecHit::MuonRecHitPointer&,
0099 const MuonTransientTrackingRecHit::MuonRecHitPointer&) const;
0100
0101
0102 bool leftIsBetter(const MuonTransientTrackingRecHit::MuonRecHitPointer&,
0103 const MuonTransientTrackingRecHit::MuonRecHitPointer&) const;
0104
0105 struct DecreasingGlobalY {
0106 bool operator()(const MuonTransientTrackingRecHit::ConstMuonRecHitPointer& lhs,
0107 const MuonTransientTrackingRecHit::ConstMuonRecHitPointer& rhs) const {
0108 return lhs->globalPosition().y() > rhs->globalPosition().y();
0109 }
0110 };
0111
0112 private:
0113
0114 bool theEnableDTFlag;
0115
0116
0117 bool theEnableCSCFlag;
0118
0119
0120 edm::InputTag theDTRecSegmentLabel;
0121
0122
0123 edm::InputTag theCSCRecSegmentLabel;
0124
0125
0126 unsigned int theMaxSeeds;
0127
0128
0129 double theMaxDTChi2;
0130 double theMaxCSCChi2;
0131 bool theForcePointDownFlag;
0132 edm::ESHandle<MuonDetLayerGeometry> theMuonLayers;
0133 edm::ESHandle<MagneticField> theField;
0134 edm::ESGetToken<MuonDetLayerGeometry, MuonRecoGeometryRecord> muonLayersToken;
0135 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magFieldToken;
0136
0137 std::map<std::string, float> theParameters;
0138
0139 MuonDetLayerMeasurements* muonMeasurements;
0140 };
0141 #endif