CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
MuonServiceProxy Class Reference

#include <MuonServiceProxy.h>

Public Member Functions

edm::ESHandle
< MuonDetLayerGeometry
detLayerGeometry () 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
< GlobalTrackingGeometry
trackingGeometry () 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
< MuonDetLayerGeometry
theDetLayerGeometry
 
const edm::EventSetuptheEventSetup
 
bool theGEMLayer
 
bool theME0Layer
 
edm::ESHandle< MagneticFieldtheMGField
 
bool theMuonNavigationFlag
 
propagators thePropagators
 
bool theRPCLayer
 
const MuonNavigationSchooltheSchool
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 

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 27 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 37 of file MuonServiceProxy.cc.

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

38 
39  // load the propagators map
40  vector<string> noPropagators;
41  vector<string> propagatorNames;
42 
43  theMuonNavigationFlag = par.getUntrackedParameter<bool>("UseMuonNavigation",true);
44 
46  theRPCLayer = par.getParameter<bool>("RPCLayers");
47 
48  if( par.existsAs<bool>("CSCLayers"))
49  theCSCLayer = par.getParameter< bool >("CSCLayers");
50  else theCSCLayer = true ;
51 
52  if( par.existsAs<bool>("GEMLayers"))
53  theGEMLayer = par.getParameter< bool >("GEMLayers");
54  else theGEMLayer = false ;
55 
56  if( par.existsAs<bool>("ME0Layers"))
57  theME0Layer = par.getParameter< bool >("ME0Layers");
58  else theME0Layer = false ;
59 
60  }
61  else {
62  theRPCLayer = true;
63  theCSCLayer = true;
64  theGEMLayer = true;
65  theME0Layer = true;
66  }
67 
68  propagatorNames = par.getUntrackedParameter<vector<string> >("Propagators", noPropagators);
69 
70  if(propagatorNames.empty())
71  LogDebug("Muon|RecoMuon|MuonServiceProxy") << "NO propagator(s) selected!";
72 
73  for(vector<string>::iterator propagatorName = propagatorNames.begin();
74  propagatorName != propagatorNames.end(); ++propagatorName)
75  thePropagators[ *propagatorName ] = ESHandle<Propagator>(0);
76 
77  theCacheId_GTG = 0;
78  theCacheId_MG = 0;
79  theCacheId_DG = 0;
80  theCacheId_P = 0;
82 
83 }
#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:186
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
volatile std::atomic< bool > shutdown_flag false
edm::ESHandle< MuonDetLayerGeometry > theDetLayerGeometry
MuonServiceProxy::~MuonServiceProxy ( )
virtual

Destructor.

Definition at line 87 of file MuonServiceProxy.cc.

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

Member Function Documentation

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

get the detLayer geometry

Definition at line 47 of file MuonServiceProxy.h.

References theDetLayerGeometry.

Referenced by MuonSimHitProducer::produce().

47 {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 56 of file MuonServiceProxy.h.

References theChangeInTrackingComponentsRecord.

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

Definition at line 58 of file MuonServiceProxy.h.

References theSchool.

58  {
59  return theSchool;
60  }
const MuonNavigationSchool * theSchool
ESHandle< Propagator > MuonServiceProxy::propagator ( std::string  propagatorName) const
edm::ESHandle<GlobalTrackingGeometry> MuonServiceProxy::trackingGeometry ( ) const
inline
void MuonServiceProxy::update ( const edm::EventSetup setup)

update the services each event

Definition at line 102 of file MuonServiceProxy.cc.

References edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), LogTrace, metname, GeneralSetup::setup(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), ResidualRefitting::analyze(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), TSGFromL2Muon::beginRun(), 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(), TSGFromL2Muon::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().

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

unsigned long long MuonServiceProxy::theCacheId_GTG
private

Definition at line 80 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

unsigned long long MuonServiceProxy::theCacheId_MG
private

Definition at line 81 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

unsigned long long MuonServiceProxy::theCacheId_P
private

Definition at line 83 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

bool MuonServiceProxy::theChangeInTrackingComponentsRecord
private

Definition at line 85 of file MuonServiceProxy.h.

Referenced by isTrackingComponentsRecordChanged(), and MuonServiceProxy().

bool MuonServiceProxy::theCSCLayer
private

Definition at line 73 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

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

Definition at line 69 of file MuonServiceProxy.h.

Referenced by detLayerGeometry().

const edm::EventSetup* MuonServiceProxy::theEventSetup
private

Definition at line 70 of file MuonServiceProxy.h.

Referenced by eventSetup().

bool MuonServiceProxy::theGEMLayer
private

Definition at line 74 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

bool MuonServiceProxy::theME0Layer
private

Definition at line 75 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

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

Definition at line 68 of file MuonServiceProxy.h.

Referenced by magneticField().

bool MuonServiceProxy::theMuonNavigationFlag
private

Definition at line 71 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

propagators MuonServiceProxy::thePropagators
private

Definition at line 78 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

bool MuonServiceProxy::theRPCLayer
private

Definition at line 72 of file MuonServiceProxy.h.

Referenced by MuonServiceProxy().

const MuonNavigationSchool* MuonServiceProxy::theSchool
private

Definition at line 76 of file MuonServiceProxy.h.

Referenced by muonNavigationSchool().

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