CMS 3D CMS Logo

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

#include <SiPixelTemplateDBObject.h>

Classes

union  char2float
 
struct  Reader
 

Public Member Functions

bool fail ()
 
short getTemplateID (const uint32_t &detid) const
 
const std::map< unsigned int,
short > & 
getTemplateIDs () const
 
void incrementIndex (int i)
 
int index () const
 
int maxIndex () const
 
int numOfTempl () const
 
SiPixelTemplateDBObjectoperator>> (int &i)
 
SiPixelTemplateDBObjectoperator>> (float &f)
 
void push_back (float entry)
 
bool putTemplateID (const uint32_t &detid, short &value)
 
void putTemplateIDs (std::map< unsigned int, short > &t_ID)
 
Reader reader () const
 
void setIndex (int index)
 
void setInvalid ()
 
void setMaxIndex (int maxIndex)
 
void setNumOfTempl (int numOfTempl)
 
void setVersion (float version)
 
 SiPixelTemplateDBObject ()
 
std::vector< float > const & sVector () const
 
float version () const
 
virtual ~SiPixelTemplateDBObject ()
 

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 SiPixelTemplateDBObject &dbobject)
 

Detailed Description

Definition at line 16 of file SiPixelTemplateDBObject.h.

Constructor & Destructor Documentation

SiPixelTemplateDBObject::SiPixelTemplateDBObject ( )
inline
virtual SiPixelTemplateDBObject::~SiPixelTemplateDBObject ( )
inlinevirtual

Definition at line 63 of file SiPixelTemplateDBObject.h.

63 {}

Member Function Documentation

bool SiPixelTemplateDBObject::fail ( )
inline

Definition at line 92 of file SiPixelTemplateDBObject.h.

References isInvalid_.

short SiPixelTemplateDBObject::getTemplateID ( const uint32_t &  detid) const
inline

Definition at line 131 of file SiPixelTemplateDBObject.h.

References templ_ID.

Referenced by SiPixelTemplateDBObjectUploader::analyze(), SiPixelLorentzAnglePCLWorker::analyze(), PixelCPEBase::fillDetParams(), PixelCPETemplateReco::localPosition(), PixelTemplateSmearerBase::smearHit(), and PixelTemplateSmearerBase::smearMergeGroup().

131  {
132  std::map<unsigned int, short>::const_iterator id = templ_ID.find(detid);
133  if (id != templ_ID.end())
134  return id->second;
135  else
136  edm::LogError("SiPixelTemplateDBObject") << "Template ID for DetID " << detid << " is not stored" << std::endl;
137  return 0;
138  }
std::map< unsigned int, short > templ_ID
const std::map<unsigned int, short>& SiPixelTemplateDBObject::getTemplateIDs ( ) const
inline

Definition at line 118 of file SiPixelTemplateDBObject.h.

References templ_ID.

Referenced by SiPixelTemplateDBObjectReader::analyze().

118 { return templ_ID; }
std::map< unsigned int, short > templ_ID
void SiPixelTemplateDBObject::incrementIndex ( int  i)
inline

Definition at line 108 of file SiPixelTemplateDBObject.h.

References mps_fire::i, and index_.

int SiPixelTemplateDBObject::index ( ) const
inline

Definition at line 101 of file SiPixelTemplateDBObject.h.

References index_.

Referenced by BeautifulSoup.PageElement::_invert(), and setIndex().

int SiPixelTemplateDBObject::maxIndex ( ) const
inline
int SiPixelTemplateDBObject::numOfTempl ( ) const
inline
SiPixelTemplateDBObject& SiPixelTemplateDBObject::operator>> ( int &  i)
inline

Definition at line 69 of file SiPixelTemplateDBObject.h.

References index_, isInvalid_, and maxIndex_.

69  {
70  isInvalid_ = false;
71  if (index_ <= maxIndex_) {
72  i = (int)(*this).sVector_[index_];
73  index_++;
74  } else
75  (*this).setInvalid();
76  return *this;
77  }
SiPixelTemplateDBObject& SiPixelTemplateDBObject::operator>> ( float &  f)
inline

