Skip to content

Commit

Permalink
add a method to copy parameters from BeamSpotObjects into BeamSpotOnl…
Browse files Browse the repository at this point in the history
…ineObjects
  • Loading branch information
mmusich committed May 15, 2023
1 parent 9aeabd1 commit f933305
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -164,4 +167,4 @@ class BeamSpotOnlineObjects : public BeamSpotObjects {

std::ostream& operator<<(std::ostream&, BeamSpotOnlineObjects beam);

#endif
#endif
23 changes: 22 additions & 1 deletion CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -173,4 +194,4 @@ std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) {
beam.print(ss);
os << ss.str();
return os;
}
}

0 comments on commit f933305

Please sign in to comment.