CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

LumiDetails Class Reference

#include <LumiDetails.h>

List of all members.

Public Types

enum  Algos {
  kOCC1, kOCC2, kET, kPLT,
  kMaxNumAlgos
}
typedef unsigned int AlgoType
typedef std::pair< std::vector
< float >::const_iterator,
std::vector< float >
::const_iterator > 
ErrorRange
typedef std::pair< std::vector
< short >::const_iterator,
std::vector< short >
::const_iterator > 
QualityRange
typedef std::pair< std::vector
< float >::const_iterator,
std::vector< float >
::const_iterator > 
ValueRange

Public Member Functions

void fill (AlgoType algo, std::vector< float > const &values, std::vector< float > const &errors, std::vector< short > const &qualities)
void fillBeamIntensities (std::vector< float > const &beam1Intensities, std::vector< float > const &beam2Intensities)
bool isProductEqual (LumiDetails const &lumiDetails) const
bool isValid () const
std::vector< float > const & lumiBeam1Intensities () const
float lumiBeam1Intensity (unsigned int bx) const
std::vector< float > const & lumiBeam2Intensities () const
float lumiBeam2Intensity (unsigned int bx) const
 LumiDetails (std::string const &lumiVersion)
 LumiDetails ()
float lumiError (AlgoType algo, unsigned int bx) const
ErrorRange lumiErrorsForAlgo (AlgoType algo) const
QualityRange lumiQualitiesForAlgo (AlgoType algo) const
short lumiQuality (AlgoType algo, unsigned int bx) const
float lumiValue (AlgoType algo, unsigned int bx) const
ValueRange lumiValuesForAlgo (AlgoType algo) const
std::string const & lumiVersion () const
void setLumiVersion (std::string const &lumiVersion)
 ~LumiDetails ()

Static Public Member Functions

static std::vector
< std::string > const & 
algoNames ()
static std::vector
< std::string > const & 
dipalgoNames ()

Private Member Functions

void checkAlgo (AlgoType algo) const
void checkAlgoAndBX (AlgoType algo, unsigned int bx) const

Private Attributes

std::vector< unsigned int > m_algoToFirstIndex
std::vector< float > m_allErrors
std::vector< short > m_allQualities
std::vector< float > m_allValues
std::vector< float > m_beam1Intensities
std::vector< float > m_beam2Intensities
std::string m_lumiVersion

Static Private Attributes

static std::vector< std::string > m_algoNames

Detailed Description

LumiDetails holds Details information: the lumi value, the error on this value, its quality, and 2 beam intensities for each bunch crossing (BX) in a given luminosity section (LS)

Author:
Valerie Halyo, David Dagenhart, created June 7, 2007>

Definition at line 20 of file LumiDetails.h.


Member Typedef Documentation

typedef unsigned int LumiDetails::AlgoType

Definition at line 34 of file LumiDetails.h.

typedef std::pair<std::vector<float>::const_iterator, std::vector<float>::const_iterator> LumiDetails::ErrorRange

Definition at line 36 of file LumiDetails.h.

typedef std::pair<std::vector<short>::const_iterator, std::vector<short>::const_iterator> LumiDetails::QualityRange

Definition at line 37 of file LumiDetails.h.

typedef std::pair<std::vector<float>::const_iterator, std::vector<float>::const_iterator> LumiDetails::ValueRange

Definition at line 35 of file LumiDetails.h.


Member Enumeration Documentation

Enumerator:
kOCC1 
kOCC2 
kET 
kPLT 
kMaxNumAlgos 

Definition at line 27 of file LumiDetails.h.


Constructor & Destructor Documentation

LumiDetails::LumiDetails ( )
LumiDetails::LumiDetails ( std::string const &  lumiVersion) [explicit]
LumiDetails::~LumiDetails ( )

Definition at line 32 of file LumiDetails.cc.

                          {
}

Member Function Documentation

std::vector< std::string > const & LumiDetails::algoNames ( ) [static]

Definition at line 140 of file LumiDetails.cc.

References kMaxNumAlgos, and m_algoNames.

Referenced by operator<<().

                       {
  if (m_algoNames.size() != kMaxNumAlgos) {
    assert(m_algoNames.size() == 0U);
    // If in the future additional algorithm names are added,
    // it is important that they be added at the end of the list.
    // The Algos enum in LumiDetails.h also would need to be
    // updated to keep the list of names in sync.
    m_algoNames.push_back(std::string("OCC1"));
    m_algoNames.push_back(std::string("OCC2"));
    m_algoNames.push_back(std::string("ET"));
    m_algoNames.push_back(std::string("PLT"));
    assert(m_algoNames.size() == kMaxNumAlgos);
  }
  return m_algoNames;
}
void LumiDetails::checkAlgo ( AlgoType  algo) const [private]

