Detector_service.cc
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 
7 
8 #include "SummaryData/RunData.h"
9 
12 
13 namespace ds
14 {
15  //------------------------------------------------------------
18  : fDetId(novadaq::cnv::kUNKNOWN_DET)
19  {
20  // Belt and braces. Maybe there's a case where the information becomes
21  // available at beginRun().
24  }
25 
26  //----------------------------------------------------------
28  {
29  HandleRun(run);
30  return fDetId;
31  }
32 
33  //----------------------------------------------------------
35  {
36  HandleRun(run);
37  }
38 
39  //----------------------------------------------------------
41  {
42  HandleRun(run);
43  }
44 
45  //----------------------------------------------------------
47  {
48  std::vector<art::Handle<sumdata::RunData>> rdcol;
49  run.getManyByType(rdcol);
50  if(!rdcol.empty()) fDetId = rdcol[0]->DetId();
51  }
52 
54 
55 }
56 ////////////////////////////////////////////////////////////////////////
novadaq::cnv::DetId DetId() const
What detector are we in?
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
A very simple service to remember what detector we&#39;re working in.
GlobalSignal< detail::SignalResponseType::LIFO, void(Run const &)> sPostBeginRun
void HandleRun(const art::Run &run)
Definition: Run.h:31
void preBeginRun(const art::Run &run)
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
novadaq::cnv::DetId fDetId
A very simple service to remember what detector we&#39;re working in.
Definition: run.py:1
void postBeginRun(const art::Run &run)
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
DetectorService(const Parameters &params, art::ActivityRegistry &reg)