CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DQMRootOutputModule Class Reference
Inheritance diagram for DQMRootOutputModule:
edm::OutputModule edm::EDConsumerBase

Public Member Functions

 DQMRootOutputModule (edm::ParameterSet const &pset)
 
virtual ~DQMRootOutputModule ()
 
- Public Member Functions inherited from edm::OutputModule
BranchChildren const & branchChildren () const
 
BranchIDLists const * branchIDLists () const
 
std::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType
const & 
keptProducts () const
 
int maxEvents () const
 
OutputModuleoperator= (OutputModule const &)=delete
 
 OutputModule (ParameterSet const &pset)
 
 OutputModule (OutputModule const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg)
 
bool wantAllEvents () const
 
virtual ~OutputModule ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::OutputModule
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void finishEndFile ()
 
virtual bool isFileOpen () const override
 
virtual void openFile (edm::FileBlock const &) override
 
virtual void postForkReacquireResources (unsigned int childIndex, unsigned int numberOfChildren) override
 
virtual void reallyCloseFile () override
 
void startEndFile ()
 
virtual void write (edm::EventPrincipal const &e, edm::ModuleCallingContext const *) override
 
virtual void writeLuminosityBlock (edm::LuminosityBlockPrincipal const &, edm::ModuleCallingContext const *) override
 
virtual void writeRun (edm::RunPrincipal const &, edm::ModuleCallingContext 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::ProcessHistoryID
m_seenHistories
 
std::vector< boost::shared_ptr
< TreeHelperBase > > 
m_treeHelpers
 
unsigned int m_type
 

Additional Inherited Members

- Public Types inherited from edm::OutputModule
typedef OutputModule ModuleType
 
- Protected Member Functions inherited from edm::OutputModule
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *mcc)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
Trig getTriggerResults (EventPrincipal const &ep, ModuleCallingContext const *) const
 
ModuleDescription const & moduleDescription () const
 
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 181 of file DQMRootOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 269 of file DQMRootOutputModule.cc.

269  :
270 edm::OutputModule(pset),
271 m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
272 m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName","")),
273 m_file(0),
274 m_treeHelpers(kNIndicies,boost::shared_ptr<TreeHelperBase>()),
276 m_filterOnRun(pset.getUntrackedParameter<unsigned int>("filterOnRun",0)),
277 m_enableMultiThread(pset.getUntrackedParameter<bool>("enableMultiThread", false)),
279 m_indicesTree(0)
280 {
281 }
unsigned int m_presentHistoryIndex
std::auto_ptr< TFile > m_file
std::vector< boost::shared_ptr< TreeHelperBase > > m_treeHelpers
std::string * m_fullNameBufferPtr
DQMRootOutputModule::~DQMRootOutputModule ( )
virtual

Definition at line 288 of file DQMRootOutputModule.cc.

289 {
290 }

Member Function Documentation

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

Definition at line 594 of file DQMRootOutputModule.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

594  {
595  //The following says we do not know what parameters are allowed so do no validation
596  // Please change this to state exactly what you do use, even if it is no parameters
598  desc.setUnknown();
599  descriptions.addDefault(desc);
600 
601  //NOTE: when actually filling this in, do not forget to add a untracked PSet 'dataset'
602  // which is used for bookkeeping by the DMWM
603 }
void addDefault(ParameterSetDescription const &psetDescription)
void DQMRootOutputModule::finishEndFile ( )
private

Definition at line 578 of file DQMRootOutputModule.cc.

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

Referenced by reallyCloseFile().

578  {
579  //std::cout << "DQMRootOutputModule::finishEndFile"<< std::endl;
580  m_file->Write();
581  m_file->Close();
584 }
std::auto_ptr< TFile > m_file
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:513
edm::JobReport::Token m_jrToken
bool DQMRootOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::OutputModule.

Definition at line 308 of file DQMRootOutputModule.cc.

References m_file.

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

Reimplemented from edm::OutputModule.

Definition at line 314 of file DQMRootOutputModule.cc.

