ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ByteStreamEmonInputSvc Class Reference

implements the interface IByteStreamInputSvc for reading events from emon. More...

#include <ByteStreamEmonInputSvc.h>

Inheritance diagram for ByteStreamEmonInputSvc:
Collaboration diagram for ByteStreamEmonInputSvc:

Public Member Functions

 ByteStreamEmonInputSvc (const std::string &name, ISvcLocator *svcloc)
 Constructors: More...
 
virtual StatusCode initialize () override
 
virtual StatusCode start () override
 
virtual StatusCode finalize () override
 
virtual const RawEventpreviousEvent () override
 Implementation of the ByteStreamInputSvc interface methods. More...
 
virtual const RawEventnextEvent () override
 
virtual const RawEventcurrentEvent () const override
 Implementation of the ByteStreamInputSvc interface methods. More...
 

Private Member Functions

bool getIterator ()
 
void check_publish ()
 
void get_runparams ()
 
void updateHandler (Gaudi::Details::PropertyBase &p)
 

Private Attributes

int m_totalEventCounter {0}
 event Counter More...
 
std::unique_ptr< RawEventm_re {nullptr}
 current event More...
 
Gaudi::Property< std::string > m_partition {this, "Partition", {}, "Partition name, default taken from $TDAQ_PARTITION if not set"}
 
Gaudi::Property< std::string > m_key {this, "Key", {}, &ByteStreamEmonInputSvc::updateHandler, "EMON Selection key, e.g. SFI"}
 
Gaudi::Property< std::vector< std::string > > m_value {this, "KeyValue", {}, &ByteStreamEmonInputSvc::updateHandler, "EMON key values, e.g. [SFI-1, SFI-2]; if empty all SFIs"}
 
Gaudi::Property< unsigned int > m_key_count {this, "KeyCount", 0, &ByteStreamEmonInputSvc::updateHandler, "EMON key count, e.g. 5 to get five random SFIs"}
 
Gaudi::Property< std::string > m_publish {this, "PublishName", "Athena", &ByteStreamEmonInputSvc::updateHandler, "Name under which to publish histograms"}
 
Gaudi::Property< bool > m_exit {this, "ExitOnPartitionShutdown", false, &ByteStreamEmonInputSvc::updateHandler, "If true, exit if partition shuts down"}
 
Gaudi::Property< std::string > m_is_server {this, "ISServer", "", &ByteStreamEmonInputSvc::updateHandler, "IS Server to publish histograms to"}
 
Gaudi::Property< std::string > m_include {this, "Include", {}, &ByteStreamEmonInputSvc::updateHandler, "Regular expression to select histograms to publish"}
 
Gaudi::Property< std::string > m_exclude {this, "Exclude", {}, &ByteStreamEmonInputSvc::updateHandler, "Regular expression to select histograms not to publish"}
 
Gaudi::Property< int > m_frequency {this, "Frequency", 60, &ByteStreamEmonInputSvc::updateHandler, "Frequency (in number of events) of publishing histograms"}
 
Gaudi::Property< int > m_updatePeriod {this, "UpdatePeriod", 0, &ByteStreamEmonInputSvc::updateHandler, "Frequency (in seconds) of publishing histograms"}
 
Gaudi::Property< float > m_updatePeriodRange {this, "UpdatePeriodRange", 0.2, "A percentage number to determine how close we have to be to the next update time to publish now"}
 
Gaudi::Property< bool > m_clearHistograms {this, "ClearHistograms", true, &ByteStreamEmonInputSvc::updateHandler, "If true, clear histograms when new run starts (default: True)"}
 
Gaudi::Property< std::vector< std::string > > m_l1names {this, "LVL1Names", {}, &ByteStreamEmonInputSvc::updateHandler, "A list of L1 bit names"}
 
Gaudi::Property< std::vector< unsigned int > > m_l1items {this, "LVL1Items", {}, &ByteStreamEmonInputSvc::updateHandler, "A list of L1 bit numbers"}
 
Gaudi::Property< std::string > m_l1logic {this, "LVL1Logic", "Ignore", &ByteStreamEmonInputSvc::updateHandler, "'And', 'Or' or 'Ignore' (default: Ignore)"}
 
Gaudi::Property< std::string > m_l1origin {this, "LVL1Origin", "TAV", &ByteStreamEmonInputSvc::updateHandler, "TBP, TAP, TAV (default: TAV"}
 
Gaudi::Property< std::string > m_stream_type {this, "StreamType", "physics", &ByteStreamEmonInputSvc::updateHandler, "HLT stream type (e.g. physics or calibration)"}
 
Gaudi::Property< std::vector< std::string > > m_stream_names {this, "StreamNames", {}, &ByteStreamEmonInputSvc::updateHandler, "List of HLT stream names"}
 
Gaudi::Property< std::string > m_stream_logic {this, "StreamLogic", "Ignore", &ByteStreamEmonInputSvc::updateHandler, "'And', 'Or' or 'Ignore' (default: Ignore)"}
 
Gaudi::Property< unsigned int > m_trigger_type {this, "TriggerType", 256, &ByteStreamEmonInputSvc::updateHandler, "LVL1 8 bit trigger type"}
 
Gaudi::Property< std::string > m_groupName {this, "GroupName", {}, &ByteStreamEmonInputSvc::updateHandler, "Name of the monitoring group"}
 
Gaudi::Property< unsigned int > m_buffer_size {this, "BufferSize", 2, "Number of buffers"}
 
Gaudi::Property< bool > m_readDetectorMask {this, "ReadDetectorMaskFromIS", true, "Read detector mask from IS"}
 
Gaudi::Property< int > m_timeout {this, "Timeout", 3600000, &ByteStreamEmonInputSvc::updateHandler, "Timeout in seconds, -1 == infinity"}
 
