Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:08

0001 #include "Fireworks/Core/interface/FWBeamSpot.h"
0002 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0003 #include "FWCore/Common/interface/EventBase.h"
0004 #include "Fireworks/Core/interface/fwLog.h"
0005 
0006 void FWBeamSpot::checkBeamSpot(const edm::EventBase* event) {
0007   try {
0008     edm::InputTag tag("offlineBeamSpot");
0009     edm::Handle<reco::BeamSpot> spot;
0010 
0011     event->getByLabel(tag, spot);
0012     if (spot.isValid()) {
0013       m_beamspot = spot.product();
0014     } else {
0015       m_beamspot = nullptr;
0016     }
0017   } catch (cms::Exception& iException) {
0018     fwLog(fwlog::kWarning) << "Can't get beam spot info. Setting coordintes to (0, 0, 0).\n";
0019     m_beamspot = nullptr;
0020   }
0021 }
0022 
0023 double FWBeamSpot::x0() const { return m_beamspot ? m_beamspot->x0() : 0.0; }
0024 
0025 double FWBeamSpot::y0() const { return m_beamspot ? m_beamspot->y0() : 0.0; }
0026 
0027 double FWBeamSpot::z0() const { return m_beamspot ? m_beamspot->z0() : 0.0; }
0028 
0029 double FWBeamSpot::x0Error() const { return m_beamspot ? m_beamspot->x0Error() : 0.0; }
0030 
0031 double FWBeamSpot::y0Error() const { return m_beamspot ? m_beamspot->y0Error() : 0.0; }
0032 
0033 double FWBeamSpot::z0Error() const { return m_beamspot ? m_beamspot->z0Error() : 0.0; }