Definition at line 79 of file SiPixelTemplateDBObject.h.

References index_, isInvalid_, and maxIndex_.

79  {
80  isInvalid_ = false;
81  if (index_ <= maxIndex_) {
82  f = (*this).sVector_[index_];
83  index_++;
84  } else
85  (*this).setInvalid();
86  return *this;
87  }
void SiPixelTemplateDBObject::push_back ( float  entry)
inline

Definition at line 95 of file SiPixelTemplateDBObject.h.

References sVector_.

Referenced by SiPixelTemplateDBObjectUploader::analyze().

95 { sVector_.push_back(entry); }
list entry
Definition: mps_splice.py:68
bool SiPixelTemplateDBObject::putTemplateID ( const uint32_t &  detid,
short &  value 
)
inline

Definition at line 120 of file SiPixelTemplateDBObject.h.

References templ_ID, and relativeConstraints::value.

Referenced by SiPixelTemplateDBObjectUploader::analyze().

120  {
121  std::map<unsigned int, short>::const_iterator id = templ_ID.find(detid);
122  if (id != templ_ID.end()) {
123  edm::LogError("SiPixelTemplateDBObject")
124  << "Template ID for DetID " << detid << " is already stored. Skipping this put" << std::endl;
125  return false;
126  } else
127  templ_ID[detid] = value;
128  return true;
129  }
Log< level::Error, false > LogError
std::map< unsigned int, short > templ_ID
void SiPixelTemplateDBObject::putTemplateIDs ( std::map< unsigned int, short > &  t_ID)
inline

Definition at line 117 of file SiPixelTemplateDBObject.h.

References templ_ID.

117 { templ_ID = t_ID; }
std::map< unsigned int, short > templ_ID
Reader SiPixelTemplateDBObject::reader ( ) const
inline

Definition at line 58 of file SiPixelTemplateDBObject.h.

Referenced by SiPixelTemplate::pushfile().

58 { return Reader(*this); }
template<class Archive >
void SiPixelTemplateDBObject::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void SiPixelTemplateDBObject::setIndex ( int  index)
inline

Definition at line 96 of file SiPixelTemplateDBObject.h.

References index(), and index_.

void SiPixelTemplateDBObject::setInvalid ( void  )
inline

Definition at line 91 of file SiPixelTemplateDBObject.h.

References isInvalid_.

void SiPixelTemplateDBObject::setMaxIndex ( int  maxIndex)
inline
void SiPixelTemplateDBObject::setNumOfTempl ( int  numOfTempl)
inline
void SiPixelTemplateDBObject::setVersion ( float  version)
inline
std::vector<float> const& SiPixelTemplateDBObject::sVector ( ) const
inline
float SiPixelTemplateDBObject::version ( ) const
inline

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 149 of file SiPixelTemplateDBObject.h.

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

Definition at line 149 of file SiPixelTemplateDBObject.h.

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

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

-these are modifiable parameters for the extended templates

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

-local indicies for loops

-changes the size of the templates based on the version

Definition at line 198 of file SiPixelTemplateDBObjectReader.cc.

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

Member Data Documentation

int SiPixelTemplateDBObject::index_
private

Definition at line 141 of file SiPixelTemplateDBObject.h.

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

bool SiPixelTemplateDBObject::isInvalid_
private

Definition at line 145 of file SiPixelTemplateDBObject.h.

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

int SiPixelTemplateDBObject::maxIndex_
private

Definition at line 142 of file SiPixelTemplateDBObject.h.

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

int SiPixelTemplateDBObject::numOfTempl_
private

Definition at line 143 of file SiPixelTemplateDBObject.h.

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

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

Definition at line 146 of file SiPixelTemplateDBObject.h.

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

std::map<unsigned int, short> SiPixelTemplateDBObject::templ_ID
private
float SiPixelTemplateDBObject::version_
private

Definition at line 144 of file SiPixelTemplateDBObject.h.

Referenced by setVersion(), and version().