Gaudi::Property< bool > m_corrupted_events {this, "ProcessCorruptedEvents", false, &ByteStreamEmonInputSvc::updateHandler, "Process corrupted events not passing check_tree()"}
 
Gaudi::Property< std::string > m_state {this, "State", "None", "Read-only property showing the state"}
 
Gaudi::Property< bool > m_convertEfficiency {this, "ConvertEfficiency", true, "Convert TEfficiency to TProfile before publishing"}
 
SG::ReadHandleKey< TrigConf::L1Menum_l1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "Name of the L1Menu object to read configuration from"}
 
bool m_connect {false}
 
std::auto_ptr< emon::EventIterator > m_eventIt
 Event iterator. More...
 
OHRootProvider * m_provider {nullptr}
 
boost::regex m_include_rex
 
boost::regex m_exclude_rex
 
int m_frequency_counter {60}
 
int m_publish_target {0}
 
ServiceHandle< StoreGateSvcm_inputMetaDataStore
 
ServiceHandle< StoreGateSvcm_sgSvc
 
ServiceHandle< IROBDataProviderSvcm_robProvider
 
ServiceHandle< ITHistSvc > m_histSvc
 

Detailed Description

implements the interface IByteStreamInputSvc for reading events from emon.

Definition at line 37 of file ByteStreamEmonInputSvc.h.

Constructor & Destructor Documentation

◆ ByteStreamEmonInputSvc()

ByteStreamEmonInputSvc::ByteStreamEmonInputSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

Constructors:

Definition at line 152 of file ByteStreamEmonInputSvc.cxx.

152  :
153  base_class(name,svcloc),
154  m_inputMetaDataStore("StoreGateSvc/InputMetaDataStore", name ),
155  m_sgSvc("StoreGateSvc", name),
156  m_robProvider("ROBDataProviderSvc", name),
157  m_histSvc("THistSvc", name)
158 {
159 }

Member Function Documentation

◆ check_publish()

void ByteStreamEmonInputSvc::check_publish ( )
private

Definition at line 483 of file ByteStreamEmonInputSvc.cxx.

484 {
485  // is a server specified ?
486  if(m_is_server.empty()) return;
487 
488  // a time based update ?
489  if(m_updatePeriod) {
490  time_t now = time(0);
491 
493  // it's too early to publish
494  return;
495  }
496 
498  // it's too late
499  unsigned int missed_publications = 0;
500  while(m_publish_target < now) {
501  missed_publications++;
503  }
504 
505  // do NOT publish, but print a warning
506  ATH_MSG_WARNING(" check_publish: missed " << missed_publications << " publications to OH");
507 
508  return;
509  }
510  }
511 
512  // an event based update ?
513  if(m_frequency && --m_frequency_counter > 0) return;
514 
516 
517  try {
518 
519  if(m_provider == nullptr) {
520  IPCPartition part(m_partition);
521  if(!part.isValid()) return;
522  // might throw...
523  m_provider = new OHRootProvider(part, m_is_server, m_publish);
524  }
525 
526  for(const std::string& name : m_histSvc->getHists()) {
527 
528  if(!m_include.empty() && !regex_match(name, m_include_rex)) {
529  continue;
530  }
531 
532  if(!m_exclude.empty() && regex_match(name, m_exclude_rex)) {
533  continue;
534  }
535 
536  TH1 *h = nullptr;
537  if(m_histSvc->getHist(name, h)) {
538  // might throw...
539  auto name_tag = detail::extract_histogram_tag(name);
540  m_provider->publish(*h, name_tag.first, name_tag.second);
541  };
542  }
543  for(const std::string& name : m_histSvc->getEfficiencies()) {
544 
545  if(!m_include.empty() && !regex_match(name, m_include_rex)) {
546  continue;
547  }
548 
549  if(!m_exclude.empty() && regex_match(name, m_exclude_rex)) {
550  continue;
551  }
552 
553  TEfficiency *h = nullptr;
554  if(m_histSvc->getEfficiency(name, h)) {
555  if (m_convertEfficiency) {
556  std::unique_ptr<const TH1> p;
557  if (h->GetDimension() == 1) {
558  p = create1DProfile(h);
559  } else if (h->GetDimension() == 2) {
560  p = create2DProfile(h);
561  }
562  // might throw...
563  auto name_tag = detail::extract_histogram_tag(name);
564  m_provider->publish(*p, name_tag.first, name_tag.second);
565  //m_provider->publish(*h, name_tag.first, name_tag.second);
566  } // tdaq doesn't currently support publishing efficiencies, will change in the future
567  };
568  }
569  } catch (daq::oh::Exception& ex) {
570  ATH_MSG_ERROR(ex.what());
571  }
572 
574 }

◆ currentEvent()

const RawEvent * ByteStreamEmonInputSvc::currentEvent ( ) const
overridevirtual

Implementation of the ByteStreamInputSvc interface methods.

Definition at line 478 of file ByteStreamEmonInputSvc.cxx.

479 {
480  return m_re.get();
481 }

◆ finalize()

StatusCode ByteStreamEmonInputSvc::finalize ( )
overridevirtual

Definition at line 652 of file ByteStreamEmonInputSvc.cxx.

653 {
654  setProperty("State","Shutdown").ignore();
655  m_inputMetaDataStore.release().ignore();
656  m_robProvider.release().ignore();
657  m_sgSvc.release().ignore();
658  return StatusCode::SUCCESS;
659 }

◆ get_runparams()

void ByteStreamEmonInputSvc::get_runparams ( )
private

Definition at line 576 of file ByteStreamEmonInputSvc.cxx.

