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::one::OutputModule<> edm::one::OutputModuleBase edm::EDConsumerBase

Public Member Functions

 DQMRootOutputModule (edm::ParameterSet const &pset)
 
virtual ~DQMRootOutputModule ()
 
- Public Member Functions inherited from edm::one::OutputModule<>
 OutputModule (edm::ParameterSet const &iPSet)
 
- Public Member Functions inherited from edm::one::OutputModuleBase
BranchChildren const & branchChildren () const
 
BranchIDLists const * branchIDLists () const
 
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)
 
bool wantAllEvents () const
 
virtual ~OutputModuleBase ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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::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 ()
 
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::one::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- 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 ()
 
Trig getTriggerResults (EventPrincipal const &ep, ModuleCallingContext const *) 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.

References DQMStore::enableMultiThread_, and m_enableMultiThread.

269  :
272 m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
273 m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName","")),
274 m_file(0),
275 m_treeHelpers(kNIndicies,boost::shared_ptr<TreeHelperBase>()),
277 m_filterOnRun(pset.getUntrackedParameter<unsigned int>("filterOnRun",0)),
278 m_enableMultiThread(false),
280 m_indicesTree(0)
281 {
282  edm::Service<DQMStore> dstore;
284 }
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
bool enableMultiThread_
Definition: DQMStore.h:686
DQMRootOutputModule::~DQMRootOutputModule ( )
virtual

Definition at line 291 of file DQMRootOutputModule.cc.

292 {
293 }

Member Function Documentation

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

Definition at line 597 of file DQMRootOutputModule.cc.

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

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

Definition at line 581 of file DQMRootOutputModule.cc.

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

Referenced by reallyCloseFile().

581  {
582  //std::cout << "DQMRootOutputModule::finishEndFile"<< std::endl;
583  m_file->Write();
584  m_file->Close();
587 }
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::one::OutputModuleBase.

Definition at line 311 of file DQMRootOutputModule.cc.

References m_file.

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

Reimplemented from edm::one::OutputModuleBase.

Definition at line 317 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, 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().

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

Reimplemented from edm::one::OutputModuleBase.

Definition at line 376 of file DQMRootOutputModule.cc.

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

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

Reimplemented from edm::one::OutputModuleBase.

Definition at line 518 of file DQMRootOutputModule.cc.

References finishEndFile(), and startEndFile().

518  {
519  startEndFile();
520  finishEndFile();
521 }
void DQMRootOutputModule::startEndFile ( )
private

Definition at line 524 of file DQMRootOutputModule.cc.

References edm::ProcessHistory::begin(), edm::pset::Registry::begin(), edm::ProcessHistory::end(), edm::pset::Registry::end(), edm::ProcessHistoryRegistry::getMapped(), cmsHarvester::index, 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().

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

Definition at line 397 of file DQMRootOutputModule.cc.

Referenced by pkg.AbstractPkg::generate().

397  {
398 
399 }
void DQMRootOutputModule::writeLuminosityBlock ( edm::LuminosityBlockPrincipal const &  iLumi,
edm::ModuleCallingContext const *   
)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 403 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().

404  {
405  //std::cout << "DQMRootOutputModule::writeLuminosityBlock"<< std::endl;
406  edm::Service<DQMStore> dstore;
407  m_run = iLumi.id().run();
408  m_lumi = iLumi.id().value();
409  m_beginTime = iLumi.beginTime().value();
410  m_endTime = iLumi.endTime().value();
411  bool shouldWrite = (m_filterOnRun == 0 ||
412  (m_filterOnRun != 0 && m_filterOnRun == m_run));
413 
414  if (! shouldWrite)
415  return;
416  std::vector<MonitorElement *> items(dstore->getAllContents("",
418  m_enableMultiThread ? m_lumi : 0));
419  for(std::vector<MonitorElement*>::iterator it = items.begin(), itEnd=items.end();
420  it!=itEnd;
421  ++it) {
422  if((*it)->getLumiFlag()) {
423  std::map<unsigned int,unsigned int>::iterator itFound = m_dqmKindToTypeIndex.find((*it)->kind());
424  assert(itFound !=m_dqmKindToTypeIndex.end());
425  m_treeHelpers[itFound->second]->fill(*it);
426  }
427  }
428 
429  edm::ProcessHistoryID id = iLumi.processHistoryID();
430  std::vector<edm::ProcessHistoryID>::iterator itFind = std::find(m_seenHistories.begin(),m_seenHistories.end(),id);
431  if(itFind == m_seenHistories.end()) {
432  m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
434  m_seenHistories.push_back(id);
435  } else {
436  m_presentHistoryIndex = itFind - m_seenHistories.begin();
437  }
438 
439  //Now store the relationship between run/lumi and indices in the other TTrees
440  bool storedLumiIndex = false;
441  unsigned int typeIndex = 0;
442  for(std::vector<boost::shared_ptr<TreeHelperBase> >::iterator it = m_treeHelpers.begin(), itEnd = m_treeHelpers.end();
443  it != itEnd;
444  ++it,++typeIndex) {
445  if((*it)->wasFilled()) {
446  m_type = typeIndex;
447  (*it)->getRangeAndReset(m_firstIndex,m_lastIndex);
448  storedLumiIndex = true;
449  m_indicesTree->Fill();
450  }
451  }
452  if(not storedLumiIndex) {
453  //need to record lumis even if we stored no MonitorElements since some later DQM modules
454  // look to see what lumis were processed
456  m_firstIndex=0;
457  m_lastIndex=0;
458  m_indicesTree->Fill();
459  }
460 
462  jr->reportLumiSection(m_jrToken, m_run, m_lumi);
463 }
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:1909
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::one::OutputModuleBase.

Definition at line 465 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().

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