Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-04 04:34:58

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Integration
0004 // Class  :     TestServiceTwo
0005 //
0006 // Implementation:
0007 //     Service initially intended for testing behavior after exceptions.
0008 //     ExceptionThrowingProducer uses this and is in the same test plugin
0009 //     library and could be used to access the service if it was ever useful
0010 //     for debugging issues related to begin/end transitions.
0011 //
0012 // Original Author:  W. David Dagenhart
0013 //         Created:  13 March 2024
0014 
0015 #include "FWCore/Integration/plugins/TestServiceTwo.h"
0016 
0017 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0020 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0021 #include "FWCore/ServiceRegistry/interface/GlobalContext.h"
0022 #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
0023 #include "FWCore/ServiceRegistry/interface/ServiceMaker.h"
0024 #include "FWCore/ServiceRegistry/interface/StreamContext.h"
0025 #include "FWCore/Utilities/interface/TimeOfDay.h"
0026 
0027 #include <ostream>
0028 
0029 using edm::GlobalContext;
0030 using edm::ModuleCallingContext;
0031 using edm::StreamContext;
0032 
0033 namespace {
0034 
0035   class TimeStamper {
0036   public:
0037     TimeStamper(bool enable) : enabled_(enable) {}
0038 
0039     friend std::ostream& operator<<(std::ostream& out, TimeStamper const& timestamp) {
0040       if (timestamp.enabled_)
0041         out << std::setprecision(2) << edm::TimeOfDay() << "  ";
0042       return out;
0043     }
0044 
0045   private:
0046     bool enabled_;
0047   };
0048 
0049   const char* globalIndent = "    ";
0050   const char* globalModuleIndent = "        ";
0051   const char* streamIndent = "            ";
0052   const char* streamModuleIndent = "                ";
0053 }  // namespace
0054 
0055 namespace edmtest {
0056 
0057   TestServiceTwo::TestServiceTwo(edm::ParameterSet const& iPS, edm::ActivityRegistry& iRegistry)
0058       : verbose_(iPS.getUntrackedParameter<bool>("verbose")),
0059         printTimestamps_(iPS.getUntrackedParameter<bool>("printTimestamps")) {
0060     iRegistry.watchPreBeginProcessBlock(this, &TestServiceTwo::preBeginProcessBlock);
0061     iRegistry.watchPreEndProcessBlock(this, &TestServiceTwo::preEndProcessBlock);
0062 
0063     iRegistry.watchPreStreamBeginLumi(this, &TestServiceTwo::preStreamBeginLumi);
0064     iRegistry.watchPostStreamBeginLumi(this, &TestServiceTwo::postStreamBeginLumi);
0065     iRegistry.watchPreStreamEndLumi(this, &TestServiceTwo::preStreamEndLumi);
0066     iRegistry.watchPostStreamEndLumi(this, &TestServiceTwo::postStreamEndLumi);
0067 
0068     iRegistry.watchPreModuleStreamBeginLumi(this, &TestServiceTwo::preModuleStreamBeginLumi);
0069     iRegistry.watchPostModuleStreamBeginLumi(this, &TestServiceTwo::postModuleStreamBeginLumi);
0070     iRegistry.watchPreModuleStreamEndLumi(this, &TestServiceTwo::preModuleStreamEndLumi);
0071     iRegistry.watchPostModuleStreamEndLumi(this, &TestServiceTwo::postModuleStreamEndLumi);
0072 
0073     iRegistry.watchPreGlobalBeginLumi(this, &TestServiceTwo::preGlobalBeginLumi);
0074     iRegistry.watchPostGlobalBeginLumi(this, &TestServiceTwo::postGlobalBeginLumi);
0075     iRegistry.watchPreGlobalEndLumi(this, &TestServiceTwo::preGlobalEndLumi);
0076     iRegistry.watchPostGlobalEndLumi(this, &TestServiceTwo::postGlobalEndLumi);
0077 
0078     iRegistry.watchPreModuleGlobalBeginLumi(this, &TestServiceTwo::preModuleGlobalBeginLumi);
0079     iRegistry.watchPostModuleGlobalBeginLumi(this, &TestServiceTwo::postModuleGlobalBeginLumi);
0080     iRegistry.watchPreModuleGlobalEndLumi(this, &TestServiceTwo::preModuleGlobalEndLumi);
0081     iRegistry.watchPostModuleGlobalEndLumi(this, &TestServiceTwo::postModuleGlobalEndLumi);
0082 
0083     iRegistry.watchPreGlobalWriteLumi(this, &TestServiceTwo::preGlobalWriteLumi);
0084     iRegistry.watchPostGlobalWriteLumi(this, &TestServiceTwo::postGlobalWriteLumi);
0085 
0086     iRegistry.watchPreStreamBeginRun(this, &TestServiceTwo::preStreamBeginRun);
0087     iRegistry.watchPostStreamBeginRun(this, &TestServiceTwo::postStreamBeginRun);
0088     iRegistry.watchPreStreamEndRun(this, &TestServiceTwo::preStreamEndRun);
0089     iRegistry.watchPostStreamEndRun(this, &TestServiceTwo::postStreamEndRun);
0090 
0091     iRegistry.watchPreModuleStreamBeginRun(this, &TestServiceTwo::preModuleStreamBeginRun);
0092     iRegistry.watchPostModuleStreamBeginRun(this, &TestServiceTwo::postModuleStreamBeginRun);
0093     iRegistry.watchPreModuleStreamEndRun(this, &TestServiceTwo::preModuleStreamEndRun);
0094     iRegistry.watchPostModuleStreamEndRun(this, &TestServiceTwo::postModuleStreamEndRun);
0095 
0096     iRegistry.watchPreGlobalBeginRun(this, &TestServiceTwo::preGlobalBeginRun);
0097     iRegistry.watchPostGlobalBeginRun(this, &TestServiceTwo::postGlobalBeginRun);
0098     iRegistry.watchPreGlobalEndRun(this, &TestServiceTwo::preGlobalEndRun);
0099     iRegistry.watchPostGlobalEndRun(this, &TestServiceTwo::postGlobalEndRun);
0100 
0101     iRegistry.watchPreModuleGlobalBeginRun(this, &TestServiceTwo::preModuleGlobalBeginRun);
0102     iRegistry.watchPostModuleGlobalBeginRun(this, &TestServiceTwo::postModuleGlobalBeginRun);
0103     iRegistry.watchPreModuleGlobalEndRun(this, &TestServiceTwo::preModuleGlobalEndRun);
0104     iRegistry.watchPostModuleGlobalEndRun(this, &TestServiceTwo::postModuleGlobalEndRun);
0105 
0106     iRegistry.watchPreGlobalWriteRun(this, &TestServiceTwo::preGlobalWriteRun);
0107     iRegistry.watchPostGlobalWriteRun(this, &TestServiceTwo::postGlobalWriteRun);
0108   }
0109 
0110   void TestServiceTwo::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0111     edm::ParameterSetDescription desc;
0112     desc.addUntracked<bool>("verbose", false)->setComment("Prints LogAbsolute messages for every transition");
0113     desc.addUntracked<bool>("printTimestamps", false)
0114         ->setComment("Include a time stamp in message printed for every transition");
0115     descriptions.add("TestServiceTwo", desc);
0116   }
0117 
0118   void TestServiceTwo::preBeginProcessBlock(GlobalContext const&) {
0119     if (verbose_) {
0120       edm::LogAbsolute("TestServiceTwo") << "test message from TestServiceTwo::preBeginProcessBlock";
0121     }
0122   }
0123 
0124   void TestServiceTwo::preEndProcessBlock(GlobalContext const&) {
0125     if (verbose_) {
0126       edm::LogAbsolute("TestServiceTwo") << "test message from TestServiceTwo::preEndProcessBlock";
0127     }
0128   }
0129 
0130   void TestServiceTwo::preStreamBeginLumi(StreamContext const& sc) {
0131     ++nPreStreamBeginLumi_;
0132     if (verbose_) {
0133       edm::LogAbsolute out("TestServiceTwo");
0134       out << streamIndent << "TestServiceTwo::preStreamBeginLumi " << TimeStamper(printTimestamps_)
0135           << " stream = " << sc.streamID() << " run = " << sc.eventID().run()
0136           << " lumi = " << sc.eventID().luminosityBlock();
0137     }
0138   }
0139 
0140   void TestServiceTwo::postStreamBeginLumi(StreamContext const& sc) {
0141     ++nPostStreamBeginLumi_;
0142     if (verbose_) {
0143       edm::LogAbsolute out("TestServiceTwo");
0144       out << streamIndent << "TestServiceTwo::postStreamBeginLumi " << TimeStamper(printTimestamps_)
0145           << " stream = " << sc.streamID() << " run = " << sc.eventID().run()
0146           << " lumi = " << sc.eventID().luminosityBlock();
0147     }
0148   }
0149 
0150   void TestServiceTwo::preStreamEndLumi(StreamContext const& sc) {
0151     ++nPreStreamEndLumi_;
0152     if (verbose_) {
0153       edm::LogAbsolute out("TestServiceTwo");
0154       out << streamIndent << "TestServiceTwo::preStreamEndLumi " << TimeStamper(printTimestamps_)
0155           << " stream = " << sc.streamID() << " run = " << sc.eventID().run()
0156           << " lumi = " << sc.eventID().luminosityBlock();
0157     }
0158   }
0159 
0160   void TestServiceTwo::postStreamEndLumi(StreamContext const& sc) {
0161     ++nPostStreamEndLumi_;
0162     if (verbose_) {
0163       edm::LogAbsolute out("TestServiceTwo");
0164       out << streamIndent << "TestServiceTwo::postStreamEndLumi " << TimeStamper(printTimestamps_)
0165           << " stream = " << sc.streamID() << " run = " << sc.eventID().run()
0166           << " lumi = " << sc.eventID().luminosityBlock();
0167     }
0168   }
0169 
0170   void TestServiceTwo::preModuleStreamBeginLumi(StreamContext const& sc, ModuleCallingContext const& mcc) {
0171     ++nPreModuleStreamBeginLumi_;
0172     if (verbose_) {
0173       edm::LogAbsolute out("TestServiceTwo");
0174       out << streamModuleIndent << "TestServiceTwo::preModuleStreamBeginLumi " << TimeStamper(printTimestamps_)
0175           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0176           << " run = " << sc.eventID().run() << " lumi = " << sc.eventID().luminosityBlock();
0177     }
0178   }
0179 
0180   void TestServiceTwo::postModuleStreamBeginLumi(StreamContext const& sc, ModuleCallingContext const& mcc) {
0181     ++nPostModuleStreamBeginLumi_;
0182     if (verbose_) {
0183       edm::LogAbsolute out("TestServiceTwo");
0184       out << streamModuleIndent << "TestServiceTwo::postModuleStreamBeginLumi " << TimeStamper(printTimestamps_)
0185           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0186           << " run = " << sc.eventID().run() << " lumi = " << sc.eventID().luminosityBlock();
0187     }
0188   }
0189 
0190   void TestServiceTwo::preModuleStreamEndLumi(StreamContext const& sc, ModuleCallingContext const& mcc) {
0191     ++nPreModuleStreamEndLumi_;
0192     if (verbose_) {
0193       edm::LogAbsolute out("TestServiceTwo");
0194       out << streamModuleIndent << "TestServiceTwo::preModuleStreamEndLumi " << TimeStamper(printTimestamps_)
0195           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0196           << " run = " << sc.eventID().run() << " lumi = " << sc.eventID().luminosityBlock();
0197     }
0198   }
0199 
0200   void TestServiceTwo::postModuleStreamEndLumi(StreamContext const& sc, ModuleCallingContext const& mcc) {
0201     ++nPostModuleStreamEndLumi_;
0202     if (verbose_) {
0203       edm::LogAbsolute out("TestServiceTwo");
0204       out << streamModuleIndent << "TestServiceTwo::postModuleStreamEndLumi " << TimeStamper(printTimestamps_)
0205           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0206           << " run = " << sc.eventID().run() << " lumi = " << sc.eventID().luminosityBlock();
0207     }
0208   }
0209 
0210   void TestServiceTwo::preGlobalBeginLumi(GlobalContext const& gc) {
0211     ++nPreGlobalBeginLumi_;
0212     if (verbose_) {
0213       edm::LogAbsolute out("TestServiceTwo");
0214       out << globalIndent << "TestServiceTwo::preGlobalBeginLumi " << TimeStamper(printTimestamps_)
0215           << " run = " << gc.luminosityBlockID().run() << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0216     }
0217   }
0218 
0219   void TestServiceTwo::postGlobalBeginLumi(GlobalContext const& gc) {
0220     ++nPostGlobalBeginLumi_;
0221     if (verbose_) {
0222       edm::LogAbsolute out("TestServiceTwo");
0223       out << globalIndent << "TestServiceTwo::postGlobalBeginLumi " << TimeStamper(printTimestamps_)
0224           << " run = " << gc.luminosityBlockID().run() << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0225     }
0226   }
0227 
0228   void TestServiceTwo::preGlobalEndLumi(GlobalContext const& gc) {
0229     ++nPreGlobalEndLumi_;
0230     if (verbose_) {
0231       edm::LogAbsolute out("TestServiceTwo");
0232       out << globalIndent << "TestServiceTwo::preGlobalEndLumi " << TimeStamper(printTimestamps_)
0233           << " run = " << gc.luminosityBlockID().run() << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0234     }
0235   }
0236 
0237   void TestServiceTwo::postGlobalEndLumi(GlobalContext const& gc) {
0238     ++nPostGlobalEndLumi_;
0239     if (verbose_) {
0240       edm::LogAbsolute out("TestServiceTwo");
0241       out << globalIndent << "TestServiceTwo::postGlobalEndLumi " << TimeStamper(printTimestamps_)
0242           << " run = " << gc.luminosityBlockID().run() << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0243     }
0244   }
0245 
0246   void TestServiceTwo::preModuleGlobalBeginLumi(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0247     ++nPreModuleGlobalBeginLumi_;
0248     if (verbose_) {
0249       edm::LogAbsolute out("TestServiceTwo");
0250       out << globalModuleIndent << "TestServiceTwo::preModuleGlobalBeginLumi " << TimeStamper(printTimestamps_)
0251           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run()
0252           << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0253     }
0254   }
0255 
0256   void TestServiceTwo::postModuleGlobalBeginLumi(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0257     ++nPostModuleGlobalBeginLumi_;
0258     if (verbose_) {
0259       edm::LogAbsolute out("TestServiceTwo");
0260       out << globalModuleIndent << "TestServiceTwo::postModuleGlobalBeginLumi " << TimeStamper(printTimestamps_)
0261           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run()
0262           << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0263     }
0264   }
0265 
0266   void TestServiceTwo::preModuleGlobalEndLumi(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0267     ++nPreModuleGlobalEndLumi_;
0268     if (verbose_) {
0269       edm::LogAbsolute out("TestServiceTwo");
0270       out << globalModuleIndent << "TestServiceTwo::preModuleGlobalEndLumi " << TimeStamper(printTimestamps_)
0271           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run()
0272           << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0273     }
0274   }
0275 
0276   void TestServiceTwo::postModuleGlobalEndLumi(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0277     ++nPostModuleGlobalEndLumi_;
0278     if (verbose_) {
0279       edm::LogAbsolute out("TestServiceTwo");
0280       out << globalModuleIndent << "TestServiceTwo::postModuleGlobalEndLumi " << TimeStamper(printTimestamps_)
0281           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run()
0282           << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0283     }
0284   }
0285 
0286   void TestServiceTwo::preGlobalWriteLumi(GlobalContext const& gc) {
0287     ++nPreGlobalWriteLumi_;
0288     if (verbose_) {
0289       edm::LogAbsolute out("TestServiceTwo");
0290       out << globalIndent << "TestServiceTwo::preGlobalWriteLumi " << TimeStamper(printTimestamps_)
0291           << " run = " << gc.luminosityBlockID().run() << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0292     }
0293   }
0294 
0295   void TestServiceTwo::postGlobalWriteLumi(GlobalContext const& gc) {
0296     ++nPostGlobalWriteLumi_;
0297     if (verbose_) {
0298       edm::LogAbsolute out("TestServiceTwo");
0299       out << globalIndent << "TestServiceTwo::postGlobalWriteLumi " << TimeStamper(printTimestamps_)
0300           << " run = " << gc.luminosityBlockID().run() << " lumi = " << gc.luminosityBlockID().luminosityBlock();
0301     }
0302   }
0303 
0304   void TestServiceTwo::preStreamBeginRun(StreamContext const& sc) {
0305     ++nPreStreamBeginRun_;
0306     if (verbose_) {
0307       edm::LogAbsolute out("TestServiceTwo");
0308       out << streamIndent << "TestServiceTwo::preStreamBeginRun " << TimeStamper(printTimestamps_)
0309           << " stream = " << sc.streamID() << " run = " << sc.eventID().run();
0310     }
0311   }
0312 
0313   void TestServiceTwo::postStreamBeginRun(StreamContext const& sc) {
0314     ++nPostStreamBeginRun_;
0315     if (verbose_) {
0316       edm::LogAbsolute out("TestServiceTwo");
0317       out << streamIndent << "TestServiceTwo::postStreamBeginRun " << TimeStamper(printTimestamps_)
0318           << " stream = " << sc.streamID() << " run = " << sc.eventID().run();
0319     }
0320   }
0321 
0322   void TestServiceTwo::preStreamEndRun(StreamContext const& sc) {
0323     ++nPreStreamEndRun_;
0324     if (verbose_) {
0325       edm::LogAbsolute out("TestServiceTwo");
0326       out << streamIndent << "TestServiceTwo::preStreamEndRun " << TimeStamper(printTimestamps_)
0327           << " stream = " << sc.streamID() << " run = " << sc.eventID().run();
0328     }
0329   }
0330 
0331   void TestServiceTwo::postStreamEndRun(StreamContext const& sc) {
0332     ++nPostStreamEndRun_;
0333     if (verbose_) {
0334       edm::LogAbsolute out("TestServiceTwo");
0335       out << streamIndent << "TestServiceTwo::postStreamEndRun " << TimeStamper(printTimestamps_)
0336           << " stream = " << sc.streamID() << " run = " << sc.eventID().run();
0337     }
0338   }
0339 
0340   void TestServiceTwo::preModuleStreamBeginRun(StreamContext const& sc, ModuleCallingContext const& mcc) {
0341     ++nPreModuleStreamBeginRun_;
0342     if (verbose_) {
0343       edm::LogAbsolute out("TestServiceTwo");
0344       out << streamModuleIndent << "TestServiceTwo::preModuleStreamBeginRun " << TimeStamper(printTimestamps_)
0345           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0346           << " run = " << sc.eventID().run();
0347     }
0348   }
0349 
0350   void TestServiceTwo::postModuleStreamBeginRun(StreamContext const& sc, ModuleCallingContext const& mcc) {
0351     ++nPostModuleStreamBeginRun_;
0352     if (verbose_) {
0353       edm::LogAbsolute out("TestServiceTwo");
0354       out << streamModuleIndent << "TestServiceTwo::postModuleStreamBeginRun " << TimeStamper(printTimestamps_)
0355           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0356           << " run = " << sc.eventID().run();
0357     }
0358   }
0359 
0360   void TestServiceTwo::preModuleStreamEndRun(StreamContext const& sc, ModuleCallingContext const& mcc) {
0361     ++nPreModuleStreamEndRun_;
0362     if (verbose_) {
0363       edm::LogAbsolute out("TestServiceTwo");
0364       out << streamModuleIndent << "TestServiceTwo::preModuleStreamEndRun " << TimeStamper(printTimestamps_)
0365           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0366           << " run = " << sc.eventID().run();
0367     }
0368   }
0369 
0370   void TestServiceTwo::postModuleStreamEndRun(StreamContext const& sc, ModuleCallingContext const& mcc) {
0371     ++nPostModuleStreamEndRun_;
0372     if (verbose_) {
0373       edm::LogAbsolute out("TestServiceTwo");
0374       out << streamModuleIndent << "TestServiceTwo::postModuleStreamEndRun " << TimeStamper(printTimestamps_)
0375           << " stream = " << sc.streamID() << " label = " << mcc.moduleDescription()->moduleLabel()
0376           << " run = " << sc.eventID().run();
0377     }
0378   }
0379 
0380   void TestServiceTwo::preGlobalBeginRun(GlobalContext const& gc) {
0381     ++nPreGlobalBeginRun_;
0382     if (verbose_) {
0383       edm::LogAbsolute out("TestServiceTwo");
0384       out << globalIndent << "TestServiceTwo::preGlobalBeginRun " << TimeStamper(printTimestamps_)
0385           << " run = " << gc.luminosityBlockID().run();
0386     }
0387   }
0388 
0389   void TestServiceTwo::postGlobalBeginRun(GlobalContext const& gc) {
0390     ++nPostGlobalBeginRun_;
0391     if (verbose_) {
0392       edm::LogAbsolute out("TestServiceTwo");
0393       out << globalIndent << "TestServiceTwo::postGlobalBeginRun " << TimeStamper(printTimestamps_)
0394           << " run = " << gc.luminosityBlockID().run();
0395     }
0396   }
0397 
0398   void TestServiceTwo::preGlobalEndRun(GlobalContext const& gc) {
0399     ++nPreGlobalEndRun_;
0400     if (verbose_) {
0401       edm::LogAbsolute out("TestServiceTwo");
0402       out << globalIndent << "TestServiceTwo::preGlobalEndRun " << TimeStamper(printTimestamps_)
0403           << " run = " << gc.luminosityBlockID().run();
0404     }
0405   }
0406 
0407   void TestServiceTwo::postGlobalEndRun(GlobalContext const& gc) {
0408     ++nPostGlobalEndRun_;
0409     if (verbose_) {
0410       edm::LogAbsolute out("TestServiceTwo");
0411       out << globalIndent << "TestServiceTwo::postGlobalEndRun " << TimeStamper(printTimestamps_)
0412           << " run = " << gc.luminosityBlockID().run();
0413     }
0414   }
0415 
0416   void TestServiceTwo::preModuleGlobalBeginRun(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0417     ++nPreModuleGlobalBeginRun_;
0418     if (verbose_) {
0419       edm::LogAbsolute out("TestServiceTwo");
0420       out << globalModuleIndent << "TestServiceTwo::preModuleGlobalBeginRun " << TimeStamper(printTimestamps_)
0421           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run();
0422     }
0423   }
0424 
0425   void TestServiceTwo::postModuleGlobalBeginRun(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0426     ++nPostModuleGlobalBeginRun_;
0427     if (verbose_) {
0428       edm::LogAbsolute out("TestServiceTwo");
0429       out << globalModuleIndent << "TestServiceTwo::postModuleGlobalBeginRun " << TimeStamper(printTimestamps_)
0430           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run();
0431     }
0432   }
0433 
0434   void TestServiceTwo::preModuleGlobalEndRun(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0435     ++nPreModuleGlobalEndRun_;
0436     if (verbose_) {
0437       edm::LogAbsolute out("TestServiceTwo");
0438       out << globalModuleIndent << "TestServiceTwo::preModuleGlobalEndRun " << TimeStamper(printTimestamps_)
0439           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run();
0440     }
0441   }
0442 
0443   void TestServiceTwo::postModuleGlobalEndRun(GlobalContext const& gc, ModuleCallingContext const& mcc) {
0444     ++nPostModuleGlobalEndRun_;
0445     if (verbose_) {
0446       edm::LogAbsolute out("TestServiceTwo");
0447       out << globalModuleIndent << "TestServiceTwo::postModuleGlobalEndRun " << TimeStamper(printTimestamps_)
0448           << " label = " << mcc.moduleDescription()->moduleLabel() << " run = " << gc.luminosityBlockID().run();
0449     }
0450   }
0451 
0452   void TestServiceTwo::preGlobalWriteRun(GlobalContext const& gc) {
0453     ++nPreGlobalWriteRun_;
0454     if (verbose_) {
0455       edm::LogAbsolute out("TestServiceTwo");
0456       out << globalIndent << "TestServiceTwo::preGlobalWriteRun " << TimeStamper(printTimestamps_)
0457           << " run = " << gc.luminosityBlockID().run();
0458     }
0459   }
0460 
0461   void TestServiceTwo::postGlobalWriteRun(GlobalContext const& gc) {
0462     ++nPostGlobalWriteRun_;
0463     if (verbose_) {
0464       edm::LogAbsolute out("TestServiceTwo");
0465       out << globalIndent << "TestServiceTwo::postGlobalWriteRun " << TimeStamper(printTimestamps_)
0466           << " run = " << gc.luminosityBlockID().run();
0467     }
0468   }
0469 
0470   unsigned int TestServiceTwo::nPreStreamBeginLumi() const { return nPreStreamBeginLumi_.load(); }
0471   unsigned int TestServiceTwo::nPostStreamBeginLumi() const { return nPostStreamBeginLumi_.load(); }
0472   unsigned int TestServiceTwo::nPreStreamEndLumi() const { return nPreStreamEndLumi_.load(); }
0473   unsigned int TestServiceTwo::nPostStreamEndLumi() const { return nPostStreamEndLumi_.load(); }
0474 
0475   unsigned int TestServiceTwo::nPreModuleStreamBeginLumi() const { return nPreModuleStreamBeginLumi_.load(); }
0476   unsigned int TestServiceTwo::nPostModuleStreamBeginLumi() const { return nPostModuleStreamBeginLumi_.load(); }
0477   unsigned int TestServiceTwo::nPreModuleStreamEndLumi() const { return nPreModuleStreamEndLumi_.load(); }
0478   unsigned int TestServiceTwo::nPostModuleStreamEndLumi() const { return nPostModuleStreamEndLumi_.load(); }
0479 
0480   unsigned int TestServiceTwo::nPreGlobalBeginLumi() const { return nPreGlobalBeginLumi_.load(); }
0481   unsigned int TestServiceTwo::nPostGlobalBeginLumi() const { return nPostGlobalBeginLumi_.load(); }
0482   unsigned int TestServiceTwo::nPreGlobalEndLumi() const { return nPreGlobalEndLumi_.load(); }
0483   unsigned int TestServiceTwo::nPostGlobalEndLumi() const { return nPostGlobalEndLumi_.load(); }
0484 
0485   unsigned int TestServiceTwo::nPreModuleGlobalBeginLumi() const { return nPreModuleGlobalBeginLumi_.load(); }
0486   unsigned int TestServiceTwo::nPostModuleGlobalBeginLumi() const { return nPostModuleGlobalBeginLumi_.load(); }
0487   unsigned int TestServiceTwo::nPreModuleGlobalEndLumi() const { return nPreModuleGlobalEndLumi_.load(); }
0488   unsigned int TestServiceTwo::nPostModuleGlobalEndLumi() const { return nPostModuleGlobalEndLumi_.load(); }
0489 
0490   unsigned int TestServiceTwo::nPreGlobalWriteLumi() const { return nPreGlobalWriteLumi_.load(); }
0491   unsigned int TestServiceTwo::nPostGlobalWriteLumi() const { return nPostGlobalWriteLumi_.load(); }
0492 
0493   unsigned int TestServiceTwo::nPreStreamBeginRun() const { return nPreStreamBeginRun_.load(); }
0494   unsigned int TestServiceTwo::nPostStreamBeginRun() const { return nPostStreamBeginRun_.load(); }
0495   unsigned int TestServiceTwo::nPreStreamEndRun() const { return nPreStreamEndRun_.load(); }
0496   unsigned int TestServiceTwo::nPostStreamEndRun() const { return nPostStreamEndRun_.load(); }
0497 
0498   unsigned int TestServiceTwo::nPreModuleStreamBeginRun() const { return nPreModuleStreamBeginRun_.load(); }
0499   unsigned int TestServiceTwo::nPostModuleStreamBeginRun() const { return nPostModuleStreamBeginRun_.load(); }
0500   unsigned int TestServiceTwo::nPreModuleStreamEndRun() const { return nPreModuleStreamEndRun_.load(); }
0501   unsigned int TestServiceTwo::nPostModuleStreamEndRun() const { return nPostModuleStreamEndRun_.load(); }
0502 
0503   unsigned int TestServiceTwo::nPreGlobalBeginRun() const { return nPreGlobalBeginRun_.load(); }
0504   unsigned int TestServiceTwo::nPostGlobalBeginRun() const { return nPostGlobalBeginRun_.load(); }
0505   unsigned int TestServiceTwo::nPreGlobalEndRun() const { return nPreGlobalEndRun_.load(); }
0506   unsigned int TestServiceTwo::nPostGlobalEndRun() const { return nPostGlobalEndRun_.load(); }
0507 
0508   unsigned int TestServiceTwo::nPreModuleGlobalBeginRun() const { return nPreModuleGlobalBeginRun_.load(); }
0509   unsigned int TestServiceTwo::nPostModuleGlobalBeginRun() const { return nPostModuleGlobalBeginRun_.load(); }
0510   unsigned int TestServiceTwo::nPreModuleGlobalEndRun() const { return nPreModuleGlobalEndRun_.load(); }
0511   unsigned int TestServiceTwo::nPostModuleGlobalEndRun() const { return nPostModuleGlobalEndRun_.load(); }
0512 
0513   unsigned int TestServiceTwo::nPreGlobalWriteRun() const { return nPreGlobalWriteRun_.load(); }
0514   unsigned int TestServiceTwo::nPostGlobalWriteRun() const { return nPostGlobalWriteRun_.load(); }
0515 }  // namespace edmtest
0516 
0517 using edmtest::TestServiceTwo;
0518 DEFINE_FWK_SERVICE(TestServiceTwo);