CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
BeamSpotOnlineShifter Class Reference

#include <CondTools/BeamSpot/plugins/BeamSpotOnlineShifter.cc>

Inheritance diagram for BeamSpotOnlineShifter:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 BeamSpotOnlineShifter (const edm::ParameterSet &)
 
cond::Time_t pack (uint32_t, uint32_t)
 
template<class Record >
void writeToDB (const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::ESGetToken< BeamSpotOnlineObjects, Record > &token)
 
 ~BeamSpotOnlineShifter () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
const GlobalPoint deltaAlignments (const Alignments *target, const Alignments *reference, const TrackerTopology &tTopo, const bool isFullPixel=false)
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
const GlobalPoint getPixelBarycenter (const AlignmentPI::TkAlBarycenters barycenters, const bool isFullPixel)
 

Private Attributes

edm::ESWatcher< BeamSpotOnlineHLTObjectsRcdbsHLTWatcher_
 
edm::ESWatcher< BeamSpotOnlineLegacyObjectsRcdbsLegayWatcher_
 
uint32_t fIOVStartLumi_
 
uint32_t fIOVStartRun_
 
const bool fIsHLT_
 
std::string fLabel_
 
cond::Time_t fnewSince_
 
const bool fullPixel_
 
bool fuseNewSince_
 
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcdhltToken_
 
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcdlegacyToken_
 
const edm::ESGetToken< Alignments, TrackerAlignmentRcdrefAliTokenBR_
 
const edm::ESGetToken< Alignments, TrackerAlignmentRcdtarAliTokenBR_
 
GlobalPoint theShift_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopoTokenBR_
 
const double xShift_
 
const double yShift_
 
const double zShift_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: EDAnalyzer to create a BeamSpotOnlineHLTObjectsRcd from a BeamSpotObjectsRcd (inserting some parameters manually)

Implementation: [Notes on implementation]

Definition at line 54 of file BeamSpotOnlineShifter.cc.

Constructor & Destructor Documentation

◆ BeamSpotOnlineShifter()

BeamSpotOnlineShifter::BeamSpotOnlineShifter ( const edm::ParameterSet iConfig)
explicit

Definition at line 106 of file BeamSpotOnlineShifter.cc.

References edm::EDConsumerBase::esConsumes(), edm::ParameterSet::exists(), fIOVStartLumi_, fIOVStartRun_, fIsHLT_, fLabel_, fnewSince_, fuseNewSince_, edm::ParameterSet::getUntrackedParameter(), hltToken_, legacyToken_, and pack().

107  : theShift_(GlobalPoint()),
108  fIsHLT_(iConfig.getParameter<bool>("isHLT")),
109  fullPixel_(iConfig.getParameter<bool>("useFullPixel")),
110  trackerTopoTokenBR_(esConsumes<edm::Transition::BeginRun>()),
111  refAliTokenBR_(esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "reference"))),
112  tarAliTokenBR_(esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "target"))),
113  xShift_(iConfig.getParameter<double>("xShift")),
114  yShift_(iConfig.getParameter<double>("yShift")),
115  zShift_(iConfig.getParameter<double>("zShift")) {
116  if (iConfig.exists("IOVStartRun") && iConfig.exists("IOVStartLumi")) {
117  fIOVStartRun_ = iConfig.getUntrackedParameter<uint32_t>("IOVStartRun");
118  fIOVStartLumi_ = iConfig.getUntrackedParameter<uint32_t>("IOVStartLumi");
120  fuseNewSince_ = true;
121  edm::LogPrint("BeamSpotOnlineShifter") << "useNewSince = True";
122  } else {
123  fuseNewSince_ = false;
124  edm::LogPrint("BeamSpotOnlineShifter") << "useNewSince = False";
125  }
126  fLabel_ = (fIsHLT_) ? "BeamSpotOnlineHLTObjectsRcd" : "BeamSpotOnlineLegacyObjectsRcd";
127 
128  if (fIsHLT_) {
129  hltToken_ = esConsumes();
130  } else {
132  }
133 }
cond::Time_t pack(uint32_t, uint32_t)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > refAliTokenBR_
bool exists(std::string const &parameterName) const
checks if a parameter exists
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoTokenBR_
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > hltToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > tarAliTokenBR_
Log< level::Warning, true > LogPrint
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > legacyToken_

◆ ~BeamSpotOnlineShifter()

BeamSpotOnlineShifter::~BeamSpotOnlineShifter ( )
overridedefault

