CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions

HDQMSummary Class Reference

#include <HDQMSummary.h>

List of all members.

Classes

struct  DetRegistry
class  StrictWeakOrdering

Public Types

typedef std::vector< float >
::const_iterator 
ContainerIterator
typedef std::vector< float > InputVector
typedef std::pair
< ContainerIterator,
ContainerIterator
Range
typedef std::vector< DetRegistryRegistry
typedef Registry::const_iterator RegistryIterator

Public Member Functions

ContainerIterator getDataVectorBegin () const
ContainerIterator getDataVectorEnd () const
std::vector< uint32_t > getDetIds () const
const Range getRange (const uint32_t &detID) const
RegistryIterator getRegistryVectorBegin () const
RegistryIterator getRegistryVectorEnd () const
int getRunNr () const
std::vector< float > getSummaryObj () const
std::vector< float > getSummaryObj (uint32_t &detID, std::vector< std::string > list) const
std::vector< float > getSummaryObj (std::string elementName) const
std::vector< float > getSummaryObj (uint32_t &detID) const
unsigned long long getTimeValue () const
std::vector< std::string > getUserDBContent () const
 HDQMSummary (std::vector< std::string > &userDBContent)
 HDQMSummary (const HDQMSummary &input)
 HDQMSummary ()
void print ()
bool put (const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
void setObj (const uint32_t &detID, std::string elementName, float value)
void setRunNr (int inputRunNr)
void setTimeValue (unsigned long long inputTimeValue)
void setUserDBContent (std::vector< std::string > userDBContent)
 ~HDQMSummary ()

Public Attributes

std::vector< DetRegistryindexes_
int runNr_
unsigned long long timeValue_
std::vector< std::string > userDBContent_
std::vector< float > v_sum_

Protected Member Functions

const short getPosition (std::string elementName) const

Detailed Description

Author:
D. Giordano, A.-C. Le Bihan

Definition at line 37 of file HDQMSummary.h.


Member Typedef Documentation

typedef std::vector<float>::const_iterator HDQMSummary::ContainerIterator

Definition at line 54 of file HDQMSummary.h.

typedef std::vector<float> HDQMSummary::InputVector

Definition at line 58 of file HDQMSummary.h.

Definition at line 55 of file HDQMSummary.h.

typedef std::vector<DetRegistry> HDQMSummary::Registry

Definition at line 56 of file HDQMSummary.h.

typedef Registry::const_iterator HDQMSummary::RegistryIterator

Definition at line 57 of file HDQMSummary.h.


Constructor & Destructor Documentation

HDQMSummary::HDQMSummary ( std::vector< std::string > &  userDBContent)

Definition at line 6 of file HDQMSummary.cc.

References runNr_, timeValue_, and userDBContent_.

{
  userDBContent_ = userDBContent;
  runNr_ = 0;
  timeValue_ = 0;
}
HDQMSummary::HDQMSummary ( const HDQMSummary input)

Definition at line 14 of file HDQMSummary.cc.

References getRunNr(), getTimeValue(), getUserDBContent(), indexes_, runNr_, timeValue_, userDBContent_, and v_sum_.

{
  userDBContent_ = input.getUserDBContent();
  runNr_ = input.getTimeValue();
  timeValue_ = input.getRunNr();
  v_sum_.clear();
  indexes_.clear();
  v_sum_.insert(v_sum_.end(),input.v_sum_.begin(),input.v_sum_.end());
  indexes_.insert(indexes_.end(),input.indexes_.begin(),input.indexes_.end());
}
HDQMSummary::HDQMSummary ( ) [inline]

Definition at line 63 of file HDQMSummary.h.

{};
HDQMSummary::~HDQMSummary ( ) [inline]

Definition at line 64 of file HDQMSummary.h.

{};

Member Function Documentation

ContainerIterator HDQMSummary::getDataVectorBegin ( ) const [inline]

Definition at line 67 of file HDQMSummary.h.

References v_sum_.

{return v_sum_.begin();  }
ContainerIterator HDQMSummary::getDataVectorEnd ( ) const [inline]

Definition at line 68 of file HDQMSummary.h.

References v_sum_.

{return v_sum_.end();    } 
std::vector< uint32_t > HDQMSummary::getDetIds ( ) const

Definition at line 71 of file HDQMSummary.cc.

References begin, end, indexes_, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by getSummaryObj().

{
  // returns vector of DetIds in map
  std::vector<uint32_t> DetIds_;
  HDQMSummary::RegistryIterator begin = indexes_.begin();
  HDQMSummary::RegistryIterator end   = indexes_.end();
  for (HDQMSummary::RegistryIterator p=begin; p != end; ++p) {
    DetIds_.push_back(p->detid);
  }
  return DetIds_;
}
const short HDQMSummary::getPosition ( std::string  elementName) const [protected]

Definition at line 85 of file HDQMSummary.cc.

References spr::find(), pos, and userDBContent_.

Referenced by getSummaryObj(), put(), and setObj().

{
  // returns position of elementName in UserDBContent_
    
  std::vector<std::string>::const_iterator it = find(userDBContent_.begin(),userDBContent_.end(),elementName);  
  short pos = -1;
  if (it != userDBContent_.end()) pos = it - userDBContent_.begin();
  else edm::LogError("HDQMSummary") << "attempting to retrieve non existing historic DB object : "<< elementName <<std::endl;
  return pos;  
}   
const HDQMSummary::Range HDQMSummary::getRange ( const uint32_t &  detID) const

Definition at line 60 of file HDQMSummary.cc.

References gather_cfg::cout, indexes_, AlCaHLTBitMon_ParallelJobs::p, userDBContent_, and v_sum_.

Referenced by getSummaryObj(), and setObj().

{

  RegistryIterator p = std::lower_bound(indexes_.begin(),indexes_.end(),DetId,HDQMSummary::StrictWeakOrdering());
  if (p==indexes_.end()|| p->detid!=DetId) {
    return HDQMSummary::Range(v_sum_.end(),v_sum_.end()); std::cout << "not in range " << std::endl;}
  else 
    return HDQMSummary::Range(v_sum_.begin()+p->ibegin,v_sum_.begin()+p->ibegin+userDBContent_.size());
}
RegistryIterator HDQMSummary::getRegistryVectorBegin ( ) const [inline]

Definition at line 69 of file HDQMSummary.h.

References indexes_.

{return indexes_.begin();}
RegistryIterator HDQMSummary::getRegistryVectorEnd ( ) const [inline]

Definition at line 70 of file HDQMSummary.h.

References indexes_.

{return indexes_.end();  }
int HDQMSummary::getRunNr ( ) const [inline]

Definition at line 113 of file HDQMSummary.h.

References runNr_.

Referenced by HDQMInspector::createTrend(), and HDQMSummary().

{ return runNr_;            }
std::vector< float > HDQMSummary::getSummaryObj ( uint32_t &  detID,
std::vector< std::string >  list 
) const

Definition at line 119 of file HDQMSummary.cc.

References getPosition(), getRange(), i, and pos.

Referenced by HDQMInspector::createTrend().

{  
  std::vector<float> SummaryObj;
  const HDQMSummary::Range range = getRange(detID);
  if (range.first != range.second ) {
   for (unsigned int i=0; i<list.size(); i++){ 
     const short pos=getPosition(list.at(i));
     
     if (pos!=-1) 
       SummaryObj.push_back(*((range.first)+pos));
     else 
       SummaryObj.push_back(-999.);
   }
  }
  else 
   for (unsigned int i=0; i<list.size(); i++) SummaryObj.push_back(-99.); // no summary obj has ever been inserted for this detid, most likely all related histos were not available in DQM
  
  return SummaryObj;
}
std::vector< float > HDQMSummary::getSummaryObj ( std::string  elementName) const

Definition at line 158 of file HDQMSummary.cc.

References getDetIds(), getPosition(), getRange(), i, and pos.

{
  std::vector<float> vSumElement;
  std::vector<uint32_t> DetIds_ = getDetIds();
  const short pos = getPosition(elementName);
   
  if (pos !=-1)
    {
      for (unsigned int i=0; i<DetIds_.size(); i++){
        const HDQMSummary::Range range = getRange(DetIds_.at(i));
        if (range.first != range.second ) {
        vSumElement.push_back(*((range.first)+pos));}
        else { vSumElement.push_back(-99.);}
    }
  }
  
  return vSumElement;
}
std::vector< float > HDQMSummary::getSummaryObj ( uint32_t &  detID) const

Definition at line 139 of file HDQMSummary.cc.

References getRange(), i, and userDBContent_.

{  
  std::vector<float> SummaryObj;
  const HDQMSummary::Range range = getRange(detID);
  if (range.first != range.second ) {
   for (unsigned int i=0; i<userDBContent_.size(); i++) SummaryObj.push_back(*((range.first)+i));}
  else {
   for (unsigned int i=0; i<userDBContent_.size(); i++) SummaryObj.push_back(-99.);} 
  return SummaryObj;
}
std::vector< float > HDQMSummary::getSummaryObj ( ) const

Definition at line 152 of file HDQMSummary.cc.

References v_sum_.

{
  return v_sum_;
}
unsigned long long HDQMSummary::getTimeValue ( ) const [inline]

Definition at line 111 of file HDQMSummary.h.

References timeValue_.

Referenced by HDQMSummary().

{ return timeValue_;        }
std::vector<std::string> HDQMSummary::getUserDBContent ( ) const [inline]

Definition at line 112 of file HDQMSummary.h.

References userDBContent_.

Referenced by DQMHistoryServiceBase::createSummary(), and HDQMSummary().

{ return userDBContent_;    }
void HDQMSummary::print ( void  )

Definition at line 178 of file HDQMSummary.cc.

References gather_cfg::cout, indexes_, runNr_, and timeValue_.

{
  std::cout << "Nr. of detector elements in HDQMSummary object is " << indexes_.size() 
            << " RunNr= " << runNr_ 
            << " timeValue= " << timeValue_ 
            << std::endl;
}
bool HDQMSummary::put ( const uint32_t &  detID,
InputVector input,
std::vector< std::string > &  userContent 
)

Definition at line 26 of file HDQMSummary.cc.

References HDQMSummary::DetRegistry::detid, getPosition(), i, HDQMSummary::DetRegistry::ibegin, indexes_, AlCaHLTBitMon_ParallelJobs::p, tmp, userDBContent_, and v_sum_.

Referenced by DQMHistoryServiceBase::scanTreeAndFillSummary().

{
  Registry::iterator p  = std::lower_bound(indexes_.begin(),indexes_.end(),DetId,HDQMSummary::StrictWeakOrdering());
  
  if(p==indexes_.end() || p->detid!=DetId){
    //First request for the given DetID
    //Create entries for all the declared userDBContent
    //and fill for the provided userContent
 
    DetRegistry detregistry;
    detregistry.detid  = DetId;
    detregistry.ibegin = v_sum_.size();
    indexes_.insert(p,detregistry);
    InputVector tmp(userDBContent_.size(),-9999);

    for(size_t i=0;i<userContent.size();++i)
      tmp[getPosition(userContent[i])]=input[i];
    
    v_sum_.insert(v_sum_.end(),tmp.begin(),tmp.end());
  } else {

    if (p->detid==DetId){
      //I should already find the entries 
      //fill for the provided userContent

      for(size_t i=0;i<userContent.size();++i)
        v_sum_[p->ibegin+getPosition(userContent[i])]=input[i];
    }
  }
        
  return true;
}
void HDQMSummary::setObj ( const uint32_t &  detID,
std::string  elementName,
float  value 
)

Definition at line 98 of file HDQMSummary.cc.

References Exception, getPosition(), getRange(), indexes_, AlCaHLTBitMon_ParallelJobs::p, pos, v_sum_, and relativeConstraints::value.

{
  // modifies value of info "elementName" for the given detID
  // requires that an entry has be defined beforehand for detId in DB
  RegistryIterator p = std::lower_bound(indexes_.begin(),indexes_.end(),detID,HDQMSummary::StrictWeakOrdering());
  if (p==indexes_.end()|| p->detid!=detID) 
    {
      throw cms::Exception("")
        <<"not allowed to modify "<< elementName << " in historic DB - SummaryObj needs to be available first !";
    }

  const HDQMSummary::Range range = getRange(detID);
   
  std::vector<float>::const_iterator it = range.first+getPosition(elementName);
  std::vector<float>::difference_type pos = -1;
  if (it != v_sum_.end()){ 
    pos = it - v_sum_.begin();
    v_sum_.at(pos) = value; }  
}
void HDQMSummary::setRunNr ( int  inputRunNr) [inline]

Definition at line 108 of file HDQMSummary.h.

References runNr_.

Referenced by DQMHistoryServiceBase::createSummary().

{ runNr_ = inputRunNr;      }
void HDQMSummary::setTimeValue ( unsigned long long  inputTimeValue) [inline]

Definition at line 109 of file HDQMSummary.h.

References timeValue_.

{ timeValue_=inputTimeValue;}
void HDQMSummary::setUserDBContent ( std::vector< std::string >  userDBContent) [inline]

Definition at line 107 of file HDQMSummary.h.

References userDBContent_.

Referenced by DQMHistoryServiceBase::createSummary().

{ userDBContent_ = userDBContent;}

Member Data Documentation

Definition at line 127 of file HDQMSummary.h.

Referenced by getRunNr(), HDQMSummary(), print(), and setRunNr().

unsigned long long HDQMSummary::timeValue_

Definition at line 128 of file HDQMSummary.h.

Referenced by getTimeValue(), HDQMSummary(), print(), and setTimeValue().

std::vector<std::string> HDQMSummary::userDBContent_
std::vector<float> HDQMSummary::v_sum_