CMS 3D CMS Logo

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

#include <SiPixelGenErrorDBObject.h>

Classes

union  char2float
 

Public Member Functions

bool fail ()
 
short getGenErrorID (const uint32_t &detid) const
 
const std::map< unsigned int, short > & getGenErrorIDs () const
 
void incrementIndex (int i)
 
int index () const
 
int maxIndex () const
 
int numOfTempl () const
 
SiPixelGenErrorDBObjectoperator>> (int &i)
 
SiPixelGenErrorDBObjectoperator>> (float &f)
 
void push_back (float entry)
 
bool putGenErrorID (const uint32_t &detid, short &value)
 
void putGenErrorIDs (std::map< unsigned int, short > &t_ID)
 
void setIndex (int index)
 
void setInvalid ()
 
void setMaxIndex (int maxIndex)
 
void setNumOfTempl (int numOfTempl)
 
void setVersion (float version)
 
 SiPixelGenErrorDBObject ()
 
std::vector< float > sVector () const
 
float version () const
 
virtual ~SiPixelGenErrorDBObject ()
 

Private Member Functions

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

Private Attributes

int index_
 
bool isInvalid_
 
int maxIndex_
 
int numOfTempl_
 
std::vector< float > sVector_
 
std::map< unsigned int, short > templ_ID
 
float version_
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
std::ostream & operator<< (std::ostream &s, const SiPixelGenErrorDBObject &dbobject)
 

Detailed Description

Definition at line 16 of file SiPixelGenErrorDBObject.h.

Constructor & Destructor Documentation

◆ SiPixelGenErrorDBObject()

SiPixelGenErrorDBObject::SiPixelGenErrorDBObject ( )
inline

◆ ~SiPixelGenErrorDBObject()

virtual SiPixelGenErrorDBObject::~SiPixelGenErrorDBObject ( )
inlinevirtual

Definition at line 21 of file SiPixelGenErrorDBObject.h.

21 {}

Member Function Documentation

◆ fail()

bool SiPixelGenErrorDBObject::fail ( )
inline

Definition at line 50 of file SiPixelGenErrorDBObject.h.

References isInvalid_.

Referenced by SiPixelGenErrorDBObjectReader::analyze().

◆ getGenErrorID()

short SiPixelGenErrorDBObject::getGenErrorID ( const uint32_t &  detid) const
inline

Definition at line 89 of file SiPixelGenErrorDBObject.h.

References l1ctLayer2EG_cff::id, and templ_ID.

Referenced by PixelCPEBase::fillDetParams().

89  {
90  std::map<unsigned int, short>::const_iterator id = templ_ID.find(detid);
91  if (id != templ_ID.end())
92  return id->second;
93  else
94  edm::LogError("SiPixelGenErrorDBObject") << "GenError ID for DetID " << detid << " is not stored" << std::endl;
95  return 0;
96  }
std::map< unsigned int, short > templ_ID

◆ getGenErrorIDs()

const std::map<unsigned int, short>& SiPixelGenErrorDBObject::getGenErrorIDs ( ) const
inline

Definition at line 76 of file SiPixelGenErrorDBObject.h.

References templ_ID.

Referenced by SiPixelGenErrorDBObjectReader::analyze().

76 { return templ_ID; }
std::map< unsigned int, short > templ_ID

◆ incrementIndex()

void SiPixelGenErrorDBObject::incrementIndex ( int  i)
inline

Definition at line 66 of file SiPixelGenErrorDBObject.h.

References mps_fire::i, and index_.

◆ index()

int SiPixelGenErrorDBObject::index ( ) const
inline

◆ maxIndex()

int SiPixelGenErrorDBObject::maxIndex ( ) const
inline

Definition at line 60 of file SiPixelGenErrorDBObject.h.

References maxIndex_.

Referenced by SiPixelGenErrorDBObjectReader::analyze(), and setMaxIndex().

◆ numOfTempl()

int SiPixelGenErrorDBObject::numOfTempl ( ) const
inline

◆ operator>>() [1/2]

SiPixelGenErrorDBObject& SiPixelGenErrorDBObject::operator>> ( int &  i)
inline

Definition at line 27 of file SiPixelGenErrorDBObject.h.

References mps_fire::i, index_, createfilelist::int, isInvalid_, and maxIndex_.

27  {
28  isInvalid_ = false;
29  if (index_ <= maxIndex_) {
30  i = (int)(*this).sVector_[index_];
31  index_++;
32  } else
33  (*this).setInvalid();
34  return *this;
35  }

◆ operator>>() [2/2]