Member Function Documentation

◆ analyze()

void BeamSpotOnlineShifter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 286 of file BeamSpotOnlineShifter.cc.

References bsHLTWatcher_, bsLegayWatcher_, edm::ESWatcher< T >::check(), fIsHLT_, hltToken_, iEvent, and legacyToken_.

286  {
287  using namespace edm;
288  if (fIsHLT_) {
289  if (bsHLTWatcher_.check(iSetup)) {
290  writeToDB<BeamSpotOnlineHLTObjectsRcd>(iEvent, iSetup, hltToken_);
291  }
292  } else {
293  if (bsLegayWatcher_.check(iSetup)) {
294  writeToDB<BeamSpotOnlineLegacyObjectsRcd>(iEvent, iSetup, legacyToken_);
295  }
296  }
297 }
edm::ESWatcher< BeamSpotOnlineLegacyObjectsRcd > bsLegayWatcher_
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > hltToken_
int iEvent
Definition: GenABIO.cc:224
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > legacyToken_
edm::ESWatcher< BeamSpotOnlineHLTObjectsRcd > bsHLTWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
HLT enums.

◆ beginRun()

void BeamSpotOnlineShifter::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 271 of file BeamSpotOnlineShifter.cc.

References deltaAlignments(), fullPixel_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), refAliTokenBR_, RecoTauValidation_cfi::reference, tarAliTokenBR_, filterCSVwithJSON::target, theShift_, trackerTopoTokenBR_, xShift_, yShift_, and zShift_.

271  {
272  const auto& reference = iSetup.getHandle(refAliTokenBR_);
273  const auto& target = iSetup.getHandle(tarAliTokenBR_);
274 
275  const TrackerTopology& tTopo = iSetup.getData(trackerTopoTokenBR_);
276 
277  if (reference.isValid() and target.isValid()) {
278  theShift_ = this->deltaAlignments(&(*reference), &(*target), tTopo, fullPixel_);
279  } else {
281  }
282  edm::LogPrint("BeamSpotOnlineShifter") << "[BeamSpotOnlineShifter] applied shift: " << theShift_ << std::endl;
283 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > refAliTokenBR_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoTokenBR_
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > tarAliTokenBR_
Log< level::Warning, true > LogPrint
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const GlobalPoint deltaAlignments(const Alignments *target, const Alignments *reference, const TrackerTopology &tTopo, const bool isFullPixel=false)

◆ deltaAlignments()

const GlobalPoint BeamSpotOnlineShifter::deltaAlignments ( const Alignments target,
const Alignments reference,
const TrackerTopology tTopo,
const bool  isFullPixel = false 
)
private

Definition at line 227 of file BeamSpotOnlineShifter.cc.

References AlignmentPI::TkAlBarycenters::computeBarycenters(), getPixelBarycenter(), RecoTauValidation_cfi::reference, AlignmentPI::t_x, AlignmentPI::t_y, AlignmentPI::t_z, and filterCSVwithJSON::target.

Referenced by beginRun().

230  {
231  const std::map<AlignmentPI::coordinate, float> theZero = {
232  {AlignmentPI::t_x, 0.0}, {AlignmentPI::t_y, 0.0}, {AlignmentPI::t_z, 0.0}};
233 
234  AlignmentPI::TkAlBarycenters ref_barycenters;
235  ref_barycenters.computeBarycenters(reference->m_align, tTopo, theZero);
236  const auto& ref = this->getPixelBarycenter(ref_barycenters, isFullPixel);
237 
238  AlignmentPI::TkAlBarycenters tar_barycenters;
239  tar_barycenters.computeBarycenters(target->m_align, tTopo, theZero);
240  const auto& tar = this->getPixelBarycenter(tar_barycenters, isFullPixel);
241 
242  return GlobalPoint(tar.x() - ref.x(), tar.y() - ref.y(), tar.z() - ref.z());
243 }
void computeBarycenters(const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< AlignmentPI::coordinate, float > &GPR)
const GlobalPoint getPixelBarycenter(const AlignmentPI::TkAlBarycenters barycenters, const bool isFullPixel)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10

◆ endRun()

void BeamSpotOnlineShifter::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverrideprivate

Definition at line 74 of file BeamSpotOnlineShifter.cc.

74 {};

◆ fillDescriptions()

void BeamSpotOnlineShifter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 300 of file BeamSpotOnlineShifter.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), and submitPVResolutionJobs::desc.

300  {
302  desc.add<bool>("isHLT", true);
303  desc.add<bool>("useFullPixel", false)->setComment("use the full pixel detector to compute the barycenter");
304  desc.add<double>("xShift", 0.0)->setComment("in cm");
305  desc.add<double>("yShift", 0.0)->setComment("in cm");
306  desc.add<double>("zShift", 0.0)->setComment("in cm");
307  desc.addOptionalUntracked<uint32_t>("IOVStartRun", 1);
308  desc.addOptionalUntracked<uint32_t>("IOVStartLumi", 1);
309  descriptions.addWithDefaultLabel(desc);
310 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ getPixelBarycenter()

const GlobalPoint BeamSpotOnlineShifter::getPixelBarycenter ( const AlignmentPI::TkAlBarycenters  barycenters,
const bool  isFullPixel 
)
private

Definition at line 246 of file BeamSpotOnlineShifter.cc.

References AlignmentPI::BPix, AlignmentPI::BPIX, AlignmentPI::FPIXm, AlignmentPI::FPIXp, AlignmentPI::TkAlBarycenters::getNModules(), and AlignmentPI::TkAlBarycenters::getPartitionAvg().

Referenced by deltaAlignments().

247  {
248  const auto& BPix = barycenters.getPartitionAvg(AlignmentPI::PARTITION::BPIX);
249  const double BPixMods = barycenters.getNModules(AlignmentPI::PARTITION::BPIX);
250 
251  const auto& FPixM = barycenters.getPartitionAvg(AlignmentPI::PARTITION::FPIXm);
252  const double FPixMMods = barycenters.getNModules(AlignmentPI::PARTITION::FPIXm);
253 
254  const auto& FPixP = barycenters.getPartitionAvg(AlignmentPI::PARTITION::FPIXp);
255  const double FPixPMods = barycenters.getNModules(AlignmentPI::PARTITION::FPIXp);
256 
257  const double BPixFrac = BPixMods / (BPixMods + FPixMMods + FPixPMods);
258  const double FPixMFrac = FPixMMods / (BPixMods + FPixMMods + FPixPMods);
259  const double FPixPFrac = FPixPMods / (BPixMods + FPixMMods + FPixPMods);
260 
261  if (isFullPixel) {
262  return GlobalPoint(BPixFrac * BPix.x() + FPixMFrac * FPixM.x() + FPixPFrac * FPixP.x(),
263  BPixFrac * BPix.y() + FPixMFrac * FPixM.y() + FPixPFrac * FPixP.y(),
264  BPixFrac * BPix.z() + FPixMFrac * FPixM.z() + FPixPFrac * FPixP.z());
265  } else {
266  return GlobalPoint(BPix.x(), BPix.y(), BPix.z());
267  }
268 }
const double getNModules(AlignmentPI::PARTITION p)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPartitionAvg(AlignmentPI::PARTITION p)

◆ pack()

cond::Time_t BeamSpotOnlineShifter::pack ( uint32_t  fIOVStartRun,
uint32_t  fIOVStartLumi 
)

Definition at line 140 of file BeamSpotOnlineShifter.cc.

Referenced by BeamSpotOnlineShifter(), and writeToDB().

140  {
141  return ((uint64_t)fIOVStartRun << 32 | fIOVStartLumi);
142 }
unsigned long long uint64_t
Definition: Time.h:13

◆ writeToDB()

template<class Record >
void BeamSpotOnlineShifter::writeToDB ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::ESGetToken< BeamSpotOnlineObjects, Record > &  token 
)

