CMS 3D CMS Logo

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

Public Member Functions

void beginJob () override
 
 DQMRootOutputModule (edm::ParameterSet const &pset)
 
 ~DQMRootOutputModule () override
 
- Public Member Functions inherited from edm::one::OutputModule<>
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const OutputModuleoperator= (const OutputModule &)=delete
 
 OutputModule (edm::ParameterSet const &iPSet)
 
 OutputModule (const OutputModule &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::OutputModuleBase
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
- 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 finishEndFile ()
 
bool isFileOpen () const override
 
void openFile (edm::FileBlock const &) override
 
void reallyCloseFile () override
 
void startEndFile ()
 
void write (edm::EventForOutput const &e) override
 
void writeLuminosityBlock (edm::LuminosityBlockForOutput const &) override
 
void writeRun (edm::RunForOutput const &) override
 

Private Attributes

ULong64_t m_beginTime
 
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
 
ULong64_t m_endTime
 
std::unique_ptr< TFile > m_file
 
std::string m_fileName
 
unsigned int m_filterOnRun
 
ULong64_t m_firstIndex
 
std::string m_fullNameBuffer
 
std::string * m_fullNameBufferPtr
 
edm::GetterOfProducts< DQMTokenm_getterOfProductsLumi
 
edm::GetterOfProducts< DQMTokenm_getterOfProductsRun
 
TTree * m_indicesTree
 
edm::JobReport::Token m_jrToken
 
ULong64_t m_lastIndex
 
std::string m_logicalFileName
 
unsigned int m_lumi
 
unsigned int m_presentHistoryIndex
 
edm::ProcessHistoryRegistry m_processHistoryRegistry
 
unsigned int m_run
 
std::vector< edm::ProcessHistoryIDm_seenHistories
 
std::vector< std::shared_ptr< TreeHelperBase > > m_treeHelpers
 
unsigned int m_type
 

Additional Inherited Members

- Public Types inherited from edm::one::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::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
void doBeginJob ()
 
bool doEvent (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
- 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 201 of file DQMRootOutputModule.cc.

Constructor & Destructor Documentation

◆ DQMRootOutputModule()

DQMRootOutputModule::DQMRootOutputModule ( edm::ParameterSet const &  pset)
explicit

Definition at line 292 of file DQMRootOutputModule.cc.

References edm::core::OutputModuleCore::callWhenNewProductsRegistered(), m_getterOfProductsLumi, and m_getterOfProductsRun.

295  m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
296  m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName")),
297  m_file(nullptr),
298  m_treeHelpers(kNIndicies, std::shared_ptr<TreeHelperBase>()),
300  m_filterOnRun(pset.getUntrackedParameter<unsigned int>("filterOnRun")),
302  m_indicesTree(nullptr),
305  // Declare dependencies for all Lumi and Run tokens here. In
306  // principle could use the keep statements, but then DQMToken would
307  // have to be made persistent (transient products are ignored),
308  // which would lead to a need to (finally) remove underscores from
309  // DQM module labels.
310  // This is needed to support unscheduled DQM modules now that
311  // non-consumed EDProducers are deleted from the job at beginJob.
315  });
316 }
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
edm::GetterOfProducts< DQMToken > m_getterOfProductsRun
unsigned int m_presentHistoryIndex
std::vector< std::shared_ptr< TreeHelperBase > > m_treeHelpers
std::unique_ptr< TFile > m_file
OutputModuleBase(ParameterSet const &pset)
std::string * m_fullNameBufferPtr
edm::GetterOfProducts< DQMToken > m_getterOfProductsLumi

◆ ~DQMRootOutputModule()

DQMRootOutputModule::~DQMRootOutputModule ( )
override

Definition at line 325 of file DQMRootOutputModule.cc.

325 {}

Member Function Documentation

◆ beginJob()

void DQMRootOutputModule::beginJob ( void  )
overridevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 323 of file DQMRootOutputModule.cc.

323 {}

◆ fillDescriptions()

void DQMRootOutputModule::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 581 of file DQMRootOutputModule.cc.

References edm::ConfigurationDescriptions::addDefault(), EgammaPostProcessor_cfi::dataSet, submitPVResolutionJobs::desc, edm::core::OutputModuleCore::fillDescription(), runTheMatrix::keep, and AlCaHLTBitMon_QueryRunRegistry::string.

581  {
583 
584  desc.addUntracked<std::string>("fileName");
585  desc.addUntracked<std::string>("logicalFileName", "");
586  desc.addUntracked<unsigned int>("filterOnRun", 0)
587  ->setComment("Only write the run with this run number. 0 means write all runs.");
588  desc.addOptionalUntracked<int>("splitLevel", 99)
589  ->setComment("UNUSED Only here to allow older configurations written for PoolOutputModule to work.");
590  const std::vector<std::string> keep = {"drop *", "keep DQMToken_*_*_*"};
592 
594  dataSet.setAllowAnything();
595  desc.addUntracked<edm::ParameterSetDescription>("dataset", dataSet)
596  ->setComment("PSet is only used by Data Operations and not by this module.");
597 
598  descriptions.addDefault(desc);
599 }
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())

◆ finishEndFile()

void DQMRootOutputModule::finishEndFile ( )
private

Definition at line 566 of file DQMRootOutputModule.cc.

References m_file, m_jrToken, and edm::JobReport::outputFileClosed().

Referenced by reallyCloseFile().

566  {
567  //std::cout << "DQMRootOutputModule::finishEndFile"<< std::endl;
568  m_file->Write();
569  m_file->Close();
572 }
std::unique_ptr< TFile > m_file
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:467
edm::JobReport::Token m_jrToken

◆ isFileOpen()

bool DQMRootOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 342 of file DQMRootOutputModule.cc.

References m_file.

342 { return nullptr != m_file.get(); }
std::unique_ptr< TFile > m_file

◆ openFile()

void DQMRootOutputModule::openFile ( edm::FileBlock const &  )
overrideprivatevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 344 of file DQMRootOutputModule.cc.

References edm::createGlobalIdentifier(), edm::core::OutputModuleCore::description(), cms::Digest::digest(), mps_fire::i, createfilelist::int, MonitorElementData::INT, kBeginTimeBranch, kCmsGuid, kEndTimeBranch, kFirstIndex, kFloatIndex, kIndicesTree, kIntIndex, kLastIndex, kLumiBranch, kProcessHistoryIndexBranch, kRunBranch, kStringIndex, kTH1DIndex, kTH1FIndex, kTH1IIndex, kTH1SIndex, kTH2DIndex, kTH2FIndex, kTH2IIndex, kTH2SIndex, kTH3FIndex, kTProfile2DIndex, kTProfileIndex, kTypeBranch, kTypeNames, m_beginTime, m_dqmKindToTypeIndex, m_endTime, m_file, m_fileName, m_firstIndex, m_fullNameBufferPtr, m_indicesTree, m_jrToken, m_lastIndex, m_logicalFileName, m_lumi, m_presentHistoryIndex, m_run, m_treeHelpers, m_type, makeHelper(), HerwigMaxPtPartonFilter_cfi::moduleLabel, MonitorElementData::REAL, MonitorElementData::STRING, AlCaHLTBitMon_QueryRunRegistry::string, MonitorElementData::TH1D, MonitorElementData::TH1F, MonitorElementData::TH1I, MonitorElementData::TH1S, MonitorElementData::TH2D, MonitorElementData::TH2F, MonitorElementData::TH2I, MonitorElementData::TH2S, MonitorElementData::TH3F, cms::MD5Result::toString(), MonitorElementData::TPROFILE, MonitorElementData::TPROFILE2D, HcalDetIdTransform::transform(), and trackerHitRTTI::vector.

