CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CDFRunInfo Class Reference

Per-run or per-file information. More...

#include <CDFRunInfo.h>

Public Member Functions

 CDFRunInfo ()
 
 CDFRunInfo (TFile *fromFile)
 
const char * get (const char *key) const
 Get some run info by name. More...
 
double getDouble (const char *key) const
 Get a run info item by name and convert it to a double. More...
 
int getInt (const char *key) const
 Get a run info item by name and convert it to an integer. More...
 
int getKeys (const char **buffer, int nbufs)
 fill the given array with key name pointers More...
 
int getSize () const
 get the number of items More...
 
bool hasKey (const char *key) const
 test for thr presence of given key More...
 
void print () const
 print all information to the terminal More...
 
void setInfo (const char *key, const char *value)
 add some information to the run info More...
 
void store (TFile *toFile)
 

Private Member Functions

bool load (TFile *fromFile)
 

Private Attributes

std::map< std::string,
std::string > 
m_mapData
 

Static Private Attributes

static const char * RootVariableName = "CDFRunInfo"
 

Detailed Description

Per-run or per-file information.

This class allows access to per-run or per-file information as opposed to per-event information such as CDFEventInfo. The information is stored in the form of string -> string pairs. There are utility methods for decoding string values as integers and doubles.

Definition at line 15 of file CDFRunInfo.h.

Constructor & Destructor Documentation

CDFRunInfo::CDFRunInfo ( )

Definition at line 8 of file CDFRunInfo.cc.

8 {}
CDFRunInfo::CDFRunInfo ( TFile *  fromFile)

Definition at line 10 of file CDFRunInfo.cc.

References load().

10 { load(file); }
bool load(TFile *fromFile)
Definition: CDFRunInfo.cc:49

Member Function Documentation

const char * CDFRunInfo::get ( const char *  key) const

Get some run info by name.

Definition at line 12 of file CDFRunInfo.cc.

References mps_fire::i, and m_mapData.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), and submitPVValidationJobs.BetterConfigParser::getResultingSection().

12  {
13  std::map<std::string, std::string>::const_iterator i = m_mapData.find(key);
14  if (i == m_mapData.end())
15  return nullptr;
16  return i->second.c_str();
17 }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
tuple key
prepare the HTCondor submission files and eventually submit them
double CDFRunInfo::getDouble ( const char *  key) const

Get a run info item by name and convert it to a double.

Definition at line 26 of file CDFRunInfo.cc.

References isotrackApplyRegressor::k, and submitPVResolutionJobs::key.

26  {
27  const char* k = get(key);
28  if (k == nullptr)
29  return 0;
30  return atof(k);
31 }
tuple key
prepare the HTCondor submission files and eventually submit them
int CDFRunInfo::getInt ( const char *  key) const

Get a run info item by name and convert it to an integer.

Definition at line 19 of file CDFRunInfo.cc.

References isotrackApplyRegressor::k, and submitPVResolutionJobs::key.

19  {
20  const char* k = get(key);
21  if (k == nullptr)
22  return 0;
23  return atoi(k);
24 }
tuple key
prepare the HTCondor submission files and eventually submit them
int CDFRunInfo::getKeys ( const char **  buffer,
int  nbufs 
)

fill the given array with key name pointers

Definition at line 33 of file CDFRunInfo.cc.

References mps_fire::i, dqmiolumiharvest::j, and m_mapData.

33  {
34  int j = 0;
35  for (std::map<std::string, std::string>::const_iterator i = m_mapData.begin(); i != m_mapData.end() && j < nbufs;
36  i++, j++) {
37  buffer[j] = i->first.c_str();
38  }
39  return j;
40 }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
int CDFRunInfo::getSize ( ) const
inline

get the number of items

Definition at line 27 of file CDFRunInfo.h.

References m_mapData.

27 { return m_mapData.size(); }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
bool CDFRunInfo::hasKey ( const char *  key) const

test for thr presence of given key

Definition at line 42 of file CDFRunInfo.cc.

References mps_fire::i, and m_mapData.

42  {
43  std::map<std::string, std::string>::const_iterator i = m_mapData.find(key);
44  return (i != m_mapData.end());
45 }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
tuple key
prepare the HTCondor submission files and eventually submit them
bool CDFRunInfo::load ( TFile *  fromFile)
private

Definition at line 49 of file CDFRunInfo.cc.

References a, b, mps_fire::i, m_mapData, class-composition::o, RootVariableName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CDFRunInfo().

49  {
50  m_mapData.clear();
51  if (f == nullptr)
52  return false;
53  TMap* pMap = (TMap*)f->Get(RootVariableName);
54  if (pMap == nullptr)
55  return false;
56  TIterator* i = pMap->MakeIterator();
57  TObject* o;
58 
59  while ((o = i->Next()) != nullptr) {
60  std::string a(o->GetName());
61  std::string b(pMap->GetValue(o)->GetName());
62  m_mapData.insert(std::pair<std::string, std::string>(a, b));
63  }
64  return true;
65 }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
static const char * RootVariableName
Definition: CDFRunInfo.h:42
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
void CDFRunInfo::print ( void  ) const

print all information to the terminal

Definition at line 77 of file CDFRunInfo.cc.

References mps_fire::i, m_mapData, and gpuVertexFinder::printf().

77  {
78  for (std::map<std::string, std::string>::const_iterator i = m_mapData.begin(); i != m_mapData.end(); i++)
79  printf(" '%s' => '%s' \n", i->first.c_str(), i->second.c_str());
80 }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void CDFRunInfo::setInfo ( const char *  key,
const char *  value 
)

add some information to the run info

Definition at line 47 of file CDFRunInfo.cc.

References submitPVResolutionJobs::key, m_mapData, and relativeConstraints::value.

Referenced by HcalTBWriter::analyze(), and HcalTBWriter::endJob().

47 { m_mapData[key] = value; }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
tuple key
prepare the HTCondor submission files and eventually submit them
void CDFRunInfo::store ( TFile *  toFile)

Definition at line 67 of file CDFRunInfo.cc.

References mps_fire::i, m_mapData, and RootVariableName.

Referenced by HcalTBWriter::endJob().

67  {
68  f->cd();
69  TMap* myMap = new TMap();
70  for (std::map<std::string, std::string>::iterator i = m_mapData.begin(); i != m_mapData.end(); i++) {
71  myMap->Add(new TObjString(i->first.c_str()), new TObjString(i->second.c_str()));
72  }
73  myMap->SetName(RootVariableName);
74  myMap->Write(RootVariableName, TObject::kSingleKey);
75 }
std::map< std::string, std::string > m_mapData
Definition: CDFRunInfo.h:43
static const char * RootVariableName
Definition: CDFRunInfo.h:42

Member Data Documentation

std::map<std::string, std::string> CDFRunInfo::m_mapData
private

Definition at line 43 of file CDFRunInfo.h.

Referenced by get(), getKeys(), getSize(), hasKey(), load(), print(), setInfo(), and store().

const char * CDFRunInfo::RootVariableName = "CDFRunInfo"
staticprivate

Definition at line 42 of file CDFRunInfo.h.

Referenced by load(), and store().