CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pos::PixelTrimCommon Class Reference

This class implements.. More...

#include <PixelTrimCommon.h>

Inheritance diagram for pos::PixelTrimCommon:
pos::PixelTrimBase pos::PixelConfigBase

Public Member Functions

void generateConfiguration (PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, const PixelMaskBase &pixelMask) const override
 
 PixelTrimCommon (std::string filename)
 
void writeASCII (std::string filename) const override
 
void writeBinary (std::string filename) const override
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void writeXML (std::ofstream *out) const override
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
- Public Member Functions inherited from pos::PixelTrimBase
virtual PixelROCTrimBits getTrimBits (int ROCId) const =0
 
virtual PixelROCTrimBitsgetTrimBits (PixelROCName name)=0
 
 PixelTrimBase (std::string description, std::string creator, std::string date)
 
void setOverride (PixelTrimOverrideBase *trimOverride)
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
 ~PixelTrimBase () override
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual ~PixelConfigBase ()
 

Private Attributes

std::vector< PixelROCNamerocname_
 
std::vector< unsigned int > trimbits_
 

Detailed Description

This class implements..

" " " "

A longer explanation will be placed here later

Definition at line 30 of file PixelTrimCommon.h.

Constructor & Destructor Documentation

◆ PixelTrimCommon()

PixelTrimCommon::PixelTrimCommon ( std::string  filename)

Definition at line 19 of file PixelTrimCommon.cc.

19  : PixelTrimBase("", "", "") {
20  if (filename[filename.size() - 1] == 't') {
21  std::ifstream in(filename.c_str());
22 
23  std::string s1;
24  in >> s1;
25 
26  trimbits_.clear();
27 
28  while (!in.eof()) {
29  //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;
30 
31  PixelROCName rocid(in);
32 
33  //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
34 
35  unsigned int trimbits;
36 
37  in >> trimbits;
38 
39  trimbits_.push_back(trimbits);
40 
41  in >> s1;
42  }
43 
44  in.close();
45 
46  } else {
47  std::ifstream in(filename.c_str(), std::ios::binary);
48 
49  char nchar;
50 
51  in.read(&nchar, 1);
52 
53  std::string s1;
54 
55  //wrote these lines of code without ref. needs to be fixed
56  for (int i = 0; i < nchar; i++) {
57  char c;
58  in >> c;
59  s1.push_back(c);
60  }
61 
62  //std::cout << "READ ROC name:"<<s1<<std::endl;
63 
64  trimbits_.clear();
65 
66  while (!in.eof()) {
67  //std::cout << "PixelTrimCommon::PixelTrimCommon read s1:"<<s1<<std::endl;
68 
69  PixelROCName rocid(s1);
70 
71  //std::cout << "PixelTrimCommon::PixelTrimCommon read rocid:"<<rocid<<std::endl;
72 
73  unsigned int trimbits;
74 
75  in >> trimbits;
76 
77  trimbits_.push_back(trimbits);
78 
79  in.read(&nchar, 1);
80 
81  s1.clear();
82 
83  if (in.eof())
84  continue;
85 
86  //wrote these lines of code without ref. needs to be fixed
87  for (int i = 0; i < nchar; i++) {
88  char c;
89  in >> c;
90  s1.push_back(c);
91  }
92  }
93 
94  in.close();
95  }
96 
97  //std::cout << "Read trimbits for "<<trimbits_.size()<<" ROCs"<<std::endl;
98 }

References HltBtagPostValidation_cff::c, corrVsCorr::filename, mps_fire::i, recoMuon::in, AlCaHLTBitMon_QueryRunRegistry::string, and trimbits_.

Member Function Documentation

◆ generateConfiguration()

void PixelTrimCommon::generateConfiguration ( PixelFECConfigInterface pixelFEC,
PixelNameTranslation trans,
const PixelMaskBase pixelMask 
) const
overridevirtual

Implements pos::PixelTrimBase.

Definition at line 113 of file PixelTrimCommon.cc.

115  {
116  for (unsigned int i = 0; i < trimbits_.size(); i++) {
117  std::vector<unsigned char> trimAndMasks(4160);
118 
119  const PixelROCMaskBits& maskbits = pixelMask.getMaskBits(i);
120 
121  for (unsigned int col = 0; col < 52; col++) {
122  for (unsigned int row = 0; row < 80; row++) {
123  unsigned char tmp = trimbits_[i];
124  if (maskbits.mask(col, row) != 0)
125  tmp |= 0x80;
126  trimAndMasks[col * 80 + row] = tmp;
127  }
128  }
129 
130  pixelFEC->setMaskAndTrimAll(*(trans->getHdwAddress(rocname_[i])), trimAndMasks);
131  }
132 }