344  {
345  //NOTE: I need to also set the I/O performance settings
346 
347  m_file = std::make_unique<TFile>(m_fileName.c_str(),
348  "RECREATE",
349  "1" //This is the file format version number
350  );
351 
353  cms::Digest branchHash;
355  std::transform(guid.begin(), guid.end(), guid.begin(), (int (*)(int))std::toupper);
356 
357  m_file->WriteObject(&guid, kCmsGuid);
358  m_jrToken = jr->outputFileOpened(m_fileName,
360  std::string(),
361  "DQMRootOutputModule",
363  guid,
364  std::string(),
365  branchHash.digest().toString(),
366  std::vector<std::string>());
367 
369  m_indicesTree->Branch(kRunBranch, &m_run);
370  m_indicesTree->Branch(kLumiBranch, &m_lumi);
374  m_indicesTree->Branch(kTypeBranch, &m_type);
377  m_indicesTree->SetDirectory(m_file.get());
378 
379  unsigned int i = 0;
380  for (std::vector<std::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
381  it != itEnd;
382  ++it, ++i) {
383  //std::cout <<"making "<<kTypeNames[i]<<std::endl;
384  TTree* tree = new TTree(kTypeNames[i], kTypeNames[i]);
385  *it = std::shared_ptr<TreeHelperBase>(makeHelper(i, tree, m_fullNameBufferPtr));
386  tree->SetDirectory(m_file.get()); //TFile takes ownership
387  }
388 
403 }
static const char *const kRunBranch
Definition: format.h:63
static const char *const kTypeNames[]
Definition: format.h:41
static const char *const kIndicesTree
Definition: format.h:62
unsigned int m_presentHistoryIndex
static TreeHelperBase * makeHelper(unsigned int iTypeIndex, TTree *iTree, std::string *iFullNameBufferPtr)
static const char *const kFirstIndex
Definition: format.h:69
static const char *const kLumiBranch
Definition: format.h:64
ModuleDescription const & description() const
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
MD5Result digest()
Definition: Digest.cc:171
static const char *const kTypeBranch
Definition: format.h:68
std::vector< std::shared_ptr< TreeHelperBase > > m_treeHelpers
static const char *const kProcessHistoryIndexBranch
Definition: format.h:65
static const char *const kEndTimeBranch
Definition: format.h:67
std::unique_ptr< TFile > m_file
std::string createGlobalIdentifier(bool binary=false)
std::string * m_fullNameBufferPtr
static const char *const kCmsGuid
Definition: format.h:73
static const char *const kLastIndex
Definition: format.h:70
static const char *const kBeginTimeBranch
Definition: format.h:66
edm::JobReport::Token m_jrToken
Definition: tree.py:1
std::string toString() const
Definition: Digest.cc:95
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ reallyCloseFile()

void DQMRootOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 508 of file DQMRootOutputModule.cc.

References finishEndFile(), and startEndFile().

508  {
509  startEndFile();
510  finishEndFile();
511 }

◆ startEndFile()

void DQMRootOutputModule::startEndFile ( )
private

Definition at line 513 of file DQMRootOutputModule.cc.

