LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
rndm::NuRandomServiceHelper::ArtState Class Reference

Describe the current state of art processing, as understood by the NuRandomService. More...

#include "ArtState.h"

Public Types

enum  state_type {
  unDefined, inServiceConstructor, inModuleConstructor, inBeginRun,
  inModuleBeginRun, inEvent, inModuleEvent, inEndJob,
  inOther
}
 
using EventInfo_t = art::EventAuxiliary
 

Public Member Functions

 ArtState (state_type start_state=unDefined)
 
EventSeedInputData getEventSeedInputData () const
 
void set_state (state_type astate)
 Records the status of ART. More...
 
state_type transit_to (state_type astate)
 Records the new status of ART and returns the old one. More...
 
void reset_state ()
 Resets the status to "something else" (inOther) More...
 
void set_event (art::Event const &evt)
 Records the specified event ID. More...
 
void reset_event ()
 Records the status of ART. More...
 
void set_module (art::ModuleDescription const &desc)
 Records the specified module description. More...
 
void reset_module ()
 Records the status of ART. More...
 
void set_process_name (std::string pn)
 Records the status of ART. More...
 
void set_process_name (art::ModuleDescription const &currentModuleDesc)
 Records the status of ART. More...
 
state_type state () const
 Getters. More...
 
std::string stateName () const
 Getters. More...
 
art::EventID const & eventID () const
 Getters. More...
 
EventInfo_t const & eventInfo () const
 Getters. More...
 
art::ModuleDescription const & moduleDesc () const
 Getters. More...
 
std::string moduleLabel () const
 Getters. More...
 
std::string processName () const
 Getters. More...
 

Static Public Member Functions

static std::string stateName (state_type state)
 

Protected Attributes

state_type artState
 current state of the art More...
 
EventInfo_t lastEvent
 
art::ModuleDescription lastModule
 
std::string procName
 

Detailed Description

Describe the current state of art processing, as understood by the NuRandomService.

Definition at line 32 of file ArtState.h.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
unDefined 

not assigned yet

inServiceConstructor 

in service construction phase

inModuleConstructor 

in module construction phase

inBeginRun 

in begin of run phase

inModuleBeginRun 

in begin of run for a module

inEvent 

in event phase

inModuleEvent 

in event processing by a module

inEndJob 

in end job

inOther 

none of the above

Definition at line 34 of file ArtState.h.

Constructor & Destructor Documentation

rndm::NuRandomServiceHelper::ArtState::ArtState ( state_type  start_state = unDefined)
inline

Definition at line 49 of file ArtState.h.

References artState, and set_state().

50  : artState(start_state)
51  , lastEvent()
52  , lastModule()
53  , procName()
54  {}
state_type artState
current state of the art
Definition: ArtState.h:168
art::ModuleDescription lastModule
Definition: ArtState.h:171

Member Function Documentation

art::EventID const& rndm::NuRandomServiceHelper::ArtState::eventID ( ) const
inline

Getters.

Definition at line 116 of file ArtState.h.

References art::EventAuxiliary::id(), and lastEvent.

Referenced by getEventSeedInputData().

116 { return lastEvent.id(); }
EventID const & id() const noexcept
EventInfo_t const& rndm::NuRandomServiceHelper::ArtState::eventInfo ( ) const
inline

Getters.

Definition at line 118 of file ArtState.h.

References lastEvent.

Referenced by getEventSeedInputData().

118 { return lastEvent; }
EventSeedInputData rndm::NuRandomServiceHelper::ArtState::getEventSeedInputData ( ) const
inline

Definition at line 128 of file ArtState.h.

References art::EventID::event(), eventID(), eventInfo(), rndm::NuRandomServiceHelper::EventSeedInputData::eventNumber, art::Timestamp::invalidTimestamp(), rndm::NuRandomServiceHelper::EventSeedInputData::isData, art::EventAuxiliary::isRealData(), rndm::NuRandomServiceHelper::EventSeedInputData::isTimeValid, moduleDesc(), rndm::NuRandomServiceHelper::EventSeedInputData::moduleLabel, moduleLabel(), art::ModuleDescription::moduleName(), rndm::NuRandomServiceHelper::EventSeedInputData::moduleType, rndm::NuRandomServiceHelper::EventSeedInputData::processName, processName(), art::EventID::run(), rndm::NuRandomServiceHelper::EventSeedInputData::runNumber, art::EventID::subRun(), rndm::NuRandomServiceHelper::EventSeedInputData::subRunNumber, art::EventAuxiliary::time(), rndm::NuRandomServiceHelper::EventSeedInputData::time, and art::Timestamp::value().