References edm::createGlobalIdentifier(), edm::OutputModule::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, 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, cms::MD5Result::toString(), and diffTreeTool::tree.

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

315 {
316  //NOTE: I need to also set the I/O performance settings
317 
318  m_file = std::auto_ptr<TFile>(new TFile(m_fileName.c_str(),"RECREATE",
319  "1" //This is the file format version number
320  ));
321 
323  cms::Digest branchHash;
326  std::string(),
327  "DQMRootOutputModule",
328  description().moduleLabel(),
330  std::string(),
331  branchHash.digest().toString(),
332  std::vector<std::string>()
333  );
334 
335 
337  m_indicesTree->Branch(kRunBranch,&m_run);
338  m_indicesTree->Branch(kLumiBranch,&m_lumi);
342  m_indicesTree->Branch(kTypeBranch,&m_type);
345  m_indicesTree->SetDirectory(m_file.get());
346 
347  unsigned int i = 0;
348  for(std::vector<boost::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
349  it != itEnd;
350  ++it,++i) {
351  //std::cout <<"making "<<kTypeNames[i]<<std::endl;
352  TTree* tree = new TTree(kTypeNames[i],kTypeNames[i]);
353  *it = boost::shared_ptr<TreeHelperBase>(makeHelper(i,tree,m_fullNameBufferPtr));
354  tree->SetDirectory(m_file.get()); //TFile takes ownership
355  }
356 
369 }
int i
Definition: DBlmapReader.cc:9
static const char *const kRunBranch
Definition: format.h:41
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:467
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
ModuleDescription const & description() const
std::string createGlobalIdentifier()
void DQMRootOutputModule::postForkReacquireResources ( unsigned int  childIndex,
unsigned int  numberOfChildren 
)
overrideprivatevirtual

Reimplemented from edm::OutputModule.

Definition at line 373 of file DQMRootOutputModule.cc.

References lut2db_cfg::filename, m_fileName, and getHLTPrescaleColumns::path.

373  {
374  // this is copied from IOPool/Output/src/PoolOutputModule.cc, for consistency
375  unsigned int digits = 0;
376  while (numberOfChildren != 0) {
377  ++digits;
378  numberOfChildren /= 10;
379  }
380  // protect against zero numberOfChildren
381  if (digits == 0) {
382  digits = 3;
383  }
384 
385  char buffer[digits + 2];
386  snprintf(buffer, digits + 2, "_%0*d", digits, childIndex);
387 
389  m_fileName = (filename.parent_path() / (filename.stem().string() + buffer + filename.extension().string())).string();
390 }
tuple filename
Definition: lut2db_cfg.py:20
void DQMRootOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::OutputModule.

Definition at line 515 of file DQMRootOutputModule.cc.

References finishEndFile(), and startEndFile().

515  {
516  startEndFile();
517  finishEndFile();
518 }
void DQMRootOutputModule::startEndFile ( )
private

Definition at line 521 of file DQMRootOutputModule.cc.