577 {
578  IPCPartition p(m_partition);
579 
580  RunParamsNamed runParams(p, "RunParams.RunParams");
581  try {
582  runParams.checkout();
583 
584  eformat::helper::DetectorMask mask(runParams.det_mask);
585 
586  auto metadatacont = std::make_unique<ByteStreamMetadataContainer>();
587  metadatacont->push_back(std::make_unique<ByteStreamMetadata>(
588  runParams.run_number,
589  0,
590  0,
591  runParams.recording_enabled,
592  runParams.trigger_type,
593  mask.serialize().second,
594  runParams.beam_type,
595  runParams.beam_energy,
596  "",
597  "",
598  runParams.T0_project_tag,
599  0,
600  std::vector<std::string>()
601  ));
602  // Record ByteStreamMetadataContainer in MetaData Store
603  if(m_inputMetaDataStore->record(std::move(metadatacont),"ByteStreamMetadata").isFailure()) {
604  ATH_MSG_WARNING("Unable to record MetaData in InputMetaDataStore");
605  }
606  else {
607  ATH_MSG_DEBUG("Recorded MetaData in InputMetaDataStore");
608  }
609 
610  } catch(ers::Issue& ex) {
611  ATH_MSG_ERROR("Cannot get run parameters:" << ex.what());
612  }
613 }

◆ getIterator()

bool ByteStreamEmonInputSvc::getIterator ( )
private

Definition at line 222 of file ByteStreamEmonInputSvc.cxx.

223 {
224  setProperty("State", "Init").ignore();
225 
226  if(!IPCCore::isInitialised()) {
227  char* argv[2] = { 0 };
228  int argc = 0;
230  }
231 
232  IPCPartition partition(m_partition);
233  while(!partition.isValid()) {
234  if(m_exit) {
235  ATH_MSG_ERROR("No such partition: " << m_partition);
236  return false;
237  }
238  ATH_MSG_INFO("No such partition (yet?): " << m_partition);
239  sleep(20);
240  }
241 
242  delete m_provider;
243  m_provider = nullptr;
244 
245  std::unique_ptr<emon::SamplingAddress> address;
246 
247  if(m_key_count > 0) {
248  address.reset(new emon::SamplingAddress(m_key, m_key_count));
249  } else {
250  address.reset(new emon::SamplingAddress(m_key, m_value));
251  }
252 
253  emon::Logic l1_logic = emon::logic::IGNORE;
254  emon::Logic stream_logic = emon::logic::IGNORE;
255  emon::Origin l1_origin = emon::origin::AFTER_VETO;
256 
257  if(m_l1logic == "Or") {
258  l1_logic = emon::logic::OR;
259  } else if (m_l1logic == "And") {
260  l1_logic = emon::logic::AND;
261  } else if (m_l1logic == "Ignore") {
262  l1_logic = emon::logic::IGNORE;
263  }
264 
265  if(m_l1origin == "TBP") {
266  l1_origin = emon::origin::BEFORE_PRESCALE;
267  } else if (m_l1origin == "TAP") {
268  l1_origin = emon::origin::AFTER_PRESCALE;
269  } else if(m_l1origin == "TAV") {
270  l1_origin = emon::origin::AFTER_VETO;
271  } else {
272  ATH_MSG_FATAL("Invalid L1 origin");
273  }
274 
275  if(m_stream_logic == "Or") {
276  stream_logic = emon::logic::OR;
277  } else if (m_stream_logic == "And") {
278  stream_logic = emon::logic::AND;
279  } else if (m_stream_logic == "Ignore") {
280  stream_logic = emon::logic::IGNORE;
281  }
282 
283  // now put together the bit mask from all
284  // three sources: l1 bit mask, l1 names, l1 items
285 
286  std::vector<unsigned short> l1bits(m_l1items.begin(), m_l1items.end());
287 
288  // if names are given, read the mapping information from L1Menu
289  if (not m_l1names.value().empty()) {
290  ATH_MSG_DEBUG("Reading L1Menu to map " << m_l1names.name() << " to CTP IDs");
292  if (not l1Menu.isValid()) {
293  ATH_MSG_ERROR("Cannot read L1Menu to map L1 item names to IDs. The property " << m_l1names.name() << " will be ignored!");
294  } else {
295  for (const std::string& l1name : m_l1names) {
296  try {
297  const unsigned int id = l1Menu->item(l1name).ctpId();
298  ATH_MSG_DEBUG("Item " << l1name << " mapped to CTP ID " << id);
299  l1bits.push_back(static_cast<unsigned short>(id));
300  } catch (const std::exception& ex) {
301  ATH_MSG_ERROR(ex.what());
302  continue;
303  }
304  }
305  }
306  }
307 
308  typedef emon::MaskedValue<unsigned char> L1TriggerType;
309 
310  emon::SmartBitValue l1pattern(l1bits, l1_logic, l1_origin);
311  emon::SmartStreamValue streamTags(m_stream_type, m_stream_names, stream_logic);
312 
313  emon::L1TriggerType l1triggerType(static_cast<unsigned char>(m_trigger_type), m_trigger_type > 255);
314 
315  emon::SelectionCriteria criteria(l1triggerType,
316  l1pattern,
317  streamTags,
318  emon::StatusWord());
319 
320  while (true) {
321 
322  if (partition.name() != m_partition) {
323  ATH_MSG_INFO("Partition name changed - reconnecting to " << m_partition);
324  return getIterator();
325  }
326 
327  try {
328  m_eventIt.reset(0);
329  m_eventIt.reset(new emon::EventIterator(partition, *address, criteria, m_buffer_size, m_groupName));
330  if(m_readDetectorMask) {
331  get_runparams();
332  }
333  setProperty("State", "Connected").ignore();
334  return true;
335  } catch(ers::Issue& ex) {
336  ATH_MSG_INFO("Cannot connect to sampler (will wait 20s): " << m_key << "/" << m_value
337  << " Reason: " << ex.what());
338  sleep(20);
339  }
340  }
341 }

