47 : timeThreshold_(
p.getParameter<
int>(
"timeThreshold")),
48 sigmaZThreshold_(
p.getParameter<double>(
"sigmaZThreshold")),
49 sigmaXYThreshold_(
p.getParameter<double>(
"sigmaXYThreshold") * 1E-4) {
72 dsc.
add<
int>(
"timeThreshold", 48)->setComment(
"hours");
75 desc.addWithDefaultLabel(dsc);
85 auto bs1time = std::chrono::microseconds(bs1->
creationTime());
86 auto diffBStime1 = (currentTime - bs1time).
count();
87 auto bs2time = std::chrono::microseconds(bs2->
creationTime());
88 auto diffBStime2 = (currentTime - bs2time).
count();
99 if (diffBStime1 > limitTime && diffBStime2 > limitTime) {
101 <<
"Defaulting to fake (fallback to PCL) because both payloads are too old.";
103 }
else if (diffBStime2 > limitTime) {
107 edm::LogWarning(
"OnlineBeamSpotESProducer") <<
"Defaulting to fake (fallback to PCL) because the legacy Beam " 108 "Spot is not suitable and HLT one is too old.";
111 }
else if (diffBStime1 > limitTime) {
115 edm::LogWarning(
"OnlineBeamSpotESProducer") <<
"Defaulting to fake (fallback to PCL) because the HLT Beam Spot " 116 "is not suitable and the legacy one too old.";
125 edm::LogWarning(
"OnlineBeamSpotESProducer") <<
"Defaulting to fake (fallback to PCL) because despite both " 126 "payloads are young enough, none has passed the fit sanity checks";
138 auto bs1time = std::chrono::microseconds(bs1->
creationTime());
139 auto diffBStime1 = (currentTime - bs1time).
count();
145 if (diffBStime1 < limitTime &&
isGoodBS(bs1)) {
164 if (not legacyRec and not hltRec) {
166 <<
"None of the Beam Spots in ES are available! \n returning a fake one (fallback to PCL).";
171 if (legacyRec and hltRec) {
173 }
else if (legacyRec) {
182 <<
"None of the Online BeamSpots in the ES is suitable, \n returning a fake one(fallback to PCL).";
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void setComment(std::string const &value)
cond::Time_t creationTime() const
void setCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
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
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
Log< level::Warning, false > LogWarning
void setBeamWidthY(double val)
set average transverse beam width Y