129  {
130  EventSeedInputData data;
131  data.runNumber = eventID().run();
132  data.subRunNumber = eventID().subRun();
133  data.eventNumber = eventID().event();
134 
135  data.time = eventInfo().time().value();
136  data.isTimeValid
138 
139  data.isData = eventInfo().isRealData();
140 
141  data.processName = processName();
142  data.moduleType = moduleDesc().moduleName();
143  data.moduleLabel = moduleLabel();
144 
145  return data;
146  } // getEventSeedInputData()
std::string moduleLabel() const
Getters.
Definition: ArtState.h:122
art::EventID const & eventID() const
Getters.
Definition: ArtState.h:116
std::string processName() const
Getters.
Definition: ArtState.h:124
constexpr TimeValue_t value() const
Definition: Timestamp.h:23
RunNumber_t run() const
Definition: EventID.h:98
EventInfo_t const & eventInfo() const
Getters.
Definition: ArtState.h:118
std::string const & moduleName() const
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:82
EventNumber_t event() const
Definition: EventID.h:116
bool isRealData() const noexcept
art::ModuleDescription const & moduleDesc() const
Getters.
Definition: ArtState.h:120
SubRunNumber_t subRun() const
Definition: EventID.h:110
Timestamp const & time() const noexcept
art::ModuleDescription const& rndm::NuRandomServiceHelper::ArtState::moduleDesc ( ) const
inline

Getters.

Definition at line 120 of file ArtState.h.

References lastModule.

Referenced by getEventSeedInputData().

120 { return lastModule; }
art::ModuleDescription lastModule
Definition: ArtState.h:171
std::string rndm::NuRandomServiceHelper::ArtState::moduleLabel ( ) const
inline

Getters.

Definition at line 122 of file ArtState.h.

References lastModule, and art::ModuleDescription::moduleLabel().

Referenced by getEventSeedInputData().

122 { return lastModule.moduleLabel(); }
std::string const & moduleLabel() const
art::ModuleDescription lastModule
Definition: ArtState.h:171
std::string rndm::NuRandomServiceHelper::ArtState::processName ( ) const
inline

Getters.

Definition at line 124 of file ArtState.h.

References procName.

Referenced by getEventSeedInputData().

124 { return procName; }
void rndm::NuRandomServiceHelper::ArtState::reset_event ( )
inline

Records the status of ART.

Definition at line 83 of file ArtState.h.

References lastEvent.

void rndm::NuRandomServiceHelper::ArtState::reset_module ( )
inline

Records the status of ART.

Definition at line 91 of file ArtState.h.

References lastModule.

void rndm::NuRandomServiceHelper::ArtState::reset_state ( )
inline

Resets the status to "something else" (inOther)

Definition at line 74 of file ArtState.h.

References inOther, and transit_to().

74 { transit_to(inOther); }
state_type transit_to(state_type astate)
Records the new status of ART and returns the old one.
Definition: ArtState.h:63
void rndm::NuRandomServiceHelper::ArtState::set_event ( art::Event const &  evt)
inline

Records the specified event ID.

Definition at line 77 of file ArtState.h.

References art::Event::experimentType(), art::Event::id(), art::Event::isRealData(), lastEvent, and art::Event::time().

78  {
79  lastEvent = {
80  evt.id(), evt.time(), evt.isRealData(), evt.experimentType()
81  };
82  } // set_event()
TCEvent evt
Definition: DataStructs.cxx:8
void rndm::NuRandomServiceHelper::ArtState::set_module ( art::ModuleDescription const &  desc)
inline

Records the specified module description.

Definition at line 86 of file ArtState.h.

References lastModule, and set_process_name().

87  {
88  lastModule = desc;
89  set_process_name(desc);
90  }
void set_process_name(std::string pn)
Records the status of ART.
Definition: ArtState.h:93
art::ModuleDescription lastModule
Definition: ArtState.h:171
void rndm::NuRandomServiceHelper::ArtState::set_process_name ( std::string  pn)
inline

Records the status of ART.

Definition at line 93 of file ArtState.h.

References procName.

Referenced by set_module().

93 { procName = pn; }
void rndm::NuRandomServiceHelper::ArtState::set_process_name ( art::ModuleDescription const &  currentModuleDesc)
inline

Records the status of ART.

Definition at line 94 of file ArtState.h.

References art::errors::LogicError, art::ModuleDescription::processName(), and procName.

95  {
96  if (!procName.empty()
97  && (procName != currentModuleDesc.processName()))
98  {
100  << "Process name changed from '" << procName << "' to '"
101  << currentModuleDesc.processName() << "'?!?";
102  }
103  procName = currentModuleDesc.processName();
104  } // set_process_name()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void rndm::NuRandomServiceHelper::ArtState::set_state ( state_type  astate)
inline

Records the status of ART.

Definition at line 60 of file ArtState.h.

Referenced by ArtState(), and transit_to().

60 { artState = astate; }
state_type artState
current state of the art
Definition: ArtState.h:168
state_type rndm::NuRandomServiceHelper::ArtState::state ( ) const
inline

Getters.

Definition at line 112 of file ArtState.h.

References artState.

Referenced by stateName(), and transit_to().

112 { return artState; }
state_type artState
current state of the art
Definition: ArtState.h:168
std::string rndm::NuRandomServiceHelper::ArtState::stateName ( ) const
inline

Getters.

Definition at line 114 of file ArtState.h.

References state(), and stateName().

Referenced by stateName(), and transit_to().

114 { return stateName(state()); }
std::string stateName() const
Getters.
Definition: ArtState.h:114
state_type state() const
Getters.
Definition: ArtState.h:112
static std::string rndm::NuRandomServiceHelper::ArtState::stateName ( state_type  state)
inlinestatic

Definition at line 149 of file ArtState.h.

References inBeginRun, inEndJob, inEvent, inModuleBeginRun, inModuleConstructor, inModuleEvent, inOther, inServiceConstructor, art::errors::LogicError, and unDefined.

150  {
151  switch (state) {
152  case unDefined: return "(not assigned yet)";
153  case inServiceConstructor: return "service construction";
154  case inModuleConstructor: return "module construction";
155  case inBeginRun: return "begin of run";
156  case inModuleBeginRun: return "begin of run for module";
157  case inEvent: return "event preparation";
158  case inModuleEvent: return "event processing by a module";
159  case inEndJob: return "end job";
160  case inOther: return "unidentified";
161  } // switch
163  << "artext::NuRandomServiceHelper::ArtState::stateName: unknown state #"
164  << ((int) state) << "\n";
165  } // stateName()
in event processing by a module
Definition: ArtState.h:41
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
state_type state() const
Getters.
Definition: ArtState.h:112
state_type rndm::NuRandomServiceHelper::ArtState::transit_to ( state_type  astate)
inline

Records the new status of ART and returns the old one.

Definition at line 63 of file ArtState.h.

References MF_LOG_DEBUG, set_state(), state(), and stateName().

Referenced by reset_state().

64  {
65  state_type old_state = state();
66  set_state(astate);
67  MF_LOG_DEBUG("ArtState")
68  << "NuRandomService::ArtState: transition from "
69  << stateName(old_state) << " to " << stateName();
70  return old_state;
71  } // transit_to()
std::string stateName() const
Getters.
Definition: ArtState.h:114
void set_state(state_type astate)
Records the status of ART.
Definition: ArtState.h:60
state_type state() const
Getters.
Definition: ArtState.h:112
#define MF_LOG_DEBUG(id)

Member Data Documentation

state_type rndm::NuRandomServiceHelper::ArtState::artState
protected

current state of the art

Definition at line 168 of file ArtState.h.

Referenced by ArtState(), and state().

EventInfo_t rndm::NuRandomServiceHelper::ArtState::lastEvent
protected

Definition at line 170 of file ArtState.h.

Referenced by eventID(), eventInfo(), reset_event(), and set_event().

art::ModuleDescription rndm::NuRandomServiceHelper::ArtState::lastModule
protected

Definition at line 171 of file ArtState.h.

Referenced by moduleDesc(), moduleLabel(), reset_module(), and set_module().

std::string rndm::NuRandomServiceHelper::ArtState::procName
protected

Definition at line 172 of file ArtState.h.

Referenced by processName(), and set_process_name().


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