◆ initialize()

StatusCode ByteStreamEmonInputSvc::initialize ( )
overridevirtual

Definition at line 162 of file ByteStreamEmonInputSvc.cxx.

163 {
164  setProperty("State", "Init").ignore();
165 
166  // check properties
167  if(m_partition.empty() && getenv("TDAQ_PARTITION") != 0) {
168  m_partition = getenv("TDAQ_PARTITION");
169  }
170 
171  if(m_partition.empty()){
172  ATH_MSG_ERROR("initialize: No partition name specified");
173  return StatusCode::FAILURE;
174  }
175 
176  if(m_key.empty()) {
177  ATH_MSG_ERROR("initialize: No emon key ");
178  return StatusCode::FAILURE;
179  }
180 
181  m_connect = true;
182 
183  if (m_histSvc.retrieve().isFailure()) {
184  ATH_MSG_ERROR("Unable to locate THistSvc");
185  m_is_server.clear();
186  } else {
187  if(!m_include.empty()) m_include_rex = m_include.value();
188  if(!m_exclude.empty()) m_exclude_rex = m_exclude.value();
189  if(m_frequency < 0) m_frequency = 100000;
191 
192  // if time based update, disable frequency based update
193  if(m_updatePeriod) {
194  m_frequency = 0;
195  // calculate our next target for publishing
196  time_t now = time(0);
198  }
199  }
200 
201  //-------------------------------------------------------------------------
202  // Setup the InputMetaDataStore
203  //-------------------------------------------------------------------------
204  ATH_CHECK( m_inputMetaDataStore.retrieve() );
205  ATH_CHECK( m_robProvider.retrieve() );
206 
207  // Initialise the L1Menu read handle if we need to map L1 item names to IDs
208  ATH_CHECK(m_l1MenuKey.initialize(not m_l1names.value().empty()));
209 
210  signal(SIGTERM, handle_terminate);
211 
212  // Read run parameters from the partition
213  if (m_readDetectorMask) {
214  get_runparams();
215  }
216 
217  ATH_MSG_INFO("initialized for: " << m_partition << " " << m_key << "/" << m_value);
218 
219  return StatusCode::SUCCESS;
220 }

◆ nextEvent()

const RawEvent * ByteStreamEmonInputSvc::nextEvent ( )
overridevirtual

Definition at line 352 of file ByteStreamEmonInputSvc.cxx.

353 {
354  if (m_re) {
356  m_re->start(st);
357  if (st) delete [] st;
358  m_re.reset();
359  }
360 
361  while(m_re == nullptr) {
362 
363  if(m_connect) {
364 
365  if(!getIterator()) {
366  return nullptr;
367  } else {
368  ATH_MSG_INFO("Got sampler...");
369  m_connect = false;
370  }
371  }
372 
374  try {
375  int timeout = m_timeout;
376  if(m_updatePeriod) {
377  // try to hit lower end of update period
379  if(timeout <= 0) timeout = 1000;
380  }
381  event = m_eventIt->nextEvent(timeout);
382  } catch(emon::NoMoreEvents& ex) {
383  if(m_exit) {
384  return nullptr;
385  }
386  check_publish();
387  continue;
388  } catch (ers::Issue& ex) {
389  m_connect = true;
390  continue;
391  }
392 
393  setProperty("State", "Processing").ignore();
394 
396  memcpy(buf, event.data(), event.size() * sizeof(OFFLINE_FRAGMENTS_NAMESPACE::DataType));
397 
398 
399  if (buf[0] == eformat::FULL_EVENT) {
400 
401  // We got a full event
402  m_re = std::make_unique<RawEvent>(buf);
403  try {
404  m_re->check_tree();
405  ATH_MSG_INFO("nextEvent: Got valid fragment of size:" << event.size());
406  } catch (ers::Issue& ex) {
407 
408  // log in any case
409  std::stringstream ss;
410  ss << ex;
411  ATH_MSG_ERROR("nextEvent: Invalid event fragment: " << ss.str());
412 
413  if(!m_corrupted_events) {
414 
415  delete [] buf;
416  m_re.reset();
417  continue;
418  } // else fall through
419  }
420  m_robProvider->setNextEvent(Gaudi::Hive::currentContext(), m_re.get());
421  m_robProvider->setEventStatus(Gaudi::Hive::currentContext(), 0);
422 
423  } else {
424  // We got something we didn't expect.
425  ATH_MSG_ERROR("nextEvent: Got invalid fragment of unknown type: 0x"
426  << std::hex << buf[0] << std::dec);
427  delete [] buf;
428  continue;
429  }
431  }
432 
433  // generate DataHeader
434  DataHeader* Dh = new DataHeader();
435 
436  // Declare header primary
438 
439  // Now add ref to xAOD::EventInfo objects
440  IOpaqueAddress* iop = new ByteStreamAddress(ClassID_traits<xAOD::EventInfo>::ID(), "EventInfo", "");
441  StatusCode ioc = m_sgSvc->recordAddress("EventInfo",iop);
442  if (ioc.isSuccess()) {
443  const SG::DataProxy* ptmp = m_sgSvc->transientProxy(ClassID_traits<xAOD::EventInfo>::ID(), "EventInfo");
444  if (ptmp !=0) {
445  DataHeaderElement DheEI(ptmp, nullptr, "EventInfo");
446  Dh->insert(DheEI);
447  }
448  //else ATH_MSG_ERROR("Failed to create xAOD::EventInfo proxy " << ptmp);
449  }
450 
451  // Now add ref to xAOD::EventAuxInfo objects
452  IOpaqueAddress* iopaux = new ByteStreamAddress(ClassID_traits<xAOD::EventAuxInfo>::ID(), "EventInfoAux.", "");
453  StatusCode iocaux = m_sgSvc->recordAddress("EventInfoAux.",iopaux);
454  if (iocaux.isSuccess()) {
455  const SG::DataProxy* ptmpaux = m_sgSvc->transientProxy(ClassID_traits<xAOD::EventAuxInfo>::ID(), "EventInfoAux.");
456  if (ptmpaux !=0) {
457  DataHeaderElement DheEIAux(ptmpaux, nullptr, "EventInfoAux.");
458  Dh->insert(DheEIAux);
459  }
460  //else ATH_MSG_ERROR("Failed to create xAOD::EventAuxInfo proxy " << ptmpaux);
461  }
462 
463  // Record new data header.Boolean flags will allow it's deletion in case
464  // of skipped events.
465  StatusCode rec_sg = m_sgSvc->record<DataHeader>(Dh, "ByteStreamDataHeader", true, false, true);
466  if (rec_sg != StatusCode::SUCCESS) {
467  ATH_MSG_ERROR("Fail to record BS DataHeader in StoreGate. Skipping events?! " << rec_sg);
468  }
469 
470  // we got an event, check if we have to publish
471  check_publish();
472 
473  return m_re.get();
474 
475 }

