Public Member Functions | Private Member Functions | List of all members
arttest::FPCTest Class Reference
Inheritance diagram for arttest::FPCTest:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 FPCTest (fhicl::ParameterSet const &)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void analyze (Event const &)
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 31 of file FPCTest_module.cc.

Constructor & Destructor Documentation

arttest::FPCTest::FPCTest ( fhicl::ParameterSet const &  p)
explicit

Definition at line 39 of file FPCTest_module.cc.

39  : EDAnalyzer{p}
40  {
41  // Install the SIGFPE handler.
42  struct sigaction act;
43  memset(&act, 0, sizeof(act));
44  act.sa_sigaction = handle_sigfpe;
45  act.sa_flags = SA_RESTART;
46  if (sigaction(SIGFPE, &act, 0) != 0) {
47  perror("sigaction failed");
48  throw runtime_error("cannot install sigaction signal handler");
49  }
50  // Block the floating point exception signal SIGFPE.
51  // We need this to be done in the main thread early
52  // so that it is blocked in all threads started by tbb.
53  sigset_t newset;
54  sigemptyset(&newset);
55  sigaddset(&newset, SIGFPE);
56  pthread_sigmask(SIG_BLOCK, &newset, 0);
57  }
p
Definition: test.py:223
void handle_sigfpe(int, siginfo_t *, void *)

Member Function Documentation

void arttest::FPCTest::analyze ( Event const &  e)
privatevirtual

Implements art::EDAnalyzer.

Definition at line 60 of file FPCTest_module.cc.

61  {
62  double const x{1.0};
63  double const y{DBL_MAX};
64  if (e.id().event() == 2) {
65  // Allow the floating point exception signal SIGFPE.
66  sigset_t newset;
67  sigemptyset(&newset);
68  sigaddset(&newset, SIGFPE);
69  pthread_sigmask(SIG_UNBLOCK, &newset, 0);
70  // Show the variable values.
71  mf::LogVerbatim("FPExceptions") << "\n\t\tx = " << x;
72  mf::LogVerbatim("FPExceptions") << "\t\ty = " << y << " (DBL_MAX)";
73  // DivideByZero
74  mf::LogVerbatim("FPExceptions") << "\t\tForce DivideByZero: a = x/zero";
75  double const a{divit(x, 0)};
76  mf::LogVerbatim("FPExceptions") << "\t\ta = " << a;
77  // Invalid
78  mf::LogVerbatim("FPExceptions") << "\t\tForce Invalid: b = log(-1.0)";
79  double const b{log(-1.0)};
80  mf::LogVerbatim("FPExceptions") << "\t\tb = " << b;
81  // Overflow (actually precision)
82  mf::LogVerbatim("FPExceptions") << "\t\tForce Overflow: c = y*y";
83  double const c{multit(y, y)};
84  mf::LogVerbatim("FPExceptions") << "\t\tc = " << c;
85  // Underflow (actually precision)
86  mf::LogVerbatim("FPExceptions") << "\t\tForce Underflow: d = x/y";
87  double const d{divit(x, y)};
88  mf::LogVerbatim("FPExceptions") << "\t\td = " << d;
89  abort();
90  }
91  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
double multit(double x, double y)
Definition: fpc_utils.cc:11
const double e
const double a
static bool * b
Definition: config.cpp:1043
list x
Definition: train.py:276
double divit(double x, double y)
Definition: fpc_utils.cc:4

The documentation for this class was generated from the following file: