CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

SiStripApvGain Class Reference

#include <SiStripApvGain.h>

List of all members.

Classes

struct  RegistryPointers

Public Types

typedef std::vector< float >
::const_iterator 
ContainerIterator
typedef std::vector< float > InputVector
typedef std::pair
< ContainerIterator,
ContainerIterator
Range
typedef std::vector< unsigned int > Registry
typedef Registry::const_iterator RegistryConstIterator
typedef Registry::iterator RegistryIterator

Public Member Functions

float getApvGain (const uint16_t &apv, const Range &range) const
void getDetIds (std::vector< uint32_t > &DetIds_) const
const Range getRange (const uint32_t &detID) const
RegistryPointers getRegistryPointers () const
float getStripGain (const uint16_t &strip, const Range &range) const
void printDebug (std::stringstream &ss) const
void printSummary (std::stringstream &ss) const
bool put (const uint32_t &detID, Range input)
 SiStripApvGain ()
 ~SiStripApvGain ()

Private Attributes

std::vector< unsigned int > v_detids
std::vector< float > v_gains
std::vector< unsigned int > v_ibegin
std::vector< unsigned int > v_iend

Detailed Description

Stores the information of the gain for each apv using four vectors
A vector<unsigned int> (v_detids) stores the detId.
A vector<float> (v_gains) stores the value of the gain (more than one per detId).
Two vector<unsigned int> (v_ibegin and v_iend) store the correspondence of the v_detids and the ranges of values in v_gain.

The printSummary method uses SiStripDetSummary. See description therein.
The printDebug method prints the gain value for every apv of every detId.

Definition at line 20 of file SiStripApvGain.h.


Member Typedef Documentation

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

Definition at line 24 of file SiStripApvGain.h.

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

Definition at line 29 of file SiStripApvGain.h.

Definition at line 25 of file SiStripApvGain.h.

typedef std::vector<unsigned int> SiStripApvGain::Registry

Definition at line 26 of file SiStripApvGain.h.

typedef Registry::const_iterator SiStripApvGain::RegistryConstIterator

Definition at line 28 of file SiStripApvGain.h.

typedef Registry::iterator SiStripApvGain::RegistryIterator

Definition at line 27 of file SiStripApvGain.h.


Constructor & Destructor Documentation

SiStripApvGain::SiStripApvGain ( ) [inline]

Definition at line 46 of file SiStripApvGain.h.

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

Definition at line 47 of file SiStripApvGain.h.

{};

Member Function Documentation

float SiStripApvGain::getApvGain ( const uint16_t &  apv,
const Range range 
) const

Definition at line 61 of file SiStripApvGain.cc.

References Exception.

Referenced by SiStripPlotGain::DoAnalysis(), SiStripGain::fillNewGain(), SiStripGain::getApvGain(), SiStripCorrelateNoise::getGainRatio(), printDebug(), and printSummary().

                                                                              {
  if (apv>=range.second-range.first){
    throw cms::Exception("CorruptedData")
      << "[SiStripApvGain::getApvGain] looking for SiStripApvGain for an apv out of range: apv " << apv << std::endl;
  }
  
  //  return static_cast<float> (*(range.first+apv));

  return *(range.first+apv);
}
void SiStripApvGain::getDetIds ( std::vector< uint32_t > &  DetIds_) const

Definition at line 42 of file SiStripApvGain.cc.

References v_detids.

Referenced by SiStripGain::fillNewGain(), and SiStripGain::getDetIds().

                                                                 {
  // returns vector of DetIds in map
  //  DetIds_=v_detids;
  DetIds_.insert(DetIds_.begin(),v_detids.begin(),v_detids.end());
}
const SiStripApvGain::Range SiStripApvGain::getRange ( const uint32_t &  detID) const

Definition at line 29 of file SiStripApvGain.cc.

References AlCaHLTBitMon_ParallelJobs::p, v_detids, v_gains, v_ibegin, and v_iend.

Referenced by SiStripGain::fillNewGain(), SiStripCorrelateNoise::getGainRatio(), SiStripGain::getRange(), printDebug(), and printSummary().

                                                                              {
  // get SiStripApvGain Range of DetId
  RegistryConstIterator p = std::lower_bound(v_detids.begin(),v_detids.end(),DetId);
  if (p==v_detids.end() || *p!=DetId) 
    return SiStripApvGain::Range(v_gains.end(),v_gains.end()); 
  else{ 
    unsigned int pd= p-v_detids.begin();
    unsigned int ibegin = *(v_ibegin.begin()+pd);
    unsigned int iend   = *(v_iend.begin()+pd);    
    return SiStripApvGain::Range(v_gains.begin()+ibegin,v_gains.begin()+iend);
  }
}
RegistryPointers SiStripApvGain::getRegistryPointers ( ) const [inline]
float SiStripApvGain::getStripGain ( const uint16_t &  strip,
const Range range 
) const

