test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelCalibConfiguration.cc
Go to the documentation of this file.
3 #include <cstdlib>
4 
5 short SiPixelCalibConfiguration::vcalIndexForEvent(const uint32_t & eventnumber) const{
6  uint32_t relative_event = abs(eventnumber-1)%patternSize();
7  short relative_pattern = relative_event/getNTriggers();
8  return relative_pattern;
9 }
10 short SiPixelCalibConfiguration::vcalForEvent(const uint32_t & eventnumber) const{
11  short result = fVCalValues[vcalIndexForEvent(eventnumber)];
12  return result;
13 }
14 std::vector<short> SiPixelCalibConfiguration::columnPatternForEvent(const uint32_t & eventnumber) const{
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 }
32 
33 std::vector<short> SiPixelCalibConfiguration::rowPatternForEvent(const uint32_t & eventnumber) const {
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 }
51 uint32_t SiPixelCalibConfiguration::nextPatternChangeForEvent(const uint32_t & eventnumber) const {
52  uint32_t relative_event = eventnumber/patternSize();
53  relative_event+=1;
54  return relative_event*patternSize();
55 }
57  return patternSize()*nPatterns();
58 }
59 
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 }
98 
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 }
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 }
116 
short vcalForEvent(const uint32_t &eventnumber) const
uint32_t nextPatternChangeForEvent(const uint32_t &eventnumber) const
int i
Definition: DBlmapReader.cc:9
const std::vector< std::vector< unsigned int > > & columnList() const
tuple result
Definition: mps_fire.py:83
short vcalIndexForEvent(const uint32_t &eventnumber) const
This class implements the steps that are used in a scan over Threshold and CalDelay.
std::vector< unsigned int > scanValues(std::string dac) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< short > columnPatternForEvent(const uint32_t &eventnumber) const
const std::vector< std::vector< unsigned int > > & rowList() const
unsigned int nTriggersPerPattern() const
std::string scanName(unsigned int iscan) const
tuple cout
Definition: gather_cfg.py:145
std::vector< short > rowPatternForEvent(const uint32_t &eventnumber) const
This class implements the steps that are used in a scan over Threshold and CalDelay.