Definition at line 177 of file LumiDetails.cc.

References Exception, kMaxNumAlgos, and edm::errors::LogicError.

Referenced by checkAlgoAndBX(), fill(), lumiErrorsForAlgo(), lumiQualitiesForAlgo(), and lumiValuesForAlgo().

                                          {
  if (algo >= kMaxNumAlgos) {
    throw edm::Exception(edm::errors::LogicError)
      << "Algorithm type argument out of range in a call to a function in LumiDetails\n";
  }
}
void LumiDetails::checkAlgoAndBX ( AlgoType  algo,
unsigned int  bx 
) const [private]

Definition at line 185 of file LumiDetails.cc.

References checkAlgo(), Exception, edm::errors::LogicError, and m_algoToFirstIndex.

Referenced by lumiError(), lumiQuality(), and lumiValue().

                                                                {
  checkAlgo(algo);
  if (bx >= (m_algoToFirstIndex[algo + 1U] - m_algoToFirstIndex[algo])) {
    throw edm::Exception(edm::errors::LogicError)
      << "Branch crossing argument out of range in call to a function in LumiDetails\n";
  }
}
std::vector< std::string > const & LumiDetails::dipalgoNames ( ) [static]

Definition at line 157 of file LumiDetails.cc.

References m_algoNames.

Referenced by operator<<().

                          {
  m_algoNames.push_back(std::string("DIP"));
  return m_algoNames;
}
void LumiDetails::fill ( AlgoType  algo,
std::vector< float > const &  values,
std::vector< float > const &  errors,
std::vector< short > const &  qualities 
)

Definition at line 51 of file LumiDetails.cc.

References algo, checkAlgo(), Exception, i, kMaxNumAlgos, edm::errors::LogicError, m_algoToFirstIndex, m_allErrors, m_allQualities, and m_allValues.

Referenced by ExpressLumiProducer::writeProductsForEntry(), and LumiProducer::writeProductsForEntry().

                                                     {
  checkAlgo(algo);
  if (values.size() != errors.size() ||
      values.size() != qualities.size() ||
      m_algoToFirstIndex[algo] != m_algoToFirstIndex[algo + 1U]) {
    throw edm::Exception(edm::errors::LogicError)
      << "Illegal input values passed to LumiDetails::fill.\n"
      << "The current implementation of LumiDetails only allows filling\n"
      << "vectors for each algorithm once and the input vectors must\n"
      << "all be the same size.\n";
  }
  m_allValues.insert(m_allValues.begin() + m_algoToFirstIndex[algo], values.begin(), values.end());
  m_allErrors.insert(m_allErrors.begin() + m_algoToFirstIndex[algo], errors.begin(), errors.end());
  m_allQualities.insert(m_allQualities.begin() + m_algoToFirstIndex[algo], qualities.begin(), qualities.end());
  for (unsigned i = algo + 1U; i <= kMaxNumAlgos; ++i) {
    m_algoToFirstIndex[i] += values.size();
  }
}
void LumiDetails::fillBeamIntensities ( std::vector< float > const &  beam1Intensities,
std::vector< float > const &  beam2Intensities 
)

Definition at line 74 of file LumiDetails.cc.

References m_beam1Intensities, and m_beam2Intensities.

Referenced by LumiProducer::writeProductsForEntry().

                                                                           {
  m_beam1Intensities = beam1Intensities;
  m_beam2Intensities = beam2Intensities;
}
bool LumiDetails::isProductEqual ( LumiDetails const &  lumiDetails) const

Definition at line 162 of file LumiDetails.cc.

References m_algoToFirstIndex, m_allErrors, m_allQualities, m_allValues, m_beam1Intensities, m_beam2Intensities, and m_lumiVersion.

                                                                {
  
  if (m_lumiVersion == lumiDetails.m_lumiVersion &&
      m_algoToFirstIndex == lumiDetails.m_algoToFirstIndex &&
      m_allValues == lumiDetails.m_allValues &&
      m_allErrors == lumiDetails.m_allErrors &&
      m_allQualities == lumiDetails.m_allQualities &&
      m_beam1Intensities == lumiDetails.m_beam1Intensities &&
      m_beam2Intensities == lumiDetails.m_beam2Intensities) {
    return true;
  }
  return false;
}
bool LumiDetails::isValid ( void  ) const

