CMS 3D CMS Logo

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

SiStripSummary Class Reference

#include <SiStripSummary.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 (std::string elementName) const
std::vector< float > getSummaryObj (uint32_t &detID) const
std::vector< float > getSummaryObj () const
std::vector< float > getSummaryObj (uint32_t &detID, std::vector< std::string > list) const
std::vector< float > getSummaryObj (sistripsummary::TrackerRegion region, std::vector< std::string > list) const
unsigned long long getTimeValue () const
std::vector< std::string > getUserDBContent () const
void print ()
bool put (const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
bool put (sistripsummary::TrackerRegion region, 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)
 SiStripSummary ()
 SiStripSummary (std::vector< std::string > &userDBContent)
 SiStripSummary (const SiStripSummary &input)
 ~SiStripSummary ()

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 35 of file SiStripSummary.h.


Member Typedef Documentation

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

Definition at line 52 of file SiStripSummary.h.

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

Definition at line 56 of file SiStripSummary.h.

Definition at line 53 of file SiStripSummary.h.

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

Definition at line 54 of file SiStripSummary.h.

typedef Registry::const_iterator SiStripSummary::RegistryIterator

Definition at line 55 of file SiStripSummary.h.


Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripSummary.cc.

References runNr_, timeValue_, and userDBContent_.

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

Definition at line 14 of file SiStripSummary.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());
}
SiStripSummary::SiStripSummary ( ) [inline]

Definition at line 61 of file SiStripSummary.h.

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

Definition at line 62 of file SiStripSummary.h.

{};

Member Function Documentation

ContainerIterator SiStripSummary::getDataVectorBegin ( ) const [inline]

Definition at line 65 of file SiStripSummary.h.

References v_sum_.

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

Definition at line 66 of file SiStripSummary.h.

References v_sum_.

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

Definition at line 78 of file SiStripSummary.cc.

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

Referenced by getSummaryObj().

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

Definition at line 92 of file SiStripSummary.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("SiStripSummary") << "attempting to retrieve non existing historic DB object : "<< elementName <<std::endl;
  return pos;  
}   
const SiStripSummary::Range SiStripSummary::getRange ( const uint32_t &  detID) const

Definition at line 67 of file SiStripSummary.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,SiStripSummary::StrictWeakOrdering());
  if (p==indexes_.end()|| p->detid!=DetId) {
    return SiStripSummary::Range(v_sum_.end(),v_sum_.end()); std::cout << "not in range " << std::endl;}
  else 
    return SiStripSummary::Range(v_sum_.begin()+p->ibegin,v_sum_.begin()+p->ibegin+userDBContent_.size());
}
RegistryIterator SiStripSummary::getRegistryVectorBegin ( ) const [inline]

Definition at line 67 of file SiStripSummary.h.

References indexes_.

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

Definition at line 68 of file SiStripSummary.h.

References indexes_.

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

Definition at line 113 of file SiStripSummary.h.

References runNr_.

Referenced by SiStripSummary().

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

Definition at line 126 of file SiStripSummary.cc.

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

Referenced by cond::ValueExtractor< SiStripSummary >::compute().

{  
  std::vector<float> SummaryObj;
  const SiStripSummary::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 > SiStripSummary::getSummaryObj ( sistripsummary::TrackerRegion  region,
std::vector< std::string >  list 
) const

Definition at line 146 of file SiStripSummary.cc.

References getSummaryObj().

{ 
 
  uint32_t fakeDet = region;
  return getSummaryObj(fakeDet,list);
}
std::vector< float > SiStripSummary::getSummaryObj ( std::string  elementName) const

Definition at line 172 of file SiStripSummary.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 SiStripSummary::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 > SiStripSummary::getSummaryObj ( uint32_t &  detID) const

Definition at line 153 of file SiStripSummary.cc.

References getRange(), i, and userDBContent_.

{  
  std::vector<float> SummaryObj;
  const SiStripSummary::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 > SiStripSummary::getSummaryObj ( ) const

Definition at line 166 of file SiStripSummary.cc.

References v_sum_.

Referenced by getSummaryObj().

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

Definition at line 111 of file SiStripSummary.h.

References timeValue_.

Referenced by SiStripSummary().

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

Definition at line 112 of file SiStripSummary.h.

References userDBContent_.

Referenced by SiStripSummaryBuilder::analyze(), and SiStripSummary().

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

Definition at line 192 of file SiStripSummary.cc.

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

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

Definition at line 26 of file SiStripSummary.cc.

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

Referenced by SiStripSummaryBuilder::analyze(), and put().

{
  Registry::iterator p  = std::lower_bound(indexes_.begin(),indexes_.end(),DetId,SiStripSummary::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;
}
bool SiStripSummary::put ( sistripsummary::TrackerRegion  region,
InputVector input,
std::vector< std::string > &  userContent 
)

Definition at line 60 of file SiStripSummary.cc.

References put().

                                                                                                                   {

  uint32_t fakeDet = region;
  return put(fakeDet, input, userContent);
}
void SiStripSummary::setObj ( const uint32_t &  detID,
std::string  elementName,
float  value 
)

Definition at line 105 of file SiStripSummary.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,SiStripSummary::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 SiStripSummary::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 SiStripSummary::setRunNr ( int  inputRunNr) [inline]

Definition at line 108 of file SiStripSummary.h.

References runNr_.

Referenced by SiStripSummaryBuilder::analyze().

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

Definition at line 109 of file SiStripSummary.h.

References timeValue_.

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

Definition at line 107 of file SiStripSummary.h.

References userDBContent_.

Referenced by SiStripSummaryBuilder::analyze().

{ userDBContent_ = userDBContent;}

Member Data Documentation

Definition at line 127 of file SiStripSummary.h.

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

unsigned long long SiStripSummary::timeValue_

Definition at line 128 of file SiStripSummary.h.

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

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