CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
MuonServiceProxy Class Reference

#include <MuonServiceProxy.h>

Public Member Functions

edm::ESHandle< MuonDetLayerGeometrydetLayerGeometry () const
 get the detLayer geometry More...
 
const edm::EventSetupeventSetup () const
 get the whole EventSetup More...
 
bool isTrackingComponentsRecordChanged () const
 check if the MuonReco Geometry has been changed More...
 
edm::ESHandle< MagneticFieldmagneticField () const
 get the magnetic field More...
 
const MuonNavigationSchoolmuonNavigationSchool () const
 
 MuonServiceProxy (const edm::ParameterSet &par)
 Constructor. More...
 
edm::ESHandle< Propagatorpropagator (std::string propagatorName) const
 get the propagator More...
 
edm::ESHandle< GlobalTrackingGeometrytrackingGeometry () const
 get the tracking geometry More...
 
void update (const edm::EventSetup &setup)
 update the services each event More...
 
virtual ~MuonServiceProxy ()
 Destructor. More...
 

Private Types

typedef std::map< std::string, edm::ESHandle< Propagator > > propagators
 

Private Attributes

unsigned long long theCacheId_DG
 
unsigned long long theCacheId_GTG
 
unsigned long long theCacheId_MG
 
unsigned long long theCacheId_P
 
bool theChangeInTrackingComponentsRecord
 
bool theCSCLayer
 
edm::ESHandle< MuonDetLayerGeometrytheDetLayerGeometry
 
const edm::EventSetuptheEventSetup
 
bool theGEMLayer
 
bool theME0Layer
 
edm::ESHandle< MagneticFieldtheMGField
 
bool theMuonNavigationFlag
 
propagators thePropagators
 
bool theRPCLayer
 
const MuonNavigationSchooltheSchool
 
edm::ESHandle< GlobalTrackingGeometrytheTrackingGeometry
 

Detailed Description

Class to handle the services needed by the muon reconstruction This class avoid the EventSetup percolation. The update method is called each event in order to update the pointers.

Author
N. Amapane - CERN nicol.nosp@m.a.am.nosp@m.apane.nosp@m.@cer.nosp@m.n.ch
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Modified by C. Calabria Modified by D. Nash

Class to handle the services needed by the muon reconstruction This class avoid the EventSetup percolation. The update method is called each event in order to update the pointers.

Author
N. Amapane - CERN nicol.nosp@m.a.am.nosp@m.apane.nosp@m.@cer.nosp@m.n.ch
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Modified by C. Calabria & A. Sharma Modified by D. Nash

Definition at line 30 of file MuonServiceProxy.h.

Member Typedef Documentation

typedef std::map<std::string, edm::ESHandle<Propagator> > MuonServiceProxy::propagators
private

Definition at line 65 of file MuonServiceProxy.h.

Constructor & Destructor Documentation

MuonServiceProxy::MuonServiceProxy ( const edm::ParameterSet par)

Constructor.

Definition at line 36 of file MuonServiceProxy.cc.

References edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, HLT_2018_cff::propagatorName, theCacheId_DG, theCacheId_GTG, theCacheId_MG, theCacheId_P, theChangeInTrackingComponentsRecord, theCSCLayer, theGEMLayer, theME0Layer, theMuonNavigationFlag, thePropagators, and theRPCLayer.