SiPixelGenErrorDBObject& SiPixelGenErrorDBObject::operator>> ( float &  f)
inline

Definition at line 37 of file SiPixelGenErrorDBObject.h.

References f, index_, isInvalid_, and maxIndex_.

37  {
38  isInvalid_ = false;
39  if (index_ <= maxIndex_) {
40  f = (*this).sVector_[index_];
41  index_++;
42  } else
43  (*this).setInvalid();
44  return *this;
45  }
double f[11][100]

◆ push_back()

void SiPixelGenErrorDBObject::push_back ( float  entry)
inline

Definition at line 53 of file SiPixelGenErrorDBObject.h.

References mps_splice::entry, and sVector_.

53 { sVector_.push_back(entry); }

◆ putGenErrorID()

bool SiPixelGenErrorDBObject::putGenErrorID ( const uint32_t &  detid,
short &  value 
)
inline

Definition at line 78 of file SiPixelGenErrorDBObject.h.

References templ_ID, and relativeConstraints::value.

78  {
79  std::map<unsigned int, short>::const_iterator id = templ_ID.find(detid);
80  if (id != templ_ID.end()) {
81  edm::LogError("SiPixelGenErrorDBObject")
82  << "GenError ID for DetID " << detid << " is already stored. Skipping this put" << std::endl;
83  return false;
84  } else
85  templ_ID[detid] = value;
86  return true;
87  }
Log< level::Error, false > LogError
std::map< unsigned int, short > templ_ID

◆ putGenErrorIDs()

void SiPixelGenErrorDBObject::putGenErrorIDs ( std::map< unsigned int, short > &  t_ID)
inline

Definition at line 75 of file SiPixelGenErrorDBObject.h.

References templ_ID.

75 { templ_ID = t_ID; }
std::map< unsigned int, short > templ_ID

◆ serialize()

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

◆ setIndex()

void SiPixelGenErrorDBObject::setIndex ( int  index)
inline

Definition at line 54 of file SiPixelGenErrorDBObject.h.

References index(), and index_.

◆ setInvalid()

void SiPixelGenErrorDBObject::setInvalid ( void  )
inline

Definition at line 49 of file SiPixelGenErrorDBObject.h.

References isInvalid_.

◆ setMaxIndex()

void SiPixelGenErrorDBObject::setMaxIndex ( int  maxIndex)
inline

◆ setNumOfTempl()

void SiPixelGenErrorDBObject::setNumOfTempl ( int  numOfTempl)
inline

◆ setVersion()

void SiPixelGenErrorDBObject::setVersion ( float  version)
inline

Definition at line 48 of file SiPixelGenErrorDBObject.h.

References version(), and version_.

◆ sVector()

std::vector<float> SiPixelGenErrorDBObject::sVector ( ) const
inline

Definition at line 63 of file SiPixelGenErrorDBObject.h.

References sVector_.

Referenced by SiPixelGenErrorDBObjectReader::analyze().

63 { return sVector_; }

◆ version()

float SiPixelGenErrorDBObject::version ( ) const
inline

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 107 of file SiPixelGenErrorDBObject.h.

◆ cond::serialization::access

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

Definition at line 107 of file SiPixelGenErrorDBObject.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const SiPixelGenErrorDBObject dbobject 
)
friend

-index to keep track of where we are in the object

-these are modifiable parameters for the extended GenErrors

-entries takes the number of entries in By,Bx,Fy,Fx from the object

-local indicies for loops

-changes the size of the GenErrors based on the version

Definition at line 206 of file SiPixelGenErrorDBObjectReader.cc.

