45 : timeThreshold_(p.getParameter<int>(
"timeThreshold")),
46 sigmaZThreshold_(p.getParameter<double>(
"sigmaZThreshold")) {
61 dsc.
add<
int>(
"timeThreshold", 48)->setComment(
"hours");
74 auto diffBStime1 = (currentTime - bs1time).
count();
76 auto diffBStime2 = (currentTime - bs2time).
count();
79 auto limitTime = std::chrono::microseconds((std::chrono::hours)
timeThreshold_).count();
87 if (diffBStime1 > limitTime && diffBStime2 > limitTime) {
88 edm::LogInfo(
"OnlineBeamSpotESProducer") <<
"Defaulting to fake becuase 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.";
126 auto diffBStime1 = (currentTime - bs1time).
count();
129 auto limitTime = std::chrono::microseconds((std::chrono::hours)
timeThreshold_).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)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const BeamSpotOnlineObjects * checkSingleBS(const BeamSpotOnlineObjects *bs1)
std::optional< DepRecordT > tryToGetRecord() const
cond::Time_t GetCreationTime() const
void SetSigmaZ(double val)
set sigma Z, RMS bunch length
double GetSigmaZ() const
get sigma Z, RMS bunch length
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > bsHLTToken_
const double sigmaZThreshold_
OnlineBeamSpotESProducer(const edm::ParameterSet &p)
static void fillDescriptions(edm::ConfigurationDescriptions &desc)
int GetBeamType() const
get beam type
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
void SetType(int type)
set beam type
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::shared_ptr< const BeamSpotObjects > produce(const BeamSpotTransientObjectsRcd &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
void SetBeamWidthX(double val)
set average transverse beam width X
void SetBeamWidthY(double val)
set average transverse beam width Y
void SetPosition(double x, double y, double z)
set XYZ position