Definition at line 145 of file BeamSpotOnlineShifter.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), BeamSpotObjects::beamType(), BeamSpotObjects::beamWidthX(), BeamSpotObjects::beamWidthXError(), BeamSpotObjects::beamWidthY(), BeamSpotObjects::beamWidthYError(), cond::service::PoolDBOutputService::beginOfTime(), BeamSpotObjects::betaStar(), BeamSpotObjects::covariance(), cond::service::PoolDBOutputService::createOneIOV(), BeamSpotOnlineObjects::creationTime(), cond::service::PoolDBOutputService::currentTime(), BeamSpotObjects::dxdz(), BeamSpotObjects::dydz(), BeamSpotObjects::emittanceX(), BeamSpotObjects::emittanceY(), BeamSpotOnlineObjects::endTime(), BeamSpotOnlineObjects::endTimeStamp(), fLabel_, fnewSince_, fuseNewSince_, edm::EventSetup::getData(), mps_fire::i, iEvent, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), dqmiolumiharvest::j, BeamSpotOnlineObjects::lastAnalyzedFill(), BeamSpotOnlineObjects::lastAnalyzedLumi(), BeamSpotOnlineObjects::lastAnalyzedRun(), BeamSpotOnlineObjects::lumiRange(), BeamSpotOnlineObjects::maxPVs(), BeamSpotOnlineObjects::meanErrorPV(), BeamSpotOnlineObjects::meanPV(), BeamSpotOnlineObjects::numPVs(), BeamSpotOnlineObjects::numTracks(), pack(), BeamSpotOnlineObjects::rmsErrorPV(), BeamSpotOnlineObjects::rmsPV(), BeamSpotObjects::setBeamWidthX(), BeamSpotObjects::setBeamWidthXError(), BeamSpotObjects::setBeamWidthY(), BeamSpotObjects::setBeamWidthYError(), BeamSpotObjects::setBetaStar(), BeamSpotObjects::setCovariance(), BeamSpotOnlineObjects::setCreationTime(), BeamSpotObjects::setdxdz(), BeamSpotObjects::setdydz(), BeamSpotObjects::setEmittanceX(), BeamSpotObjects::setEmittanceY(), BeamSpotOnlineObjects::setEndTime(), BeamSpotOnlineObjects::setEndTimeStamp(), BeamSpotOnlineObjects::setLastAnalyzedFill(), BeamSpotOnlineObjects::setLastAnalyzedLumi(), BeamSpotOnlineObjects::setLastAnalyzedRun(), BeamSpotOnlineObjects::setLumiRange(), BeamSpotOnlineObjects::setMaxPVs(), BeamSpotOnlineObjects::setMeanErrorPV(), BeamSpotOnlineObjects::setMeanPV(), BeamSpotOnlineObjects::setNumPVs(), BeamSpotOnlineObjects::setNumTracks(), BeamSpotObjects::setPosition(), BeamSpotOnlineObjects::setRmsErrorPV(), BeamSpotOnlineObjects::setRmsPV(), BeamSpotObjects::setSigmaZ(), BeamSpotOnlineObjects::setStartTime(), BeamSpotOnlineObjects::setStartTimeStamp(), BeamSpotObjects::setType(), BeamSpotOnlineObjects::setUsedEvents(), BeamSpotObjects::sigmaZ(), BeamSpotOnlineObjects::startTime(), BeamSpotOnlineObjects::startTimeStamp(), theShift_, unpackBuffers-CaloStage2::token, BeamSpotOnlineObjects::usedEvents(), PV3DBase< T, PVType, FrameType >::x(), BeamSpotObjects::x(), PV3DBase< T, PVType, FrameType >::y(), BeamSpotObjects::y(), PV3DBase< T, PVType, FrameType >::z(), and BeamSpotObjects::z().