206  {
208  int index = 0;
210  int txsize[4] = {7, 13, 0, 0};
211  int tysize[4] = {21, 21, 0, 0};
213  int entries[4] = {0};
215  int i, j, k, l, m, n, entry_it;
217  int sizeSetter = 1, generrorVersion = 0;
218 
219  edm::LogPrint("SiPixelGenErrorDBObjectReader") << "\n\nDBobject version: " << dbobject.version() << std::endl;
220 
221  for (m = 0; m < dbobject.numOfTempl(); ++m) {
222  //To change the size of the output based on which GenError version we are using"
223  generrorVersion = (int)dbobject.sVector_[index + 21];
224 
225  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " GenError version " << generrorVersion << " " << m << std::endl;
226 
227  if (generrorVersion <= 10) {
228  edm::LogPrint("SiPixelGenErrorDBObjectReader")
229  << "*****WARNING***** This code will not format this GenError version properly *****WARNING*****\n";
230  sizeSetter = 0;
231  } else if (generrorVersion <= 16)
232  sizeSetter = 1;
233  else
234  edm::LogPrint("SiPixelGenErrorDBObjectReader")
235  << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n";
236 
237  edm::LogPrint("SiPixelGenErrorDBObjectReader")
238  << "\n\n*********************************************************************************************"
239  << std::endl;
240  edm::LogPrint("SiPixelGenErrorDBObjectReader")
241  << "*************** Reading GenError ID " << dbobject.sVector_[index + 20] << "\t(" << m + 1
242  << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl;
243  edm::LogPrint("SiPixelGenErrorDBObjectReader")
244  << "*********************************************************************************************\n\n"
245  << std::endl;
246 
247  //Header Title
248  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Header Title" << std::endl;
250  for (n = 0; n < 20; ++n) {
251  temp.f = dbobject.sVector_[index];
252  s << temp.c[0] << temp.c[1] << temp.c[2] << temp.c[3];
253  ++index;
254  }
255 
256  entries[0] = (int)dbobject.sVector_[index + 3]; // Y
257  entries[1] = (int)(dbobject.sVector_[index + 4] * dbobject.sVector_[index + 5]); // X
258 
259  //Header
260  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Header " << std::endl;
261  s << dbobject.sVector_[index] << "\t" << dbobject.sVector_[index + 1] << "\t" << dbobject.sVector_[index + 2]
262  << "\t" << dbobject.sVector_[index + 3] << "\t" << dbobject.sVector_[index + 4] << "\t"
263  << dbobject.sVector_[index + 5] << "\t" << dbobject.sVector_[index + 6] << "\t" << dbobject.sVector_[index + 7]
264  << "\t" << dbobject.sVector_[index + 8] << "\t" << dbobject.sVector_[index + 9] << "\t"
265  << dbobject.sVector_[index + 10] << "\t" << dbobject.sVector_[index + 11] << "\t" << dbobject.sVector_[index + 12]
266  << "\t" << dbobject.sVector_[index + 13] << "\t" << dbobject.sVector_[index + 14] << "\t"
267  << dbobject.sVector_[index + 15] << "\t" << dbobject.sVector_[index + 16] << std::endl;
268  index += 17;
269 
270  //Loop over By,Bx,Fy,Fx
271  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " ByBxFyFx" << std::endl;
272  for (entry_it = 0; entry_it < 4; ++entry_it) {
273  //Run,costrk,qavg,...,clslenx
274  for (i = 0; i < entries[entry_it]; ++i) {
275  s << dbobject.sVector_[index] << "\t" << dbobject.sVector_[index + 1] << "\t" << dbobject.sVector_[index + 2]
276  << "\t" << dbobject.sVector_[index + 3] << "\n"
277  << dbobject.sVector_[index + 4] << "\t" << dbobject.sVector_[index + 5] << "\t"
278  << dbobject.sVector_[index + 6] << "\t" << dbobject.sVector_[index + 7] << "\t"
279  << dbobject.sVector_[index + 8] << "\t" << dbobject.sVector_[index + 9] << "\t"
280  << dbobject.sVector_[index + 10] << "\t" << dbobject.sVector_[index + 11] << "\n"
281  << dbobject.sVector_[index + 12] << "\t" << dbobject.sVector_[index + 13] << "\t"
282  << dbobject.sVector_[index + 14] << "\t" << dbobject.sVector_[index + 15] << "\t"
283  << dbobject.sVector_[index + 16] << "\t" << dbobject.sVector_[index + 17] << "\t"
284  << dbobject.sVector_[index + 18] << std::endl;
285  index += 19;
286  //YPar
287  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " YPar" << std::endl;
288  for (j = 0; j < 2; ++j) {
289  for (k = 0; k < 5; ++k) {
290  s << dbobject.sVector_[index] << "\t";
291  ++index;
292  }
293  s << std::endl;
294  }
295  //YTemp
296  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " YTemp" << std::endl;
297  for (j = 0; j < 9; ++j) {
298  for (k = 0; k < tysize[sizeSetter]; ++k) {
299  s << dbobject.sVector_[index] << "\t";
300  ++index;
301  }
302  s << std::endl;
303  }
304  //XPar
305  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " XPar" << std::endl;
306  for (j = 0; j < 2; ++j) {
307  for (k = 0; k < 5; ++k) {
308  s << dbobject.sVector_[index] << "\t";
309  ++index;
310  }
311  s << std::endl;
312  }
313  //XTemp
314  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Xtemp" << std::endl;
315  for (j = 0; j < 9; ++j) {
316  for (k = 0; k < txsize[sizeSetter]; ++k) {
317  s << dbobject.sVector_[index] << "\t";
318  ++index;
319  }
320  s << std::endl;
321  }
322  //Y average reco params
323  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Y average reco params " << std::endl;
324  for (j = 0; j < 4; ++j) {
325  for (k = 0; k < 4; ++k) {
326  s << dbobject.sVector_[index] << "\t";
327  ++index;
328  }
329  s << std::endl;
330  }
331  //Yflpar
332  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Yflar " << std::endl;
333  for (j = 0; j < 4; ++j) {
334  for (k = 0; k < 6; ++k) {
335  s << dbobject.sVector_[index] << "\t";
336  ++index;
337  }
338  s << std::endl;
339  }
340  //X average reco params
341  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " X average reco params" << std::endl;
342  for (j = 0; j < 4; ++j) {
343  for (k = 0; k < 4; ++k) {
344  s << dbobject.sVector_[index] << "\t";
345  ++index;
346  }
347  s << std::endl;
348  }
349  //Xflpar
350  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Xflar" << std::endl;
351  for (j = 0; j < 4; ++j) {
352  for (k = 0; k < 6; ++k) {
353  s << dbobject.sVector_[index] << "\t";
354  ++index;
355  }
356  s << std::endl;
357  }
358  //Chi2X,Y
359  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " XY chi2" << std::endl;
360  for (j = 0; j < 4; ++j) {
361  for (k = 0; k < 2; ++k) {
362  for (l = 0; l < 2; ++l) {
363  s << dbobject.sVector_[index] << "\t";
364  ++index;
365  }
366  }
367  s << std::endl;
368  }
369  //Y average Chi2 params
370  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Y chi2" << std::endl;
371  for (j = 0; j < 4; ++j) {
372  for (k = 0; k < 4; ++k) {
373  s << dbobject.sVector_[index] << "\t";
374  ++index;
375  }
376  s << std::endl;
377  }
378  //X average Chi2 params
379  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " X chi2" << std::endl;
380  for (j = 0; j < 4; ++j) {
381  for (k = 0; k < 4; ++k) {
382  s << dbobject.sVector_[index] << "\t";
383  ++index;
384  }
385  s << std::endl;
386  }
387  //Y average reco params for CPE Generic
388  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Y reco params for generic" << std::endl;
389  for (j = 0; j < 4; ++j) {
390  for (k = 0; k < 4; ++k) {
391  s << dbobject.sVector_[index] << "\t";
392  ++index;
393  }
394  s << std::endl;
395  }
396  //X average reco params for CPE Generic
397  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " X reco params for generic" << std::endl;
398  for (j = 0; j < 4; ++j) {
399  for (k = 0; k < 4; ++k) {
400  s << dbobject.sVector_[index] << "\t";
401  ++index;
402  }
403  s << std::endl;
404  }
405  //SpareX,Y
406  edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Spare " << std::endl;
407  for (j = 0; j < 20; ++j) {
408  s << dbobject.sVector_[index] << "\t";
409  ++index;
410  if (j == 9 || j == 19)
411  s << std::endl;
412  }
413  }
414  }
415  }
416  return s;
417 }
Log< level::Warning, true > LogPrint

