CMS 3D CMS Logo

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

This class implements.. More...

#include "interface/PixelROCName.h"

Public Member Functions

int blade () const
 
char detsub () const
 
int disk () const
 
char HF () const
 
unsigned int id () const
 
char IO () const
 
int ladder () const
 
int layer () const
 
int module () const
 
char mp () const
 
const bool operator< (const PixelROCName &aROC) const
 
const PixelROCNameoperator= (const PixelROCName &aROC)
 
const bool operator== (const PixelROCName &aROC) const
 
int panel () const
 
 PixelROCName ()
 
 PixelROCName (std::string rocname)
 
 PixelROCName (std::ifstream &s)
 
int plaquet () const
 
int roc () const
 
std::string rocname () const
 
int sec () const
 

Private Member Functions

void check (bool check, const std::string &name)
 
void parsename (std::string name)
 
void setIdBPix (char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
 
void setIdFPix (char np, char LR, int disk, int blade, int panel, int plaquet, int roc)
 

Private Attributes

unsigned int id_
 

Friends

std::ostream & pos::operator<< (std::ostream &s, const PixelROCName &pixelroc)
 

Detailed Description

This class implements..

A longer explanation will be placed here later

Definition at line 23 of file PixelROCName.h.

Constructor & Destructor Documentation

◆ PixelROCName() [1/3]

PixelROCName::PixelROCName ( )

Definition at line 17 of file PixelROCName.cc.

17 : id_(0) {}
unsigned int id_
Definition: PixelROCName.h:122

◆ PixelROCName() [2/3]

PixelROCName::PixelROCName ( std::string  rocname)
explicit

Definition at line 19 of file PixelROCName.cc.

References parsename(), and rocname().

19 { parsename(rocname); }
void parsename(std::string name)
Definition: PixelROCName.cc:97
std::string rocname() const

◆ PixelROCName() [3/3]

PixelROCName::PixelROCName ( std::ifstream &  s)
explicit

Definition at line 227 of file PixelROCName.cc.

References parsename(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

227  {
229 
230  s >> tmp;
231 
232  parsename(tmp);
233 }
void parsename(std::string name)
Definition: PixelROCName.cc:97
tmp
align.sh
Definition: createJobs.py:716

Member Function Documentation

◆ blade()

int pos::PixelROCName::blade ( ) const
inline

Definition at line 43 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by rocname(), and setIdFPix().

43  {
44  assert((id_ & 0x80000000) == 0);
45  return (id_ >> 7) & 0x1f;
46  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ check()

void PixelROCName::check ( bool  check,
const std::string &  name 
)
private

Definition at line 85 of file PixelROCName.cc.

References gather_cfg::cout, Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by parsename().

85  {
86  static std::string mthn = "[PixelROCName::check()]\t\t\t\t ";
87 
88  if (check)
89  return;
90 
91  cout << __LINE__ << "]\t" << mthn << "ERROR tried to parse string:'" << name;
92  cout << "' as a ROC name. Will terminate." << endl;
93 
94  ::abort();
95 }
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:85

◆ detsub()

char pos::PixelROCName::detsub ( ) const
inline

Definition at line 33 of file PixelROCName.h.

References id_.

Referenced by rocname().

33 { return (id_ & 0x80000000) ? 'B' : 'F'; }
unsigned int id_
Definition: PixelROCName.h:122

◆ disk()

int pos::PixelROCName::disk ( ) const
inline

Definition at line 39 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by parsename(), rocname(), and setIdFPix().

39  {
40  assert((id_ & 0x80000000) == 0);
41  return (id_ >> 12) & 0x3;
42  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ HF()

char pos::PixelROCName::HF ( ) const
inline

Definition at line 69 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by parsename(), rocname(), and setIdBPix().

69  {
70  assert((id_ & 0x80000000) != 0);
71  return id_ & 0x00000800 ? 'F' : 'H';
72  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ id()

unsigned int pos::PixelROCName::id ( ) const
inline

Definition at line 86 of file PixelROCName.h.

References id_.

86 { return id_; }
unsigned int id_
Definition: PixelROCName.h:122

◆ IO()

char pos::PixelROCName::IO ( ) const
inline

Definition at line 35 of file PixelROCName.h.

References id_.

Referenced by rocname().

35 { return id_ & 0x20000000 ? 'I' : 'O'; }
unsigned int id_
Definition: PixelROCName.h:122

◆ ladder()

int pos::PixelROCName::ladder ( ) const
inline

Definition at line 65 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by parsename(), rocname(), and setIdBPix().

65  {
66  assert((id_ & 0x80000000) != 0);
67  return (id_ >> 6) & 0x1f;
68  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ layer()

int pos::PixelROCName::layer ( ) const
inline

Definition at line 61 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by geometryXMLparser.DTAlignable::index(), geometryXMLparser.CSCAlignable::index(), parsename(), rocname(), and setIdBPix().

61  {
62  assert((id_ & 0x80000000) != 0);
63  return (id_ >> 12) & 0x3;
64  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ module()

int pos::PixelROCName::module ( ) const
inline

Definition at line 73 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by rocname().

73  {
74  assert((id_ & 0x80000000) != 0);
75  return ((id_ >> 4) & 0x3) + 1;
76  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ mp()

char pos::PixelROCName::mp ( ) const
inline

Definition at line 34 of file PixelROCName.h.

References id_.

Referenced by rocname().

34 { return id_ & 0x40000000 ? 'p' : 'm'; }
unsigned int id_
Definition: PixelROCName.h:122

◆ operator<()

const bool pos::PixelROCName::operator< ( const PixelROCName aROC) const
inline

Definition at line 82 of file PixelROCName.h.

References id_.

82 { return id_ < aROC.id_; }
unsigned int id_
Definition: PixelROCName.h:122

◆ operator=()

const PixelROCName & PixelROCName::operator= ( const PixelROCName aROC)

Definition at line 290 of file PixelROCName.cc.

References id_.

290  {
291  id_ = aROC.id_;
292 
293  return *this;
294 }
unsigned int id_
Definition: PixelROCName.h:122

◆ operator==()

const bool pos::PixelROCName::operator== ( const PixelROCName aROC) const
inline

Definition at line 84 of file PixelROCName.h.

References id_.

84 { return id_ == aROC.id_; }
unsigned int id_
Definition: PixelROCName.h:122

◆ panel()

int pos::PixelROCName::panel ( ) const
inline

Definition at line 47 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by rocname(), and setIdFPix().

47  {
48  assert((id_ & 0x80000000) == 0);
49  return ((id_ >> 6) & 0x1) + 1;
50  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ parsename()

void PixelROCName::parsename ( std::string  name)
private

Definition at line 97 of file PixelROCName.cc.

References check(), disk(), HF(), ladder(), layer(), Skims_PA_cff::name, np, hltrates_dqm_sourceclient-live_cfg::offset, roc(), sec(), setIdBPix(), and setIdFPix().

Referenced by PixelROCName().

97  {
98  //
99  // The name should be on the format
100  //
101  // FPix_BpR_D1_BLD1_PNL1_PLQ1_ROC1
102  //
103 
104  // std::cout << "[PixelROCName::parsename()]\t\tROC name:"<<name<<std::endl;
105 
106  check(name[0] == 'F' || name[0] == 'B', name);
107 
108  if (name[0] == 'F') {
109  check(name[0] == 'F', name);
110  check(name[1] == 'P', name);
111  check(name[2] == 'i', name);
112  check(name[3] == 'x', name);
113  check(name[4] == '_', name);
114  check(name[5] == 'B', name);
115  check((name[6] == 'm') || (name[6] == 'p'), name);
116  char np = name[6];
117  check((name[7] == 'I') || (name[7] == 'O'), name);
118  char LR = name[7];
119  check(name[8] == '_', name);
120  check(name[9] == 'D', name);
121  char digit[2] = {0, 0};
122  digit[0] = name[10];
123  int disk = atoi(digit);
124  check(name[11] == '_', name);
125  check(name[12] == 'B', name);
126  check(name[13] == 'L', name);
127  check(name[14] == 'D', name);
128  check(std::isdigit(name[15]), name);
129  digit[0] = name[15];
130  int bld = atoi(digit);
131  unsigned int offset = 0;
132  if (std::isdigit(name[16])) {
133  digit[0] = name[16];
134  bld = 10 * bld + atoi(digit);
135  offset++;
136  }
137  check(name[16 + offset] == '_', name);
138  check(name[17 + offset] == 'P', name);
139  check(name[18 + offset] == 'N', name);
140  check(name[19 + offset] == 'L', name);
141  check(std::isdigit(name[20 + offset]), name);
142  digit[0] = name[20 + offset];
143  int pnl = atoi(digit);
144  check(name[21 + offset] == '_', name);
145  check(name[22 + offset] == 'P', name);
146  check(name[23 + offset] == 'L', name);
147  check(name[24 + offset] == 'Q', name);
148  check(std::isdigit(name[25 + offset]), name);
149  digit[0] = name[25 + offset];
150  int plq = atoi(digit);
151  check(name[26 + offset] == '_', name);
152  check(name[27 + offset] == 'R', name);
153  check(name[28 + offset] == 'O', name);
154  check(name[29 + offset] == 'C', name);
155  check(std::isdigit(name[30 + offset]), name);
156  digit[0] = name[30 + offset];
157  int roc = atoi(digit);
158  if (name.size() == 32 + offset) {
159  digit[0] = name[31 + offset];
160  roc = roc * 10 + atoi(digit);
161  }
162 
163  setIdFPix(np, LR, disk, bld, pnl, plq, roc);
164  } else {
165  check(name[0] == 'B', name);
166  check(name[1] == 'P', name);
167  check(name[2] == 'i', name);
168  check(name[3] == 'x', name);
169  check(name[4] == '_', name);
170  check(name[5] == 'B', name);
171  check((name[6] == 'm') || (name[6] == 'p'), name);
172  char np = name[6];
173  check((name[7] == 'I') || (name[7] == 'O'), name);
174  char LR = name[7];
175  check(name[8] == '_', name);
176  check(name[9] == 'S', name);
177  check(name[10] == 'E', name);
178  check(name[11] == 'C', name);
179  char digit[2] = {0, 0};
180  digit[0] = name[12];
181  int sec = atoi(digit);
182  check(name[13] == '_', name);
183  check(name[14] == 'L', name);
184  check(name[15] == 'Y', name);
185  check(name[16] == 'R', name);
186  check(std::isdigit(name[17]), name);
187  digit[0] = name[17];
188  int layer = atoi(digit);
189  check(name[18] == '_', name);
190  check(name[19] == 'L', name);
191  check(name[20] == 'D', name);
192  check(name[21] == 'R', name);
193  check(std::isdigit(name[22]), name);
194  digit[0] = name[22];
195  int ladder = atoi(digit);
196  unsigned int offset = 0;
197  if (std::isdigit(name[23])) {
198  offset++;
199  digit[0] = name[22 + offset];
200  ladder = 10 * ladder + atoi(digit);
201  }
202  check(name[23 + offset] == 'H' || name[23 + offset] == 'F', name);
203  char HF = name[23 + offset];
204  check(name[24 + offset] == '_', name);
205  check(name[25 + offset] == 'M', name);
206  check(name[26 + offset] == 'O', name);
207  check(name[27 + offset] == 'D', name);
208  check(std::isdigit(name[28 + offset]), name);
209  digit[0] = name[28 + offset];
210  int module = atoi(digit);
211  check(name[29 + offset] == '_', name);
212  check(name[30 + offset] == 'R', name);
213  check(name[31 + offset] == 'O', name);
214  check(name[32 + offset] == 'C', name);
215  check(std::isdigit(name[33 + offset]), name);
216  digit[0] = name[33 + offset];
217  int roc = atoi(digit);
218  if (name.size() == 35 + offset) {
219  digit[0] = name[34 + offset];
220  roc = roc * 10 + atoi(digit);
221  }
222 
223  setIdBPix(np, LR, sec, layer, ladder, HF, module, roc);
224  }
225 }
void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc)
Definition: PixelROCName.cc:21
void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
Definition: PixelROCName.cc:51
int roc() const
Definition: PixelROCName.h:36
char HF() const
Definition: PixelROCName.h:69
int sec() const
Definition: PixelROCName.h:57
int layer() const
Definition: PixelROCName.h:61
int np
Definition: AMPTWrapper.h:43
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:85
int ladder() const
Definition: PixelROCName.h:65
int disk() const
Definition: PixelROCName.h:39

◆ plaquet()

int pos::PixelROCName::plaquet ( ) const
inline

Definition at line 51 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by rocname(), and setIdFPix().

51  {
52  assert((id_ & 0x80000000) == 0);
53  return ((id_ >> 4) & 0x3) + 1;
54  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ roc()

int pos::PixelROCName::roc ( ) const
inline

Definition at line 36 of file PixelROCName.h.

References id_.

Referenced by parsename(), rocname(), setIdBPix(), and setIdFPix().

36 { return id_ & 0xf; }
unsigned int id_
Definition: PixelROCName.h:122

◆ rocname()

std::string PixelROCName::rocname ( ) const

Definition at line 235 of file PixelROCName.cc.

References cms::cuda::assert(), blade(), detsub(), disk(), HF(), IO(), ladder(), layer(), module(), mp(), panel(), plaquet(), roc(), alignCSCRings::s, sec(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pos::operator<<(), pos::PixelNameTranslation::PixelNameTranslation(), PixelROCName(), pos::PixelROCMaskBits::writeASCII(), pos::PixelROCTrimBits::writeASCII(), pos::PixelTBMSettings::writeASCII(), pos::PixelROCMaskBits::writeBinary(), pos::PixelROCTrimBits::writeBinary(), pos::PixelTBMSettings::writeBinary(), pos::PixelROCMaskBits::writeXML(), pos::PixelROCTrimBits::writeXML(), and pos::PixelTBMSettings::writeXML().

235  {
236  std::string s;
237 
238  std::ostringstream s1;
239 
240  if (detsub() == 'F') {
241  s1 << "FPix";
242  s1 << "_B";
243  s1 << mp();
244  s1 << IO();
245  s1 << "_D";
246  s1 << disk();
247  s1 << "_BLD";
248  s1 << blade();
249  s1 << "_PNL";
250  s1 << panel();
251  s1 << "_PLQ";
252  s1 << plaquet();
253  s1 << "_ROC";
254  s1 << roc();
255 
256  assert(roc() >= 0 && roc() <= 10);
257  } else {
258  s1 << "BPix";
259  s1 << "_B";
260  s1 << mp();
261  s1 << IO();
262  s1 << "_SEC";
263  s1 << sec();
264  s1 << "_LYR";
265  s1 << layer();
266  s1 << "_LDR";
267  s1 << ladder();
268  s1 << HF();
269  s1 << "_MOD";
270  s1 << module();
271  s1 << "_ROC";
272  s1 << roc();
273 
274  assert(roc() >= 0 && roc() <= 15);
275  }
276 
277  s = s1.str();
278 
279  return s;
280 }
int roc() const
Definition: PixelROCName.h:36
char detsub() const
Definition: PixelROCName.h:33
assert(be >=bs)
char HF() const
Definition: PixelROCName.h:69
int sec() const
Definition: PixelROCName.h:57
int layer() const
Definition: PixelROCName.h:61
int panel() const
Definition: PixelROCName.h:47
char mp() const
Definition: PixelROCName.h:34
char IO() const
Definition: PixelROCName.h:35
int ladder() const
Definition: PixelROCName.h:65
int plaquet() const
Definition: PixelROCName.h:51
int disk() const
Definition: PixelROCName.h:39
int module() const
Definition: PixelROCName.h:73
int blade() const
Definition: PixelROCName.h:43

◆ sec()

int pos::PixelROCName::sec ( ) const
inline

Definition at line 57 of file PixelROCName.h.

References cms::cuda::assert(), and id_.

Referenced by parsename(), rocname(), and setIdBPix().

57  {
58  assert((id_ & 0x80000000) != 0);
59  return ((id_ >> 14) & 0x7) + 1;
60  }
unsigned int id_
Definition: PixelROCName.h:122
assert(be >=bs)

◆ setIdBPix()

void PixelROCName::setIdBPix ( char  np,
char  LR,
int  sec,
int  layer,
int  ladder,
char  HF,
int  module,
int  roc 
)
private

Definition at line 51 of file PixelROCName.cc.

References cms::cuda::assert(), HF(), id_, ladder(), layer(), np, roc(), and sec().

Referenced by parsename().

51  {
52  id_ = 0;
53 
54  //std::cout<< __LINE__ << "]\t" << mthn <<"BPix ladder:"<<ladder<<std::endl;
55  //std::cout<< __LINE__ << "]\t" << mthn <<"np : " << np << std::endl;
56  //std::cout<< __LINE__ << "]\t" << mthn <<"LR : " << LR << std::endl;
57  //std::cout<< __LINE__ << "]\t" << mthn <<"disk: " << disk << std::endl;
58 
59  assert(roc >= 0 && roc < 16);
60 
61  id_ = 0x80000000;
62 
63  if (np == 'p')
64  id_ = (id_ | 0x40000000);
65  //std::cout<< __LINE__ << "]\t" << mthn <<"2 id_="<<std::hex<<id_<<std::dec<<std::endl;
66  if (LR == 'I')
67  id_ = (id_ | 0x20000000);
68  //std::cout<< __LINE__ << "]\t" << mthn <<"3 id_="<<std::hex<<id_<<std::dec<<std::endl;
69  id_ = (id_ | ((sec - 1) << 14));
70  //std::cout<< __LINE__ << "]\t" << mthn <<"4 id_="<<std::hex<<id_<<std::dec<<std::endl;
71  if (HF == 'F')
72  id_ = (id_ | 0x00000800);
73 
74  id_ = (id_ | (layer << 12));
75  //std::cout<< __LINE__ << "]\t" << mthn <<"5 id_="<<std::hex<<id_<<std::dec<<std::endl;
76  id_ = (id_ | (ladder << 6));
77  //std::cout<< __LINE__ << "]\t" << mthn <<"6 id_="<<std::hex<<id_<<std::dec<<std::endl;
78  id_ = (id_ | ((module - 1) << 4));
79  //std::cout<< __LINE__ << "]\t" << mthn <<"7 id_="<<std::hex<<id_<<std::dec<<std::endl;
80  id_ = (id_ | roc);
81 
82  //std::cout<< __LINE__ << "]\t" << mthn <<"final id_="<<std::hex<<id_<<std::dec<<std::endl;
83 }
unsigned int id_
Definition: PixelROCName.h:122
int roc() const
Definition: PixelROCName.h:36
assert(be >=bs)
char HF() const
Definition: PixelROCName.h:69
int sec() const
Definition: PixelROCName.h:57
int layer() const
Definition: PixelROCName.h:61
int np
Definition: AMPTWrapper.h:43
int ladder() const
Definition: PixelROCName.h:65

◆ setIdFPix()

void PixelROCName::setIdFPix ( char  np,
char  LR,
int  disk,
int  blade,
int  panel,
int  plaquet,
int  roc 
)
private

Definition at line 21 of file PixelROCName.cc.

References cms::cuda::assert(), blade(), disk(), id_, np, panel(), plaquet(), roc(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by parsename().

21  {
22  std::string mthn = "[PixelROCName::setIdFPix()]\t\t\t\t ";
23  id_ = 0;
24 
25  //std::cout << __LINE__ << "]\t" << mthn << "subdet: " << subdet << std::endl;
26  //std::cout << __LINE__ << "]\t" << mthn << "np : " << np << std::endl;
27  //std::cout << __LINE__ << "]\t" << mthn << "LR : " << LR << std::endl;
28  //std::cout << __LINE__ << "]\t" << mthn << "disk : " << disk << std::endl;
29 
30  assert(roc >= 0 && roc < 10);
31 
32  if (np == 'p')
33  id_ = (id_ | 0x40000000);
34  //std::cout<< __LINE__ << "]\t" << mthn <<"2 id_="<<std::hex<<id_<<std::dec<<std::endl;
35  if (LR == 'I')
36  id_ = (id_ | 0x20000000);
37  //std::cout<< __LINE__ << "]\t" << mthn <<"3 id_="<<std::hex<<id_<<std::dec<<std::endl;
38  id_ = (id_ | (disk << 12));
39  //std::cout<< __LINE__ << "]\t" << mthn <<"4 id_="<<std::hex<<id_<<std::dec<<std::endl;
40  id_ = (id_ | (blade << 7));
41  //std::cout<< __LINE__ << "]\t" << mthn <<"5 id_="<<std::hex<<id_<<std::dec<<std::endl;
42  id_ = (id_ | ((panel - 1) << 6));
43  //std::cout<< __LINE__ << "]\t" << mthn <<"6 id_="<<std::hex<<id_<<std::dec<<std::endl;
44  id_ = (id_ | ((plaquet - 1) << 4));
45  //std::cout<< __LINE__ << "]\t" << mthn <<"7 id_="<<std::hex<<id_<<std::dec<<std::endl;
46  id_ = (id_ | roc);
47 
48  //std::cout<< __LINE__ << "]\t" << mthn <<"final id_="<<std::hex<<id_<<std::dec<<std::endl;
49 }
unsigned int id_
Definition: PixelROCName.h:122
int roc() const
Definition: PixelROCName.h:36
assert(be >=bs)
int np
Definition: AMPTWrapper.h:43
int panel() const
Definition: PixelROCName.h:47
int plaquet() const
Definition: PixelROCName.h:51
int disk() const
Definition: PixelROCName.h:39
int blade() const
Definition: PixelROCName.h:43

Friends And Related Function Documentation

◆ pos::operator<<

std::ostream& pos::operator<< ( std::ostream &  s,
const PixelROCName pixelroc 
)
friend

Member Data Documentation

◆ id_

unsigned int pos::PixelROCName::id_
private