diff --git a/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h b/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h index 3a6f171a4ddc1..91765287a5377 100644 --- a/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h +++ b/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h @@ -44,6 +44,9 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { enum TimeParamIndex { CREATE_TIME = 0, START_TIMESTAMP = 1, END_TIMESTAMP = 2, TSIZE = 3 }; /// Setters Methods + // copy all copiable members from BeamSpotObjects + void copyFromBeamSpotObject(const BeamSpotObjects& bs); + // set lastAnalyzedLumi_, last analyzed lumisection void setLastAnalyzedLumi(int val) { lastAnalyzedLumi_ = val; } @@ -164,4 +167,4 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { std::ostream& operator<<(std::ostream&, BeamSpotOnlineObjects beam); -#endif \ No newline at end of file +#endif diff --git a/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc b/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc index dfee339cae9e8..9517de935d274 100644 --- a/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc +++ b/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc @@ -92,6 +92,27 @@ cond::Time_t BeamSpotOnlineObjects::endTimeStamp() const { } // setters +void BeamSpotOnlineObjects::copyFromBeamSpotObject(const BeamSpotObjects& bs) { + setType(bs.beamType()); + setPosition(bs.x(), bs.y(), bs.z()); + setSigmaZ(bs.sigmaZ()); + setdxdz(bs.dxdz()); + setdydz(bs.dydz()); + setBeamWidthX(bs.beamWidthX()); + setBeamWidthY(bs.beamWidthY()); + setBeamWidthXError(bs.beamWidthXError()); + setBeamWidthYError(bs.beamWidthYError()); + setEmittanceX(bs.emittanceX()); + setEmittanceY(bs.emittanceY()); + setBetaStar(bs.betaStar()); + + for (int i = 0; i < 7; ++i) { + for (int j = 0; j < 7; ++j) { + setCovariance(i, j, bs.covariance(i, j)); + } + } +} + void BeamSpotOnlineObjects::setNumTracks(int nTracks) { BeamSpotOnlineObjectsImpl::setOneParam(intParams_, NUM_TRACKS, nTracks); } @@ -173,4 +194,4 @@ std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) { beam.print(ss); os << ss.str(); return os; -} \ No newline at end of file +}