◆ previousEvent()

const RawEvent * ByteStreamEmonInputSvc::previousEvent ( )
overridevirtual

Implementation of the ByteStreamInputSvc interface methods.

Definition at line 344 of file ByteStreamEmonInputSvc.cxx.

345 {
346  ATH_MSG_WARNING("previousEvent not implemented for ByteStreamEmonInputSvc");
347 
348  return nullptr;
349 }

◆ start()

StatusCode ByteStreamEmonInputSvc::start ( )
overridevirtual

Definition at line 616 of file ByteStreamEmonInputSvc.cxx.

617 {
618  if(m_clearHistograms) {
619  ATH_MSG_INFO("Resetting histograms...");
620  for(const std::string& name : m_histSvc->getHists()) {
621  TH1 *h = nullptr;
622  if(m_histSvc->getHist(name, h)) {
623  h->Reset();
624  };
625  }
626  for(const std::string& name : m_histSvc->getEfficiencies()) {
627  TEfficiency *h = nullptr;
628  if(m_histSvc->getEfficiency(name, h)) {
629  std::unique_ptr<TH1> pass{h->GetCopyPassedHisto()};
630  pass->Reset();
631  h->SetPassedHistogram(*pass.get(), "");
632  std::unique_ptr<TH1> tot{h->GetCopyTotalHisto()};
633  tot->Reset();
634  h->SetTotalHistogram(*tot.get(), "");
635  h->SetWeight(1);
636  };
637  }
638  }
639  return StatusCode::SUCCESS;
640 }

◆ updateHandler()

void ByteStreamEmonInputSvc::updateHandler ( Gaudi::Details::PropertyBase &  p)
private

Definition at line 642 of file ByteStreamEmonInputSvc.cxx.

643 {
644  if(! m_connect) {
645  m_connect = true;
646  sleep(2);
647  setProperty("State","Reconnect").ignore();
648  }
649 }

Member Data Documentation

◆ m_buffer_size

Gaudi::Property<unsigned int> ByteStreamEmonInputSvc::m_buffer_size {this, "BufferSize", 2, "Number of buffers"}
private

Definition at line 90 of file ByteStreamEmonInputSvc.h.

◆ m_clearHistograms

Gaudi::Property<bool> ByteStreamEmonInputSvc::m_clearHistograms {this, "ClearHistograms", true, &ByteStreamEmonInputSvc::updateHandler, "If true, clear histograms when new run starts (default: True)"}
private

Definition at line 79 of file ByteStreamEmonInputSvc.h.

◆ m_connect

bool ByteStreamEmonInputSvc::m_connect {false}
private

Definition at line 101 of file ByteStreamEmonInputSvc.h.

◆ m_convertEfficiency

Gaudi::Property<bool> ByteStreamEmonInputSvc::m_convertEfficiency {this, "ConvertEfficiency", true, "Convert TEfficiency to TProfile before publishing"}
private

Definition at line 95 of file ByteStreamEmonInputSvc.h.

◆ m_corrupted_events

Gaudi::Property<bool> ByteStreamEmonInputSvc::m_corrupted_events {this, "ProcessCorruptedEvents", false, &ByteStreamEmonInputSvc::updateHandler, "Process corrupted events not passing check_tree()"}
private

Definition at line 93 of file ByteStreamEmonInputSvc.h.

◆ m_eventIt

std::auto_ptr<emon::EventIterator> ByteStreamEmonInputSvc::m_eventIt
private

Event iterator.

Definition at line 102 of file ByteStreamEmonInputSvc.h.

◆ m_exclude

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_exclude {this, "Exclude", {}, &ByteStreamEmonInputSvc::updateHandler, "Regular expression to select histograms not to publish"}
private

Definition at line 75 of file ByteStreamEmonInputSvc.h.

◆ m_exclude_rex

boost::regex ByteStreamEmonInputSvc::m_exclude_rex
private

Definition at line 107 of file ByteStreamEmonInputSvc.h.

◆ m_exit

Gaudi::Property<bool> ByteStreamEmonInputSvc::m_exit {this, "ExitOnPartitionShutdown", false, &ByteStreamEmonInputSvc::updateHandler, "If true, exit if partition shuts down"}
private

Definition at line 72 of file ByteStreamEmonInputSvc.h.

◆ m_frequency

Gaudi::Property<int> ByteStreamEmonInputSvc::m_frequency {this, "Frequency", 60, &ByteStreamEmonInputSvc::updateHandler, "Frequency (in number of events) of publishing histograms"}
private

