Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ds::DetectorService Class Reference

A very simple service to remember what detector we're working in. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/CMap/service/DetectorService.h"

Classes

struct  Params
 

Public Types

using Parameters = art::ServiceTable< Params >
 

Public Member Functions

 DetectorService (const Parameters &params, art::ActivityRegistry &reg)
 
virtual ~DetectorService ()
 
novadaq::cnv::DetId DetId () const
 What detector are we in? More...
 
novadaq::cnv::DetId DetId (const art::Run &run)
 If you have a Run object handy, please call this variant. More...
 
void SetDetector (novadaq::cnv::DetId det)
 Call this if you have definitive special knowledge (ie you're the Geometry service) More...
 
void preBeginRun (const art::Run &run)
 
void postBeginRun (const art::Run &run)
 

Protected Member Functions

void HandleRun (const art::Run &run)
 

Protected Attributes

novadaq::cnv::DetId fDetId
 

Detailed Description

A very simple service to remember what detector we're working in.

Not quite so simple as you might hope, given that a lot of people want to know the detector in preBeginRun/beginRun/postBeginRun, for both normal running and MC generation jobs. The trick of having people pass any Run object they have handy resolves that.

Definition at line 23 of file DetectorService.h.

Member Typedef Documentation

Definition at line 32 of file DetectorService.h.

Constructor & Destructor Documentation

ds::DetectorService::DetectorService ( const Parameters params,
art::ActivityRegistry reg 
)

Definition at line 16 of file Detector_service.cc.

References postBeginRun(), preBeginRun(), art::ActivityRegistry::sPostBeginRun, and art::ActivityRegistry::sPreBeginRun.

19  {
20  // Belt and braces. Maybe there's a case where the information becomes
21  // available at beginRun().
24  }
GlobalSignal< detail::SignalResponseType::LIFO, void(Run const &)> sPostBeginRun
void preBeginRun(const art::Run &run)
novadaq::cnv::DetId fDetId
void postBeginRun(const art::Run &run)
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
virtual ds::DetectorService::~DetectorService ( )
inlinevirtual

Definition at line 36 of file DetectorService.h.

36 {};

Member Function Documentation

novadaq::cnv::DetId ds::DetectorService::DetId ( ) const
inline
novadaq::cnv::DetId ds::DetectorService::DetId ( const art::Run run)

If you have a Run object handy, please call this variant.

You may have won the race, and we haven't found out the detector yet, but we can learn from your Run object.

Definition at line 27 of file Detector_service.cc.

References fDetId, and HandleRun().

28  {
29  HandleRun(run);
30  return fDetId;
31  }
void HandleRun(const art::Run &run)
novadaq::cnv::DetId fDetId
void ds::DetectorService::HandleRun ( const art::Run run)
protected

Definition at line 46 of file Detector_service.cc.

References DEFINE_ART_SERVICE, DetId(), fDetId, and art::DataViewImpl::getManyByType().

Referenced by DetId(), postBeginRun(), preBeginRun(), and SetDetector().

47  {
48  std::vector<art::Handle<sumdata::RunData>> rdcol;
49  run.getManyByType(rdcol);
50  if(!rdcol.empty()) fDetId = rdcol[0]->DetId();
51  }
novadaq::cnv::DetId DetId() const
What detector are we in?
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
novadaq::cnv::DetId fDetId
void ds::DetectorService::postBeginRun ( const art::Run run)

Definition at line 40 of file Detector_service.cc.

References HandleRun().

Referenced by DetectorService(), and SetDetector().

41  {
42  HandleRun(run);
43  }
void HandleRun(const art::Run &run)
void ds::DetectorService::preBeginRun ( const art::Run run)

Definition at line 34 of file Detector_service.cc.

References HandleRun().

Referenced by DetectorService(), and SetDetector().

35  {
36  HandleRun(run);
37  }
void HandleRun(const art::Run &run)
void ds::DetectorService::SetDetector ( novadaq::cnv::DetId  det)
inline

Call this if you have definitive special knowledge (ie you're the Geometry service)

Definition at line 48 of file DetectorService.h.

References fillBadChanDBTables::det, fDetId, HandleRun(), postBeginRun(), and preBeginRun().

Referenced by daq2raw::OnlineUnpack::ProcessRawEvent_(), and geo::Geometry::setDetectorID().

Member Data Documentation

novadaq::cnv::DetId ds::DetectorService::fDetId
protected

Definition at line 56 of file DetectorService.h.

Referenced by DetId(), HandleRun(), and SetDetector().


The documentation for this class was generated from the following files: