CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

DQMHistAdder Class Reference

#include <DQMHistAdder.h>

Inheritance diagram for DQMHistAdder:
edm::EDAnalyzer

List of all members.

Classes

struct  cfgEntryAddJob

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 DQMHistAdder (const edm::ParameterSet &)
virtual void endJob ()
virtual ~DQMHistAdder ()

Private Types

typedef std::vector< std::string > vstring

Private Attributes

std::map< std::string,
cfgEntryAddJob
addJobs_
int cfgError_

Detailed Description

Class to add DQM monitoring elements stored in separate directories in DQMStore (in order to e.g. compute the total Standard Model expectation)

Date:
2008/12/19 19:05:50
Revision:
1.1
Author:
Christian Veelken, UC Davis

Definition at line 27 of file DQMHistAdder.h.


Member Typedef Documentation

typedef std::vector<std::string> DQMHistAdder::vstring [private]

Definition at line 29 of file DQMHistAdder.h.


Constructor & Destructor Documentation

DQMHistAdder::DQMHistAdder ( const edm::ParameterSet cfg) [explicit]

Definition at line 50 of file DQMHistAdder.cc.

References addJobs_, cfgError_, and gather_cfg::cout.

{
  std::cout << "<DQMHistAdder::DQMHistAdder>:" << std::endl;

  cfgError_ = 0;

//--- configure processes  
  //std::cout << "--> configuring addJobs..." << std::endl;
  readCfgParameter<cfgEntryAddJob>(cfg, addJobs_);
  
  std::cout << "done." << std::endl;
}
DQMHistAdder::~DQMHistAdder ( ) [virtual]

Definition at line 63 of file DQMHistAdder.cc.

{
// nothing to be done yet...
}

Member Function Documentation

void DQMHistAdder::analyze ( const edm::Event ,
const edm::EventSetup  
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 68 of file DQMHistAdder.cc.

{
// nothing to be done yet...
}
void DQMHistAdder::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file DQMHistAdder.cc.

References addJobs_, cfgError_, gather_cfg::cout, dqmCopyRecursively(), dqmDirectoryName(), dqmRootDirectory, mode, DQMStore::showDirStructure(), and verbosity.

{
  std::cout << "<DQMHistAdder::endJob>:" << std::endl;

//--- check that configuration parameters contain no errors
  if ( cfgError_ ) {
    edm::LogError ("endJob") << " Error in Configuration ParameterSet --> histograms will NOT be added !!";
    return;
  }

//--- check that DQMStore service is available
  if ( !edm::Service<DQMStore>().isAvailable() ) {
    edm::LogError ("endJob") << " Failed to access dqmStore --> histograms will NOT be added !!";
    return;
  }

//--- stop ROOT from keeping references to all histograms
  //TH1::AddDirectory(false);

//--- add histograms
  //std::cout << "--> adding histograms..." << std::endl;
  DQMStore& dqmStore = (*edm::Service<DQMStore>());
  for ( std::map<std::string, cfgEntryAddJob>::const_iterator addJob = addJobs_.begin();
        addJob != addJobs_.end(); ++addJob ) {
    const std::string& dqmDirectory_output = addJob->second.dqmDirectory_output_;
    for ( vstring::const_iterator dqmDirectory_input = addJob->second.dqmDirectories_input_.begin();
          dqmDirectory_input != addJob->second.dqmDirectories_input_.end(); ++dqmDirectory_input ) {
      
      std::string inputDirectory = dqmDirectoryName(std::string(dqmRootDirectory)).append(*dqmDirectory_input);
      //std::cout << " inputDirectory = " << inputDirectory << std::endl;
      std::string outputDirectory = dqmDirectoryName(std::string(dqmRootDirectory)).append(dqmDirectory_output);
      //std::cout << " outputDirectory = " << outputDirectory << std::endl;
      
//--- when processing first inputDirectory, check that histograms in outputDirectory do not yet exist;
//    afterwards, add histograms in inputDirectory to those in outputDirectory
      int mode = ( dqmDirectory_input == addJob->second.dqmDirectories_input_.begin() ) ? 1 : 3;
      //std::cout << " mode = " << mode << std::endl;
      dqmCopyRecursively(dqmStore, inputDirectory, outputDirectory, 1., mode, false);
    }
  }

  std::cout << "done." << std::endl; 
  if ( verbosity ) dqmStore.showDirStructure();
}

Member Data Documentation

std::map<std::string, cfgEntryAddJob> DQMHistAdder::addJobs_ [private]

Definition at line 47 of file DQMHistAdder.h.

Referenced by DQMHistAdder(), and endJob().

int DQMHistAdder::cfgError_ [private]

Definition at line 48 of file DQMHistAdder.h.

Referenced by DQMHistAdder(), and endJob().