47 : timeThreshold_(
p.getParameter<
int>(
"timeThreshold")),
48 sigmaZThreshold_(
p.getParameter<double>(
"sigmaZThreshold")),
49 sigmaXYThreshold_(
p.getParameter<double>(
"sigmaXYThreshold") * 1E-4) {
64 dsc.
add<
int>(
"timeThreshold", 48)->setComment(
"hours");
67 desc.addWithDefaultLabel(dsc);
77 auto bs1time = std::chrono::microseconds(bs1->
creationTime());
78 auto diffBStime1 = (currentTime - bs1time).
count();
79 auto bs2time = std::chrono::microseconds(bs2->
creationTime());
80 auto diffBStime2 = (currentTime - bs2time).
count();
91 if (diffBStime1 > limitTime && diffBStime2 > limitTime) {
92 edm::LogInfo(
"OnlineBeamSpotESProducer") <<
"Defaulting to fake because both payloads are too old.";
94 }
else if (diffBStime2 > limitTime) {
99 <<
"Defaulting to fake because the legacy Beam Spot is not suitable and HLT one is too old.";
102 }
else if (diffBStime1 > limitTime) {
107 <<
"Defaulting to fake because the HLT Beam Spot is not suitable and the legacy one too old.";
117 <<
"Defaulting to fake because despite both payloads are young enough, none has passed the fit sanity checks";
129 auto bs1time = std::chrono::microseconds(bs1->
creationTime());
130 auto diffBStime1 = (currentTime - bs1time).
count();
136 if (diffBStime1 < limitTime &&
isGoodBS(bs1)) {
155 if (not legacyRec and not hltRec) {
156 edm::LogInfo(
"OnlineBeamSpotESProducer") <<
"None of the Beam Spots in ES are available! \n returning a fake one.";
161 if (legacyRec and hltRec) {
163 }
else if (legacyRec) {
173 <<
"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)
uint32_t cc[maxCellsPerHit]
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > bsHLTToken_
const double sigmaXYThreshold_
double beamWidthX() const
get average transverse beam width
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)
bool isGoodBS(const BeamSpotOnlineObjects *bs1) const
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > bsLegacyToken_
edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcd > const bsToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
double beamWidthY() const
get average transverse beam width
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
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