Definition at line 46 of file LumiDetails.cc.

References m_allValues.

                           {
  return m_allValues.size()!=0;
}
std::vector< float > const & LumiDetails::lumiBeam1Intensities ( ) const

Definition at line 130 of file LumiDetails.cc.

References m_beam1Intensities.

Referenced by operator<<().

                                        {
  return m_beam1Intensities;
}
float LumiDetails::lumiBeam1Intensity ( unsigned int  bx) const

Definition at line 99 of file LumiDetails.cc.

References m_beam1Intensities.

                                                     {
  return m_beam1Intensities.at(bx);
}
std::vector< float > const & LumiDetails::lumiBeam2Intensities ( ) const

Definition at line 135 of file LumiDetails.cc.

References m_beam2Intensities.

Referenced by operator<<().

                                        {
  return m_beam2Intensities;
}
float LumiDetails::lumiBeam2Intensity ( unsigned int  bx) const

Definition at line 104 of file LumiDetails.cc.

References m_beam2Intensities.

                                                     {
  return m_beam2Intensities.at(bx);
}
float LumiDetails::lumiError ( AlgoType  algo,
unsigned int  bx 
) const

Definition at line 87 of file LumiDetails.cc.

References algo, checkAlgoAndBX(), m_algoToFirstIndex, and m_allErrors.

LumiDetails::ErrorRange LumiDetails::lumiErrorsForAlgo ( AlgoType  algo) const

Definition at line 116 of file LumiDetails.cc.

References algo, checkAlgo(), m_algoToFirstIndex, and m_allErrors.

Referenced by operator<<().

LumiDetails::QualityRange LumiDetails::lumiQualitiesForAlgo ( AlgoType  algo) const

Definition at line 123 of file LumiDetails.cc.

References algo, checkAlgo(), m_algoToFirstIndex, and m_allQualities.

Referenced by operator<<().

short LumiDetails::lumiQuality ( AlgoType  algo,
unsigned int  bx 
) const

Definition at line 93 of file LumiDetails.cc.

References algo, checkAlgoAndBX(), m_algoToFirstIndex, and m_allQualities.

float LumiDetails::lumiValue ( AlgoType  algo,
unsigned int  bx 
) const

Definition at line 81 of file LumiDetails.cc.

References algo, checkAlgoAndBX(), m_algoToFirstIndex, and m_allValues.

LumiDetails::ValueRange LumiDetails::lumiValuesForAlgo ( AlgoType  algo) const

Definition at line 109 of file LumiDetails.cc.

References algo, checkAlgo(), m_algoToFirstIndex, and m_allValues.

Referenced by operator<<().

std::string const & LumiDetails::lumiVersion ( ) const

Definition at line 41 of file LumiDetails.cc.

References m_lumiVersion.

Referenced by operator<<(), and setLumiVersion().

                               {
  return m_lumiVersion;
}
void LumiDetails::setLumiVersion ( std::string const &  lumiVersion)

Member Data Documentation

std::vector< std::string > LumiDetails::m_algoNames [static, private]

Definition at line 81 of file LumiDetails.h.

Referenced by algoNames(), and dipalgoNames().

std::vector<unsigned int> LumiDetails::m_algoToFirstIndex [private]
std::vector<float> LumiDetails::m_allErrors [private]

Definition at line 94 of file LumiDetails.h.

Referenced by fill(), isProductEqual(), lumiError(), and lumiErrorsForAlgo().

std::vector<short> LumiDetails::m_allQualities [private]

Definition at line 95 of file LumiDetails.h.

Referenced by fill(), isProductEqual(), lumiQualitiesForAlgo(), and lumiQuality().

std::vector<float> LumiDetails::m_allValues [private]

Definition at line 93 of file LumiDetails.h.

Referenced by fill(), isProductEqual(), isValid(), lumiValue(), and lumiValuesForAlgo().

std::vector<float> LumiDetails::m_beam1Intensities [private]
std::vector<float> LumiDetails::m_beam2Intensities [private]
std::string LumiDetails::m_lumiVersion [private]

Definition at line 83 of file LumiDetails.h.

Referenced by isProductEqual(), lumiVersion(), and setLumiVersion().