CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
TauDQMFileLoader::cfgEntryFileSet Struct Reference

Public Member Functions

 cfgEntryFileSet (const std::string &, const edm::ParameterSet &)
 
void print () const
 

Public Attributes

std::string dqmDirectory_store_
 
vstring inputFileNames_
 
std::string name_
 
double scaleFactor_
 

Detailed Description

Definition at line 31 of file DQMFileLoader.h.

Constructor & Destructor Documentation

TauDQMFileLoader::cfgEntryFileSet::cfgEntryFileSet ( const std::string &  name,
const edm::ParameterSet cfg 
)

Definition at line 55 of file DQMFileLoader.cc.

References defaultScaleFactor, dqmDirectory_store_, edm::ParameterSet::exists(), convertXMLtoSQLite_cfg::fileName, edm::ParameterSet::getParameter(), analyzePatCOC_cfg::inputFile, diJetCalib::inputFileList, inputFileNames_, mergeVDriftHistosByStation::name, name_, print(), rangeKeyword, scaleFactor_, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

56 {
57  //std::cout << "<TauDQMFileLoader::cfgEntryFileSet>" << std::endl;
58 
59  name_ = name;
60 
61  vstring inputFileList = cfg.getParameter<vstring>("inputFileNames");
62  for ( vstring::const_iterator inputFile = inputFileList.begin();
63  inputFile != inputFileList.end(); ++inputFile ) {
64  if ( inputFile->find(rangeKeyword) != std::string::npos ) {
65  size_t posRangeStart = inputFile->find(rangeKeyword) + rangeKeyword.length();
66  size_t posRangeEnd = inputFile->find('#', posRangeStart);
67 
68  size_t posRangeSeparator = inputFile->find('-', posRangeStart);
69 
70  if ( (posRangeEnd == std::string::npos) ||
71  (posRangeSeparator >= posRangeEnd) ) {
72  edm::LogError ("TauDQMFileLoader::cfgEntryFileSet") << " Invalid range specification in inputFile = " << (*inputFile) << " !!";
73  continue;
74  }
75 
76  std::string firstFile = std::string(*inputFile, posRangeStart, posRangeSeparator - posRangeStart);
77  //std::cout << "firstFile = " << firstFile << std::endl;
78  std::string lastFile = std::string(*inputFile, posRangeSeparator + 1, posRangeEnd - (posRangeSeparator + 1));
79  //std::cout << "lastFile = " << lastFile << std::endl;
80 
81  if ( firstFile.length() != lastFile.length() ) {
82  edm::LogError ("TauDQMFileLoader::cfgEntryFileSet") << " Invalid range specification in inputFile = " << (*inputFile) << " !!";
83  continue;
84  }
85 
86  int numFirstFile = atoi(firstFile.data());
87  int numLastFile = atoi(lastFile.data());
88  for ( int iFile = numFirstFile; iFile <= numLastFile; ++iFile ) {
89  std::ostringstream fileName;
90  fileName << std::string(*inputFile, 0, inputFile->find(rangeKeyword));
91  fileName << std::setfill('0') << std::setw(firstFile.length()) << iFile;
92  fileName << std::string(*inputFile, posRangeEnd + 1);
93  //std::cout << "iFile = " << iFile << ", fileName = " << fileName.str() << std::endl;
94  inputFileNames_.push_back(fileName.str());
95  }
96  } else {
97  inputFileNames_.push_back(*inputFile);
98  }
99  }
100 
101  scaleFactor_ = ( cfg.exists("scaleFactor") ) ? cfg.getParameter<double>("scaleFactor") : defaultScaleFactor;
102 
103  //dqmDirectory_store_ = ( cfg.exists("dqmDirectory_store") ) ? cfg.getParameter<std::string>("dqmDirectory_store") : name_;
104  dqmDirectory_store_ = ( cfg.exists("dqmDirectory_store") ) ? cfg.getParameter<std::string>("dqmDirectory_store") : "";
105 
106  if ( verbosity ) print();
107 }
T getParameter(std::string const &) const
const double defaultScaleFactor
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::string rangeKeyword
tuple inputFileList
Definition: diJetCalib.py:17
std::vector< std::string > vstring

Member Function Documentation

void TauDQMFileLoader::cfgEntryFileSet::print ( void  ) const

Definition at line 109 of file DQMFileLoader.cc.

References gather_cfg::cout, and format_vstring().

Referenced by cfgEntryFileSet().

110 {
111  std::cout << "<cfgEntryFileSet::print>:" << std::endl;
112  std::cout << " name = " << name_ << std::endl;
113  std::cout << " inputFileNames = " << format_vstring(inputFileNames_) << std::endl;
114  std::cout << " scaleFactor = " << scaleFactor_ << std::endl;
115  std::cout << " dqmDirectory_store = " << dqmDirectory_store_ << std::endl;
116 }
std::string format_vstring(const std::vector< std::string > &vs)
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::string TauDQMFileLoader::cfgEntryFileSet::dqmDirectory_store_

Definition at line 38 of file DQMFileLoader.h.

Referenced by cfgEntryFileSet().

vstring TauDQMFileLoader::cfgEntryFileSet::inputFileNames_

Definition at line 36 of file DQMFileLoader.h.

Referenced by cfgEntryFileSet().

std::string TauDQMFileLoader::cfgEntryFileSet::name_

Definition at line 35 of file DQMFileLoader.h.

Referenced by cfgEntryFileSet().

double TauDQMFileLoader::cfgEntryFileSet::scaleFactor_

Definition at line 37 of file DQMFileLoader.h.

Referenced by cfgEntryFileSet().