References edm::ProcessHistory::begin(), edm::pset::Registry::begin(), edm::ProcessHistory::end(), edm::pset::Registry::end(), edm::ProcessHistoryRegistry::getMapped(), getHLTprescales::index, edm::pset::Registry::instance(), kMetaDataDirectory, kParameterSetBranch, kParameterSetTree, kPHIndexBranch, kProcessConfigurationParameterSetIDBranch, kProcessConfigurationPassID, kProcessConfigurationProcessNameBranch, kProcessConfigurationReleaseVersion, kProcessHistoryTree, m_file, m_processHistoryRegistry, m_seenHistories, edm::OutputModule::processName(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by reallyCloseFile().

521  {
522  //std::cout << "DQMRootOutputModule::startEndFile"<< std::endl;
523  //fill in the meta data
524  m_file->cd();
525  TDirectory* metaDataDirectory = m_file->mkdir(kMetaDataDirectory);
526 
527 
528  //Write out the Process History
529  TTree* processHistoryTree = new TTree(kProcessHistoryTree,kProcessHistoryTree);
530  processHistoryTree->SetDirectory(metaDataDirectory);
531 
532  unsigned int index = 0;
533  processHistoryTree->Branch(kPHIndexBranch,&index);
535  processHistoryTree->Branch(kProcessConfigurationProcessNameBranch,&processName);
536  std::string parameterSetID;
537  processHistoryTree->Branch(kProcessConfigurationParameterSetIDBranch,&parameterSetID);
538  std::string releaseVersion;
539  processHistoryTree->Branch(kProcessConfigurationReleaseVersion,&releaseVersion);
540  std::string passID;
541  processHistoryTree->Branch(kProcessConfigurationPassID,&passID);
542 
543  for(std::vector<edm::ProcessHistoryID>::iterator it = m_seenHistories.begin(), itEnd = m_seenHistories.end();
544  it !=itEnd;
545  ++it) {
547  assert(0!=history);
548  index = 0;
549  for(edm::ProcessHistory::collection_type::const_iterator itPC = history->begin(), itPCEnd = history->end();
550  itPC != itPCEnd;
551  ++itPC,++index) {
552  processName = itPC->processName();
553  releaseVersion = itPC->releaseVersion();
554  passID = itPC->passID();
555  parameterSetID = itPC->parameterSetID().compactForm();
556  processHistoryTree->Fill();
557  }
558  }
559 
560  //Store the ParameterSets
561  TTree* parameterSetsTree = new TTree(kParameterSetTree,kParameterSetTree);
562  parameterSetsTree->SetDirectory(metaDataDirectory);
563  std::string blob;
564  parameterSetsTree->Branch(kParameterSetBranch,&blob);
565 
567  assert(0!=psr);
568  for(edm::pset::Registry::const_iterator it = psr->begin(), itEnd = psr->end();
569  it != itEnd;
570  ++it) {
571  blob.clear();
572  it->second.toString(blob);
573  parameterSetsTree->Fill();
574  }
575 
576 }
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
std::string const & processName() const
Definition: OutputModule.h:66
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
static const char *const kProcessConfigurationProcessNameBranch
Definition: format.h:56
const_iterator end() const
static Registry * instance()
Definition: Registry.cc:14
static const char *const kProcessConfigurationParameterSetIDBranch
Definition: format.h:57
std::vector< edm::ProcessHistoryID > m_seenHistories
void DQMRootOutputModule::write ( edm::EventPrincipal const &  e,
edm::ModuleCallingContext const *   
)
overrideprivatevirtual

Implements edm::OutputModule.

Definition at line 394 of file DQMRootOutputModule.cc.

Referenced by pkg.AbstractPkg::generate().

394  {
395 
396 }
void DQMRootOutputModule::writeLuminosityBlock ( edm::LuminosityBlockPrincipal const &  iLumi,
edm::ModuleCallingContext const *   
)
overrideprivatevirtual

Implements edm::OutputModule.

Definition at line 400 of file DQMRootOutputModule.cc.

References edm::LuminosityBlockPrincipal::beginTime(), edm::LuminosityBlockPrincipal::endTime(), spr::find(), DQMStore::getAllContents(), edm::LuminosityBlockPrincipal::id(), 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::Principal::processHistory(), edm::Principal::processHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportLumiSection(), edm::LuminosityBlockID::run(), edm::LuminosityBlockID::value(), and edm::Timestamp::value().

401  {
402  //std::cout << "DQMRootOutputModule::writeLuminosityBlock"<< std::endl;
403  edm::Service<DQMStore> dstore;
404  m_run = iLumi.id().run();
405  m_lumi = iLumi.id().value();
406  m_beginTime = iLumi.beginTime().value();
407  m_endTime = iLumi.endTime().value();
408  bool shouldWrite = (m_filterOnRun == 0 ||
409  (m_filterOnRun != 0 && m_filterOnRun == m_run));
410 
411  if (! shouldWrite)
412  return;
413  std::vector<MonitorElement *> items(dstore->getAllContents("",
415  m_enableMultiThread ? m_lumi : 0));
416  for(std::vector<MonitorElement*>::iterator it = items.begin(), itEnd=items.end();
417  it!=itEnd;
418  ++it) {
419  if((*it)->getLumiFlag()) {
420  std::map<unsigned int,unsigned int>::iterator itFound = m_dqmKindToTypeIndex.find((*it)->kind());
421  assert(itFound !=m_dqmKindToTypeIndex.end());
422  m_treeHelpers[itFound->second]->fill(*it);
423  }
424  }
425 
426  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<boost::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  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  m_indicesTree->Fill();
456  }
457 
459  jr->reportLumiSection(m_jrToken, m_run, m_lumi);
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:7
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1836
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)
Definition: JobReport.cc:539
std::vector< edm::ProcessHistoryID > m_seenHistories
void DQMRootOutputModule::writeRun ( edm::RunPrincipal const &  iRun,
edm::ModuleCallingContext const *   
)
overrideprivatevirtual

