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