Definition at line 76 of file ByteStreamEmonInputSvc.h.

◆ m_frequency_counter

int ByteStreamEmonInputSvc::m_frequency_counter {60}
private

Definition at line 109 of file ByteStreamEmonInputSvc.h.

◆ m_groupName

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_groupName {this, "GroupName", {}, &ByteStreamEmonInputSvc::updateHandler, "Name of the monitoring group"}
private

Definition at line 89 of file ByteStreamEmonInputSvc.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> ByteStreamEmonInputSvc::m_histSvc
private

Definition at line 115 of file ByteStreamEmonInputSvc.h.

◆ m_include

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_include {this, "Include", {}, &ByteStreamEmonInputSvc::updateHandler, "Regular expression to select histograms to publish"}
private

Definition at line 74 of file ByteStreamEmonInputSvc.h.

◆ m_include_rex

boost::regex ByteStreamEmonInputSvc::m_include_rex
private

Definition at line 106 of file ByteStreamEmonInputSvc.h.

◆ m_inputMetaDataStore

ServiceHandle<StoreGateSvc> ByteStreamEmonInputSvc::m_inputMetaDataStore
private

Definition at line 112 of file ByteStreamEmonInputSvc.h.

◆ m_is_server

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_is_server {this, "ISServer", "", &ByteStreamEmonInputSvc::updateHandler, "IS Server to publish histograms to"}
private

Definition at line 73 of file ByteStreamEmonInputSvc.h.

◆ m_key

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_key {this, "Key", {}, &ByteStreamEmonInputSvc::updateHandler, "EMON Selection key, e.g. SFI"}
private

Definition at line 68 of file ByteStreamEmonInputSvc.h.

◆ m_key_count

Gaudi::Property<unsigned int> ByteStreamEmonInputSvc::m_key_count {this, "KeyCount", 0, &ByteStreamEmonInputSvc::updateHandler, "EMON key count, e.g. 5 to get five random SFIs"}
private

Definition at line 70 of file ByteStreamEmonInputSvc.h.

◆ m_l1items

Gaudi::Property<std::vector<unsigned int> > ByteStreamEmonInputSvc::m_l1items {this, "LVL1Items", {}, &ByteStreamEmonInputSvc::updateHandler, "A list of L1 bit numbers"}
private

Definition at line 81 of file ByteStreamEmonInputSvc.h.

◆ m_l1logic

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_l1logic {this, "LVL1Logic", "Ignore", &ByteStreamEmonInputSvc::updateHandler, "'And', 'Or' or 'Ignore' (default: Ignore)"}
private

Definition at line 82 of file ByteStreamEmonInputSvc.h.

◆ m_l1MenuKey

SG::ReadHandleKey<TrigConf::L1Menu> ByteStreamEmonInputSvc::m_l1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "Name of the L1Menu object to read configuration from"}
private

Definition at line 98 of file ByteStreamEmonInputSvc.h.

◆ m_l1names

Gaudi::Property<std::vector<std::string> > ByteStreamEmonInputSvc::m_l1names {this, "LVL1Names", {}, &ByteStreamEmonInputSvc::updateHandler, "A list of L1 bit names"}
private

Definition at line 80 of file ByteStreamEmonInputSvc.h.

◆ m_l1origin

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_l1origin {this, "LVL1Origin", "TAV", &ByteStreamEmonInputSvc::updateHandler, "TBP, TAP, TAV (default: TAV"}
private

Definition at line 83 of file ByteStreamEmonInputSvc.h.

◆ m_partition

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_partition {this, "Partition", {}, "Partition name, default taken from $TDAQ_PARTITION if not set"}
private

Definition at line 67 of file ByteStreamEmonInputSvc.h.

◆ m_provider

OHRootProvider* ByteStreamEmonInputSvc::m_provider {nullptr}
private

Definition at line 104 of file ByteStreamEmonInputSvc.h.

◆ m_publish

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_publish {this, "PublishName", "Athena", &ByteStreamEmonInputSvc::updateHandler, "Name under which to publish histograms"}
private

Definition at line 71 of file ByteStreamEmonInputSvc.h.

◆ m_publish_target

int ByteStreamEmonInputSvc::m_publish_target {0}
private

Definition at line 110 of file ByteStreamEmonInputSvc.h.

◆ m_re

std::unique_ptr<RawEvent> ByteStreamEmonInputSvc::m_re {nullptr}
private

current event

Definition at line 64 of file ByteStreamEmonInputSvc.h.

◆ m_readDetectorMask

Gaudi::Property<bool> ByteStreamEmonInputSvc::m_readDetectorMask {this, "ReadDetectorMaskFromIS", true, "Read detector mask from IS"}
private

Definition at line 91 of file ByteStreamEmonInputSvc.h.

◆ m_robProvider

ServiceHandle<IROBDataProviderSvc> ByteStreamEmonInputSvc::m_robProvider
private

Definition at line 114 of file ByteStreamEmonInputSvc.h.

◆ m_sgSvc

ServiceHandle<StoreGateSvc> ByteStreamEmonInputSvc::m_sgSvc
private

Definition at line 113 of file ByteStreamEmonInputSvc.h.

◆ m_state

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_state {this, "State", "None", "Read-only property showing the state"}
private

Definition at line 94 of file ByteStreamEmonInputSvc.h.

◆ m_stream_logic

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_stream_logic {this, "StreamLogic", "Ignore", &ByteStreamEmonInputSvc::updateHandler, "'And', 'Or' or 'Ignore' (default: Ignore)"}
private

Definition at line 86 of file ByteStreamEmonInputSvc.h.

◆ m_stream_names