147  {
148  // input object
149  const BeamSpotOnlineObjects* inputSpot = &iSetup.getData(token);
150 
151  // output object
152  BeamSpotOnlineObjects abeam;
153 
154  // N.B.: theShift is the difference between the target and the reference geometry barycenters
155  // so if effectively the displacement of the new origin of reference frame w.r.t the old one.
156  // This has to be subtracted from the old position of the beamspot:
157  // - if the new reference frame rises, the beamspot drops
158  // - if the new reference frame drops, the beamspot rises
159 
160  abeam.setPosition(inputSpot->x() - theShift_.x(), inputSpot->y() - theShift_.y(), inputSpot->z() - theShift_.z());
161  abeam.setSigmaZ(inputSpot->sigmaZ());
162  abeam.setdxdz(inputSpot->dxdz());
163  abeam.setdydz(inputSpot->dydz());
164  abeam.setBeamWidthX(inputSpot->beamWidthX());
165  abeam.setBeamWidthY(inputSpot->beamWidthY());
166  abeam.setBeamWidthXError(inputSpot->beamWidthXError());
167  abeam.setBeamWidthYError(inputSpot->beamWidthYError());
168 
169  for (unsigned int i = 0; i < 7; i++) {
170  for (unsigned int j = 0; j < 7; j++) {
171  abeam.setCovariance(i, j, inputSpot->covariance(i, j));
172  }
173  }
174 
175  abeam.setType(inputSpot->beamType());
176  abeam.setEmittanceX(inputSpot->emittanceX());
177  abeam.setEmittanceY(inputSpot->emittanceY());
178  abeam.setBetaStar(inputSpot->betaStar());
179 
180  // online BeamSpot object specific
181  abeam.setLastAnalyzedLumi(inputSpot->lastAnalyzedLumi());
182  abeam.setLastAnalyzedRun(inputSpot->lastAnalyzedRun());
183  abeam.setLastAnalyzedFill(inputSpot->lastAnalyzedFill());
184  abeam.setStartTimeStamp(inputSpot->startTimeStamp());
185  abeam.setEndTimeStamp(inputSpot->endTimeStamp());
186  abeam.setNumTracks(inputSpot->numTracks());
187  abeam.setNumPVs(inputSpot->numPVs());
188  abeam.setUsedEvents(inputSpot->usedEvents());
189  abeam.setMaxPVs(inputSpot->maxPVs());
190  abeam.setMeanPV(inputSpot->meanPV());
191  abeam.setMeanErrorPV(inputSpot->meanErrorPV());
192  abeam.setRmsPV(inputSpot->rmsPV());
193  abeam.setRmsErrorPV(inputSpot->rmsErrorPV());
194  abeam.setStartTime(inputSpot->startTime());
195  abeam.setEndTime(inputSpot->endTime());
196  abeam.setLumiRange(inputSpot->lumiRange());
197  abeam.setCreationTime(inputSpot->creationTime());
198 
199  edm::LogPrint("BeamSpotOnlineShifter") << " Writing results to DB...";
200  edm::LogPrint("BeamSpotOnlineShifter") << abeam;
201 
203  if (poolDbService.isAvailable()) {
204  edm::LogPrint("BeamSpotOnlineShifter") << "poolDBService available";
205  if (poolDbService->isNewTagRequest(fLabel_)) {
206  edm::LogPrint("BeamSpotOnlineShifter") << "new tag requested";
207  if (fuseNewSince_) {
208  edm::LogPrint("BeamSpotOnlineShifter") << "Using a new Since: " << fnewSince_;
209  poolDbService->createOneIOV<BeamSpotOnlineObjects>(abeam, fnewSince_, fLabel_);
210  } else
211  poolDbService->createOneIOV<BeamSpotOnlineObjects>(abeam, poolDbService->beginOfTime(), fLabel_);
212  } else {
213  edm::LogPrint("BeamSpotOnlineShifter") << "no new tag requested";
214  if (fuseNewSince_) {
215  cond::Time_t thisSince = BeamSpotOnlineShifter::pack(iEvent.getLuminosityBlock().run(),
216  iEvent.getLuminosityBlock().luminosityBlock());
217  edm::LogPrint("BeamSpotOnlineShifter") << "Using a new Since: " << thisSince;
218  poolDbService->appendOneIOV<BeamSpotOnlineObjects>(abeam, thisSince, fLabel_);
219  } else
220  poolDbService->appendOneIOV<BeamSpotOnlineObjects>(abeam, poolDbService->currentTime(), fLabel_);
221  }
222  }
223  edm::LogPrint("BeamSpotOnlineShifter") << "[BeamSpotOnlineShifter] analyze done \n";
224 }
double emittanceX() const
get emittance
void setBeamWidthYError(double val)
set beam width Y error
int lastAnalyzedLumi() const
Getters Methods.
cond::Time_t pack(uint32_t, uint32_t)
cond::Time_t creationTime() const
void setCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
double z() const
get Z beam position
void setStartTimeStamp(cond::Time_t val)
double dydz() const
get dydz slope, crossing angle in YZ
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void setEmittanceY(double val)
set emittance
double covariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
T z() const
Definition: PV3DBase.h:61
void setBetaStar(double val)
set beta star
std::string endTime() const
void setEndTimeStamp(cond::Time_t val)
double beamWidthX() const
get average transverse beam width
std::string lumiRange() const
std::string startTime() const
int beamType() const
get beam type
void setType(int type)
set beam type
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void setEndTime(std::string val)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
void setEmittanceX(double val)
set emittance
int iEvent
Definition: GenABIO.cc:224
double beamWidthYError() const
get average transverse beam width error X = Y
unsigned long long Time_t
Definition: Time.h:14
bool isNewTagRequest(const std::string &recordName)
void setdydz(double val)
set dydz slope, crossing angle in XZ
cond::Time_t endTimeStamp() const
double x() const
get X beam position
Log< level::Warning, true > LogPrint
void setdxdz(double val)
set dxdz slope, crossing angle
double beamWidthY() const
get average transverse beam width
double y() const
get Y beam position
cond::Time_t startTimeStamp() const
void setBeamWidthXError(double val)
set beam width X error
void setSigmaZ(double val)
set sigma Z, RMS bunch length
void setLumiRange(std::string val)
double sigmaZ() const
get sigma Z, RMS bunch length
double emittanceY() const
get emittance
double betaStar() const
get beta star
double beamWidthXError() const
get average transverse beam width error ASSUME the same for X and Y
void setStartTime(std::string val)
void setPosition(double x, double y, double z)
set XYZ position
void setBeamWidthX(double val)
set average transverse beam width X
void setCreationTime(cond::Time_t val)
bool isAvailable() const
Definition: Service.h:40
double dxdz() const
get dxdz slope, crossing angle in XZ
void setBeamWidthY(double val)
set average transverse beam width Y

