UnitTestClient_G

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#include <cmath>
#include <iomanip>
#include <iostream>

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/StreamID.h"

namespace edmtest {

  class UnitTestClient_G : public edm::global::EDAnalyzer<> {
  public:
    explicit UnitTestClient_G(edm::ParameterSet const&) {}

    void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
  };

  void UnitTestClient_G::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {
    if (!edm::isMessageProcessingSetUp()) {
      std::cerr << "??? It appears that Message Processing is not Set Up???\n\n";
    }

    double d = M_PI;
    edm::LogWarning("cat_A") << "Test of std::setprecision(p):"
                             << " Pi with precision 12 is " << std::setprecision(12) << d;

    for (int i = 0; i < 10; ++i) {
      edm::LogInfo("cat_B") << "\t\tEmit Info level message " << i + 1;
    }

    for (int i = 0; i < 15; ++i) {
      edm::LogWarning("cat_C") << "\t\tEmit Warning level message " << i + 1;
    }
  }

}  // namespace edmtest

using edmtest::UnitTestClient_G;
DEFINE_FWK_MODULE(UnitTestClient_G);