Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-24 02:18:50

0001 /*
0002  *  proxyfactoryproducer_t.cc
0003  *  EDMProto
0004  *
0005  *  Created by Chris Jones on 4/8/05.
0006  *  Changed by Viji Sundararajan on 28-Jun-05
0007  */
0008 #include <iostream>
0009 #include <atomic>
0010 #include <vector>
0011 #include <map>
0012 #include <functional>
0013 #include "oneapi/tbb/global_control.h"
0014 #include "FWCore/Framework/interface/global/EDProducer.h"
0015 #include "FWCore/Framework/interface/maker/WorkerT.h"
0016 #include "FWCore/Framework/interface/maker/ModuleHolder.h"
0017 #include "FWCore/Framework/interface/PreallocationConfiguration.h"
0018 #include "FWCore/Framework/interface/TransitionInfoTypes.h"
0019 #include "FWCore/Framework/interface/OccurrenceTraits.h"
0020 #include "DataFormats/Provenance/interface/ProductRegistry.h"
0021 #include "DataFormats/Provenance/interface/BranchIDListHelper.h"
0022 #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h"
0023 #include "FWCore/Framework/interface/HistoryAppender.h"
0024 #include "FWCore/ServiceRegistry/interface/ParentContext.h"
0025 #include "FWCore/ServiceRegistry/interface/StreamContext.h"
0026 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0027 #include "FWCore/Utilities/interface/GlobalIdentifier.h"
0028 
0029 #include "FWCore/Utilities/interface/Exception.h"
0030 
0031 #include "cppunit/extensions/HelperMacros.h"
0032 
0033 namespace {
0034   struct ShadowStreamID {
0035     constexpr ShadowStreamID() : value(0) {}
0036     unsigned int value;
0037   };
0038 
0039   union IDUnion {
0040     IDUnion() : m_shadow() {}
0041     ShadowStreamID m_shadow;
0042     edm::StreamID m_id;
0043   };
0044 }  // namespace
0045 static edm::StreamID makeID() {
0046   IDUnion u;
0047   assert(u.m_id.value() == 0);
0048   return u.m_id;
0049 }
0050 static const edm::StreamID s_streamID0 = makeID();
0051 
0052 class testGlobalProducer : public CppUnit::TestFixture {
0053   CPPUNIT_TEST_SUITE(testGlobalProducer);
0054 
0055   CPPUNIT_TEST(basicTest);
0056   CPPUNIT_TEST(streamTest);
0057   CPPUNIT_TEST(runTest);
0058   CPPUNIT_TEST(runSummaryTest);
0059   CPPUNIT_TEST(lumiTest);
0060   CPPUNIT_TEST(lumiSummaryTest);
0061   CPPUNIT_TEST(beginRunProdTest);
0062   CPPUNIT_TEST(beginLumiProdTest);
0063   CPPUNIT_TEST(endRunProdTest);
0064   CPPUNIT_TEST(endLumiProdTest);
0065   CPPUNIT_TEST(endRunSummaryProdTest);
0066   CPPUNIT_TEST(endLumiSummaryProdTest);
0067 
0068   CPPUNIT_TEST_SUITE_END();
0069 
0070 public:
0071   testGlobalProducer();
0072 
0073   void setUp() {}
0074   void tearDown() {}
0075 
0076   void basicTest();
0077   void streamTest();
0078   void runTest();
0079   void runSummaryTest();
0080   void lumiTest();
0081   void lumiSummaryTest();
0082   void beginRunProdTest();
0083   void beginLumiProdTest();
0084   void endRunProdTest();
0085   void endLumiProdTest();
0086   void endRunSummaryProdTest();
0087   void endLumiSummaryProdTest();
0088 
0089   enum class Trans {
0090     kBeginJob,
0091     kBeginStream,
0092     kGlobalBeginRun,
0093     kGlobalBeginRunProduce,
0094     kStreamBeginRun,
0095     kGlobalBeginLuminosityBlock,
0096     kStreamBeginLuminosityBlock,
0097     kEvent,
0098     kStreamEndLuminosityBlock,
0099     kGlobalEndLuminosityBlock,
0100     kStreamEndRun,
0101     kGlobalEndRun,
0102     kEndStream,
0103     kEndJob
0104   };
0105   typedef std::vector<Trans> Expectations;
0106 
0107 private:
0108   std::map<Trans, std::function<void(edm::Worker*)>> m_transToFunc;
0109 
0110   edm::ProcessConfiguration m_procConfig;
0111   edm::PreallocationConfiguration m_preallocConfig;
0112   std::shared_ptr<edm::ProductRegistry> m_prodReg;
0113   std::shared_ptr<edm::BranchIDListHelper> m_idHelper;
0114   std::shared_ptr<edm::ThinnedAssociationsHelper> m_associationsHelper;
0115   std::unique_ptr<edm::EventPrincipal> m_ep;
0116   edm::HistoryAppender historyAppender_;
0117   std::shared_ptr<edm::LuminosityBlockPrincipal> m_lbp;
0118   std::shared_ptr<edm::RunPrincipal> m_rp;
0119   std::shared_ptr<edm::ActivityRegistry>
0120       m_actReg;  // We do not use propagate_const because the registry itself is mutable.
0121   edm::EventSetupImpl* m_es = nullptr;
0122   edm::ModuleDescription m_desc = {"Dummy", "dummy"};
0123 
0124   template <typename T>
0125   void testTransitions(std::shared_ptr<T> iMod, Expectations const& iExpect);
0126 
0127   template <typename Traits, typename Info>
0128   void doWork(edm::Worker* iBase, Info const& info, edm::ParentContext const& iContext) {
0129     edm::FinalWaitingTask task;
0130     oneapi::tbb::task_group group;
0131     edm::ServiceToken token;
0132     iBase->doWorkAsync<Traits>(edm::WaitingTaskHolder(group, &task), info, token, s_streamID0, iContext, nullptr);
0133     do {
0134       group.wait();
0135     } while (not task.done());
0136     if (auto e = task.exceptionPtr()) {
0137       std::rethrow_exception(*e);
0138     }
0139   }
0140 
0141   class BasicProd : public edm::global::EDProducer<> {
0142   public:
0143     mutable unsigned int m_count = 0;  //[[cms-thread-safe]]
0144 
0145     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0146   };
0147   class StreamProd : public edm::global::EDProducer<edm::StreamCache<int>> {
0148   public:
0149     mutable unsigned int m_count = 0;
0150     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0151 
0152     std::unique_ptr<int> beginStream(edm::StreamID) const override {
0153       ++m_count;
0154       return std::unique_ptr<int>{};
0155     }
0156 
0157     virtual void streamBeginRun(edm::StreamID, edm::Run const&, edm::EventSetup const&) const override { ++m_count; }
0158     virtual void streamBeginLuminosityBlock(edm::StreamID,
0159                                             edm::LuminosityBlock const&,
0160                                             edm::EventSetup const&) const override {
0161       ++m_count;
0162     }
0163     virtual void streamEndLuminosityBlock(edm::StreamID,
0164                                           edm::LuminosityBlock const&,
0165                                           edm::EventSetup const&) const override {
0166       ++m_count;
0167     }
0168     virtual void streamEndRun(edm::StreamID, edm::Run const&, edm::EventSetup const&) const override { ++m_count; }
0169     void endStream(edm::StreamID) const override { ++m_count; }
0170   };
0171 
0172   class RunProd : public edm::global::EDProducer<edm::RunCache<int>> {
0173   public:
0174     mutable unsigned int m_count = 0;
0175     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0176 
0177     std::shared_ptr<int> globalBeginRun(edm::Run const&, edm::EventSetup const&) const override {
0178       ++m_count;
0179       return std::shared_ptr<int>{};
0180     }
0181 
0182     void globalEndRun(edm::Run const&, edm::EventSetup const&) const override { ++m_count; }
0183   };
0184 
0185   class LumiProd : public edm::global::EDProducer<edm::LuminosityBlockCache<int>> {
0186   public:
0187     mutable unsigned int m_count = 0;
0188     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0189 
0190     std::shared_ptr<int> globalBeginLuminosityBlock(edm::LuminosityBlock const&,
0191                                                     edm::EventSetup const&) const override {
0192       ++m_count;
0193       return std::shared_ptr<int>{};
0194     }
0195 
0196     void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) const override { ++m_count; }
0197   };
0198 
0199   class RunSummaryProd : public edm::global::EDProducer<edm::RunSummaryCache<int>> {
0200   public:
0201     mutable unsigned int m_count = 0;
0202     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0203 
0204     std::shared_ptr<int> globalBeginRunSummary(edm::Run const&, edm::EventSetup const&) const override {
0205       ++m_count;
0206       return std::shared_ptr<int>{};
0207     }
0208 
0209     void streamEndRunSummary(edm::StreamID, edm::Run const&, edm::EventSetup const&, int*) const override { ++m_count; }
0210 
0211     void globalEndRunSummary(edm::Run const&, edm::EventSetup const&, int*) const override { ++m_count; }
0212   };
0213 
0214   class LumiSummaryProd : public edm::global::EDProducer<edm::LuminosityBlockSummaryCache<int>> {
0215   public:
0216     mutable unsigned int m_count = 0;
0217     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0218 
0219     std::shared_ptr<int> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
0220                                                            edm::EventSetup const&) const override {
0221       ++m_count;
0222       return std::shared_ptr<int>{};
0223     }
0224 
0225     void streamEndLuminosityBlockSummary(edm::StreamID,
0226                                          edm::LuminosityBlock const&,
0227                                          edm::EventSetup const&,
0228                                          int*) const override {
0229       ++m_count;
0230     }
0231 
0232     void globalEndLuminosityBlockSummary(edm::LuminosityBlock const&, edm::EventSetup const&, int*) const override {
0233       ++m_count;
0234     }
0235   };
0236 
0237   class BeginRunProd : public edm::global::EDProducer<edm::BeginRunProducer> {
0238   public:
0239     mutable unsigned int m_count = 0;
0240     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0241 
0242     void globalBeginRunProduce(edm::Run&, edm::EventSetup const&) const override { ++m_count; }
0243   };
0244 
0245   class BeginLumiProd : public edm::global::EDProducer<edm::BeginLuminosityBlockProducer> {
0246   public:
0247     mutable unsigned int m_count = 0;
0248     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0249 
0250     void globalBeginLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&) const override { ++m_count; }
0251   };
0252 
0253   class EndRunProd : public edm::global::EDProducer<edm::EndRunProducer> {
0254   public:
0255     mutable unsigned int m_count = 0;
0256     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0257 
0258     void globalEndRunProduce(edm::Run&, edm::EventSetup const&) const override { ++m_count; }
0259   };
0260 
0261   class EndLumiProd : public edm::global::EDProducer<edm::EndLuminosityBlockProducer> {
0262   public:
0263     mutable unsigned int m_count = 0;
0264     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0265 
0266     void globalEndLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&) const override { ++m_count; }
0267   };
0268 
0269   class EndRunSummaryProd : public edm::global::EDProducer<edm::EndRunProducer, edm::RunSummaryCache<int>> {
0270   public:
0271     mutable unsigned int m_count = 0;
0272     mutable bool m_globalEndRunSummaryCalled = false;
0273     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0274 
0275     std::shared_ptr<int> globalBeginRunSummary(edm::Run const&, edm::EventSetup const&) const override {
0276       ++m_count;
0277       return std::shared_ptr<int>{};
0278     }
0279 
0280     void streamEndRunSummary(edm::StreamID, edm::Run const&, edm::EventSetup const&, int*) const override { ++m_count; }
0281 
0282     void globalEndRunSummary(edm::Run const&, edm::EventSetup const&, int*) const override {
0283       ++m_count;
0284       CPPUNIT_ASSERT(m_globalEndRunSummaryCalled == false);
0285       m_globalEndRunSummaryCalled = true;
0286     }
0287 
0288     void globalEndRunProduce(edm::Run&, edm::EventSetup const&, int const*) const override {
0289       ++m_count;
0290       CPPUNIT_ASSERT(m_globalEndRunSummaryCalled == true);
0291       m_globalEndRunSummaryCalled = false;
0292     }
0293   };
0294 
0295   class EndLumiSummaryProd
0296       : public edm::global::EDProducer<edm::EndLuminosityBlockProducer, edm::LuminosityBlockSummaryCache<int>> {
0297   public:
0298     mutable unsigned int m_count = 0;
0299     mutable bool m_globalEndLuminosityBlockSummaryCalled = false;
0300     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override { ++m_count; }
0301 
0302     std::shared_ptr<int> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
0303                                                            edm::EventSetup const&) const override {
0304       ++m_count;
0305       return std::shared_ptr<int>{};
0306     }
0307 
0308     void streamEndLuminosityBlockSummary(edm::StreamID,
0309                                          edm::LuminosityBlock const&,
0310                                          edm::EventSetup const&,
0311                                          int*) const override {
0312       ++m_count;
0313     }
0314 
0315     void globalEndLuminosityBlockSummary(edm::LuminosityBlock const&, edm::EventSetup const&, int*) const override {
0316       ++m_count;
0317       CPPUNIT_ASSERT(m_globalEndLuminosityBlockSummaryCalled == false);
0318       m_globalEndLuminosityBlockSummaryCalled = true;
0319     }
0320 
0321     void globalEndLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&, int const*) const override {
0322       ++m_count;
0323       CPPUNIT_ASSERT(m_globalEndLuminosityBlockSummaryCalled == true);
0324       m_globalEndLuminosityBlockSummaryCalled = false;
0325     }
0326   };
0327 };
0328 
0329 ///registration of the test so that the runner can find it
0330 CPPUNIT_TEST_SUITE_REGISTRATION(testGlobalProducer);
0331 
0332 testGlobalProducer::testGlobalProducer()
0333     : m_preallocConfig{},
0334       m_prodReg(new edm::ProductRegistry{}),
0335       m_idHelper(new edm::BranchIDListHelper{}),
0336       m_associationsHelper(new edm::ThinnedAssociationsHelper{}),
0337       m_ep() {
0338   //Setup the principals
0339   m_prodReg->setFrozen();
0340   m_idHelper->updateFromRegistry(*m_prodReg);
0341   edm::EventID eventID = edm::EventID::firstValidEvent();
0342 
0343   std::string uuid = edm::createGlobalIdentifier();
0344   edm::Timestamp now(1234567UL);
0345   auto runAux = std::make_shared<edm::RunAuxiliary>(eventID.run(), now, now);
0346   m_rp.reset(new edm::RunPrincipal(runAux, m_prodReg, m_procConfig, &historyAppender_, 0));
0347   auto lumiAux = std::make_shared<edm::LuminosityBlockAuxiliary>(m_rp->run(), 1, now, now);
0348   m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0));
0349   m_lbp->setAux(*lumiAux);
0350   m_lbp->setRunPrincipal(m_rp);
0351   edm::EventAuxiliary eventAux(eventID, uuid, now, true);
0352 
0353   m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr));
0354   m_ep->fillEventPrincipal(eventAux, nullptr);
0355   m_ep->setLuminosityBlockPrincipal(m_lbp.get());
0356   m_actReg.reset(new edm::ActivityRegistry);
0357 
0358   //For each transition, bind a lambda which will call the proper method of the Worker
0359   m_transToFunc[Trans::kBeginStream] = [](edm::Worker* iBase) {
0360     edm::StreamContext streamContext(s_streamID0, nullptr);
0361     iBase->beginStream(s_streamID0, streamContext);
0362   };
0363 
0364   m_transToFunc[Trans::kGlobalBeginRun] = [this](edm::Worker* iBase) {
0365     typedef edm::OccurrenceTraits<edm::RunPrincipal, edm::BranchActionGlobalBegin> Traits;
0366     edm::ParentContext nullParentContext;
0367     edm::RunTransitionInfo info(*m_rp, *m_es);
0368     doWork<Traits>(iBase, info, nullParentContext);
0369   };
0370   m_transToFunc[Trans::kStreamBeginRun] = [this](edm::Worker* iBase) {
0371     typedef edm::OccurrenceTraits<edm::RunPrincipal, edm::BranchActionStreamBegin> Traits;
0372     edm::ParentContext nullParentContext;
0373     edm::RunTransitionInfo info(*m_rp, *m_es);
0374     doWork<Traits>(iBase, info, nullParentContext);
0375   };
0376 
0377   m_transToFunc[Trans::kGlobalBeginLuminosityBlock] = [this](edm::Worker* iBase) {
0378     typedef edm::OccurrenceTraits<edm::LuminosityBlockPrincipal, edm::BranchActionGlobalBegin> Traits;
0379     edm::ParentContext nullParentContext;
0380     edm::LumiTransitionInfo info(*m_lbp, *m_es);
0381     doWork<Traits>(iBase, info, nullParentContext);
0382   };
0383   m_transToFunc[Trans::kStreamBeginLuminosityBlock] = [this](edm::Worker* iBase) {
0384     typedef edm::OccurrenceTraits<edm::LuminosityBlockPrincipal, edm::BranchActionStreamBegin> Traits;
0385     edm::ParentContext nullParentContext;
0386     edm::LumiTransitionInfo info(*m_lbp, *m_es);
0387     doWork<Traits>(iBase, info, nullParentContext);
0388   };
0389 
0390   m_transToFunc[Trans::kEvent] = [this](edm::Worker* iBase) {
0391     typedef edm::OccurrenceTraits<edm::EventPrincipal, edm::BranchActionStreamBegin> Traits;
0392     edm::StreamContext streamContext(s_streamID0, nullptr);
0393     edm::ParentContext nullParentContext(&streamContext);
0394     iBase->setActivityRegistry(m_actReg);
0395     edm::EventTransitionInfo info(*m_ep, *m_es);
0396     doWork<Traits>(iBase, info, nullParentContext);
0397   };
0398 
0399   m_transToFunc[Trans::kStreamEndLuminosityBlock] = [this](edm::Worker* iBase) {
0400     typedef edm::OccurrenceTraits<edm::LuminosityBlockPrincipal, edm::BranchActionStreamEnd> Traits;
0401     edm::ParentContext nullParentContext;
0402     edm::LumiTransitionInfo info(*m_lbp, *m_es);
0403     doWork<Traits>(iBase, info, nullParentContext);
0404   };
0405   m_transToFunc[Trans::kGlobalEndLuminosityBlock] = [this](edm::Worker* iBase) {
0406     typedef edm::OccurrenceTraits<edm::LuminosityBlockPrincipal, edm::BranchActionGlobalEnd> Traits;
0407     edm::ParentContext nullParentContext;
0408     edm::LumiTransitionInfo info(*m_lbp, *m_es);
0409     doWork<Traits>(iBase, info, nullParentContext);
0410   };
0411 
0412   m_transToFunc[Trans::kStreamEndRun] = [this](edm::Worker* iBase) {
0413     typedef edm::OccurrenceTraits<edm::RunPrincipal, edm::BranchActionStreamEnd> Traits;
0414     edm::ParentContext nullParentContext;
0415     edm::RunTransitionInfo info(*m_rp, *m_es);
0416     doWork<Traits>(iBase, info, nullParentContext);
0417   };
0418   m_transToFunc[Trans::kGlobalEndRun] = [this](edm::Worker* iBase) {
0419     typedef edm::OccurrenceTraits<edm::RunPrincipal, edm::BranchActionGlobalEnd> Traits;
0420     edm::ParentContext nullParentContext;
0421     edm::RunTransitionInfo info(*m_rp, *m_es);
0422     doWork<Traits>(iBase, info, nullParentContext);
0423   };
0424 
0425   m_transToFunc[Trans::kEndStream] = [](edm::Worker* iBase) {
0426     edm::StreamContext streamContext(s_streamID0, nullptr);
0427     iBase->endStream(s_streamID0, streamContext);
0428   };
0429 }
0430 
0431 namespace {
0432   template <typename T>
0433   void testTransition(std::shared_ptr<T> iMod,
0434                       edm::Worker* iWorker,
0435                       testGlobalProducer::Trans iTrans,
0436                       testGlobalProducer::Expectations const& iExpect,
0437                       std::function<void(edm::Worker*)> iFunc) {
0438     assert(0 == iMod->m_count);
0439     iFunc(iWorker);
0440     auto count = std::count(iExpect.begin(), iExpect.end(), iTrans);
0441     if (count != iMod->m_count) {
0442       std::cout << "For trans " << static_cast<std::underlying_type<testGlobalProducer::Trans>::type>(iTrans)
0443                 << " expected " << count << " and got " << iMod->m_count << std::endl;
0444     }
0445     CPPUNIT_ASSERT(iMod->m_count == count);
0446     iMod->m_count = 0;
0447     iWorker->reset();
0448   }
0449 }  // namespace
0450 
0451 template <typename T>
0452 void testGlobalProducer::testTransitions(std::shared_ptr<T> iMod, Expectations const& iExpect) {
0453   oneapi::tbb::global_control control(oneapi::tbb::global_control::max_allowed_parallelism, 1);
0454 
0455   edm::maker::ModuleHolderT<edm::global::EDProducerBase> h(iMod, nullptr);
0456   h.preallocate(edm::PreallocationConfiguration{});
0457 
0458   edm::WorkerT<edm::global::EDProducerBase> w{iMod, m_desc, nullptr};
0459   for (auto& keyVal : m_transToFunc) {
0460     testTransition(iMod, &w, keyVal.first, iExpect, keyVal.second);
0461   }
0462 }
0463 
0464 void testGlobalProducer::basicTest() {
0465   auto testProd = std::make_shared<BasicProd>();
0466 
0467   CPPUNIT_ASSERT(0 == testProd->m_count);
0468   testTransitions(testProd, {Trans::kEvent});
0469 }
0470 
0471 void testGlobalProducer::streamTest() {
0472   auto testProd = std::make_shared<StreamProd>();
0473 
0474   CPPUNIT_ASSERT(0 == testProd->m_count);
0475   testTransitions(testProd,
0476                   {Trans::kBeginStream,
0477                    Trans::kStreamBeginRun,
0478                    Trans::kStreamBeginLuminosityBlock,
0479                    Trans::kEvent,
0480                    Trans::kStreamEndLuminosityBlock,
0481                    Trans::kStreamEndRun,
0482                    Trans::kEndStream});
0483 }
0484 
0485 void testGlobalProducer::runTest() {
0486   auto testProd = std::make_shared<RunProd>();
0487 
0488   CPPUNIT_ASSERT(0 == testProd->m_count);
0489   testTransitions(testProd, {Trans::kGlobalBeginRun, Trans::kEvent, Trans::kGlobalEndRun});
0490 }
0491 
0492 void testGlobalProducer::runSummaryTest() {
0493   auto testProd = std::make_shared<RunSummaryProd>();
0494 
0495   CPPUNIT_ASSERT(0 == testProd->m_count);
0496   testTransitions(testProd, {Trans::kGlobalBeginRun, Trans::kEvent, Trans::kStreamEndRun, Trans::kGlobalEndRun});
0497 }
0498 
0499 void testGlobalProducer::lumiTest() {
0500   auto testProd = std::make_shared<LumiProd>();
0501 
0502   CPPUNIT_ASSERT(0 == testProd->m_count);
0503   testTransitions(testProd, {Trans::kGlobalBeginLuminosityBlock, Trans::kEvent, Trans::kGlobalEndLuminosityBlock});
0504 }
0505 
0506 void testGlobalProducer::lumiSummaryTest() {
0507   auto testProd = std::make_shared<LumiSummaryProd>();
0508 
0509   CPPUNIT_ASSERT(0 == testProd->m_count);
0510   testTransitions(testProd,
0511                   {Trans::kGlobalBeginLuminosityBlock,
0512                    Trans::kEvent,
0513                    Trans::kStreamEndLuminosityBlock,
0514                    Trans::kGlobalEndLuminosityBlock});
0515 }
0516 
0517 void testGlobalProducer::beginRunProdTest() {
0518   auto testProd = std::make_shared<BeginRunProd>();
0519 
0520   CPPUNIT_ASSERT(0 == testProd->m_count);
0521   testTransitions(testProd, {Trans::kGlobalBeginRun, Trans::kEvent});
0522 }
0523 
0524 void testGlobalProducer::beginLumiProdTest() {
0525   auto testProd = std::make_shared<BeginLumiProd>();
0526 
0527   CPPUNIT_ASSERT(0 == testProd->m_count);
0528   testTransitions(testProd, {Trans::kGlobalBeginLuminosityBlock, Trans::kEvent});
0529 }
0530 
0531 void testGlobalProducer::endRunProdTest() {
0532   auto testProd = std::make_shared<EndRunProd>();
0533 
0534   CPPUNIT_ASSERT(0 == testProd->m_count);
0535   testTransitions(testProd, {Trans::kGlobalEndRun, Trans::kEvent});
0536 }
0537 
0538 void testGlobalProducer::endLumiProdTest() {
0539   auto testProd = std::make_shared<EndLumiProd>();
0540 
0541   CPPUNIT_ASSERT(0 == testProd->m_count);
0542   testTransitions(testProd, {Trans::kGlobalEndLuminosityBlock, Trans::kEvent});
0543 }
0544 
0545 void testGlobalProducer::endRunSummaryProdTest() {
0546   auto testProd = std::make_shared<EndRunSummaryProd>();
0547 
0548   CPPUNIT_ASSERT(0 == testProd->m_count);
0549   testTransitions(
0550       testProd,
0551       {Trans::kGlobalEndRun, Trans::kEvent, Trans::kGlobalBeginRun, Trans::kStreamEndRun, Trans::kGlobalEndRun});
0552 }
0553 
0554 void testGlobalProducer::endLumiSummaryProdTest() {
0555   auto testProd = std::make_shared<EndLumiSummaryProd>();
0556 
0557   CPPUNIT_ASSERT(0 == testProd->m_count);
0558   testTransitions(testProd,
0559                   {Trans::kGlobalEndLuminosityBlock,
0560                    Trans::kEvent,
0561                    Trans::kGlobalBeginLuminosityBlock,
0562                    Trans::kStreamEndLuminosityBlock,
0563                    Trans::kGlobalEndLuminosityBlock});
0564 }