CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
BeamSpotOnlinePopConSourceHandler.cc File Reference
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CondFormats/Common/interface/TimeConversions.h"
#include "CondTools/BeamSpot/interface/BeamSpotOnlinePopConSourceHandler.h"
#include <chrono>
#include <memory>

Go to the source code of this file.

Functions

bool checkPayloadAge (const BeamSpotOnlineObjects &payload, unsigned int maxAge)
 
std::unique_ptr
< BeamSpotOnlineObjects
makeDummyPayload ()
 

Function Documentation

bool checkPayloadAge ( const BeamSpotOnlineObjects payload,
unsigned int  maxAge 
)

Definition at line 18 of file BeamSpotOnlinePopConSourceHandler.cc.

References submitPVResolutionJobs::count, BeamSpotOnlineObjects::GetCreationTime(), submitPVValidationJobs::now, and seconds().

Referenced by BeamSpotOnlinePopConSourceHandler::getNewObjects().

18  {
19  long creationTimeInSeconds = payload.GetCreationTime() >> 32;
20  auto timeNow = std::chrono::system_clock::now();
21  auto nowSinceEpoch = std::chrono::duration_cast<std::chrono::seconds>(timeNow.time_since_epoch()).count();
22  long age = nowSinceEpoch - creationTimeInSeconds;
23  return age < maxAge;
24 }
double seconds()
cond::Time_t GetCreationTime() const
std::unique_ptr<BeamSpotOnlineObjects> makeDummyPayload ( )

Definition at line 26 of file BeamSpotOnlinePopConSourceHandler.cc.

References submitPVResolutionJobs::count, submitPVValidationJobs::now, runTheMatrix::ret, and seconds().

Referenced by BeamSpotOnlinePopConSourceHandler::getNewObjects().

26  {
27  // implement here
28  std::unique_ptr<BeamSpotOnlineObjects> ret;
29  ret = std::make_unique<BeamSpotOnlineObjects>();
30  auto timeNow = std::chrono::system_clock::now();
31  auto nowSinceEpoch = std::chrono::duration_cast<std::chrono::seconds>(timeNow.time_since_epoch()).count();
32  ret->SetCreationTime(nowSinceEpoch << 32);
33  return ret;
34 }
tuple ret
prodAgent to be discontinued
double seconds()