test
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 | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
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

void getDetIds (std::vector< uint32_t > &DetIds_) const
 
const Range getRange (const uint32_t detID) const
 
Range getRangeByPos (unsigned short pos) const
 
RegistryPointers getRegistryPointers () const
 
void printDebug (std::stringstream &ss) const
 
void printSummary (std::stringstream &ss) const
 
bool put (const uint32_t &detID, Range input)
 
 SiStripApvGain ()
 
 ~SiStripApvGain ()
 

Static Public Member Functions

static float getApvGain (uint16_t apv, const Range &range)
 
static float getStripGain (uint16_t strip, const Range &range)
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

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
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

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 22 of file SiStripApvGain.h.

Member Typedef Documentation

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

Definition at line 26 of file SiStripApvGain.h.

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

Definition at line 31 of file SiStripApvGain.h.

Definition at line 27 of file SiStripApvGain.h.

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

Definition at line 28 of file SiStripApvGain.h.

typedef Registry::const_iterator SiStripApvGain::RegistryConstIterator

Definition at line 30 of file SiStripApvGain.h.

typedef Registry::iterator SiStripApvGain::RegistryIterator

Definition at line 29 of file SiStripApvGain.h.

Constructor & Destructor Documentation

SiStripApvGain::SiStripApvGain ( )
inline

Definition at line 48 of file SiStripApvGain.h.

48 {}
SiStripApvGain::~SiStripApvGain ( )
inline

Definition at line 49 of file SiStripApvGain.h.

49 {}

Member Function Documentation

static float SiStripApvGain::getApvGain ( uint16_t  apv,
const Range range 
)
inlinestatic
void SiStripApvGain::getDetIds ( std::vector< uint32_t > &  DetIds_) const

Definition at line 52 of file SiStripApvGain.cc.

References v_detids.

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

52  {
53  // returns vector of DetIds in map
54  // DetIds_=v_detids;
55  DetIds_.insert(DetIds_.begin(),v_detids.begin(),v_detids.end());
56 }
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  __builtin_prefetch((&v_gains.front())+ibegin);
39  return SiStripApvGain::Range(v_gains.begin()+ibegin,v_gains.begin()+iend);
40  }
41 }
Registry::const_iterator RegistryConstIterator
std::vector< float > v_gains
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< unsigned int > v_iend
Definition: DetId.h:18
std::vector< unsigned int > v_detids
std::vector< unsigned int > v_ibegin
SiStripApvGain::Range SiStripApvGain::getRangeByPos ( unsigned short  pos) const

Definition at line 43 of file SiStripApvGain.cc.

References v_detids, v_gains, v_ibegin, and v_iend.

Referenced by SiStripGain::getRangeByPos().

43  {
44  if (pos>v_detids.size()) return Range(v_gains.end(),v_gains.end());
45  unsigned int ibegin = *(v_ibegin.begin()+pos);
46  unsigned int iend = *(v_iend.begin()+pos);
47  __builtin_prefetch((&v_gains.front())+ibegin);
48  return SiStripApvGain::Range(v_gains.begin()+ibegin,v_gains.begin()+iend);
49 }
std::vector< float > v_gains
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< unsigned int > v_iend
std::vector< unsigned int > v_detids
std::vector< unsigned int > v_ibegin
RegistryPointers SiStripApvGain::getRegistryPointers ( ) const
inline

Definition at line 51 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().

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

Definition at line 76 of file SiStripApvGain.h.

Referenced by SiStripGain::getStripGain().

76 {uint16_t apv = strip/128; return *(range.first+apv);}
void SiStripApvGain::printDebug ( std::stringstream &  ss) const

Definition at line 85 of file SiStripApvGain.cc.

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

86 {
87  std::vector<unsigned int>::const_iterator detid = v_detids.begin();
88  ss << "Number of detids " << v_detids.size() << std::endl;
89 
90  for( ; detid != v_detids.end(); ++detid ) {
91  SiStripApvGain::Range range = getRange(*detid);
92  int apv=0;
93  for( int it=0; it < range.second - range.first; ++it ) {
94  ss << "detid " << *detid << " \t"
95  << " apv " << apv++ << " \t"
96  << getApvGain(it,range) << " \t"
97  << std::endl;
98  }
99  }
100 }
static float getApvGain(uint16_t apv, const Range &range)
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< unsigned int > v_detids
const Range getRange(const uint32_t detID) const
void SiStripApvGain::printSummary ( std::stringstream &  ss) const

Definition at line 102 of file SiStripApvGain.cc.

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

103 {
104  SiStripDetSummary summaryGain;
105 
106  std::vector<uint32_t>::const_iterator detid = v_detids.begin();
107  for( ; detid != v_detids.end(); ++detid ) {
108  Range range = getRange(*detid);
109  for( int it=0; it < range.second - range.first; ++it ) {
110  summaryGain.add(*detid, getApvGain(it, range));
111  }
112  }
113  ss << "Summary of gain values:" << std::endl;
114  summaryGain.print(ss, true);
115 }
static float getApvGain(uint16_t apv, const Range &range)
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...
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
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< float > v_gains
std::vector< unsigned int > v_iend
Definition: DetId.h:18
std::vector< unsigned int > v_detids
double sd
std::vector< unsigned int > v_ibegin
template<class Archive >
void SiStripApvGain::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 91 of file SiStripApvGain.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 91 of file SiStripApvGain.h.

Member Data Documentation

std::vector<unsigned int> SiStripApvGain::v_detids
private
std::vector<float> SiStripApvGain::v_gains
private

Definition at line 86 of file SiStripApvGain.h.

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

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

Definition at line 88 of file SiStripApvGain.h.

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

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

Definition at line 89 of file SiStripApvGain.h.

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