Member Data Documentation

◆ index_

int SiPixelGenErrorDBObject::index_
private

Definition at line 99 of file SiPixelGenErrorDBObject.h.

Referenced by incrementIndex(), index(), operator>>(), and setIndex().

◆ isInvalid_

bool SiPixelGenErrorDBObject::isInvalid_
private

Definition at line 103 of file SiPixelGenErrorDBObject.h.

Referenced by fail(), operator>>(), and setInvalid().

◆ maxIndex_

int SiPixelGenErrorDBObject::maxIndex_
private

Definition at line 100 of file SiPixelGenErrorDBObject.h.

Referenced by maxIndex(), operator>>(), and setMaxIndex().

◆ numOfTempl_

int SiPixelGenErrorDBObject::numOfTempl_
private

Definition at line 101 of file SiPixelGenErrorDBObject.h.

Referenced by numOfTempl(), operator<<(), and setNumOfTempl().

◆ sVector_

std::vector<float> SiPixelGenErrorDBObject::sVector_
private

Definition at line 104 of file SiPixelGenErrorDBObject.h.

Referenced by operator<<(), push_back(), SiPixelGenErrorDBObject(), and sVector().

◆ templ_ID

std::map<unsigned int, short> SiPixelGenErrorDBObject::templ_ID
private

◆ version_

float SiPixelGenErrorDBObject::version_
private

Definition at line 102 of file SiPixelGenErrorDBObject.h.

Referenced by setVersion(), and version().