CMS 3D CMS Logo

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

#include <SiPixel2DTemplateDBObject.h>

Classes

union  char2float
 
class  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
 
SiPixel2DTemplateDBObjectoperator>> (int &i)
 
SiPixel2DTemplateDBObjectoperator>> (float &f)
 
void push_back (float entry)
 
bool putTemplateID (const uint32_t &detid, short &value)
 
void putTemplateIDs (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)
 
 SiPixel2DTemplateDBObject ()
 
std::vector< float > const & sVector () const
 
float version () const
 
virtual ~SiPixel2DTemplateDBObject ()
 

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 SiPixel2DTemplateDBObject &dbobject)
 
class Reader
 

Detailed Description

Definition at line 16 of file SiPixel2DTemplateDBObject.h.

Constructor & Destructor Documentation

◆ SiPixel2DTemplateDBObject()

SiPixel2DTemplateDBObject::SiPixel2DTemplateDBObject ( )
inline

◆ ~SiPixel2DTemplateDBObject()

virtual SiPixel2DTemplateDBObject::~SiPixel2DTemplateDBObject ( )
inlinevirtual

Definition at line 22 of file SiPixel2DTemplateDBObject.h.

22 {}

Member Function Documentation

◆ fail()

bool SiPixel2DTemplateDBObject::fail ( )
inline

Definition at line 51 of file SiPixel2DTemplateDBObject.h.

References isInvalid_.

◆ getTemplateID()

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

Definition at line 90 of file SiPixel2DTemplateDBObject.h.

References ALCARECOPPSCalTrackBasedSel_cff::detid, EcalPhiSymFlatTableProducers_cfi::id, and templ_ID.

Referenced by PixelCPEClusterRepair::fill2DTemplIDs(), SiPixelChargeReweightingAlgorithm::hitSignalReweight(), and SiPixelChargeReweightingAlgorithm::lateSignalReweight().

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

◆ getTemplateIDs()

const std::map<unsigned int, short>& SiPixel2DTemplateDBObject::getTemplateIDs ( ) const
inline

Definition at line 77 of file SiPixel2DTemplateDBObject.h.

References templ_ID.

Referenced by SiPixel2DTemplateDBObjectReader::analyze().

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

◆ incrementIndex()

void SiPixel2DTemplateDBObject::incrementIndex ( int  i)
inline

Definition at line 67 of file SiPixel2DTemplateDBObject.h.

References mps_fire::i, and index_.

◆ index()

int SiPixel2DTemplateDBObject::index ( ) const
inline

Definition at line 60 of file SiPixel2DTemplateDBObject.h.

References index_.

Referenced by setIndex().

◆ maxIndex()

int SiPixel2DTemplateDBObject::maxIndex ( ) const
inline

Definition at line 61 of file SiPixel2DTemplateDBObject.h.

References maxIndex_.

Referenced by setMaxIndex().

◆ numOfTempl()

int SiPixel2DTemplateDBObject::numOfTempl ( ) const
inline

◆ operator>>() [1/2]

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

Definition at line 28 of file SiPixel2DTemplateDBObject.h.

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

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

◆ operator>>() [2/2]

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

Definition at line 38 of file SiPixel2DTemplateDBObject.h.

References f, index_, isInvalid_, and maxIndex_.

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

◆ push_back()

void SiPixel2DTemplateDBObject::push_back ( float  entry)
inline

Definition at line 54 of file SiPixel2DTemplateDBObject.h.

References mps_splice::entry, and sVector_.

54 { sVector_.push_back(entry); }

◆ putTemplateID()

bool SiPixel2DTemplateDBObject::putTemplateID ( const uint32_t &  detid,
short &  value 
)
inline

Definition at line 79 of file SiPixel2DTemplateDBObject.h.

References ALCARECOPPSCalTrackBasedSel_cff::detid, templ_ID, and relativeConstraints::value.

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

◆ putTemplateIDs()

void SiPixel2DTemplateDBObject::putTemplateIDs ( std::map< unsigned int, short > &  t_ID)
inline

Definition at line 76 of file SiPixel2DTemplateDBObject.h.

References templ_ID.

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

◆ serialize()

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

◆ setIndex()

void SiPixel2DTemplateDBObject::setIndex ( int  index)
inline

◆ setInvalid()

void SiPixel2DTemplateDBObject::setInvalid ( void  )
inline

Definition at line 50 of file SiPixel2DTemplateDBObject.h.

References isInvalid_.

◆ setMaxIndex()

void SiPixel2DTemplateDBObject::setMaxIndex ( int  maxIndex)
inline

◆ setNumOfTempl()

void SiPixel2DTemplateDBObject::setNumOfTempl ( int  numOfTempl)
inline

◆ setVersion()

void SiPixel2DTemplateDBObject::setVersion ( float  version)
inline

◆ sVector()

std::vector<float> const& SiPixel2DTemplateDBObject::sVector ( ) const
inline

Definition at line 64 of file SiPixel2DTemplateDBObject.h.

References sVector_.

Referenced by SiPixel2DTemplateDBObjectReader::analyze(), and SiPixelTemplate2D::pushfile().

64 { return sVector_; }

◆ version()

float SiPixel2DTemplateDBObject::version ( ) const
inline

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 147 of file SiPixel2DTemplateDBObject.h.

◆ cond::serialization::access

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

Definition at line 147 of file SiPixel2DTemplateDBObject.h.

◆ operator<<

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

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

-these are modifiable parameters for the extended 2DTemplates

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

-local indicies for loops

-changes the size of the 2DTemplates based on the version

Definition at line 199 of file SiPixel2DTemplateDBObjectReader.cc.

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

◆ Reader

friend class Reader
friend

Definition at line 136 of file SiPixel2DTemplateDBObject.h.

Member Data Documentation

◆ index_

int SiPixel2DTemplateDBObject::index_
private

Definition at line 139 of file SiPixel2DTemplateDBObject.h.

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

◆ isInvalid_

bool SiPixel2DTemplateDBObject::isInvalid_
private

Definition at line 143 of file SiPixel2DTemplateDBObject.h.

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

◆ maxIndex_

int SiPixel2DTemplateDBObject::maxIndex_
private

◆ numOfTempl_

int SiPixel2DTemplateDBObject::numOfTempl_
private

Definition at line 141 of file SiPixel2DTemplateDBObject.h.

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

◆ sVector_

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

◆ templ_ID

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

◆ version_

float SiPixel2DTemplateDBObject::version_
private

Definition at line 142 of file SiPixel2DTemplateDBObject.h.

Referenced by setVersion(), and version().