37  : theTrackingGeometry(nullptr),
38  theMGField(nullptr),
39  theDetLayerGeometry(nullptr),
40  theEventSetup(nullptr),
41  theSchool(nullptr) {
42  // load the propagators map
43  vector<string> noPropagators;
44  vector<string> propagatorNames;
45 
46  theMuonNavigationFlag = par.getUntrackedParameter<bool>("UseMuonNavigation", true);
47 
49  theRPCLayer = par.getParameter<bool>("RPCLayers");
50 
51  if (par.existsAs<bool>("CSCLayers"))
52  theCSCLayer = par.getParameter<bool>("CSCLayers");
53  else
54  theCSCLayer = true;
55 
56  if (par.existsAs<bool>("GEMLayers"))
57  theGEMLayer = par.getParameter<bool>("GEMLayers");
58  else
59  theGEMLayer = false;
60 
61  if (par.existsAs<bool>("ME0Layers"))
62  theME0Layer = par.getParameter<bool>("ME0Layers");
63  else
64  theME0Layer = false;
65 
66  } else {
67  theRPCLayer = true;
68  theCSCLayer = true;
69  theGEMLayer = true;
70  theME0Layer = true;
71  }
72 
73  propagatorNames = par.getUntrackedParameter<vector<string> >("Propagators", noPropagators);
74 
75  if (propagatorNames.empty())
76  LogDebug("Muon|RecoMuon|MuonServiceProxy") << "NO propagator(s) selected!";
77 
78  for (vector<string>::iterator propagatorName = propagatorNames.begin(); propagatorName != propagatorNames.end();
81 
82  theCacheId_GTG = 0;
83  theCacheId_MG = 0;
84  theCacheId_DG = 0;
85  theCacheId_P = 0;
87 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
unsigned long long theCacheId_MG
unsigned long long theCacheId_P
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::ESHandle< MagneticField > theMGField
bool theChangeInTrackingComponentsRecord
unsigned long long theCacheId_DG
const MuonNavigationSchool * theSchool
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
propagators thePropagators
const edm::EventSetup * theEventSetup
unsigned long long theCacheId_GTG
edm::ESHandle< MuonDetLayerGeometry > theDetLayerGeometry
MuonServiceProxy::~MuonServiceProxy ( )
virtual

Destructor.

Definition at line 90 of file MuonServiceProxy.cc.

References thePropagators, and theSchool.

90  {
91  // FIXME: how do that?
92  // delete theTrackingGeometry;
93  // delete theMGField;
94  // delete theDetLayerGeometry;
95 
96  // FIXME: is it enough?
97  thePropagators.clear();
98  if (theSchool)
99  delete theSchool;
100 }
const MuonNavigationSchool * theSchool
propagators thePropagators

Member Function Documentation

edm::ESHandle<MuonDetLayerGeometry> MuonServiceProxy::detLayerGeometry ( ) const
inline

get the detLayer geometry

Definition at line 50 of file MuonServiceProxy.h.

References TrackCandidateProducer_cfi::propagator, HLT_2018_cff::propagatorName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MuonSimHitProducer::produce().

50 { return theDetLayerGeometry; }
edm::ESHandle< MuonDetLayerGeometry > theDetLayerGeometry
const edm::EventSetup& MuonServiceProxy::eventSetup ( ) const
inline
bool MuonServiceProxy::isTrackingComponentsRecordChanged ( ) const
inline

check if the MuonReco Geometry has been changed

Definition at line 59 of file MuonServiceProxy.h.

edm::ESHandle<MagneticField> MuonServiceProxy::magneticField ( ) const
inline
const MuonNavigationSchool* MuonServiceProxy::muonNavigationSchool ( ) const
inline

Definition at line 61 of file MuonServiceProxy.h.

61 { return theSchool; }
const MuonNavigationSchool * theSchool
ESHandle< Propagator > MuonServiceProxy::propagator ( std::string  propagatorName) const

get the propagator

Definition at line 154 of file MuonServiceProxy.cc.

References thePropagators.

Referenced by MuonSimHitProducer::beginRun(), GlobalTrajectoryBuilderBase::getTransientRecHits(), TSGForRoadSearch::makeSeeds_0(), TSGForRoadSearch::makeSeeds_3(), TSGForRoadSearch::makeSeeds_4(), TSGFromPropagation::outerTkState(), TSGFromPropagation::propagator(), FastTSGFromPropagation::propagator(), and TSGForRoadSearch::pushTrajectorySeed().

154  {
155  propagators::const_iterator prop = thePropagators.find(propagatorName);
156 
157  if (prop == thePropagators.end()) {
158  LogError("Muon|RecoMuon|MuonServiceProxy") << "MuonServiceProxy: propagator with name: " << propagatorName
159  << " not found! Please load it in the MuonServiceProxy.cff";
160  return ESHandle<Propagator>(nullptr);
161  }
162 
163  return prop->second;
164 }
propagators thePropagators
edm::ESHandle<GlobalTrackingGeometry> MuonServiceProxy::trackingGeometry ( ) const
inline
void MuonServiceProxy::update ( const edm::EventSetup setup)

update the services each event

Definition at line 105 of file MuonServiceProxy.cc.

References edm::EventSetup::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), LogTrace, metname, singleTopDQM_cfi::setup, AlCaHLTBitMon_QueryRunRegistry::string, theCacheId_DG, theCacheId_GTG, theCacheId_MG, theCacheId_P, theChangeInTrackingComponentsRecord, theCSCLayer, theDetLayerGeometry, theEventSetup, theGEMLayer, theME0Layer, theMGField, theMuonNavigationFlag, thePropagators, theRPCLayer, theSchool, and theTrackingGeometry.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), ResidualRefitting::analyze(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), MuonSimHitProducer::beginRun(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), AlignmentMonitorTracksFromTrajectories::event(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), GlobalCosmicMuonProducer::produce(), GlobalTrackQualityProducer::produce(), HIMuonTrackingRegionProducer::regions(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), MuonSeedCleaner::seedCleaner(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

105  {
106  const std::string metname = "Muon|RecoMuon|MuonServiceProxy";
107 
108  theEventSetup = &setup;
109 
110  // Global Tracking Geometry
111  unsigned long long newCacheId_GTG = setup.get<GlobalTrackingGeometryRecord>().cacheIdentifier();
112  if (newCacheId_GTG != theCacheId_GTG) {
113  LogTrace(metname) << "GlobalTrackingGeometry changed!";
114  theCacheId_GTG = newCacheId_GTG;
116  }
117 
118  // Magfield Field
119  unsigned long long newCacheId_MG = setup.get<IdealMagneticFieldRecord>().cacheIdentifier();
120  if (newCacheId_MG != theCacheId_MG) {
121  LogTrace(metname) << "Magnetic Field changed!";
122  theCacheId_MG = newCacheId_MG;
124  }
125 
126  // DetLayer Geometry
127  unsigned long long newCacheId_DG = setup.get<MuonRecoGeometryRecord>().cacheIdentifier();
128  if (newCacheId_DG != theCacheId_DG) {
129  LogTrace(metname) << "Muon Reco Geometry changed!";
130  theCacheId_DG = newCacheId_DG;
132  // MuonNavigationSchool should live until its validity expires, and then DELETE
133  // the NavigableLayers (this is implemented in MuonNavigationSchool's dtor)
134  if (theMuonNavigationFlag) {
135  if (theSchool)
136  delete theSchool;
138  }
139  }
140 
141  // Propagators
142  unsigned long long newCacheId_P = setup.get<TrackingComponentsRecord>().cacheIdentifier();
143  if (newCacheId_P != theCacheId_P) {
144  LogTrace(metname) << "Tracking Component changed!";
146  theCacheId_P = newCacheId_P;
147  for (propagators::iterator prop = thePropagators.begin(); prop != thePropagators.end(); ++prop)
148  setup.get<TrackingComponentsRecord>().get(prop->first, prop->second);
149  } else
151 }
unsigned long long theCacheId_MG
unsigned long long theCacheId_P
const std::string metname
edm::ESHandle< MagneticField > theMGField
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
bool theChangeInTrackingComponentsRecord
unsigned long long theCacheId_DG
const MuonNavigationSchool * theSchool
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
propagators thePropagators
#define LogTrace(id)
const edm::EventSetup * theEventSetup
unsigned long long theCacheId_GTG
T get() const
Definition: EventSetup.h:73
edm::ESHandle< MuonDetLayerGeometry > theDetLayerGeometry

Member Data Documentation

unsigned long long MuonServiceProxy::theCacheId_DG
private

Definition at line 82 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

unsigned long long MuonServiceProxy::theCacheId_GTG
private

Definition at line 80 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

unsigned long long MuonServiceProxy::theCacheId_MG
private

Definition at line 81 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

unsigned long long MuonServiceProxy::theCacheId_P
private

Definition at line 83 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

bool MuonServiceProxy::theChangeInTrackingComponentsRecord
private

Definition at line 85 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

bool MuonServiceProxy::theCSCLayer
private

Definition at line 73 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

edm::ESHandle<MuonDetLayerGeometry> MuonServiceProxy::theDetLayerGeometry
private

Definition at line 69 of file MuonServiceProxy.h.

Referenced by update().

const edm::EventSetup* MuonServiceProxy::theEventSetup
private

Definition at line 70 of file MuonServiceProxy.h.

Referenced by update().

bool MuonServiceProxy::theGEMLayer
private

Definition at line 74 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

bool MuonServiceProxy::theME0Layer
private

Definition at line 75 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

edm::ESHandle<MagneticField> MuonServiceProxy::theMGField
private

Definition at line 68 of file MuonServiceProxy.h.

Referenced by update().

bool MuonServiceProxy::theMuonNavigationFlag
private

Definition at line 71 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

propagators MuonServiceProxy::thePropagators
private

Definition at line 78 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), propagator(), update(), and ~MuonServiceProxy().

bool MuonServiceProxy::theRPCLayer
private

Definition at line 72 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy(), and update().

const MuonNavigationSchool* MuonServiceProxy::theSchool
private

Definition at line 76 of file MuonServiceProxy.h.

Referenced by update(), and ~MuonServiceProxy().

edm::ESHandle<GlobalTrackingGeometry> MuonServiceProxy::theTrackingGeometry
private