WebEVD_module.cc
Go to the documentation of this file.
1 // Chris Backhouse - bckhouse@fnal.gov
2 
6 
10 
13 
14 namespace evd
15 {
16 
17 class WebEVD: public art::EDAnalyzer
18 {
19 public:
20  explicit WebEVD(const fhicl::ParameterSet& pset);
21 
22  void analyze(const art::Event& evt) override;
23  void endJob() override;
24 
25 protected:
27 
29 };
30 
32 
33 // ---------------------------------------------------------------------------
34 WebEVD::WebEVD(const fhicl::ParameterSet& pset)
35  : EDAnalyzer(pset)
36 {
37 }
38 
40 {
41  std::cout << "Ran out of events. Goodbye!" << std::endl;
42 }
43 
45 {
46  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(evt);
47  const Result res = fServer.serve(evt, fGeom.get(), detProp);
48 
49  switch(res.code){
50  case kNEXT:
51  std::cout << "Next clicked in GUI. Going to next event" << std::endl;
52  // nothing, allow art to proceed to next
53  return;
54 
55  case kPREV:
56  std::cout << "Prev clicked in GUI. Going to previous event" << std::endl;
57  // Because we will automatically increment by one
58  art::ServiceHandle<InputSeeker>()->seekToEvent(-2);
59  return;
60 
61  case kQUIT:
62  // TODO give fServer a chance to clean up
63  std::cout << "Quit clicked in GUI. Goodbye!" << std::endl;
64  exit(0);
65 
66  case kERROR:
67  std::cout << "Error. Quitting" << std::endl;
68  exit(1);
69 
70  case kSEEK:
71  std::cout << "User requested seek to " << res.run << ":"<< res.subrun << ":" << res.event << std::endl;
73  res.subrun,
74  res.event));
75  return;
76 
77  default:
78  std::cout << "Unhandled result code " << res.code << "!" << std::endl;
79  abort();
80  }
81 }
82 
83 } // namespace
T * get() const
Definition: ServiceHandle.h:63
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
art framework interface to geometry description
LArSoft includes.
Definition: InfoTransfer.h:33
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
void endJob() override
evd::WebEVDServer< art::Event > fServer
art::ServiceHandle< geo::Geometry > fGeom
EResult code
Definition: WebEVDServer.h:21
Result serve(const T &evt, const geo::GeometryCore *geom, const detinfo::DetectorPropertiesData &detprop)
TCEvent evt
Definition: DataStructs.cxx:7
WebEVD(const fhicl::ParameterSet &pset)
void analyze(const art::Event &evt) override
QTextStream & endl(QTextStream &s)