11 #include "art/Framework/Core/EDAnalyzer.h"
12 #include "art/Framework/Core/ModuleMacros.h"
13 #include "canvas/Utilities/Exception.h"
14 #include "messagefacility/MessageLogger/MessageLogger.h"
15 #include "fhiclcpp/types/Atom.h"
49 fhicl::Comment(
"whether to catch the std::bad_alloc we throw"),
55 fhicl::Comment(
"whether to catch the std::out_of_range we throw"),
61 fhicl::Comment(
"whether to catch the art::Exception we throw"),
73 virtual void analyze(art::Event
const&)
override;
99 : art::EDAnalyzer(config)
100 , fManageBadAlloc(config().ManageBadAlloc())
101 , fManageOutOfRange(config().ManageOutOfRange())
102 , fManageArtException(config().ManageArtException())
112 if (fManageBadAlloc) {
116 catch (std::bad_alloc
const&) {}
125 if (fManageOutOfRange) {
129 catch (std::out_of_range
const&) {}
138 if (fManageArtException) {
142 catch (art::Exception
const&) {}
154 std::vector<int> intData(5, 0);
157 for (
unsigned int i = 0; i < 10; ++i) {
158 mf::LogVerbatim(
"Exploder") <<
"Starting TOOR iteration #" << i;
161 intTotal += intData.at(i);
164 mf::LogVerbatim(
"Exploder") <<
"TOOR iterations completed.";
173 using OneMebibyte = std::array<unsigned char, 1048576U>;
175 std::vector<OneMebibyte> manyMebibytes;
178 mf::LogVerbatim(
"Exploder") <<
"Now allocating: " << manyMebibytes.max_size()
179 <<
" x " <<
sizeof(OneMebibyte) <<
" bytes";
180 manyMebibytes.resize(manyMebibytes.max_size());
188 throw art::Exception(art::errors::LogicError)
189 <<
"I hate the world and I am vengeful.\n";
Exploder(Parameters const &config)
Constructor.
static unsigned int throwOutOfRange()
Throws a std::length_error exception.
fhicl::Atom< bool > ManageArtException
fhicl::Atom< bool > ManageBadAlloc
virtual void analyze(art::Event const &) override
Executes the iterations.
BEGIN_PROLOG vertical distance to the surface Name
static void throwBadAlloc()
Throws a std::out_of_range exception.
art::EDAnalyzer::Table< Config > Parameters
fhicl::Atom< bool > ManageOutOfRange
static void throwArtException()
Throws a std::out_of_range exception.