Member Data Documentation

◆ bsHLTWatcher_

edm::ESWatcher<BeamSpotOnlineHLTObjectsRcd> BeamSpotOnlineShifter::bsHLTWatcher_
private

Definition at line 83 of file BeamSpotOnlineShifter.cc.

Referenced by analyze().

◆ bsLegayWatcher_

edm::ESWatcher<BeamSpotOnlineLegacyObjectsRcd> BeamSpotOnlineShifter::bsLegayWatcher_
private

Definition at line 84 of file BeamSpotOnlineShifter.cc.

Referenced by analyze().

◆ fIOVStartLumi_

uint32_t BeamSpotOnlineShifter::fIOVStartLumi_
private

Definition at line 97 of file BeamSpotOnlineShifter.cc.

Referenced by BeamSpotOnlineShifter().

◆ fIOVStartRun_

uint32_t BeamSpotOnlineShifter::fIOVStartRun_
private

Definition at line 96 of file BeamSpotOnlineShifter.cc.

Referenced by BeamSpotOnlineShifter().

◆ fIsHLT_

const bool BeamSpotOnlineShifter::fIsHLT_
private

Definition at line 88 of file BeamSpotOnlineShifter.cc.

Referenced by analyze(), and BeamSpotOnlineShifter().

◆ fLabel_

std::string BeamSpotOnlineShifter::fLabel_
private

Definition at line 100 of file BeamSpotOnlineShifter.cc.

Referenced by BeamSpotOnlineShifter(), and writeToDB().

◆ fnewSince_

cond::Time_t BeamSpotOnlineShifter::fnewSince_
private

Definition at line 98 of file BeamSpotOnlineShifter.cc.

Referenced by BeamSpotOnlineShifter(), and writeToDB().

◆ fullPixel_

const bool BeamSpotOnlineShifter::fullPixel_
private

Definition at line 89 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().

◆ fuseNewSince_

bool BeamSpotOnlineShifter::fuseNewSince_
private

Definition at line 99 of file BeamSpotOnlineShifter.cc.

Referenced by BeamSpotOnlineShifter(), and writeToDB().

◆ hltToken_

edm::ESGetToken<BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd> BeamSpotOnlineShifter::hltToken_
private

Definition at line 80 of file BeamSpotOnlineShifter.cc.

Referenced by analyze(), and BeamSpotOnlineShifter().

◆ legacyToken_

edm::ESGetToken<BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd> BeamSpotOnlineShifter::legacyToken_
private

Definition at line 81 of file BeamSpotOnlineShifter.cc.

Referenced by analyze(), and BeamSpotOnlineShifter().

◆ refAliTokenBR_

const edm::ESGetToken<Alignments, TrackerAlignmentRcd> BeamSpotOnlineShifter::refAliTokenBR_
private

Definition at line 91 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().

◆ tarAliTokenBR_

const edm::ESGetToken<Alignments, TrackerAlignmentRcd> BeamSpotOnlineShifter::tarAliTokenBR_
private

Definition at line 92 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().

◆ theShift_

GlobalPoint BeamSpotOnlineShifter::theShift_
private

Definition at line 87 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun(), and writeToDB().

◆ trackerTopoTokenBR_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> BeamSpotOnlineShifter::trackerTopoTokenBR_
private

Definition at line 90 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().

◆ xShift_

const double BeamSpotOnlineShifter::xShift_
private

Definition at line 93 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().

◆ yShift_

const double BeamSpotOnlineShifter::yShift_
private

Definition at line 94 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().

◆ zShift_

const double BeamSpotOnlineShifter::zShift_
private

Definition at line 95 of file BeamSpotOnlineShifter.cc.

Referenced by beginRun().