CMS 3D CMS Logo

SiStripApvGain Class Reference

#include <CondFormats/SiStripObjects/interface/SiStripApvGain.h>

List of all members.

Public Types

typedef std::vector< float >
::const_iterator 
ContainerIterator
typedef std::pair
< ContainerIterator,
ContainerIterator
Range
typedef std::vector< unsigned intRegistry
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
float getStripGain (const uint16_t &strip, const Range &range) const
bool put (const uint32_t &detID, Range input)
 SiStripApvGain ()
 ~SiStripApvGain ()

Private Attributes

std::vector< unsigned intv_detids
std::vector< float > v_gains
std::vector< unsigned intv_ibegin
std::vector< unsigned intv_iend


Detailed Description

Definition at line 10 of file SiStripApvGain.h.


Member Typedef Documentation

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

Definition at line 14 of file SiStripApvGain.h.

typedef std::pair<ContainerIterator, ContainerIterator> SiStripApvGain::Range

Definition at line 15 of file SiStripApvGain.h.

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

Definition at line 16 of file SiStripApvGain.h.

typedef Registry::const_iterator SiStripApvGain::RegistryConstIterator

Definition at line 18 of file SiStripApvGain.h.

typedef Registry::iterator SiStripApvGain::RegistryIterator

Definition at line 17 of file SiStripApvGain.h.


Constructor & Destructor Documentation

SiStripApvGain::SiStripApvGain (  )  [inline]

Definition at line 20 of file SiStripApvGain.h.

00020 {};

SiStripApvGain::~SiStripApvGain (  )  [inline]

Definition at line 21 of file SiStripApvGain.h.

00021 {};


Member Function Documentation

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

Definition at line 58 of file SiStripApvGain.cc.

References lat::endl(), and Exception.

Referenced by SiStripGain::getApvGain().

00058                                                                               {
00059   if (apv>=range.second-range.first){
00060     throw cms::Exception("CorruptedData")
00061       << "[SiStripApvGain::getApvGain] looking for SiStripApvGain for an apv out of range: apv " << apv << std::endl;
00062   }
00063   
00064   //  return static_cast<float> (*(range.first+apv));
00065 
00066   return *(range.first+apv);
00067 }

void SiStripApvGain::getDetIds ( std::vector< uint32_t > &  DetIds_  )  const

Definition at line 39 of file SiStripApvGain.cc.

References v_detids.

Referenced by SiStripGain::getDetIds().

00039                                                                  {
00040   // returns vector of DetIds in map
00041   //  DetIds_=v_detids;
00042   DetIds_.insert(DetIds_.begin(),v_detids.begin(),v_detids.end());
00043 }

const SiStripApvGain::Range SiStripApvGain::getRange ( const uint32_t &  detID  )  const

Definition at line 26 of file SiStripApvGain.cc.

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

Referenced by SiStripGain::getRange().

00026                                                                               {
00027   // get SiStripApvGain Range of DetId
00028   RegistryConstIterator p = std::lower_bound(v_detids.begin(),v_detids.end(),DetId);
00029   if (p==v_detids.end() || *p!=DetId) 
00030     return SiStripApvGain::Range(v_gains.end(),v_gains.end()); 
00031   else{ 
00032     unsigned int pd= p-v_detids.begin();
00033     unsigned int ibegin = *(v_ibegin.begin()+pd);
00034     unsigned int iend   = *(v_iend.begin()+pd);    
00035     return SiStripApvGain::Range(v_gains.begin()+ibegin,v_gains.begin()+iend);
00036   }
00037 }

float SiStripApvGain::getStripGain ( const uint16_t &  strip,
const Range range 
) const

Definition at line 45 of file SiStripApvGain.cc.

References lat::endl(), and Exception.

Referenced by SiStripGain::getStripGain().

00045                                                                                   {
00046   uint16_t apv = (uint16_t) (strip/128);
00047   if (apv>=range.second-range.first){
00048     throw cms::Exception("CorruptedData")
00049       << "[SiStripApvGain::getApvGain] looking for SiStripApvGain for a strip out of range: strip " << strip << " apv " << apv << std::endl;
00050   }
00051   
00052   //  return static_cast<float> (*(range.first+apv));
00053 
00054   return *(range.first+apv);
00055 
00056 }

bool SiStripApvGain::put ( const uint32_t &  detID,
Range  input 
)

Definition at line 5 of file SiStripApvGain.cc.

References lat::endl(), p, v_detids, v_gains, v_ibegin, and v_iend.

Referenced by SiStripApvGainBuilder::analyze(), SiStripGainRandomCalculator::getNewObject(), SiStripGainFromData::getNewObject(), SiStripGainFromAsciiFile::getNewObject(), and SiStripGainFakeESSource::produce().

00005                                                            {
00006   // put in SiStripApvGain of DetId
00007   RegistryIterator p = std::lower_bound(v_detids.begin(),v_detids.end(),DetId);
00008   if (p!=v_detids.end() && *p==DetId){
00009     edm::LogError("SiStripApvGain") << "[" << __PRETTY_FUNCTION__ << "] SiStripApvGain for DetID " << DetId << " is already stored. Skippig this put" << std::endl;
00010     return false;
00011   }
00012  
00013   unsigned int sd= input.second-input.first; 
00014   unsigned int pd= p-v_detids.begin();
00015 
00016   unsigned int ibegin=v_gains.size();
00017   unsigned int iend  =v_gains.size()+sd;
00018   v_detids.insert(p,DetId);
00019   v_ibegin.insert(v_ibegin.begin()+pd,ibegin);
00020   v_iend.insert(v_iend.begin()+pd,iend);
00021 
00022   v_gains.insert(v_gains.end(),input.first,input.second);
00023   return true;
00024 }


Member Data Documentation

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

Definition at line 33 of file SiStripApvGain.h.

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

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

Definition at line 32 of file SiStripApvGain.h.

Referenced by getRange(), and put().

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

Definition at line 34 of file SiStripApvGain.h.

Referenced by getRange(), and put().

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

Definition at line 35 of file SiStripApvGain.h.

Referenced by getRange(), and put().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:11 2009 for CMSSW by  doxygen 1.5.4