CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
evf::GlobalEvFOutputModule Class Reference
Inheritance diagram for evf::GlobalEvFOutputModule:
edm::global::OutputModule< T > edm::global::OutputModuleBase edm::core::OutputModuleCore edm::EDConsumerBase

Public Member Functions

 GlobalEvFOutputModule (edm::ParameterSet const &ps)
 
 ~GlobalEvFOutputModule () override
 
- Public Member Functions inherited from edm::global::OutputModule< T >
const OutputModuleoperator= (const OutputModule &)=delete
 
 OutputModule (edm::ParameterSet const &iPSet)
 
 OutputModule (const OutputModule &)=delete
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::OutputModuleBase
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept
 
bool wantsGlobalRuns () const noexcept
 
- Public Member Functions inherited from edm::core::OutputModuleCore
BranchIDLists const * branchIDLists () const
 
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleCoreoperator= (OutputModuleCore const &)=delete
 
 OutputModuleCore (ParameterSet const &pset)
 
 OutputModuleCore (OutputModuleCore const &)=delete
 
OutputProcessBlockHelper const & outputProcessBlockHelper () const
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &, ProcessBlockHelperBase const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
 ~OutputModuleCore () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::core::OutputModuleCore
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void acquire (edm::StreamID, edm::EventForOutput const &, edm::WaitingTaskWithArenaHolder) const final
 
void beginJob () final
 
std::unique_ptr< SerializeDataBufferbeginStream (edm::StreamID) const final
 
void cacheEventMetaData ()
 
Trig getTriggerResults (edm::EDGetTokenT< edm::TriggerResults > const &token, edm::EventForOutput const &e) const
 
std::shared_ptr< GlobalEvFOutputEventWriterglobalBeginLuminosityBlock (edm::LuminosityBlockForOutput const &iLB) const final
 
std::shared_ptr< GlobalEvFOutputJSONDefglobalBeginRun (edm::RunForOutput const &run) const final
 
void globalEndLuminosityBlock (edm::LuminosityBlockForOutput const &iLB) const final
 
void globalEndRun (edm::RunForOutput const &) const final
 
void respondToCloseInputFile (edm::FileBlock const &) final
 
void respondToOpenInputFile (edm::FileBlock const &) final
 
void write (edm::EventForOutput const &e) final
 
void writeLuminosityBlock (edm::LuminosityBlockForOutput const &) final
 
void writeRun (edm::RunForOutput const &) final
 

Private Attributes

StreamerOutputMsgBuilders::Parameters commonParameters_
 
evf::FastMonitoringServicefms_
 
std::atomic< GlobalEvFOutputEventWriter * > lastWriter_ = nullptr
 
std::shared_ptr< MetaDataCache const > metaDataCache_
 
std::unique_ptr< const StreamerOutputMsgBuildersmsgBuilders_
 
unsigned int presentBranchIDListSize_ = 0
 
edm::EDGetTokenT< edm::SendJobHeader::ParameterSetMappsetToken_
 
std::string streamLabel_
 
edm::EDGetTokenT< edm::TriggerResultstrToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::core::OutputModuleCore
typedef OutputModuleCore ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::global::OutputModuleBase
void doAcquire (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *, WaitingTaskWithArenaHolder &)
 
void doBeginJob ()
 
void doBeginStream (StreamID id)
 
void doEndStream (StreamID id)
 
bool doEvent (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
void preActionBeforeRunEventAsync (WaitingTaskHolder iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const noexcept
 
- Protected Member Functions inherited from edm::core::OutputModuleCore
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doAccessInputProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
void doBeginJob_ ()
 
bool doBeginLuminosityBlock (LumiTransitionInfo const &, ModuleCallingContext const *)
 
void doBeginProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
bool doBeginRun (RunTransitionInfo const &, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LumiTransitionInfo const &, ModuleCallingContext const *)
 
void doEndProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
bool doEndRun (RunTransitionInfo const &, ModuleCallingContext const *)
 
bool doEvent_ (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate_ (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
virtual void preallocLumis (unsigned int)
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int >>> const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from edm::core::OutputModuleCore
std::atomic< int > remainingEvents_
 

Detailed Description

Definition at line 193 of file GlobalEvFOutputModule.cc.

Constructor & Destructor Documentation

◆ GlobalEvFOutputModule()

evf::GlobalEvFOutputModule::GlobalEvFOutputModule ( edm::ParameterSet const &  ps)
explicit

Definition at line 329 of file GlobalEvFOutputModule.cc.

References Exception, geometryDiff::file, fms_, streamLabel_, AlCaHLTBitMon_QueryRunRegistry::string, and to_lower().

333  streamLabel_(ps.getParameter<std::string>("@module_label")),
334  trToken_(consumes<edm::TriggerResults>(edm::InputTag("TriggerResults"))),
335  psetToken_(consumes<edm::SendJobHeader::ParameterSetMap, edm::InRun>(
336  ps.getUntrackedParameter<edm::InputTag>("psetMap"))) {
337  //replace hltOutoputA with stream if the HLT menu uses this convention
338  std::string testPrefix = "hltOutput";
339  if (streamLabel_.find(testPrefix) == 0)
340  streamLabel_ = std::string("stream") + streamLabel_.substr(testPrefix.size());
341 
342  if (streamLabel_.find('_') != std::string::npos) {
343  throw cms::Exception("GlobalEvFOutputModule")
344  << "Underscore character is reserved can not be used for stream names in "
345  "FFF, but was detected in stream name -: "
346  << streamLabel_;
347  }
348 
349  std::string streamLabelLow = streamLabel_;
350  boost::algorithm::to_lower(streamLabelLow);
351  auto streampos = streamLabelLow.rfind("stream");
352  if (streampos != 0 && streampos != std::string::npos)
353  throw cms::Exception("GlobalEvFOutputModule")
354  << "stream (case-insensitive) sequence was found in stream suffix. This is reserved and can not be used for "
355  "names in FFF based HLT, but was detected in stream name";
356 
357  //output initemp file. This lets hltd know number of streams early on
358  if (!edm::Service<evf::EvFDaqDirector>().isAvailable())
359  throw cms::Exception("GlobalEvFOutputModule") << "EvFDaqDirector is not available";
360 
361  const std::string iniFileName = edm::Service<evf::EvFDaqDirector>()->getInitTempFilePath(streamLabel_);
362  std::ofstream file(iniFileName);
363  if (!file)
364  throw cms::Exception("GlobalEvFOutputModule") << "can not create " << iniFileName << "error: " << strerror(errno);
365  file.close();
366 
367  edm::LogInfo("GlobalEvFOutputModule") << "Constructor created initemp file -: " << iniFileName;
368 
369  //create JSD
371 
373  }
edm::EDGetTokenT< edm::TriggerResults > trToken_
StreamerOutputMsgBuilders::Parameters commonParameters_
std::string to_lower(const std::string &s)
edm::EDGetTokenT< edm::SendJobHeader::ParameterSetMap > psetToken_
evf::FastMonitoringService * fms_
Log< level::Info, false > LogInfo
static Parameters parameters(ParameterSet const &ps)
edm::global::OutputModule< edm::RunCache< GlobalEvFOutputJSONDef >, edm::LuminosityBlockCache< evf::GlobalEvFOutputEventWriter >, edm::StreamCache< SerializeDataBuffer >, edm::WatchInputFiles, edm::ExternalWork > GlobalEvFOutputModuleType

◆ ~GlobalEvFOutputModule()

evf::GlobalEvFOutputModule::~GlobalEvFOutputModule ( )
override

Definition at line 375 of file GlobalEvFOutputModule.cc.

375 {}

Member Function Documentation

◆ acquire()

void evf::GlobalEvFOutputModule::acquire ( edm::StreamID  id,
edm::EventForOutput const &  e,
edm::WaitingTaskWithArenaHolder  iHolder 
) const
finalprivate

Definition at line 492 of file GlobalEvFOutputModule.cc.

References edmScanValgrind::buffer, MillePedeFileConverter_cfg::e, getTriggerResults(), edm::WaitingTaskWithArenaHolder::makeWaitingTaskHolderAndRelease(), metaDataCache_, eostools::move(), mps_check::msg, msgBuilders_, edm::core::OutputModuleCore::selectorConfig(), triggerResults, and trToken_.

494  {
496 
497  auto buffer = streamCache(id);
498  std::unique_ptr<EventMsgBuilder> msg =
499  msgBuilders_->serializeEvent(*buffer, e, triggerResults, selectorConfig(), metaDataCache_->checksum_);
500 
501  auto lumiWriter = luminosityBlockCache(e.getLuminosityBlock().index());
502  const_cast<evf::GlobalEvFOutputEventWriter*>(lumiWriter)
503  ->doOutputEventAsync(std::move(msg), iHolder.makeWaitingTaskHolderAndRelease());
504  }
edm::EDGetTokenT< edm::TriggerResults > trToken_
std::shared_ptr< MetaDataCache const > metaDataCache_
Trig getTriggerResults(edm::EDGetTokenT< edm::TriggerResults > const &token, edm::EventForOutput const &e) const
static std::string const triggerResults
Definition: EdmProvDump.cc:47
ParameterSetID selectorConfig() const
tuple msg
Definition: mps_check.py:286
std::unique_ptr< const StreamerOutputMsgBuilders > msgBuilders_
def move(src, dest)
Definition: eostools.py:511

◆ beginJob()

void evf::GlobalEvFOutputModule::beginJob ( void  )
finalprivatevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 472 of file GlobalEvFOutputModule.cc.

References cacheEventMetaData(), commonParameters_, edm::core::OutputModuleCore::description(), edm::InEvent, edm::core::OutputModuleCore::keptProducts(), edm::ModuleDescription::moduleLabel(), and msgBuilders_.

472  {
473  msgBuilders_ = std::make_unique<StreamerOutputMsgBuilders>(
475 
477  }
StreamerOutputMsgBuilders::Parameters commonParameters_
ModuleDescription const & description() const
SelectedProductsForBranchType const & keptProducts() const
std::unique_ptr< const StreamerOutputMsgBuilders > msgBuilders_
std::string const & moduleLabel() const

◆ beginStream()

std::unique_ptr< SerializeDataBuffer > evf::GlobalEvFOutputModule::beginStream ( edm::StreamID  ) const
finalprivate

Definition at line 386 of file GlobalEvFOutputModule.cc.

386  {
387  return std::make_unique<SerializeDataBuffer>();
388  }

◆ cacheEventMetaData()

void evf::GlobalEvFOutputModule::cacheEventMetaData ( )
private

Definition at line 488 of file GlobalEvFOutputModule.cc.

References edm::core::OutputModuleCore::branchIDLists(), metaDataCache_, msgBuilders_, and edm::core::OutputModuleCore::thinnedAssociationsHelper().

Referenced by beginJob(), and respondToOpenInputFile().

488  {
489  metaDataCache_ = std::make_shared<MetaDataCache>(*msgBuilders_, *branchIDLists(), *thinnedAssociationsHelper());
490  }
std::shared_ptr< MetaDataCache const > metaDataCache_
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
BranchIDLists const * branchIDLists() const
std::unique_ptr< const StreamerOutputMsgBuilders > msgBuilders_

◆ fillDescriptions()

void evf::GlobalEvFOutputModule::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 377 of file GlobalEvFOutputModule.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, edm::streamer::StreamerOutputMsgBuilders::fillDescription(), and edm::core::OutputModuleCore::fillDescription().

377  {
381  desc.addUntracked<edm::InputTag>("psetMap", {"hltPSetMap"})
382  ->setComment("Optionally allow the map of ParameterSets to be calculated externally.");
383  descriptions.add("globalEvfOutputModule", desc);
384  }
static void fillDescription(ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())

◆ getTriggerResults()

Trig evf::GlobalEvFOutputModule::getTriggerResults ( edm::EDGetTokenT< edm::TriggerResults > const &  token,
edm::EventForOutput const &  e 
) const
private

◆ globalBeginLuminosityBlock()

std::shared_ptr< GlobalEvFOutputEventWriter > evf::GlobalEvFOutputModule::globalBeginLuminosityBlock ( edm::LuminosityBlockForOutput const &  iLB) const
finalprivate

Definition at line 463 of file GlobalEvFOutputModule.cc.

References lastWriter_, edm::LuminosityBlockForOutput::luminosityBlock(), metaDataCache_, runTheMatrix::ret, and streamLabel_.

464  {
465  auto openDatFilePath = edm::Service<evf::EvFDaqDirector>()->getOpenDatFilePath(iLB.luminosityBlock(), streamLabel_);
466 
467  auto ret = std::make_shared<GlobalEvFOutputEventWriter>(openDatFilePath, iLB.luminosityBlock(), metaDataCache_);
468  lastWriter_ = ret.get();
469  return ret;
470  }
std::atomic< GlobalEvFOutputEventWriter * > lastWriter_
ret
prodAgent to be discontinued
std::shared_ptr< MetaDataCache const > metaDataCache_

◆ globalBeginRun()

std::shared_ptr< GlobalEvFOutputJSONDef > evf::GlobalEvFOutputModule::globalBeginRun ( edm::RunForOutput const &  run) const
finalprivate

Definition at line 390 of file GlobalEvFOutputModule.cc.

References cms::Adler32(), edm::streamer::StreamerOutputFile::adler32(), edmScanValgrind::buffer, edm::streamer::StreamerOutputFile::close(), edm::core::OutputModuleCore::description(), Exception, LogDebug, edm::core::OutputModuleCore::moduleDescription(), HerwigMaxPtPartonFilter_cfi::moduleLabel, msgBuilders_, SimL1EmulatorRepack_CalouGT_cff::processName, psetToken_, writedatasetfile::run, TrackRefitter_38T_cff::src, edm_modernize_messagelogger::stat, streamLabel_, AlCaHLTBitMon_QueryRunRegistry::string, and edm::streamer::StreamerOutputFile::write().

390  {
391  //create run Cache holding JSON file writer and variables
392  auto jsonDef = std::make_unique<GlobalEvFOutputJSONDef>(streamLabel_, false);
393  jsonDef->updateDestination(streamLabel_);
394 
395  //output INI file (non-const). This doesn't require globalBeginRun to be finished
396  const std::string openIniFileName = edm::Service<evf::EvFDaqDirector>()->getOpenInitFilePath(streamLabel_);
397  edm::LogInfo("GlobalEvFOutputModule") << "beginRun init stream -: " << openIniFileName;
398 
399  StreamerOutputFile stream_writer_preamble(openIniFileName);
400  uint32 preamble_adler32 = 1;
401 
402  auto psetMapHandle = run.getHandle(psetToken_);
403 
405  std::unique_ptr<InitMsgBuilder> init_message =
406  msgBuilders_->serializeRegistry(buffer,
409  moduleDescription().mainParameterSetID(),
410  psetMapHandle.isValid() ? psetMapHandle.product() : nullptr);
411 
412  //Let us turn it into a View
413  InitMsgView view(init_message->startAddress());
414 
415  //output header
416  stream_writer_preamble.write(view);
417  preamble_adler32 = stream_writer_preamble.adler32();
418  stream_writer_preamble.close();
419 
420  struct stat istat;
421  stat(openIniFileName.c_str(), &istat);
422  //read back file to check integrity of what was written
423  off_t readInput = 0;
424  uint32_t adlera = 1, adlerb = 0;
425  std::ifstream src(openIniFileName, std::ifstream::binary);
426  if (!src)
427  throw cms::Exception("GlobalEvFOutputModule")
428  << "can not read back " << openIniFileName << " error: " << strerror(errno);
429 
430  //allocate buffer to write INI file
431  std::unique_ptr<char[]> outBuf = std::make_unique<char[]>(1024 * 1024);
432  while (readInput < istat.st_size) {
433  size_t toRead = readInput + 1024 * 1024 < istat.st_size ? 1024 * 1024 : istat.st_size - readInput;
434  src.read(outBuf.get(), toRead);
435  //cms::Adler32(const_cast<const char*>(reinterpret_cast<char*>(outBuf.get())), toRead, adlera, adlerb);
436  cms::Adler32(const_cast<const char*>(outBuf.get()), toRead, adlera, adlerb);
437  readInput += toRead;
438  }
439  src.close();
440 
441  //free output buffer needed only for the file write
442  outBuf.reset();
443 
444  uint32_t adler32c = (adlerb << 16) | adlera;
445  if (adler32c != preamble_adler32) {
446  throw cms::Exception("GlobalEvFOutputModule") << "Checksum mismatch of ini file -: " << openIniFileName
447  << " expected:" << preamble_adler32 << " obtained:" << adler32c;
448  } else {
449  LogDebug("GlobalEvFOutputModule") << "Ini file checksum -: " << streamLabel_ << " " << adler32c;
450  std::filesystem::rename(openIniFileName, edm::Service<evf::EvFDaqDirector>()->getInitFilePath(streamLabel_));
451  }
452 
453  return jsonDef;
454  }
ModuleDescription const & description() const
edm::EDGetTokenT< edm::SendJobHeader::ParameterSetMap > psetToken_
Log< level::Info, false > LogInfo
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
std::unique_ptr< const StreamerOutputMsgBuilders > msgBuilders_
const ModuleDescription & moduleDescription() const
unsigned int uint32
Definition: MsgTools.h:14
#define LogDebug(id)

◆ globalEndLuminosityBlock()

void evf::GlobalEvFOutputModule::globalEndLuminosityBlock ( edm::LuminosityBlockForOutput const &  iLB) const
finalprivate

Definition at line 507 of file GlobalEvFOutputModule.cc.

References fms_, evf::FastMonitoringService::getEventsProcessedForLumi(), edm::LuminosityBlockForOutput::getRun(), edm::LuminosityBlockForOutput::index(), edm::RunForOutput::index(), edm::LuminosityBlockForOutput::luminosityBlock(), castor_dqm_sourceclient_file_cfg::path, edm_modernize_messagelogger::stat, streamLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

507  {
508  auto lumiWriter = luminosityBlockCache(iLB.index());
509  //close dat file
510  const bool discarded = const_cast<evf::GlobalEvFOutputEventWriter*>(lumiWriter)->close();
511 
512  //auto jsonWriter = const_cast<GlobalEvFOutputJSONWriter*>(runCache(iLB.getRun().index()));
513  auto jsonDef = runCache(iLB.getRun().index());
515  jsonDef->outJsonDef_,
516  jsonDef->outJsonDefName_,
517  jsonDef->transferDestination_,
518  jsonDef->mergeType_);
519 
520  jsonWriter.fileAdler32_.value() = lumiWriter->get_adler32();
521  jsonWriter.accepted_.value() = lumiWriter->getAccepted();
522 
523  bool abortFlag = false;
524 
525  if (!discarded) {
526  jsonWriter.processed_.value() = fms_->getEventsProcessedForLumi(iLB.luminosityBlock(), &abortFlag);
527  } else {
528  jsonWriter.errorEvents_.value() = fms_->getEventsProcessedForLumi(iLB.luminosityBlock(), &abortFlag);
529  jsonWriter.processed_.value() = 0;
530  jsonWriter.accepted_.value() = 0;
531  edm::LogInfo("GlobalEvFOutputModule")
532  << "Output suppressed, setting error events for LS -: " << iLB.luminosityBlock();
533  }
534 
535  if (abortFlag) {
536  edm::LogInfo("GlobalEvFOutputModule") << "Abort flag has been set. Output is suppressed";
537  return;
538  }
539 
540  if (jsonWriter.processed_.value() != 0) {
541  struct stat istat;
542  std::filesystem::path openDatFilePath = lumiWriter->getFilePath();
543  stat(openDatFilePath.string().c_str(), &istat);
544  jsonWriter.filesize_ = istat.st_size;
545  std::filesystem::rename(openDatFilePath.string().c_str(),
546  edm::Service<evf::EvFDaqDirector>()->getDatFilePath(iLB.luminosityBlock(), streamLabel_));
547  jsonWriter.filelist_ = openDatFilePath.filename().string();
548  } else {
549  //remove empty file when no event processing has occurred
550  remove(lumiWriter->getFilePath().c_str());
551  jsonWriter.filesize_ = 0;
552  jsonWriter.filelist_ = "";
553  jsonWriter.fileAdler32_.value() = -1; //no files in signed long
554  }
555 
556  //produce JSON file
557  jsonWriter.jsonMonitor_->snap(iLB.luminosityBlock());
558  const std::string outputJsonNameStream =
559  edm::Service<evf::EvFDaqDirector>()->getOutputJsonFilePath(iLB.luminosityBlock(), streamLabel_);
560  jsonWriter.jsonMonitor_->outputFullJSON(outputJsonNameStream, iLB.luminosityBlock());
561  }
evf::FastMonitoringService * fms_
Log< level::Info, false > LogInfo
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=nullptr)

◆ globalEndRun()

void evf::GlobalEvFOutputModule::globalEndRun ( edm::RunForOutput const &  ) const
inlinefinalprivate

Definition at line 210 of file GlobalEvFOutputModule.cc.

210 {}

◆ respondToCloseInputFile()

void evf::GlobalEvFOutputModule::respondToCloseInputFile ( edm::FileBlock const &  )
inlinefinalprivate

Definition at line 213 of file GlobalEvFOutputModule.cc.

213 {}

◆ respondToOpenInputFile()

void evf::GlobalEvFOutputModule::respondToOpenInputFile ( edm::FileBlock const &  )
finalprivate

Definition at line 479 of file GlobalEvFOutputModule.cc.

References edm::core::OutputModuleCore::branchIDLists(), cacheEventMetaData(), lastWriter_, metaDataCache_, presentBranchIDListSize_, and findQualityFiles::size.

479  {
482  if (lastWriter_) {
483  lastWriter_.load()->setMetaCache(metaDataCache_);
484  }
485  }
486  }
size
Write out results.
std::atomic< GlobalEvFOutputEventWriter * > lastWriter_
std::shared_ptr< MetaDataCache const > metaDataCache_
BranchIDLists const * branchIDLists() const

◆ write()

void evf::GlobalEvFOutputModule::write ( edm::EventForOutput const &  e)
finalprivatevirtual

Implements edm::core::OutputModuleCore.

Definition at line 505 of file GlobalEvFOutputModule.cc.

Referenced by pkg.AbstractPkg::generate().

505 {}

◆ writeLuminosityBlock()

void evf::GlobalEvFOutputModule::writeLuminosityBlock ( edm::LuminosityBlockForOutput const &  )
inlinefinalprivatevirtual

Implements edm::core::OutputModuleCore.

Definition at line 208 of file GlobalEvFOutputModule.cc.

208 {}

◆ writeRun()

void evf::GlobalEvFOutputModule::writeRun ( edm::RunForOutput const &  )
inlinefinalprivatevirtual

Implements edm::core::OutputModuleCore.

Definition at line 209 of file GlobalEvFOutputModule.cc.

209 {}

Member Data Documentation

◆ commonParameters_

StreamerOutputMsgBuilders::Parameters evf::GlobalEvFOutputModule::commonParameters_
private

Definition at line 224 of file GlobalEvFOutputModule.cc.

Referenced by beginJob().

◆ fms_

evf::FastMonitoringService* evf::GlobalEvFOutputModule::fms_
private

Definition at line 230 of file GlobalEvFOutputModule.cc.

Referenced by globalEndLuminosityBlock(), and GlobalEvFOutputModule().

◆ lastWriter_

std::atomic<GlobalEvFOutputEventWriter*> evf::GlobalEvFOutputModule::lastWriter_ = nullptr
mutableprivate

Definition at line 235 of file GlobalEvFOutputModule.cc.

Referenced by globalBeginLuminosityBlock(), and respondToOpenInputFile().

◆ metaDataCache_

std::shared_ptr<MetaDataCache const> evf::GlobalEvFOutputModule::metaDataCache_
private

◆ msgBuilders_

std::unique_ptr<const StreamerOutputMsgBuilders> evf::GlobalEvFOutputModule::msgBuilders_
private

Definition at line 225 of file GlobalEvFOutputModule.cc.

Referenced by acquire(), beginJob(), cacheEventMetaData(), and globalBeginRun().

◆ presentBranchIDListSize_

unsigned int evf::GlobalEvFOutputModule::presentBranchIDListSize_ = 0
private

Definition at line 236 of file GlobalEvFOutputModule.cc.

Referenced by respondToOpenInputFile().

◆ psetToken_

edm::EDGetTokenT<edm::SendJobHeader::ParameterSetMap> evf::GlobalEvFOutputModule::psetToken_
private

Definition at line 228 of file GlobalEvFOutputModule.cc.

Referenced by globalBeginRun().

◆ streamLabel_

std::string evf::GlobalEvFOutputModule::streamLabel_
private

◆ trToken_

edm::EDGetTokenT<edm::TriggerResults> evf::GlobalEvFOutputModule::trToken_
private

Definition at line 227 of file GlobalEvFOutputModule.cc.

Referenced by acquire().