CMS 3D CMS Logo

Functions
theLHCInfoPerLSImpl Namespace Reference

Functions

bool comparePayloads (const LHCInfoPerLS &rhs, const LHCInfoPerLS &lhs)
 
size_t transferPayloads (const std::vector< pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS >>> &buffer, std::map< cond::Time_t, std::shared_ptr< LHCInfoPerLS >> &iovsToTransfer, std::shared_ptr< LHCInfoPerLS > &prevPayload, const std::map< pair< cond::Time_t, unsigned int >, pair< cond::Time_t, unsigned int >> &lsIdMap, cond::Time_t startStableBeamTime, cond::Time_t endStableBeamTime)
 

Function Documentation

◆ comparePayloads()

bool theLHCInfoPerLSImpl::comparePayloads ( const LHCInfoPerLS rhs,
const LHCInfoPerLS lhs 
)

Definition at line 24 of file LHCInfoPerLSPopConSourceHandler.cc.

References LHCInfoPerLS::betaStarX(), LHCInfoPerLS::betaStarY(), LHCInfoPerLS::crossingAngleX(), LHCInfoPerLS::crossingAngleY(), LHCInfoPerLS::fillNumber(), and LHCInfoPerLS::runNumber().

Referenced by LHCInfoPerLSPopConSourceHandler::addDefaultPayload(), LHCInfoPerLSPopConSourceHandler::populateIovs(), and transferPayloads().

24  {
25  if (rhs.fillNumber() != lhs.fillNumber() || rhs.runNumber() != lhs.runNumber() ||
26  rhs.crossingAngleX() != lhs.crossingAngleX() || rhs.crossingAngleY() != lhs.crossingAngleY() ||
27  rhs.betaStarX() != lhs.betaStarX() || rhs.betaStarY() != lhs.betaStarY()) {
28  return false;
29  }
30  return true;
31  }
cond::Time_t runNumber() const
Definition: LHCInfoPerLS.cc:23
float const betaStarY() const
Definition: LHCInfoPerLS.cc:21
float const crossingAngleX() const
Definition: LHCInfoPerLS.cc:15
float const crossingAngleY() const
Definition: LHCInfoPerLS.cc:17
unsigned short const fillNumber() const
Definition: LHCInfoPerLS.cc:11
float const betaStarX() const
Definition: LHCInfoPerLS.cc:19

◆ transferPayloads()

size_t theLHCInfoPerLSImpl::transferPayloads ( const std::vector< pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS >>> &  buffer,
std::map< cond::Time_t, std::shared_ptr< LHCInfoPerLS >> &  iovsToTransfer,
std::shared_ptr< LHCInfoPerLS > &  prevPayload,
const std::map< pair< cond::Time_t, unsigned int >, pair< cond::Time_t, unsigned int >> &  lsIdMap,
cond::Time_t  startStableBeamTime,
cond::Time_t  endStableBeamTime 
)

Definition at line 33 of file LHCInfoPerLSPopConSourceHandler.cc.

References PVValHelper::add(), edmScanValgrind::buffer, comparePayloads(), jetsAK4_Puppi_cff::payload, SiStripO2O_cfg_template::since, and CommPDSkim_cfg::stableBeam.

Referenced by LHCInfoPerLSPopConSourceHandler::populateIovs().

38  {
39  int lsMissingInPPS = 0;
40  int xAngleBothZero = 0, xAngleBothNonZero = 0, xAngleNegative = 0;
41  int betaNegative = 0;
42  size_t niovs = 0;
43  std::stringstream condIovs;
44  std::stringstream missingLsList;
45  for (auto& iov : buffer) {
46  bool add = false;
47  auto payload = iov.second;
48  cond::Time_t since = iov.first;
49  if (iovsToTransfer.empty()) {
50  add = true;
51  } else {
52  LHCInfoPerLS& lastAdded = *iovsToTransfer.rbegin()->second;
53  if (!comparePayloads(lastAdded, *payload)) {
54  add = true;
55  }
56  }
57  auto id = make_pair(payload->runNumber(), payload->lumiSection());
58  bool stableBeam = since >= startStableBeamTime && since <= endStableBeamTime;
59  bool isMissing = lsIdMap.find(id) != lsIdMap.end() && id != lsIdMap.at(id);
60  if (stableBeam && isMissing) {
61  missingLsList << id.first << "_" << id.second << " ";
62  lsMissingInPPS += isMissing;
63  }
64  if (add && !isMissing) {
65  niovs++;
66  if (stableBeam) {
67  if (payload->crossingAngleX() == 0 && payload->crossingAngleY() == 0)
68  xAngleBothZero++;
69  if (payload->crossingAngleX() != 0 && payload->crossingAngleY() != 0)
70  xAngleBothNonZero++;
71  if (payload->crossingAngleX() < 0 || payload->crossingAngleY() < 0)
72  xAngleNegative++;
73  if (payload->betaStarX() < 0 || payload->betaStarY() < 0)
74  betaNegative++;
75  }
76 
77  condIovs << since << " ";
78  iovsToTransfer.insert(make_pair(since, payload));
79  prevPayload = iov.second;
80  }
81  }
82  unsigned short fillNumber = (!buffer.empty()) ? buffer.front().second->fillNumber() : 0;
83  if (lsMissingInPPS > 0) {
84  edm::LogWarning("transferPayloads")
85  << "Number of stable beam LS in OMS without corresponding record in PPS DB for fill " << fillNumber << ": "
86  << lsMissingInPPS;
87  edm::LogWarning("transferPayloads")
88  << "Stable beam LS in OMS without corresponding record in PPS DB (run_LS): " << missingLsList.str();
89  }
90  if (xAngleBothZero > 0) {
91  edm::LogWarning("transferPayloads")
92  << "Number of payloads written with crossingAngle == 0 for both X and Y for fill " << fillNumber << ": "
93  << xAngleBothZero;
94  }
95  if (xAngleBothNonZero > 0) {
96  edm::LogWarning("transferPayloads")
97  << "Number of payloads written with crossingAngle != 0 for both X and Y for fill " << fillNumber << ": "
98  << xAngleBothNonZero;
99  }
100  if (xAngleNegative > 0) {
101  edm::LogWarning("transferPayloads")
102  << "Number of payloads written with negative crossingAngle for fill " << fillNumber << ": " << xAngleNegative;
103  }
104  if (betaNegative > 0) {
105  edm::LogWarning("transferPayloads")
106  << "Number of payloads written with negative betaSta for fill " << fillNumber << ": " << betaNegative;
107  }
108 
109  edm::LogInfo("transferPayloads") << "TRANSFERED COND IOVS: " << condIovs.str();
110  return niovs;
111  }
unsigned long long Time_t
Definition: Time.h:14
Log< level::Info, false > LogInfo
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
Log< level::Warning, false > LogWarning
bool comparePayloads(const LHCInfoPerLS &rhs, const LHCInfoPerLS &lhs)