DetectorService.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 /// \brief A very simple service to remember what detector we're working in
3 /// \author Christopher Backhouse - bckhouse@caltech.edu
4 //////////////////////////////////////////////////////////////////////////
5 
6 #ifndef DETECTORSERVICE_H
7 #define DETECTORSERVICE_H
8 
12 
13 #include "NovaDAQConventions/DAQConventions.h"
14 
15 namespace ds
16 {
17  /// \brief A very simple service to remember what detector we're working in
18  ///
19  /// Not quite so simple as you might hope, given that a lot of people want to
20  /// know the detector in preBeginRun/beginRun/postBeginRun, for both normal
21  /// running and MC generation jobs. The trick of having people pass any Run
22  /// object they have handy resolves that.
24  {
25  public:
26  struct Params
27  {
28  // There are actually no configuration parameters
29  };
30 
31  // Allows 'nova --print-description' to work
33 
34  DetectorService(const Parameters& params,
36  virtual ~DetectorService() {};
37 
38  /// What detector are we in?
39  novadaq::cnv::DetId DetId() const {return fDetId;}
40  /// \brief If you have a Run object handy, please call this variant
41  ///
42  /// You may have won the race, and we haven't found out the detector yet,
43  /// but we can learn from your Run object.
45 
46  /// \brief Call this if you have definitive special knowledge (ie you're
47  /// the Geometry service)
49 
50  void preBeginRun(const art::Run& run);
51  void postBeginRun(const art::Run& run);
52 
53  protected:
54  void HandleRun(const art::Run& run);
55 
57  };
58 }
59 
61 
62 #endif
63 ////////////////////////////////////////////////////////////////////////
novadaq::cnv::DetId DetId() const
What detector are we in?
void SetDetector(novadaq::cnv::DetId det)
Call this if you have definitive special knowledge (ie you're the Geometry service) ...
virtual ~DetectorService()
A very simple service to remember what detector we're working in.
#define DECLARE_ART_SERVICE(svc, scope)
Definition: ServiceMacros.h:91
void HandleRun(const art::Run &run)
Definition: Run.h:31
void preBeginRun(const art::Run &run)
novadaq::cnv::DetId fDetId
A very simple service to remember what detector we're working in.
Definition: run.py:1
void postBeginRun(const art::Run &run)
DetectorService(const Parameters &params, art::ActivityRegistry &reg)