Implements edm::OutputModule.

Definition at line 462 of file DQMRootOutputModule.cc.

References edm::RunPrincipal::beginTime(), edm::RunPrincipal::endTime(), spr::find(), DQMStore::getAllContents(), edm::RunPrincipal::id(), 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::Principal::processHistory(), edm::Principal::processHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportRunNumber(), edm::RunID::run(), and edm::Timestamp::value().

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

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

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

Definition at line 216 of file DQMRootOutputModule.cc.

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

bool DQMRootOutputModule::m_enableMultiThread
private

Definition at line 212 of file DQMRootOutputModule.cc.

Referenced by writeLuminosityBlock(), and writeRun().

ULong64_t DQMRootOutputModule::m_endTime
private

Definition at line 208 of file DQMRootOutputModule.cc.

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

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

Definition at line 200 of file DQMRootOutputModule.cc.

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

std::string DQMRootOutputModule::m_fileName
private

Definition at line 198 of file DQMRootOutputModule.cc.

Referenced by openFile(), and postForkReacquireResources().

unsigned int DQMRootOutputModule::m_filterOnRun
private

Definition at line 211 of file DQMRootOutputModule.cc.

Referenced by writeLuminosityBlock(), and writeRun().

ULong64_t DQMRootOutputModule::m_firstIndex
private

Definition at line 209 of file DQMRootOutputModule.cc.

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

std::string DQMRootOutputModule::m_fullNameBuffer
private

Definition at line 214 of file DQMRootOutputModule.cc.

std::string* DQMRootOutputModule::m_fullNameBufferPtr
private

Definition at line 215 of file DQMRootOutputModule.cc.

Referenced by openFile().

TTree* DQMRootOutputModule::m_indicesTree
private

Definition at line 217 of file DQMRootOutputModule.cc.

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

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

Definition at line 221 of file DQMRootOutputModule.cc.

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

ULong64_t DQMRootOutputModule::m_lastIndex
private

Definition at line 210 of file DQMRootOutputModule.cc.

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

std::string DQMRootOutputModule::m_logicalFileName
private

Definition at line 199 of file DQMRootOutputModule.cc.

Referenced by openFile().

unsigned int DQMRootOutputModule::m_lumi
private

Definition at line 204 of file DQMRootOutputModule.cc.

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

unsigned int DQMRootOutputModule::m_presentHistoryIndex
private

Definition at line 206 of file DQMRootOutputModule.cc.

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

edm::ProcessHistoryRegistry DQMRootOutputModule::m_processHistoryRegistry
private

Definition at line 220 of file DQMRootOutputModule.cc.

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

unsigned int DQMRootOutputModule::m_run
private

Definition at line 203 of file DQMRootOutputModule.cc.

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

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

Definition at line 219 of file DQMRootOutputModule.cc.

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

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

Definition at line 201 of file DQMRootOutputModule.cc.

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

unsigned int DQMRootOutputModule::m_type
private

Definition at line 205 of file DQMRootOutputModule.cc.

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