Gaudi::Property<std::vector<std::string> > ByteStreamEmonInputSvc::m_stream_names {this, "StreamNames", {}, &ByteStreamEmonInputSvc::updateHandler, "List of HLT stream names"}
private

Definition at line 85 of file ByteStreamEmonInputSvc.h.

◆ m_stream_type

Gaudi::Property<std::string> ByteStreamEmonInputSvc::m_stream_type {this, "StreamType", "physics", &ByteStreamEmonInputSvc::updateHandler, "HLT stream type (e.g. physics or calibration)"}
private

Definition at line 84 of file ByteStreamEmonInputSvc.h.

◆ m_timeout

Gaudi::Property<int> ByteStreamEmonInputSvc::m_timeout {this, "Timeout", 3600000, &ByteStreamEmonInputSvc::updateHandler, "Timeout in seconds, -1 == infinity"}
private

Definition at line 92 of file ByteStreamEmonInputSvc.h.

◆ m_totalEventCounter

int ByteStreamEmonInputSvc::m_totalEventCounter {0}
private

event Counter

Definition at line 62 of file ByteStreamEmonInputSvc.h.

◆ m_trigger_type

Gaudi::Property<unsigned int> ByteStreamEmonInputSvc::m_trigger_type {this, "TriggerType", 256, &ByteStreamEmonInputSvc::updateHandler, "LVL1 8 bit trigger type"}
private

Definition at line 88 of file ByteStreamEmonInputSvc.h.

◆ m_updatePeriod

Gaudi::Property<int> ByteStreamEmonInputSvc::m_updatePeriod {this, "UpdatePeriod", 0, &ByteStreamEmonInputSvc::updateHandler, "Frequency (in seconds) of publishing histograms"}
private

Definition at line 77 of file ByteStreamEmonInputSvc.h.

◆ m_updatePeriodRange

Gaudi::Property<float> ByteStreamEmonInputSvc::m_updatePeriodRange {this, "UpdatePeriodRange", 0.2, "A percentage number to determine how close we have to be to the next update time to publish now"}
private

Definition at line 78 of file ByteStreamEmonInputSvc.h.

◆ m_value

Gaudi::Property<std::vector<std::string> > ByteStreamEmonInputSvc::m_value {this, "KeyValue", {}, &ByteStreamEmonInputSvc::updateHandler, "EMON key values, e.g. [SFI-1, SFI-2]; if empty all SFIs"}
private

Definition at line 69 of file ByteStreamEmonInputSvc.h.


