File indexing completed on 2024-04-06 12:27:17
0001 #ifndef RecoMuon_TrackingTools_MuonServiceProxy_H
0002 #define RecoMuon_TrackingTools_MuonServiceProxy_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "FWCore/Framework/interface/ESHandle.h"
0018 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0019 #include "FWCore/Utilities/interface/ESGetToken.h"
0020
0021
0022 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0023 #include "MagneticField/Engine/interface/MagneticField.h"
0024 #include "RecoMuon/DetLayers/interface/MuonDetLayerGeometry.h"
0025 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0026
0027
0028 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0029 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0030 #include "RecoMuon/Records/interface/MuonRecoGeometryRecord.h"
0031 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0032
0033 #include "RecoMuon/Navigation/interface/MuonNavigationSchool.h"
0034
0035 #include <map>
0036 #include <string>
0037
0038 class MuonServiceProxy {
0039 public:
0040 enum class UseEventSetupIn { Run, Event, RunAndEvent };
0041
0042
0043 MuonServiceProxy(const edm::ParameterSet&,
0044 edm::ConsumesCollector&&,
0045 UseEventSetupIn useEventSetupIn = UseEventSetupIn::Event);
0046
0047
0048 virtual ~MuonServiceProxy();
0049
0050
0051
0052
0053 void update(const edm::EventSetup& setup, bool duringEvent = true);
0054
0055
0056 edm::ESHandle<MagneticField> magneticField() const { return theMGField; }
0057
0058
0059 edm::ESHandle<GlobalTrackingGeometry> trackingGeometry() const { return theTrackingGeometry; }
0060
0061
0062 edm::ESHandle<MuonDetLayerGeometry> detLayerGeometry() const { return theDetLayerGeometry; }
0063
0064
0065 edm::ESHandle<Propagator> propagator(std::string propagatorName) const;
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 const edm::EventSetup& eventSetup() const { return *theEventSetup; }
0077
0078
0079 bool isTrackingComponentsRecordChanged() const { return theChangeInTrackingComponentsRecord; }
0080
0081 const MuonNavigationSchool* muonNavigationSchool() const { return theSchool; }
0082
0083 private:
0084 class PropagatorInfo {
0085 public:
0086 edm::ESHandle<Propagator> esHandle_;
0087 edm::ESGetToken<Propagator, TrackingComponentsRecord> eventToken_;
0088 edm::ESGetToken<Propagator, TrackingComponentsRecord> runToken_;
0089 };
0090
0091 using PropagatorMap = std::map<std::string, PropagatorInfo>;
0092
0093 edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
0094 edm::ESHandle<MagneticField> theMGField;
0095 edm::ESHandle<MuonDetLayerGeometry> theDetLayerGeometry;
0096
0097 edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> globalTrackingGeometryEventToken_;
0098 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldEventToken_;
0099 edm::ESGetToken<MuonDetLayerGeometry, MuonRecoGeometryRecord> muonDetLayerGeometryEventToken_;
0100
0101 edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> globalTrackingGeometryRunToken_;
0102 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldRunToken_;
0103 edm::ESGetToken<MuonDetLayerGeometry, MuonRecoGeometryRecord> muonDetLayerGeometryRunToken_;
0104
0105 const edm::EventSetup* theEventSetup;
0106 bool theMuonNavigationFlag;
0107 bool theRPCLayer;
0108 bool theCSCLayer;
0109 bool theGEMLayer;
0110 bool theME0Layer;
0111 const MuonNavigationSchool* theSchool;
0112
0113 PropagatorMap thePropagators;
0114
0115 unsigned long long theCacheId_GTG;
0116 unsigned long long theCacheId_MG;
0117 unsigned long long theCacheId_DG;
0118 unsigned long long theCacheId_P;
0119
0120 bool theChangeInTrackingComponentsRecord;
0121 };
0122 #endif