CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Attributes
SiStripApvGain Class Reference

#include <SiStripApvGain.h>

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.

46 {};
SiStripApvGain::~SiStripApvGain ( )
inline

Definition at line 47 of file SiStripApvGain.h.

47 {};

Member Function Documentation

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

Definition at line 61 of file SiStripApvGain.cc.

References edm::hlt::Exception.

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

61  {
62  if (apv>=range.second-range.first){
63  throw cms::Exception("CorruptedData")
64  << "[SiStripApvGain::getApvGain] looking for SiStripApvGain for an apv out of range: apv " << apv << std::endl;
65  }
66 
67  // return static_cast<float> (*(range.first+apv));
68 
69  return *(range.first+apv);
70 }
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().

42  {
43  // returns vector of DetIds in map
44  // DetIds_=v_detids;
45  DetIds_.insert(DetIds_.begin(),v_detids.begin(),v_detids.end());
46 }
std::vector< unsigned int > v_detids
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().

29  {
30  // get SiStripApvGain Range of DetId
31  RegistryConstIterator p = std::lower_bound(v_detids.begin(),v_detids.end(),DetId);
32  if (p==v_detids.end() || *p!=DetId)
33  return SiStripApvGain::Range(v_gains.end(),v_gains.end());
34  else{
35  unsigned int pd= p-v_detids.begin();
36  unsigned int ibegin = *(v_ibegin.begin()+pd);
37  unsigned int iend = *(v_iend.begin()+pd);
38  return SiStripApvGain::Range(v_gains.begin()+ibegin,v_gains.begin()+iend);
39  }
40 }
Registry::const_iterator RegistryConstIterator
std::vector< float > v_gains
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< unsigned int > v_iend
Definition: DetId.h:20
std::vector< unsigned int > v_detids
std::vector< unsigned int > v_ibegin
RegistryPointers SiStripApvGain::getRegistryPointers ( ) const
inline

Definition at line 49 of file SiStripApvGain.h.

References SiStripApvGain::RegistryPointers::detid_begin, SiStripApvGain::RegistryPointers::detid_end, SiStripApvGain::RegistryPointers::ibegin_begin, SiStripApvGain::RegistryPointers::ibegin_end, SiStripApvGain::RegistryPointers::iend_begin, SiStripApvGain::RegistryPointers::iend_end, AlCaHLTBitMon_ParallelJobs::p, SiStripApvGain::RegistryPointers::v_begin, v_detids, SiStripApvGain::RegistryPointers::v_end, v_gains, v_ibegin, and v_iend.

Referenced by SiStripPlotGain::DoAnalysis().

49  {
50  RegistryPointers p;
51  p.detid_begin=v_detids.begin();
52  p.detid_end=v_detids.end();
53  p.ibegin_begin=v_ibegin.begin();
54  p.ibegin_end=v_ibegin.end();
55  p.iend_begin=v_iend.begin();
56  p.iend_end=v_iend.end();
57  p.v_begin=v_gains.begin();
58  p.v_end=v_gains.end();
59 
60  return p;
61 }
std::vector< float > v_gains
std::vector< unsigned int > v_iend
std::vector< unsigned int > v_detids
std::vector< unsigned int > v_ibegin
float SiStripApvGain::getStripGain ( const uint16_t &  strip,
const Range range 
) const

Definition at line 48 of file SiStripApvGain.cc.

References edm::hlt::Exception.

Referenced by SiStripGain::getStripGain().

48  {
49  uint16_t apv = (uint16_t) (strip/128);
50  if (apv>=range.second-range.first){
51  throw cms::Exception("CorruptedData")
52  << "[SiStripApvGain::getApvGain] looking for SiStripApvGain for a strip out of range: strip " << strip << " apv " << apv << std::endl;
53  }
54 
55  // return static_cast<float> (*(range.first+apv));
56 
57  return *(range.first+apv);
58 
59 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
void SiStripApvGain::printDebug ( std::stringstream &  ss) const

Definition at line 72 of file SiStripApvGain.cc.

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

73 {
74  std::vector<unsigned int>::const_iterator detid = v_detids.begin();
75  ss << "Number of detids " << v_detids.size() << std::endl;
76 
77  for( ; detid != v_detids.end(); ++detid ) {
78  SiStripApvGain::Range range = getRange(*detid);
79  int apv=0;
80  for( int it=0; it < range.second - range.first; ++it ) {
81  ss << "detid " << *detid << " \t"
82  << " apv " << apv++ << " \t"
83  << getApvGain(it,range) << " \t"
84  << std::endl;
85  }
86  }
87 }
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< unsigned int > v_detids
const Range getRange(const uint32_t &detID) const
float getApvGain(const uint16_t &apv, const Range &range) const
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.

90 {
91  SiStripDetSummary summaryGain;
92 
93  std::vector<uint32_t>::const_iterator detid = v_detids.begin();
94  for( ; detid != v_detids.end(); ++detid ) {
95  Range range = getRange(*detid);
96  for( int it=0; it < range.second - range.first; ++it ) {
97  summaryGain.add(*detid, getApvGain(it, range));
98  }
99  }
100  ss << "Summary of gain values:" << std::endl;
101  summaryGain.print(ss, true);
102 }
std::pair< ContainerIterator, ContainerIterator > Range
void print(std::stringstream &ss, const bool mean=true) const
std::vector< unsigned int > v_detids
const Range getRange(const uint32_t &detID) const
void add(const DetId &detid, const float &value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...
float getApvGain(const uint16_t &apv, const Range &range) const
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(), SiStripGainFromAsciiFile::getNewObject(), SiStripGainRandomCalculator::getNewObject(), SiStripGainFromData::getNewObject(), SiStripGainFromCalibTree::getNewObject(), and SiStripCondObjBuilderFromDb::storeTiming().

8  {
9  // put in SiStripApvGain of DetId
10  RegistryIterator p = std::lower_bound(v_detids.begin(),v_detids.end(),DetId);
11  if (p!=v_detids.end() && *p==DetId){
12  edm::LogError("SiStripApvGain") << "[" << __PRETTY_FUNCTION__ << "] SiStripApvGain for DetID " << DetId << " is already stored. Skippig this put" << std::endl;
13  return false;
14  }
15 
16  unsigned int sd= input.second-input.first;
17  unsigned int pd= p-v_detids.begin();
18 
19  unsigned int ibegin=v_gains.size();
20  unsigned int iend =v_gains.size()+sd;
21  v_detids.insert(p,DetId);
22  v_ibegin.insert(v_ibegin.begin()+pd,ibegin);
23  v_iend.insert(v_iend.begin()+pd,iend);
24 
25  v_gains.insert(v_gains.end(),input.first,input.second);
26  return true;
27 }
Registry::iterator RegistryIterator
std::vector< float > v_gains
std::vector< unsigned int > v_iend
Definition: DetId.h:20
std::vector< unsigned int > v_detids
double sd
std::vector< unsigned int > v_ibegin

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().