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::EDConsumerBase

Public Member Functions

void beginJob () override
 
 DQMRootOutputModule (edm::ParameterSet const &pset)
 
 ~DQMRootOutputModule () override
 
- Public Member Functions inherited from edm::one::OutputModule<>
 OutputModule (edm::ParameterSet const &iPSet)
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::OutputModuleBase
BranchIDLists const * branchIDLists ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~OutputModuleBase () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::OutputModuleBase
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
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
 
bool m_enableMultiThread
 
ULong64_t m_endTime
 
std::auto_ptr< TFile > m_file
 
std::string m_fileName
 
unsigned int m_filterOnRun
 
ULong64_t m_firstIndex
 
std::string m_fullNameBuffer
 
std::string * m_fullNameBufferPtr
 
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< boost::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::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
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)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 182 of file DQMRootOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 270 of file DQMRootOutputModule.cc.

270  :
273 m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
274 m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName")),
275 m_file(nullptr),
276 m_treeHelpers(kNIndicies,boost::shared_ptr<TreeHelperBase>()),
278 m_filterOnRun(pset.getUntrackedParameter<unsigned int>("filterOnRun")),
279 m_enableMultiThread(false),
281 m_indicesTree(nullptr)
282 {
283 }
unsigned int m_presentHistoryIndex
std::auto_ptr< TFile > m_file
OutputModuleBase(ParameterSet const &pset)
std::vector< boost::shared_ptr< TreeHelperBase > > m_treeHelpers
std::string * m_fullNameBufferPtr
DQMRootOutputModule::~DQMRootOutputModule ( )
override

Definition at line 298 of file DQMRootOutputModule.cc.

299 {
300 }

Member Function Documentation

void DQMRootOutputModule::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 291 of file DQMRootOutputModule.cc.

References DQMStore::enableMultiThread_, and m_enableMultiThread.

292 {
293  // Determine if we are running multithreading asking to the DQMStore. Not to be moved in the ctor
294  edm::Service<DQMStore> dstore;
296 }
bool enableMultiThread_
Definition: DQMStore.h:836
void DQMRootOutputModule::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 580 of file DQMRootOutputModule.cc.

References edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addOptionalUntracked(), edm::ParameterSetDescription::addUntracked(), DEFINE_FWK_MODULE, edm::OutputModule::fillDescription(), keep, edm::ParameterSetDescription::setAllowAnything(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 564 of file DQMRootOutputModule.cc.

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

Referenced by reallyCloseFile().

564  {
565  //std::cout << "DQMRootOutputModule::finishEndFile"<< std::endl;
566  m_file->Write();
567  m_file->Close();
570 }
std::auto_ptr< TFile > m_file
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:461
edm::JobReport::Token m_jrToken
bool DQMRootOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 318 of file DQMRootOutputModule.cc.

References m_file.

319 {
320  return nullptr!=m_file.get();
321 }
std::auto_ptr< TFile > m_file
void DQMRootOutputModule::openFile ( edm::FileBlock const &  )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 324 of file DQMRootOutputModule.cc.

References edm::createGlobalIdentifier(), edm::one::OutputModuleBase::description(), cms::Digest::digest(), MonitorElement::DQM_KIND_INT, MonitorElement::DQM_KIND_REAL, MonitorElement::DQM_KIND_STRING, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TH3F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, mps_fire::i, kBeginTimeBranch, kEndTimeBranch, kFirstIndex, kFloatIndex, kIndicesTree, kIntIndex, kLastIndex, kLumiBranch, kProcessHistoryIndexBranch, kRunBranch, kStringIndex, kTH1DIndex, kTH1FIndex, kTH1SIndex, kTH2DIndex, kTH2FIndex, 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(), edm::JobReport::outputFileOpened(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::MD5Result::toString().

Referenced by Vispa.Main.Application.Application::_readCommandLineAttributes(), Vispa.Main.Application.Application::doubleClickOnFile(), Vispa.Main.Application.Application::openFileDialog(), and Vispa.Main.Application.Application::openRecentFileSlot().

325 {
326  //NOTE: I need to also set the I/O performance settings
327 
328  m_file = std::auto_ptr<TFile>(new TFile(m_fileName.c_str(),"RECREATE",
329  "1" //This is the file format version number
330  ));
331 
333  cms::Digest branchHash;
336  std::string(),
337  "DQMRootOutputModule",
338  description().moduleLabel(),
340  std::string(),
341  branchHash.digest().toString(),
342  std::vector<std::string>()
343  );
344 
345 
347  m_indicesTree->Branch(kRunBranch,&m_run);
348  m_indicesTree->Branch(kLumiBranch,&m_lumi);
352  m_indicesTree->Branch(kTypeBranch,&m_type);
355  m_indicesTree->SetDirectory(m_file.get());
356 
357  unsigned int i = 0;
358  for(std::vector<boost::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
359  it != itEnd;
360  ++it,++i) {
361  //std::cout <<"making "<<kTypeNames[i]<<std::endl;
362  TTree* tree = new TTree(kTypeNames[i],kTypeNames[i]);
363  *it = boost::shared_ptr<TreeHelperBase>(makeHelper(i,tree,m_fullNameBufferPtr));
364  tree->SetDirectory(m_file.get()); //TFile takes ownership
365  }
366 
379 }
static const char *const kRunBranch
Definition: format.h:41
ModuleDescription const & description() const
static const char *const kTypeNames[]
Definition: format.h:28
static const char *const kIndicesTree
Definition: format.h:40
unsigned int m_presentHistoryIndex
static TreeHelperBase * makeHelper(unsigned int iTypeIndex, TTree *iTree, std::string *iFullNameBufferPtr)
static const char *const kFirstIndex
Definition: format.h:47
static const char *const kLumiBranch
Definition: format.h:42
MD5Result digest() const
Definition: Digest.cc:194
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
std::auto_ptr< TFile > m_file
static const char *const kTypeBranch
Definition: format.h:46
static const char *const kProcessHistoryIndexBranch
Definition: format.h:43
Token outputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &outputModuleClassName, std::string const &moduleLabel, std::string const &guid, std::string const &dataType, std::string const &branchHash, std::vector< std::string > const &branchNames)
Definition: JobReport.cc:415
static const char *const kEndTimeBranch
Definition: format.h:45
std::vector< boost::shared_ptr< TreeHelperBase > > m_treeHelpers
std::string * m_fullNameBufferPtr
static const char *const kLastIndex
Definition: format.h:48
std::string toString() const
Definition: Digest.cc:87
static const char *const kBeginTimeBranch
Definition: format.h:44
edm::JobReport::Token m_jrToken
Definition: tree.py:1
std::string createGlobalIdentifier()
void DQMRootOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 501 of file DQMRootOutputModule.cc.

References finishEndFile(), and startEndFile().

501  {
502  startEndFile();
503  finishEndFile();
504 }
void DQMRootOutputModule::startEndFile ( )
private

Definition at line 507 of file DQMRootOutputModule.cc.

References 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::one::OutputModuleBase::processName(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by reallyCloseFile().

507  {
508  //std::cout << "DQMRootOutputModule::startEndFile"<< std::endl;
509  //fill in the meta data
510  m_file->cd();
511  TDirectory* metaDataDirectory = m_file->mkdir(kMetaDataDirectory);
512 
513 
514  //Write out the Process History
515  TTree* processHistoryTree = new TTree(kProcessHistoryTree,kProcessHistoryTree);
516  processHistoryTree->SetDirectory(metaDataDirectory);
517 
518  unsigned int index = 0;
519  processHistoryTree->Branch(kPHIndexBranch,&index);
521  processHistoryTree->Branch(kProcessConfigurationProcessNameBranch,&processName);
522  std::string parameterSetID;
523  processHistoryTree->Branch(kProcessConfigurationParameterSetIDBranch,&parameterSetID);
524  std::string releaseVersion;
525  processHistoryTree->Branch(kProcessConfigurationReleaseVersion,&releaseVersion);
526  std::string passID;
527  processHistoryTree->Branch(kProcessConfigurationPassID,&passID);
528 
529  for(std::vector<edm::ProcessHistoryID>::iterator it = m_seenHistories.begin(), itEnd = m_seenHistories.end();
530  it !=itEnd;
531  ++it) {
533  assert(nullptr!=history);
534  index = 0;
535  for(edm::ProcessHistory::collection_type::const_iterator itPC = history->begin(), itPCEnd = history->end();
536  itPC != itPCEnd;
537  ++itPC,++index) {
538  processName = itPC->processName();
539  releaseVersion = itPC->releaseVersion();
540  passID = itPC->passID();
541  parameterSetID = itPC->parameterSetID().compactForm();
542  processHistoryTree->Fill();
543  }
544  }
545 
546  //Store the ParameterSets
547  TTree* parameterSetsTree = new TTree(kParameterSetTree,kParameterSetTree);
548  parameterSetsTree->SetDirectory(metaDataDirectory);
549  std::string blob;
550  parameterSetsTree->Branch(kParameterSetBranch,&blob);
551 
553  assert(nullptr!=psr);
554  for(edm::pset::Registry::const_iterator it = psr->begin(), itEnd = psr->end();
555  it != itEnd;
556  ++it) {
557  blob.clear();
558  it->second.toString(blob);
559  parameterSetsTree->Fill();
560  }
561 
562 }
const_iterator begin() const
static const char *const kProcessHistoryTree
Definition: format.h:54
map_type::const_iterator const_iterator
Definition: Registry.h:63
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
const_iterator end() const
Definition: Registry.h:69
edm::ProcessHistoryRegistry m_processHistoryRegistry
static const char *const kPHIndexBranch
Definition: format.h:55
static const char *const kParameterSetBranch
Definition: format.h:62
static const char *const kMetaDataDirectory
Definition: format.h:52
std::auto_ptr< TFile > m_file
static const char *const kParameterSetTree
Definition: format.h:61
const_iterator begin() const
Definition: Registry.h:65
static const char *const kProcessConfigurationPassID
Definition: format.h:59
static const char *const kProcessConfigurationReleaseVersion
Definition: format.h:58
std::string const & processName() const
static const char *const kProcessConfigurationProcessNameBranch
Definition: format.h:56
const_iterator end() const
static Registry * instance()
Definition: Registry.cc:13
static const char *const kProcessConfigurationParameterSetIDBranch
Definition: format.h:57
std::vector< edm::ProcessHistoryID > m_seenHistories
void DQMRootOutputModule::write ( edm::EventForOutput const &  e)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 383 of file DQMRootOutputModule.cc.

Referenced by pkg.AbstractPkg::generate().

383  {
384 }
void DQMRootOutputModule::writeLuminosityBlock ( edm::LuminosityBlockForOutput const &  iLumi)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 388 of file DQMRootOutputModule.cc.

References edm::LuminosityBlockForOutput::beginTime(), edm::LuminosityBlockForOutput::endTime(), spr::find(), DQMStore::getAllContents(), triggerObjects_cff::id, edm::LuminosityBlockForOutput::id(), mps_monitormerge::items, kNoTypesStored, m_beginTime, m_dqmKindToTypeIndex, m_enableMultiThread, 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(), and edm::Timestamp::value().

388  {
389  //std::cout << "DQMRootOutputModule::writeLuminosityBlock"<< std::endl;
390  edm::Service<DQMStore> dstore;
391  m_run = iLumi.id().run();
392  m_lumi = iLumi.id().value();
393  m_beginTime = iLumi.beginTime().value();
394  m_endTime = iLumi.endTime().value();
395  bool shouldWrite = (m_filterOnRun == 0 ||
396  (m_filterOnRun != 0 && m_filterOnRun == m_run));
397 
398  if (! shouldWrite)
399  return;
400  std::vector<MonitorElement *> items(dstore->getAllContents("",
402  m_enableMultiThread ? m_lumi : 0));
403  for(std::vector<MonitorElement*>::iterator it = items.begin(), itEnd=items.end();
404  it!=itEnd;
405  ++it) {
406  if((*it)->getLumiFlag()) {
407  std::map<unsigned int,unsigned int>::iterator itFound = m_dqmKindToTypeIndex.find((*it)->kind());
408  assert(itFound !=m_dqmKindToTypeIndex.end());
409  m_treeHelpers[itFound->second]->fill(*it);
410  }
411  }
412 
413  const edm::ProcessHistoryID& id = iLumi.processHistoryID();
414  std::vector<edm::ProcessHistoryID>::iterator itFind = std::find(m_seenHistories.begin(),m_seenHistories.end(),id);
415  if(itFind == m_seenHistories.end()) {
416  m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
418  m_seenHistories.push_back(id);
419  } else {
420  m_presentHistoryIndex = itFind - m_seenHistories.begin();
421  }
422 
423  //Now store the relationship between run/lumi and indices in the other TTrees
424  bool storedLumiIndex = false;
425  unsigned int typeIndex = 0;
426  for(std::vector<boost::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
427  it != itEnd;
428  ++it,++typeIndex) {
429  if((*it)->wasFilled()) {
430  m_type = typeIndex;
431  (*it)->getRangeAndReset(m_firstIndex,m_lastIndex);
432  storedLumiIndex = true;
433  m_indicesTree->Fill();
434  }
435  }
436  if(not storedLumiIndex) {
437  //need to record lumis even if we stored no MonitorElements since some later DQM modules
438  // look to see what lumis were processed
440  m_firstIndex=0;
441  m_lastIndex=0;
442  m_indicesTree->Fill();
443  }
444 
446  jr->reportLumiSection(m_jrToken, m_run, m_lumi);
447 }
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:20
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1812
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
std::vector< boost::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:487
std::vector< edm::ProcessHistoryID > m_seenHistories
void DQMRootOutputModule::writeRun ( edm::RunForOutput const &  iRun)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 449 of file DQMRootOutputModule.cc.

References edm::RunForOutput::beginTime(), edm::RunForOutput::endTime(), spr::find(), DQMStore::getAllContents(), triggerObjects_cff::id, edm::RunForOutput::id(), mps_monitormerge::items, m_beginTime, m_dqmKindToTypeIndex, m_enableMultiThread, 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(), and edm::Timestamp::value().

449  {
450  //std::cout << "DQMRootOutputModule::writeRun"<< std::endl;
451  edm::Service<DQMStore> dstore;
452  m_run = iRun.id().run();
453  m_lumi = 0;
454  m_beginTime = iRun.beginTime().value();
455  m_endTime = iRun.endTime().value();
456  bool shouldWrite = (m_filterOnRun == 0 ||
457  (m_filterOnRun != 0 && m_filterOnRun == m_run));
458 
459  if (! shouldWrite)
460  return;
461 
462  std::vector<MonitorElement*> items(dstore->getAllContents("",
463  m_enableMultiThread ? m_run : 0));
464  for(std::vector<MonitorElement*>::iterator it = items.begin(), itEnd=items.end();
465  it!=itEnd;
466  ++it) {
467  if(not (*it)->getLumiFlag()) {
468  std::map<unsigned int,unsigned int>::iterator itFound = m_dqmKindToTypeIndex.find((*it)->kind());
469  assert (itFound !=m_dqmKindToTypeIndex.end());
470  m_treeHelpers[itFound->second]->fill(*it);
471  }
472  }
473 
474  const edm::ProcessHistoryID& id = iRun.processHistoryID();
475  std::vector<edm::ProcessHistoryID>::iterator itFind = std::find(m_seenHistories.begin(),m_seenHistories.end(),id);
476  if(itFind == m_seenHistories.end()) {
477  m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
479  m_seenHistories.push_back(id);
480  } else {
481  m_presentHistoryIndex = itFind - m_seenHistories.begin();
482  }
483 
484  //Now store the relationship between run/lumi and indices in the other TTrees
485  unsigned int typeIndex = 0;
486  for(std::vector<boost::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
487  it != itEnd;
488  ++it,++typeIndex) {
489  if((*it)->wasFilled()) {
490  m_type = typeIndex;
491  (*it)->getRangeAndReset(m_firstIndex,m_lastIndex);
492  m_indicesTree->Fill();
493  }
494  }
495 
497  jr->reportRunNumber(m_jrToken, m_run);
498 }
unsigned int m_presentHistoryIndex
bool registerProcessHistory(ProcessHistory const &processHistory)
edm::ProcessHistoryRegistry m_processHistoryRegistry
void reportRunNumber(JobReport::Token token, unsigned int run)
Definition: JobReport.cc:497
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1812
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
std::vector< boost::shared_ptr< TreeHelperBase > > m_treeHelpers
edm::JobReport::Token m_jrToken
std::vector< edm::ProcessHistoryID > m_seenHistories

Member Data Documentation

ULong64_t DQMRootOutputModule::m_beginTime
private

Definition at line 208 of file DQMRootOutputModule.cc.

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

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

Definition at line 217 of file DQMRootOutputModule.cc.

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

bool DQMRootOutputModule::m_enableMultiThread
private

Definition at line 213 of file DQMRootOutputModule.cc.

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

ULong64_t DQMRootOutputModule::m_endTime
private

Definition at line 209 of file DQMRootOutputModule.cc.

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

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

Definition at line 201 of file DQMRootOutputModule.cc.

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

std::string DQMRootOutputModule::m_fileName
private

Definition at line 199 of file DQMRootOutputModule.cc.

Referenced by openFile().

unsigned int DQMRootOutputModule::m_filterOnRun
private

Definition at line 212 of file DQMRootOutputModule.cc.

Referenced by writeLuminosityBlock(), and writeRun().

ULong64_t DQMRootOutputModule::m_firstIndex
private

Definition at line 210 of file DQMRootOutputModule.cc.

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

std::string DQMRootOutputModule::m_fullNameBuffer
private

Definition at line 215 of file DQMRootOutputModule.cc.

std::string* DQMRootOutputModule::m_fullNameBufferPtr
private

Definition at line 216 of file DQMRootOutputModule.cc.

Referenced by openFile().

TTree* DQMRootOutputModule::m_indicesTree
private

Definition at line 218 of file DQMRootOutputModule.cc.

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

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

Definition at line 222 of file DQMRootOutputModule.cc.

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

ULong64_t DQMRootOutputModule::m_lastIndex
private

Definition at line 211 of file DQMRootOutputModule.cc.

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

std::string DQMRootOutputModule::m_logicalFileName
private

Definition at line 200 of file DQMRootOutputModule.cc.

Referenced by openFile().

unsigned int DQMRootOutputModule::m_lumi
private

Definition at line 205 of file DQMRootOutputModule.cc.

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

unsigned int DQMRootOutputModule::m_presentHistoryIndex
private

Definition at line 207 of file DQMRootOutputModule.cc.

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

edm::ProcessHistoryRegistry DQMRootOutputModule::m_processHistoryRegistry
private

Definition at line 221 of file DQMRootOutputModule.cc.

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

unsigned int DQMRootOutputModule::m_run
private

Definition at line 204 of file DQMRootOutputModule.cc.

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

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

Definition at line 220 of file DQMRootOutputModule.cc.

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

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

Definition at line 202 of file DQMRootOutputModule.cc.

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

unsigned int DQMRootOutputModule::m_type
private

Definition at line 206 of file DQMRootOutputModule.cc.

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