Definition at line 48 of file SiStripApvGain.cc.

References Exception.

Referenced by SiStripGain::getStripGain().

                                                                                  {
  uint16_t apv = (uint16_t) (strip/128);
  if (apv>=range.second-range.first){
    throw cms::Exception("CorruptedData")
      << "[SiStripApvGain::getApvGain] looking for SiStripApvGain for a strip out of range: strip " << strip << " apv " << apv << std::endl;
  }
  
  //  return static_cast<float> (*(range.first+apv));

  return *(range.first+apv);

}
void SiStripApvGain::printDebug ( std::stringstream &  ss) const

Definition at line 72 of file SiStripApvGain.cc.

References cond::rpcobgas::detid, getApvGain(), getRange(), and v_detids.

{
  std::vector<unsigned int>::const_iterator detid = v_detids.begin();
  ss << "Number of detids " << v_detids.size() << std::endl;

  for( ; detid != v_detids.end(); ++detid ) {
    SiStripApvGain::Range range = getRange(*detid);
    int apv=0;
    for( int it=0; it < range.second - range.first; ++it ) {
      ss << "detid " << *detid << " \t"
         << " apv " << apv++ << " \t"
         << getApvGain(it,range) << " \t" 
         << std::endl;          
    } 
  }
}
void SiStripApvGain::printSummary ( std::stringstream &  ss) const

Definition at line 89 of file SiStripApvGain.cc.

References SiStripDetSummary::add(), cond::rpcobgas::detid, getApvGain(), getRange(), SiStripDetSummary::print(), and v_detids.

{
  SiStripDetSummary summaryGain;

  std::vector<uint32_t>::const_iterator detid = v_detids.begin();
  for( ; detid != v_detids.end(); ++detid ) {
    Range range = getRange(*detid);
    for( int it=0; it < range.second - range.first; ++it ) {
      summaryGain.add(*detid, getApvGain(it, range));
    } 
  }
  ss << "Summary of gain values:" << std::endl;
  summaryGain.print(ss, true);
}
bool SiStripApvGain::put ( const uint32_t &  detID,
Range  input 
)

Definition at line 8 of file SiStripApvGain.cc.

References AlCaHLTBitMon_ParallelJobs::p, sd, v_detids, v_gains, v_ibegin, and v_iend.

Referenced by SiStripApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripApvGainGenerator::createObject(), SiStripGain::fillNewGain(), SiStripGainFromCalibTree::getNewObject(), SiStripGainRandomCalculator::getNewObject(), SiStripGainFromData::getNewObject(), SiStripGainFromAsciiFile::getNewObject(), and SiStripCondObjBuilderFromDb::storeTiming().

                                                           {
  // put in SiStripApvGain of DetId
  RegistryIterator p = std::lower_bound(v_detids.begin(),v_detids.end(),DetId);
  if (p!=v_detids.end() && *p==DetId){
    edm::LogError("SiStripApvGain") << "[" << __PRETTY_FUNCTION__ << "] SiStripApvGain for DetID " << DetId << " is already stored. Skippig this put" << std::endl;
    return false;
  }
 
  unsigned int sd= input.second-input.first; 
  unsigned int pd= p-v_detids.begin();

  unsigned int ibegin=v_gains.size();
  unsigned int iend  =v_gains.size()+sd;
  v_detids.insert(p,DetId);
  v_ibegin.insert(v_ibegin.begin()+pd,ibegin);
  v_iend.insert(v_iend.begin()+pd,iend);

  v_gains.insert(v_gains.end(),input.first,input.second);
  return true;
}

Member Data Documentation

std::vector<unsigned int> SiStripApvGain::v_detids [private]

Definition at line 77 of file SiStripApvGain.h.

Referenced by getDetIds(), getRange(), getRegistryPointers(), printDebug(), printSummary(), and put().

std::vector<float> SiStripApvGain::v_gains [private]

Definition at line 76 of file SiStripApvGain.h.

Referenced by getRange(), getRegistryPointers(), and put().

std::vector<unsigned int> SiStripApvGain::v_ibegin [private]

Definition at line 78 of file SiStripApvGain.h.

Referenced by getRange(), getRegistryPointers(), and put().

std::vector<unsigned int> SiStripApvGain::v_iend [private]

Definition at line 79 of file SiStripApvGain.h.

Referenced by getRange(), getRegistryPointers(), and put().