CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
SiPixelCalibConfiguration Class Reference

#include <SiPixelCalibConfiguration.h>

Public Member Functions

std::vector< short > columnPatternForEvent (const uint32_t &eventnumber) const
 
uint32_t expectedTotalEvents () const
 
std::string getCalibrationMode () const
 
std::vector< short > getColumnPattern () const
 
short getNTriggers () const
 
std::vector< short > getRowPattern () const
 
const std::vector< short > getVCalValues () const
 
uint32_t nColumnPatterns () const
 
uint32_t nextPatternChangeForEvent (const uint32_t &eventnumber) const
 
uint32_t nPatterns () const
 
uint32_t nRowPatterns () const
 
uint32_t nVCal () const
 
uint32_t patternSize () const
 
std::vector< short > rowPatternForEvent (const uint32_t &eventnumber) const
 
void setCalibrationMode (const std::string &in)
 
void setColumnPattern (const std::vector< short > &in)
 
void setNTriggers (const short &in)
 
void setRowPattern (const std::vector< short > &in)
 
void setVCalValues (const std::vector< short > &in)
 
 SiPixelCalibConfiguration ()
 
 SiPixelCalibConfiguration (const pos::PixelCalibConfiguration &fancyConfig)
 
short vcalForEvent (const uint32_t &eventnumber) const
 
short vcalIndexForEvent (const uint32_t &eventnumber) const
 
virtual ~SiPixelCalibConfiguration ()
 

Private Member Functions

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

Private Attributes

std::vector< short > fColumnPattern
 
std::string fMode
 
short fNTriggers
 
std::vector< short > fRowPattern
 
std::vector< short > fVCalValues
 

Friends

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

Detailed Description

Definition at line 19 of file SiPixelCalibConfiguration.h.

Constructor & Destructor Documentation

SiPixelCalibConfiguration::SiPixelCalibConfiguration ( )
inline

Definition at line 24 of file SiPixelCalibConfiguration.h.

24 {;}
SiPixelCalibConfiguration::SiPixelCalibConfiguration ( const pos::PixelCalibConfiguration fancyConfig)

Definition at line 60 of file SiPixelCalibConfiguration.cc.

References pos::PixelCalibConfiguration::columnList(), gather_cfg::cout, fColumnPattern, fMode, fNTriggers, fRowPattern, fVCalValues, mps_fire::i, pos::PixelCalibConfiguration::mode(), pos::PixelCalibConfiguration::nTriggersPerPattern(), pos::PixelCalibConfiguration::rowList(), tablePrinter::rows, pos::PixelCalibConfiguration::scanName(), and pos::PixelCalibConfiguration::scanValues().

60  :
61  fNTriggers(0),
62  fRowPattern(std::vector<short>(0)),
63  fColumnPattern(std::vector<short>(0)),
64  fVCalValues(std::vector<short>(0)),
65  fMode("unknown")
66 
67 { // copy constructor that uses the complex object
68  fNTriggers = fancyConfig.nTriggersPerPattern();
69  std::vector<int> vcalpoints(0);
70  std::cout << "scan name = " << fancyConfig.scanName(0) << std::endl;
71  std::vector<uint32_t> vcalpointsuint32 = fancyConfig.scanValues(fancyConfig.scanName(0));
72  for(size_t ical=0; ical<vcalpointsuint32.size(); ++ical){
73  short vcalinput = vcalpointsuint32[ical];
74 
75  std::cout << "Vcal value " << ical << " = " << vcalinput << std::endl;
76  fVCalValues.push_back(vcalinput);
77  }
78  // copy row and column patterns
79 
80  std::vector<std::vector<uint32_t> > cols=fancyConfig.columnList();
81  std::vector<std::vector<uint32_t> > rows= fancyConfig.rowList();
82  for(uint32_t i=0; i<cols.size(); ++i){
83  for(uint32_t j=0; j<cols[i].size(); ++j){
84  short colval = cols[i][j];
85  fColumnPattern.push_back(colval);
86  }
87  fColumnPattern.push_back(-1);
88  }
89  for(uint32_t i=0; i<rows.size(); ++i){
90  for(uint32_t j=0; j<rows[i].size(); ++j){
91  short rowval = rows[i][j];
92  fRowPattern.push_back(rowval);
93  }
94  fRowPattern.push_back(-1);
95  }
96  fMode = fancyConfig.mode();
97 }
std::string mode() const override
const std::vector< std::vector< unsigned int > > & columnList() const
std::vector< unsigned int > scanValues(std::string dac) const
const std::vector< std::vector< unsigned int > > & rowList() const
unsigned int nTriggersPerPattern() const
std::string scanName(unsigned int iscan) const
virtual SiPixelCalibConfiguration::~SiPixelCalibConfiguration ( )
inlinevirtual

Definition at line 27 of file SiPixelCalibConfiguration.h.

27 {;}

Member Function Documentation

std::vector< short > SiPixelCalibConfiguration::columnPatternForEvent ( const uint32_t &  eventnumber) const

Definition at line 14 of file SiPixelCalibConfiguration.cc.

References fColumnPattern, nColumnPatterns(), patternSize(), mps_fire::result, and heppy_batch::val.

Referenced by setVCalValues().

14  {
15  std::vector<short> result;
16  uint32_t patternnumber = eventnumber/patternSize();
17  uint32_t colpatternnumber = patternnumber%nColumnPatterns();
18 
19  uint32_t nminuscol=0;
20  for(size_t icol=0; icol<fColumnPattern.size(); icol++){
21  if(fColumnPattern[icol]==-1)
22  nminuscol++;
23  else if(nminuscol>colpatternnumber)
24  break;
25  else if(nminuscol==colpatternnumber){
26  short val = fColumnPattern[icol];
27  result.push_back(val);
28  }
29  }
30  return result;
31 }
uint32_t SiPixelCalibConfiguration::expectedTotalEvents ( ) const

Definition at line 56 of file SiPixelCalibConfiguration.cc.

References nPatterns(), and patternSize().

Referenced by setVCalValues(), and SiPixelCalibDigiProducer::store().

56  {
57  return patternSize()*nPatterns();
58 }
std::string SiPixelCalibConfiguration::getCalibrationMode ( ) const
inline

Definition at line 41 of file SiPixelCalibConfiguration.h.

References fMode.

Referenced by SiPixelOfflineCalibAnalysisBase::beginRun().

41 {return fMode;}
std::vector<short> SiPixelCalibConfiguration::getColumnPattern ( ) const
inline
short SiPixelCalibConfiguration::getNTriggers ( ) const
inline
std::vector<short> SiPixelCalibConfiguration::getRowPattern ( ) const
inline
const std::vector<short> SiPixelCalibConfiguration::getVCalValues ( ) const
inline

Definition at line 43 of file SiPixelCalibConfiguration.h.

References fVCalValues.

Referenced by SiPixelOfflineCalibAnalysisBase::beginRun().

43 { return fVCalValues;}
uint32_t SiPixelCalibConfiguration::nColumnPatterns ( ) const

Definition at line 107 of file SiPixelCalibConfiguration.cc.

References fColumnPattern, mps_fire::i, and hgcalPlots::ncols.

Referenced by columnPatternForEvent(), nPatterns(), rowPatternForEvent(), and SiPixelCalibDigiProducer::setPattern().

107  {
108  uint32_t ncols = 0;
109 
110  for(std::vector<short>::const_iterator i=fColumnPattern.begin();i!=fColumnPattern.end();++i){
111  if(*i == -1)
112  ncols++;
113  }
114  return ncols;
115 }
uint32_t SiPixelCalibConfiguration::nextPatternChangeForEvent ( const uint32_t &  eventnumber) const

Definition at line 51 of file SiPixelCalibConfiguration.cc.

References patternSize().

Referenced by setVCalValues().

51  {
52  uint32_t relative_event = eventnumber/patternSize();
53  relative_event+=1;
54  return relative_event*patternSize();
55 }
uint32_t SiPixelCalibConfiguration::nPatterns ( ) const
inline

Definition at line 54 of file SiPixelCalibConfiguration.h.

References nColumnPatterns(), and nRowPatterns().

Referenced by expectedTotalEvents().