References cuy::col, pos::PixelNameTranslation::getHdwAddress(), pos::PixelMaskBase::getMaskBits(), mps_fire::i, pos::PixelROCMaskBits::mask(), rocname_, pos::PixelFECConfigInterface::setMaskAndTrimAll(), createJobs::tmp, and trimbits_.

◆ writeASCII()

void PixelTrimCommon::writeASCII ( std::string  filename) const
overridevirtual

Implements pos::PixelTrimBase.

Definition at line 143 of file PixelTrimCommon.cc.

143  {
144  std::ofstream out(filename.c_str());
145 
146  for (unsigned int i = 0; i < trimbits_.size(); i++) {
147  assert(0);
148  //trimbits_[i].writeASCII(out);
149  }
150 }

References cms::cuda::assert(), corrVsCorr::filename, mps_fire::i, MillePedeFileConverter_cfg::out, and trimbits_.

◆ writeBinary()

void PixelTrimCommon::writeBinary ( std::string  filename) const
overridevirtual

Implements pos::PixelTrimBase.

Definition at line 134 of file PixelTrimCommon.cc.

134  {
135  std::ofstream out(filename.c_str(), std::ios::binary);
136 
137  for (unsigned int i = 0; i < trimbits_.size(); i++) {
138  assert(0);
139  //trimbits_[i].writeBinary(out);
140  }
141 }

References cms::cuda::assert(), corrVsCorr::filename, mps_fire::i, MillePedeFileConverter_cfg::out, and trimbits_.

◆ writeXML() [1/4]

void pos::PixelTrimCommon::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual

Reimplemented from pos::PixelTrimBase.

Definition at line 44 of file PixelTrimCommon.h.

44 { ; }

◆ writeXML() [2/4]

void pos::PixelTrimBase::writeXML
inlineoverride

Definition at line 62 of file PixelTrimBase.h.

62 { ; }

◆ writeXML() [3/4]

void pos::PixelTrimCommon::writeXML ( std::ofstream *  out) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 49 of file PixelTrimCommon.h.

49 { ; }

◆ writeXML() [4/4]

void pos::PixelTrimBase::writeXML
inlineoverride

Definition at line 71 of file PixelTrimBase.h.

71 { ; }

◆ writeXMLHeader() [1/2]

void pos::PixelTrimCommon::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out 
) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 48 of file PixelTrimCommon.h.

48 { ; }

◆ writeXMLHeader() [2/2]

void pos::PixelTrimBase::writeXMLHeader
inlineoverride

Definition at line 63 of file PixelTrimBase.h.

68  {
69  ;
70  }

◆ writeXMLTrailer() [1/2]

void pos::PixelTrimCommon::writeXMLTrailer ( std::ofstream *  out) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 50 of file PixelTrimCommon.h.

50 { ; }

◆ writeXMLTrailer() [2/2]

void pos::PixelTrimBase::writeXMLTrailer
inlineoverride

Definition at line 72 of file PixelTrimBase.h.

74  {
75  ;
76  }

Member Data Documentation

◆ rocname_

std::vector<PixelROCName> pos::PixelTrimCommon::rocname_
private

Definition at line 53 of file PixelTrimCommon.h.

Referenced by generateConfiguration().

◆ trimbits_

std::vector<unsigned int> pos::PixelTrimCommon::trimbits_
private

Definition at line 54 of file PixelTrimCommon.h.

Referenced by generateConfiguration(), PixelTrimCommon(), writeASCII(), and writeBinary().

mps_fire.i
i
Definition: mps_fire.py:428
pos::PixelROCMaskBits
This class implements..
Definition: PixelROCMaskBits.h:24
cuy.col
col
Definition: cuy.py:1010
pos::PixelMaskBase::getMaskBits
virtual const PixelROCMaskBits & getMaskBits(int ROCId) const =0
cms::cuda::assert
assert(be >=bs)
pos::PixelFECConfigInterface::setMaskAndTrimAll
virtual void setMaskAndTrimAll(const PixelHdwAddress &theROC, const std::vector< unsigned char > &allPixels, const bool buffermode=false)=0
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
pos::PixelNameTranslation::getHdwAddress
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
Definition: PixelNameTranslation.cc:449
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
pos::PixelTrimCommon::trimbits_
std::vector< unsigned int > trimbits_
Definition: PixelTrimCommon.h:54
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
recoMuon::in
Definition: RecoMuonEnumerators.h:6
pos::PixelROCName
This class implements..
Definition: PixelROCName.h:23
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
pos::PixelTrimCommon::rocname_
std::vector< PixelROCName > rocname_
Definition: PixelTrimCommon.h:53
pos::PixelTrimBase::PixelTrimBase
PixelTrimBase(std::string description, std::string creator, std::string date)
Definition: PixelTrimBase.cc:20
pos::PixelROCMaskBits::mask
unsigned int mask(unsigned int col, unsigned int row) const
Definition: PixelROCMaskBits.cc:143
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31