45 : timeThreshold_(
p.getParameter<
int>(
"timeThreshold")),
46 sigmaZThreshold_(
p.getParameter<double>(
"sigmaZThreshold")) {
61 dsc.
add<
int>(
"timeThreshold", 48)->setComment(
"hours");
63 desc.addWithDefaultLabel(dsc);
73 auto bs1time = std::chrono::microseconds(bs1->
creationTime());
74 auto diffBStime1 = (currentTime - bs1time).
count();
75 auto bs2time = std::chrono::microseconds(bs2->
creationTime());
76 auto diffBStime2 = (currentTime - bs2time).
count();
87 if (diffBStime1 > limitTime && diffBStime2 > limitTime) {
88 edm::LogInfo(
"OnlineBeamSpotESProducer") <<
"Defaulting to fake because both payloads are too old.";
90 }
else if (diffBStime2 > limitTime) {
95 <<
"Defaulting to fake because the legacy Beam Spot is not suitable and HLT one is too old.";
98 }
else if (diffBStime1 > limitTime) {
103 <<
"Defaulting to fake because the HLT Beam Spot is not suitable and the legacy one too old.";
113 <<
"Defaulting to fake because despite both payloads are young enough, none has the right BeamType.";
125 auto bs1time = std::chrono::microseconds(bs1->
creationTime());
126 auto diffBStime1 = (currentTime - bs1time).
count();
142 if (not legacyRec and not hltRec) {
143 edm::LogInfo(
"OnlineBeamSpotESProducer") <<
"None of the Beam Spots in ES are available! \n returning a fake one.";
148 if (legacyRec and hltRec) {
150 }
else if (legacyRec) {
160 <<
"None of the Online BeamSpots in the ES is suitable, \n returning a fake one. ";
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void setComment(std::string const &value)
cond::Time_t creationTime() const
const BeamSpotOnlineObjects * checkSingleBS(const BeamSpotOnlineObjects *bs1)
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > bsHLTToken_
int beamType() const
get beam type
const double sigmaZThreshold_
void setType(int type)
set beam type
OnlineBeamSpotESProducer(const edm::ParameterSet &p)
static void fillDescriptions(edm::ConfigurationDescriptions &desc)
const BeamSpotOnlineObjects * compareBS(const BeamSpotOnlineObjects *bs1, const BeamSpotOnlineObjects *bs2)
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > bsLegacyToken_
edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcd > const bsToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::shared_ptr< const BeamSpotObjects > produce(const BeamSpotTransientObjectsRcd &)
void setSigmaZ(double val)
set sigma Z, RMS bunch length
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
double sigmaZ() const
get sigma Z, RMS bunch length
std::optional< DepRecordT > tryToGetRecord() const
void setPosition(double x, double y, double z)
set XYZ position
void setBeamWidthX(double val)
set average transverse beam width X
void setBeamWidthY(double val)
set average transverse beam width Y