File indexing completed on 2024-04-06 12:13:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0021 #include "FWCore/ParameterSet/interface/allowedValues.h"
0022 #include <csignal>
0023
0024 class SignallingAnalyzer : public edm::global::EDAnalyzer<> {
0025 public:
0026 SignallingAnalyzer(edm::ParameterSet const& iPSet) : m_signal(iPSet.getUntrackedParameter<std::string>("signal")) {}
0027
0028 void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const final {
0029 if (m_signal == "INT") {
0030 raise(SIGINT);
0031 }
0032 if (m_signal == "ABRT") {
0033 raise(SIGABRT);
0034 }
0035 if (m_signal == "SEGV") {
0036 raise(SIGSEGV);
0037 }
0038 if (m_signal == "TERM") {
0039 raise(SIGTERM);
0040 }
0041 }
0042
0043 static void fillDescriptions(edm::ConfigurationDescriptions& iConf) {
0044 edm::ParameterSetDescription desc;
0045 desc.ifValue(edm::ParameterDescription<std::string>("signal", "INT", false),
0046 edm::allowedValues<std::string>("INT", "ABRT", "SEGV", "TERM"))
0047 ->setComment("which signal to raise.");
0048 iConf.addDefault(desc);
0049 }
0050
0051 private:
0052 std::string const m_signal;
0053 };
0054
0055 DEFINE_FWK_MODULE(SignallingAnalyzer);