The documentation for this class was generated from the following files:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
ByteStreamEmonInputSvc::m_re
std::unique_ptr< RawEvent > m_re
current event
Definition: ByteStreamEmonInputSvc.h:64
ByteStreamEmonInputSvc::m_exit
Gaudi::Property< bool > m_exit
Definition: ByteStreamEmonInputSvc.h:72
ByteStreamEmonInputSvc::m_sgSvc
ServiceHandle< StoreGateSvc > m_sgSvc
Definition: ByteStreamEmonInputSvc.h:113
ByteStreamEmonInputSvc::m_connect
bool m_connect
Definition: ByteStreamEmonInputSvc.h:101
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
detail::extract_histogram_tag
std::pair< std::string, int > extract_histogram_tag(const std::string &histo_name)
Extract tag/LB number from per-LBN histogram name.
Definition: extract_histogram_tag.cxx:16
ByteStreamEmonInputSvc::m_stream_type
Gaudi::Property< std::string > m_stream_type
Definition: ByteStreamEmonInputSvc.h:84
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ByteStreamEmonInputSvc::m_totalEventCounter
int m_totalEventCounter
event Counter
Definition: ByteStreamEmonInputSvc.h:62
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
OFFLINE_FRAGMENTS_NAMESPACE::DataType
uint32_t DataType
Definition: RawEvent.h:24
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
ByteStreamEmonInputSvc::m_publish_target
int m_publish_target
Definition: ByteStreamEmonInputSvc.h:110
ByteStreamEmonInputSvc::m_l1logic
Gaudi::Property< std::string > m_l1logic
Definition: ByteStreamEmonInputSvc.h:82
TrigConf::L1Item::ctpId
unsigned int ctpId() const
Accessor to the CTP ID.
Definition: L1Item.cxx:34
DataHeader::Input
@ Input
Definition: DataHeader.h:126
ByteStreamEmonInputSvc::check_publish
void check_publish()
Definition: ByteStreamEmonInputSvc.cxx:483
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ByteStreamEmonInputSvc::m_groupName
Gaudi::Property< std::string > m_groupName
Definition: ByteStreamEmonInputSvc.h:89
Issue
Configuration Issue
Definition: PscIssues.h:31
ByteStreamEmonInputSvc::m_robProvider
ServiceHandle< IROBDataProviderSvc > m_robProvider
Definition: ByteStreamEmonInputSvc.h:114
JiveXML::Event
struct Event_t Event
Definition: ONCRPCServer.h:65
ByteStreamEmonInputSvc::m_exclude
Gaudi::Property< std::string > m_exclude
Definition: ByteStreamEmonInputSvc.h:75
ByteStreamEmonInputSvc::m_trigger_type
Gaudi::Property< unsigned int > m_trigger_type
Definition: ByteStreamEmonInputSvc.h:88
Root::AND
@ AND
Definition: TGRLCollection.h:32
Cut::signal
@ signal
Definition: SUSYToolsAlg.cxx:67
ByteStreamEmonInputSvc::m_partition
Gaudi::Property< std::string > m_partition
Definition: ByteStreamEmonInputSvc.h:67
ByteStreamEmonInputSvc::m_l1origin
Gaudi::Property< std::string > m_l1origin
Definition: ByteStreamEmonInputSvc.h:83
Logic
@ Logic
Definition: BaseObject.h:11
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
ByteStreamEmonInputSvc::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: ByteStreamEmonInputSvc.h:98
ByteStreamEmonInputSvc::getIterator
bool getIterator()
Definition: ByteStreamEmonInputSvc.cxx:222
ByteStreamEmonInputSvc::m_frequency_counter
int m_frequency_counter
Definition: ByteStreamEmonInputSvc.h:109
ByteStreamEmonInputSvc::m_l1items
Gaudi::Property< std::vector< unsigned int > > m_l1items
Definition: ByteStreamEmonInputSvc.h:81
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
ByteStreamEmonInputSvc::m_convertEfficiency
Gaudi::Property< bool > m_convertEfficiency
Definition: ByteStreamEmonInputSvc.h:95
ByteStreamEmonInputSvc::m_include_rex
boost::regex m_include_rex
Definition: ByteStreamEmonInputSvc.h:106
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
DataHeaderElement
This class provides a persistent form for the TransientAddress.
Definition: DataHeader.h:36
python.handimod.now
now
Definition: handimod.py:675
ByteStreamEmonInputSvc::m_timeout
Gaudi::Property< int > m_timeout
Definition: ByteStreamEmonInputSvc.h:92
ByteStreamEmonInputSvc::m_eventIt
std::auto_ptr< emon::EventIterator > m_eventIt
Event iterator.
Definition: ByteStreamEmonInputSvc.h:102
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ByteStreamEmonInputSvc::m_buffer_size
Gaudi::Property< unsigned int > m_buffer_size
Definition: ByteStreamEmonInputSvc.h:90
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
ByteStreamEmonInputSvc::m_frequency
Gaudi::Property< int > m_frequency
Definition: ByteStreamEmonInputSvc.h:76
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
ByteStreamEmonInputSvc::m_stream_names
Gaudi::Property< std::vector< std::string > > m_stream_names
Definition: ByteStreamEmonInputSvc.h:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ByteStreamEmonInputSvc::get_runparams
void get_runparams()
Definition: ByteStreamEmonInputSvc.cxx:576
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
TrigConf::L1Menu::item
L1Item item(const std::string &itemName) const
Get item by name.
Definition: L1Menu.cxx:201
calibdata.exception
exception
Definition: calibdata.py:496
ByteStreamEmonInputSvc::m_inputMetaDataStore
ServiceHandle< StoreGateSvc > m_inputMetaDataStore
Definition: ByteStreamEmonInputSvc.h:112
ByteStreamEmonInputSvc::m_corrupted_events
Gaudi::Property< bool > m_corrupted_events
Definition: ByteStreamEmonInputSvc.h:93
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ByteStreamEmonInputSvc::m_exclude_rex
boost::regex m_exclude_rex
Definition: ByteStreamEmonInputSvc.h:107
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ByteStreamEmonInputSvc::m_provider
OHRootProvider * m_provider
Definition: ByteStreamEmonInputSvc.h:104
ByteStreamEmonInputSvc::m_publish
Gaudi::Property< std::string > m_publish
Definition: ByteStreamEmonInputSvc.h:71
DataHeader::insert
void insert(const SG::TransientAddress *sgAddress, IOpaqueAddress *tokAddress=0, const std::string &pTag="")
Insert a new element into the "DataObject" vector.
Definition: DataHeader.cxx:267
ByteStreamEmonInputSvc::m_readDetectorMask
Gaudi::Property< bool > m_readDetectorMask
Definition: ByteStreamEmonInputSvc.h:91
ByteStreamEmonInputSvc::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: ByteStreamEmonInputSvc.h:115
DataHeader::setStatus
void setStatus(statusFlag status)
Set StatusFlag enum for DataHeader.
Definition: DataHeader.cxx:235
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ByteStreamEmonInputSvc::m_key_count
Gaudi::Property< unsigned int > m_key_count
Definition: ByteStreamEmonInputSvc.h:70
ByteStreamEmonInputSvc::m_is_server
Gaudi::Property< std::string > m_is_server
Definition: ByteStreamEmonInputSvc.h:73
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
python.PyKernel.init
def init(v_theApp, v_rootStream=None)
Definition: PyKernel.py:45
ByteStreamEmonInputSvc::m_include
Gaudi::Property< std::string > m_include
Definition: ByteStreamEmonInputSvc.h:74
ByteStreamEmonInputSvc::m_clearHistograms
Gaudi::Property< bool > m_clearHistograms
Definition: ByteStreamEmonInputSvc.h:79
ByteStreamEmonInputSvc::m_updatePeriod
Gaudi::Property< int > m_updatePeriod
Definition: ByteStreamEmonInputSvc.h:77
ByteStreamEmonInputSvc::m_value
Gaudi::Property< std::vector< std::string > > m_value
Definition: ByteStreamEmonInputSvc.h:69
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
h
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
StateLessPT_NewConfig.partition
partition
Definition: StateLessPT_NewConfig.py:49
Root::OR
@ OR
Definition: TGRLCollection.h:32
ByteStreamEmonInputSvc::m_l1names
Gaudi::Property< std::vector< std::string > > m_l1names
Definition: ByteStreamEmonInputSvc.h:80
ByteStreamEmonInputSvc::m_stream_logic
Gaudi::Property< std::string > m_stream_logic
Definition: ByteStreamEmonInputSvc.h:86
SG::DataProxy
Definition: DataProxy.h:44
python.TrigInDetArtSteps.timeout
timeout
Definition: TrigInDetArtSteps.py:35
ByteStreamEmonInputSvc::m_updatePeriodRange
Gaudi::Property< float > m_updatePeriodRange
Definition: ByteStreamEmonInputSvc.h:78
ByteStreamEmonInputSvc::m_key
Gaudi::Property< std::string > m_key
Definition: ByteStreamEmonInputSvc.h:68