LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Disturbance_module.cc
Go to the documentation of this file.
1 
10 // framework libraries
15 #include "fhiclcpp/types/Atom.h"
16 
17 
18 namespace lar {
19  namespace example {
20 
34  class Disturbance: public art::EDProducer {
35  public:
36 
37  struct Config {
38 
40  fhicl::Name("NArtExceptions"),
41  fhicl::Comment("number of exceptions to throw")
42  };
43 
44  }; // struct Config
45 
47 
49  Disturbance(Parameters const& config);
50 
52  virtual void produce(art::Event&) override;
53 
54 
55  private:
56 
57  unsigned int fNArtExceptions;
58 
60  static void throwArtException();
61 
62  }; // class Disturbance
63 
64 
65  } // namespace example
66 } // namespace lar
67 
68 //------------------------------------------------------------------------------
70  : fNArtExceptions(config().NArtExceptions())
71  {}
72 
73 
74 //------------------------------------------------------------------------------
76 
77  //
78  // art::Exception
79  //
80  for (unsigned int i = 0; i < fNArtExceptions; ++i) {
81  try {
83  }
84  catch (art::Exception const&) {}
85  } // for
86 
87 } // lar::example::Disturbance::produce()
88 
89 
90 //------------------------------------------------------------------------------
92 
94  << "I want to annoy you.\n";
95 
96 } // lar::example::Disturbance::throwArtException()
97 
98 
99 //------------------------------------------------------------------------------
101 
102 
103 //------------------------------------------------------------------------------
fhicl::Atom< unsigned int > NArtExceptions
virtual void produce(art::Event &) override
Executes the iterations.
static void throwArtException()
Throws a std::out_of_range exception.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
LArSoft-specific namespace.
Disturbance(Parameters const &config)
Constructor.