References cms::cuda::assert(), edm::ProcessHistory::begin(), edm::pset::Registry::begin(), edm::ProcessHistory::end(), edm::pset::Registry::end(), edm::ProcessHistoryRegistry::getMapped(), edm::pset::Registry::instance(), kMetaDataDirectory, kParameterSetBranch, kParameterSetTree, kPHIndexBranch, kProcessConfigurationParameterSetIDBranch, kProcessConfigurationPassID, kProcessConfigurationProcessNameBranch, kProcessConfigurationReleaseVersion, kProcessHistoryTree, m_file, m_processHistoryRegistry, m_seenHistories, edm::core::OutputModuleCore::processName(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by reallyCloseFile().

513  {
514  //std::cout << "DQMRootOutputModule::startEndFile"<< std::endl;
515  //fill in the meta data
516  m_file->cd();
517  TDirectory* metaDataDirectory = m_file->mkdir(kMetaDataDirectory);
518 
519  //Write out the Process History
520  TTree* processHistoryTree = new TTree(kProcessHistoryTree, kProcessHistoryTree);
521  processHistoryTree->SetDirectory(metaDataDirectory);
522 
523  unsigned int index = 0;
524  processHistoryTree->Branch(kPHIndexBranch, &index);
526  processHistoryTree->Branch(kProcessConfigurationProcessNameBranch, &processName);
527  std::string parameterSetID;
528  processHistoryTree->Branch(kProcessConfigurationParameterSetIDBranch, &parameterSetID);
529  std::string releaseVersion;
530  processHistoryTree->Branch(kProcessConfigurationReleaseVersion, &releaseVersion);
531  std::string passID;
532  processHistoryTree->Branch(kProcessConfigurationPassID, &passID);
533 
534  for (std::vector<edm::ProcessHistoryID>::iterator it = m_seenHistories.begin(), itEnd = m_seenHistories.end();
535  it != itEnd;
536  ++it) {
538  assert(nullptr != history);
539  index = 0;
540  for (edm::ProcessHistory::collection_type::const_iterator itPC = history->begin(), itPCEnd = history->end();
541  itPC != itPCEnd;
542  ++itPC, ++index) {
543  processName = itPC->processName();
544  releaseVersion = itPC->releaseVersion();
545  passID = itPC->passID();
546  parameterSetID = itPC->parameterSetID().compactForm();
547  tbb::this_task_arena::isolate([&] { processHistoryTree->Fill(); });
548  }
549  }
550 
551  //Store the ParameterSets
552  TTree* parameterSetsTree = new TTree(kParameterSetTree, kParameterSetTree);
553  parameterSetsTree->SetDirectory(metaDataDirectory);
554  std::string blob;
555  parameterSetsTree->Branch(kParameterSetBranch, &blob);
556 
558  assert(nullptr != psr);
559  for (edm::pset::Registry::const_iterator it = psr->begin(), itEnd = psr->end(); it != itEnd; ++it) {
560  blob.clear();
561  it->second.toString(blob);
562  tbb::this_task_arena::isolate([&] { parameterSetsTree->Fill(); });
563  }
564 }
static const char *const kProcessHistoryTree
Definition: format.h:79
map_type::const_iterator const_iterator
Definition: Registry.h:61
edm::ProcessHistoryRegistry m_processHistoryRegistry
assert(be >=bs)
const_iterator end() const
const_iterator end() const
Definition: Registry.h:65
static const char *const kPHIndexBranch
Definition: format.h:80
static const char *const kParameterSetBranch
Definition: format.h:87
static const char *const kMetaDataDirectory
Definition: format.h:77
static const char *const kParameterSetTree
Definition: format.h:86
std::unique_ptr< TFile > m_file
static const char *const kProcessConfigurationPassID
Definition: format.h:84
static const char *const kProcessConfigurationReleaseVersion
Definition: format.h:83
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
std::string const & processName() const
static const char *const kProcessConfigurationProcessNameBranch
Definition: format.h:81
const_iterator begin() const
Definition: Registry.h:63
static Registry * instance()
Definition: Registry.cc:12
static const char *const kProcessConfigurationParameterSetIDBranch
Definition: format.h:82
const_iterator begin() const
std::vector< edm::ProcessHistoryID > m_seenHistories

◆ write()

void DQMRootOutputModule::write ( edm::EventForOutput const &  e)
overrideprivatevirtual

Implements edm::core::OutputModuleCore.

Definition at line 405 of file DQMRootOutputModule.cc.

Referenced by pkg.AbstractPkg::generate().

405 {}

◆ writeLuminosityBlock()

void DQMRootOutputModule::writeLuminosityBlock ( edm::LuminosityBlockForOutput const &  iLumi)
overrideprivatevirtual

Implements edm::core::OutputModuleCore.

Definition at line 407 of file DQMRootOutputModule.cc.

References cms::cuda::assert(), edm::LuminosityBlockForOutput::beginTime(), edm::LuminosityBlockForOutput::endTime(), spr::find(), dqm::implementation::IGetter::getAllContents(), edm::LuminosityBlockForOutput::id(), l1ctLayer2EG_cff::id, mps_monitormerge::items, kNoTypesStored, m_beginTime, m_dqmKindToTypeIndex, m_endTime, m_filterOnRun, m_firstIndex, m_indicesTree, m_jrToken, m_lastIndex, m_lumi, m_presentHistoryIndex, m_processHistoryRegistry, m_run, m_seenHistories, m_treeHelpers, m_type, edm::OccurrenceForOutput::processHistory(), edm::OccurrenceForOutput::processHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportLumiSection(), edm::LuminosityBlockID::run(), edm::LuminosityBlockID::value(), edm::Timestamp::value(), and trackerHitRTTI::vector.

407  {
408  //std::cout << "DQMRootOutputModule::writeLuminosityBlock"<< std::endl;
409  edm::Service<DQMStore> dstore;
410  m_run = iLumi.id().run();
411  m_lumi = iLumi.id().value();
412  m_beginTime = iLumi.beginTime().value();
413  m_endTime = iLumi.endTime().value();
414  bool shouldWrite = (m_filterOnRun == 0 || (m_filterOnRun != 0 && m_filterOnRun == m_run));
415 
416  if (!shouldWrite)
417  return;
418  std::vector<MonitorElement*> items(dstore->getAllContents("", m_run, m_lumi));
419  for (std::vector<MonitorElement*>::iterator it = items.begin(), itEnd = items.end(); it != itEnd; ++it) {
420  assert((*it)->getScope() == MonitorElementData::Scope::LUMI);
421  std::map<unsigned int, unsigned int>::iterator itFound = m_dqmKindToTypeIndex.find((int)(*it)->kind());
422  assert(itFound != m_dqmKindToTypeIndex.end());
423  m_treeHelpers[itFound->second]->fill(*it);
424  }
425 
426  const edm::ProcessHistoryID& id = iLumi.processHistoryID();
427  std::vector<edm::ProcessHistoryID>::iterator itFind = std::find(m_seenHistories.begin(), m_seenHistories.end(), id);
428  if (itFind == m_seenHistories.end()) {
429  m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
431  m_seenHistories.push_back(id);
432  } else {
433  m_presentHistoryIndex = itFind - m_seenHistories.begin();
434  }
435 
436  //Now store the relationship between run/lumi and indices in the other TTrees
437  bool storedLumiIndex = false;
438  unsigned int typeIndex = 0;
439  for (std::vector<std::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
440  it != itEnd;
441  ++it, ++typeIndex) {
442  if ((*it)->wasFilled()) {
443  m_type = typeIndex;
444  (*it)->getRangeAndReset(m_firstIndex, m_lastIndex);
445  storedLumiIndex = true;
446  tbb::this_task_arena::isolate([&] { m_indicesTree->Fill(); });
447  }
448  }
449  if (not storedLumiIndex) {
450  //need to record lumis even if we stored no MonitorElements since some later DQM modules
451  // look to see what lumis were processed
453  m_firstIndex = 0;
454  m_lastIndex = 0;
455  tbb::this_task_arena::isolate([&] { m_indicesTree->Fill(); });
456  }
457 
460 }
unsigned int m_presentHistoryIndex
bool registerProcessHistory(ProcessHistory const &processHistory)
edm::ProcessHistoryRegistry m_processHistoryRegistry
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:641
std::vector< std::shared_ptr< TreeHelperBase > > m_treeHelpers
edm::JobReport::Token m_jrToken
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
Definition: JobReport.cc:494
std::vector< edm::ProcessHistoryID > m_seenHistories

◆ writeRun()

void DQMRootOutputModule::writeRun ( edm::RunForOutput const &  iRun)
overrideprivatevirtual

Implements edm::core::OutputModuleCore.

Definition at line 462 of file DQMRootOutputModule.cc.

References cms::cuda::assert(), edm::RunForOutput::beginTime(), edm::RunForOutput::endTime(), spr::find(), dqm::implementation::IGetter::getAllContents(), edm::RunForOutput::id(), l1ctLayer2EG_cff::id, mps_monitormerge::items, m_beginTime, m_dqmKindToTypeIndex, m_endTime, m_filterOnRun, m_firstIndex, m_indicesTree, m_jrToken, m_lastIndex, m_lumi, m_presentHistoryIndex, m_processHistoryRegistry, m_run, m_seenHistories, m_treeHelpers, m_type, edm::OccurrenceForOutput::processHistory(), edm::OccurrenceForOutput::processHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportRunNumber(), edm::RunID::run(), edm::Timestamp::value(), and trackerHitRTTI::vector.

462  {
463  //std::cout << "DQMRootOutputModule::writeRun"<< std::endl;
464  edm::Service<DQMStore> dstore;
465  m_run = iRun.id().run();
466  m_lumi = 0;
467  m_beginTime = iRun.beginTime().value();
468  m_endTime = iRun.endTime().value();
469  bool shouldWrite = (m_filterOnRun == 0 || (m_filterOnRun != 0 && m_filterOnRun == m_run));
470 
471  if (!shouldWrite)
472  return;
473 
474  std::vector<MonitorElement*> items(dstore->getAllContents("", m_run, 0));
475  for (std::vector<MonitorElement*>::iterator it = items.begin(), itEnd = items.end(); it != itEnd; ++it) {
476  assert((*it)->getScope() == MonitorElementData::Scope::RUN);
477  std::map<unsigned int, unsigned int>::iterator itFound = m_dqmKindToTypeIndex.find((int)(*it)->kind());
478  assert(itFound != m_dqmKindToTypeIndex.end());
479  m_treeHelpers[itFound->second]->fill(*it);
480  }
481 
482  const edm::ProcessHistoryID& id = iRun.processHistoryID();
483  std::vector<edm::ProcessHistoryID>::iterator itFind = std::find(m_seenHistories.begin(), m_seenHistories.end(), id);
484  if (itFind == m_seenHistories.end()) {
485  m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
487  m_seenHistories.push_back(id);
488  } else {
489  m_presentHistoryIndex = itFind - m_seenHistories.begin();
490  }
491 
492  //Now store the relationship between run/lumi and indices in the other TTrees
493  unsigned int typeIndex = 0;
494  for (std::vector<std::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
495  it != itEnd;
496  ++it, ++typeIndex) {
497  if ((*it)->wasFilled()) {
498  m_type = typeIndex;
499  (*it)->getRangeAndReset(m_firstIndex, m_lastIndex);
500  tbb::this_task_arena::isolate([&] { m_indicesTree->Fill(); });
501  }
502  }
503 
506 }
unsigned int m_presentHistoryIndex
bool registerProcessHistory(ProcessHistory const &processHistory)
edm::ProcessHistoryRegistry m_processHistoryRegistry
void reportRunNumber(JobReport::Token token, unsigned int run)
Definition: JobReport.cc:505
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:641
std::vector< std::shared_ptr< TreeHelperBase > > m_treeHelpers
edm::JobReport::Token m_jrToken
std::vector< edm::ProcessHistoryID > m_seenHistories

Member Data Documentation

◆ m_beginTime

ULong64_t DQMRootOutputModule::m_beginTime
private

Definition at line 227 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_dqmKindToTypeIndex

std::map<unsigned int, unsigned int> DQMRootOutputModule::m_dqmKindToTypeIndex
private

Definition at line 235 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_endTime

ULong64_t DQMRootOutputModule::m_endTime
private

Definition at line 228 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_file

std::unique_ptr<TFile> DQMRootOutputModule::m_file
private

Definition at line 220 of file DQMRootOutputModule.cc.

Referenced by finishEndFile(), isFileOpen(), openFile(), and startEndFile().

◆ m_fileName

std::string DQMRootOutputModule::m_fileName
private

Definition at line 218 of file DQMRootOutputModule.cc.

Referenced by openFile().

◆ m_filterOnRun

unsigned int DQMRootOutputModule::m_filterOnRun
private

Definition at line 231 of file DQMRootOutputModule.cc.

Referenced by writeLuminosityBlock(), and writeRun().

◆ m_firstIndex

ULong64_t DQMRootOutputModule::m_firstIndex
private

Definition at line 229 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_fullNameBuffer

std::string DQMRootOutputModule::m_fullNameBuffer
private

Definition at line 233 of file DQMRootOutputModule.cc.

◆ m_fullNameBufferPtr

std::string* DQMRootOutputModule::m_fullNameBufferPtr
private

Definition at line 234 of file DQMRootOutputModule.cc.

Referenced by openFile().

◆ m_getterOfProductsLumi

edm::GetterOfProducts<DQMToken> DQMRootOutputModule::m_getterOfProductsLumi
private

Definition at line 242 of file DQMRootOutputModule.cc.

Referenced by DQMRootOutputModule().

◆ m_getterOfProductsRun

edm::GetterOfProducts<DQMToken> DQMRootOutputModule::m_getterOfProductsRun
private

Definition at line 243 of file DQMRootOutputModule.cc.

Referenced by DQMRootOutputModule().

◆ m_indicesTree

TTree* DQMRootOutputModule::m_indicesTree
private

Definition at line 236 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_jrToken

edm::JobReport::Token DQMRootOutputModule::m_jrToken
private

Definition at line 240 of file DQMRootOutputModule.cc.

Referenced by finishEndFile(), openFile(), writeLuminosityBlock(), and writeRun().

◆ m_lastIndex

ULong64_t DQMRootOutputModule::m_lastIndex
private

Definition at line 230 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_logicalFileName

std::string DQMRootOutputModule::m_logicalFileName
private

Definition at line 219 of file DQMRootOutputModule.cc.

Referenced by openFile().

◆ m_lumi

unsigned int DQMRootOutputModule::m_lumi
private

Definition at line 224 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_presentHistoryIndex

unsigned int DQMRootOutputModule::m_presentHistoryIndex
private

Definition at line 226 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_processHistoryRegistry

edm::ProcessHistoryRegistry DQMRootOutputModule::m_processHistoryRegistry
private

Definition at line 239 of file DQMRootOutputModule.cc.

Referenced by startEndFile(), writeLuminosityBlock(), and writeRun().

◆ m_run

unsigned int DQMRootOutputModule::m_run
private

Definition at line 223 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_seenHistories

std::vector<edm::ProcessHistoryID> DQMRootOutputModule::m_seenHistories
private

Definition at line 238 of file DQMRootOutputModule.cc.

Referenced by startEndFile(), writeLuminosityBlock(), and writeRun().

◆ m_treeHelpers

std::vector<std::shared_ptr<TreeHelperBase> > DQMRootOutputModule::m_treeHelpers
private

Definition at line 221 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().

◆ m_type

unsigned int DQMRootOutputModule::m_type
private

Definition at line 225 of file DQMRootOutputModule.cc.

Referenced by openFile(), writeLuminosityBlock(), and writeRun().