34 #include "oneapi/tbb/concurrent_vector.h"
86 using namespace edm::service;
92 Transition stringToType(
const std::string& iTrans) {
93 if (iTrans ==
"IsStop") {
96 if (iTrans ==
"IsFile") {
99 if (iTrans ==
"IsRun") {
102 if (iTrans ==
"IsLumi") {
105 if (iTrans ==
"IsEvent") {
114 std::vector<std::tuple<Phase, edm::EventID, int>> expectedValues(
115 std::vector<std::pair<Transition, edm::EventID>>
const& iTrans,
int iNStreams) {
116 std::vector<std::tuple<Phase, edm::EventID, int>> returnValue;
117 returnValue.reserve(iTrans.size());
122 for (
auto const& tran : iTrans) {
123 switch (tran.first) {
128 if (tran.second != lastRun) {
129 if (lastRun.
run() != maxIDValue) {
131 for (
int i = 0;
i < iNStreams; ++
i) {
138 for (
int i = 0;
i < iNStreams; ++
i) {
141 lastRun = tran.second;
146 if (tran.second != lastLumi) {
147 if (lastLumi.
run() != maxIDValue) {
149 for (
int i = 0;
i < iNStreams; ++
i) {
156 for (
int i = 0;
i < iNStreams; ++
i) {
159 lastLumi = tran.second;
172 if (lastLumi.
run() != maxIDValue) {
174 for (
int i = 0;
i < iNStreams; ++
i) {
179 if (lastRun.
run() != maxIDValue) {
181 for (
int i = 0;
i < iNStreams; ++
i) {
194 p.getUntrackedParameter<
EventID>(
"id"));
232 desc.
setComment(
"Checks that the transitions specified occur during the job.");
238 descriptions.
add(
"CheckTransitions", desc);
246 std::vector<std::tuple<Phase, edm::EventID, int>> orderedSeen;
250 auto s = std::get<2>(
i);
251 if (std::get<1>(
i).event() > 0) {
254 orderedSeen.emplace_back(std::get<0>(
i), std::get<1>(
i),
s);
256 std::sort(orderedSeen.begin(), orderedSeen.end());
258 auto orderedExpected = expectedV;
259 std::sort(orderedExpected.begin(), orderedExpected.end());
264 auto itOS = orderedSeen.begin();
265 for (
auto itOE = orderedExpected.begin(); itOE != orderedExpected.end(); ++itOE) {
266 if (itOS == orderedSeen.end()) {
269 if (*itOE != *itOS) {
270 auto syncOE = std::get<1>(*itOE);
271 auto syncOS = std::get<1>(*itOS);
272 std::cout <<
"Different ordering " << syncOE <<
" " << std::get<2>(*itOE) <<
"\n"
273 <<
" " << syncOS <<
" " << std::get<2>(*itOS) <<
"\n";
279 if (orderedSeen.size() != orderedExpected.size()) {
280 std::cout <<
"Wrong number of transition " << orderedSeen.size() <<
" " << orderedExpected.size() << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
void watchPreEvent(PreEvent::slot_type const &iSlot)
CheckTransitions(const ParameterSet &, ActivityRegistry &)
void preBeginJob(PathsAndConsumesOfModulesBase const &, ProcessContext const &)
void watchPreallocate(Preallocate::slot_type const &iSlot)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
static RunNumber_t maxRunNumber()
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
LuminosityBlockID const & luminosityBlockID() const
void watchPreStreamEndRun(PreStreamEndRun::slot_type const &iSlot)
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
~CheckTransitions() noexcept(false)
void preStreamEndLumi(StreamContext const &)
void watchPreStreamEndLumi(PreStreamEndLumi::slot_type const &iSlot)
void preCloseFile(std::string const &lfn)
std::vector< std::pair< Transition, edm::EventID > > m_expectedTransitions
void preEvent(StreamContext const &)
void preStreamEndRun(StreamContext const &)
void preStreamBeginLumi(StreamContext const &)
unsigned int maxNumberOfStreams() const
void watchPreOpenFile(PreOpenFile::slot_type const &iSlot)
void setComment(std::string const &value)
void watchPreGlobalEndRun(PreGlobalEndRun::slot_type const &iSlot)
void preGlobalEndRun(GlobalContext const &)
void preGlobalBeginRun(GlobalContext const &)
StreamID const & streamID() const
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
#define DEFINE_FWK_SERVICE(type)
oneapi::tbb::concurrent_vector< std::tuple< Phase, edm::EventID, int > > m_seenTransitions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void watchPreCloseFile(PreCloseFile::slot_type const &iSlot)
void watchPreStreamBeginLumi(PreStreamBeginLumi::slot_type const &iSlot)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void preGlobalBeginLumi(GlobalContext const &)
void watchPreStreamBeginRun(PreStreamBeginRun::slot_type const &iSlot)
void preStreamBeginRun(StreamContext const &)
void preGlobalEndLumi(GlobalContext const &)
void preallocate(service::SystemBounds const &)
EventID const & eventID() const
void preOpenFile(std::string const &)
ParameterDescriptionBase * addVPSetUntracked(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)