uint32_t SiPixelCalibConfiguration::nRowPatterns ( ) const

Definition at line 99 of file SiPixelCalibConfiguration.cc.

References fRowPattern, and mps_fire::i.

Referenced by nPatterns().

99  {
100  uint32_t nrows = 0;
101  for(std::vector<short>::const_iterator i=fRowPattern.begin();i!=fRowPattern.end();++i){
102  if(*i == -1)
103  nrows++;
104  }
105  return nrows;
106 }
uint32_t SiPixelCalibConfiguration::nVCal ( ) const
inline

Definition at line 57 of file SiPixelCalibConfiguration.h.

References fVCalValues.

Referenced by SiPixelCalibDigiProducer::fillPixel(), and SiPixelCalibDigiProducer::produce().

57 { return fVCalValues.size();}
uint32_t SiPixelCalibConfiguration::patternSize ( ) const
inline
std::vector< short > SiPixelCalibConfiguration::rowPatternForEvent ( const uint32_t &  eventnumber) const

Definition at line 33 of file SiPixelCalibConfiguration.cc.

References fRowPattern, nColumnPatterns(), patternSize(), mps_fire::result, and heppy_batch::val.

Referenced by setVCalValues().

33  {
34  std::vector<short> result;
35  uint32_t patternnumber = eventnumber/patternSize();
36  uint32_t rowpatternnumber = patternnumber/nColumnPatterns();
37 
38  uint32_t nminusrow=0;
39  for(size_t irow=0; irow<fRowPattern.size(); irow++){
40  if(fRowPattern[irow]==-1)
41  nminusrow++;
42  else if(nminusrow>rowpatternnumber)
43  break;
44  else if(nminusrow==rowpatternnumber){
45  short val = fRowPattern[irow];
46  result.push_back(val);
47  }
48  }
49  return result;
50 }
template<class Archive >
void SiPixelCalibConfiguration::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void SiPixelCalibConfiguration::setCalibrationMode ( const std::string &  in)
inline

Definition at line 40 of file SiPixelCalibConfiguration.h.

References fMode, and recoMuon::in.

void SiPixelCalibConfiguration::setColumnPattern ( const std::vector< short > &  in)
inline

Definition at line 38 of file SiPixelCalibConfiguration.h.

References fColumnPattern, and recoMuon::in.

void SiPixelCalibConfiguration::setNTriggers ( const short &  in)
inline
void SiPixelCalibConfiguration::setRowPattern ( const std::vector< short > &  in)
inline

Definition at line 35 of file SiPixelCalibConfiguration.h.

References fRowPattern, and recoMuon::in.

void SiPixelCalibConfiguration::setVCalValues ( const std::vector< short > &  in)
inline
short SiPixelCalibConfiguration::vcalForEvent ( const uint32_t &  eventnumber) const

Definition at line 10 of file SiPixelCalibConfiguration.cc.

References fVCalValues, mps_fire::result, and vcalIndexForEvent().

Referenced by setVCalValues().

10  {
11  short result = fVCalValues[vcalIndexForEvent(eventnumber)];
12  return result;
13 }
short vcalIndexForEvent(const uint32_t &eventnumber) const
short SiPixelCalibConfiguration::vcalIndexForEvent ( const uint32_t &  eventnumber) const

Definition at line 5 of file SiPixelCalibConfiguration.cc.

References funct::abs(), getNTriggers(), and patternSize().

Referenced by SiPixelCalibDigiProducer::fill(), setVCalValues(), and vcalForEvent().

5  {
6  uint32_t relative_event = std::abs((int32_t)eventnumber-1)%patternSize();
7  short relative_pattern = relative_event/getNTriggers();
8  return relative_pattern;
9 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 67 of file SiPixelCalibConfiguration.h.

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

Definition at line 67 of file SiPixelCalibConfiguration.h.

Member Data Documentation

std::vector<short> SiPixelCalibConfiguration::fColumnPattern
private
std::string SiPixelCalibConfiguration::fMode
private
short SiPixelCalibConfiguration::fNTriggers
private
std::vector<short> SiPixelCalibConfiguration::fRowPattern
private
std::vector<short> SiPixelCalibConfiguration::fVCalValues
private