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::ifstream &s)
 
 PixelROCName (std::string rocname)
 
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) {}

◆ PixelROCName() [2/3]

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

Definition at line 19 of file PixelROCName.cc.

19 { parsename(rocname); }

References parsename(), and rocname().

◆ PixelROCName() [3/3]

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

Definition at line 227 of file PixelROCName.cc.

227  {
229 
230  s >> tmp;
231 
232  parsename(tmp);
233 }

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

Member Function Documentation

◆ blade()

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

Definition at line 43 of file PixelROCName.h.

43  {
44  assert((id_ & 0x80000000) == 0);
45  return (id_ >> 7) & 0x1f;
46  }

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

Referenced by rocname(), and setIdFPix().

◆ check()

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

Definition at line 85 of file PixelROCName.cc.

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 }

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

Referenced by parsename().

◆ detsub()

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

Definition at line 33 of file PixelROCName.h.

33 { return (id_ & 0x80000000) ? 'B' : 'F'; }

References id_.

Referenced by rocname().

◆ disk()

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

Definition at line 39 of file PixelROCName.h.

39  {
40  assert((id_ & 0x80000000) == 0);
41  return (id_ >> 12) & 0x3;
42  }

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

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

◆ HF()

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

Definition at line 69 of file PixelROCName.h.

69  {
70  assert((id_ & 0x80000000) != 0);
71  return id_ & 0x00000800 ? 'F' : 'H';
72  }

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

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

◆ id()

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

Definition at line 86 of file PixelROCName.h.

86 { return id_; }

References id_.

◆ IO()

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

Definition at line 35 of file PixelROCName.h.

35 { return id_ & 0x20000000 ? 'I' : 'O'; }

References id_.

Referenced by rocname().

◆ ladder()

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

Definition at line 65 of file PixelROCName.h.

65  {
66  assert((id_ & 0x80000000) != 0);
67  return (id_ >> 6) & 0x1f;
68  }

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

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

◆ layer()

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

Definition at line 61 of file PixelROCName.h.

61  {
62  assert((id_ & 0x80000000) != 0);
63  return (id_ >> 12) & 0x3;
64  }

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

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

◆ module()

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

Definition at line 73 of file PixelROCName.h.

73  {
74  assert((id_ & 0x80000000) != 0);
75  return ((id_ >> 4) & 0x3) + 1;
76  }

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

Referenced by rocname().

◆ mp()

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

Definition at line 34 of file PixelROCName.h.

34 { return id_ & 0x40000000 ? 'p' : 'm'; }

References id_.

Referenced by rocname().

◆ operator<()

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

Definition at line 82 of file PixelROCName.h.

82 { return id_ < aROC.id_; }

References id_.

◆ operator=()

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

Definition at line 290 of file PixelROCName.cc.

290  {
291  id_ = aROC.id_;
292 
293  return *this;
294 }

References id_.

◆ operator==()

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

Definition at line 84 of file PixelROCName.h.

84 { return id_ == aROC.id_; }

References id_.

◆ panel()

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

Definition at line 47 of file PixelROCName.h.

47  {
48  assert((id_ & 0x80000000) == 0);
49  return ((id_ >> 6) & 0x1) + 1;
50  }

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

Referenced by rocname(), and setIdFPix().

◆ parsename()

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

Definition at line 97 of file PixelROCName.cc.

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 }

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().

◆ plaquet()

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

Definition at line 51 of file PixelROCName.h.

51  {
52  assert((id_ & 0x80000000) == 0);
53  return ((id_ >> 4) & 0x3) + 1;
54  }

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

Referenced by rocname(), and setIdFPix().

◆ roc()

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

Definition at line 36 of file PixelROCName.h.

36 { return id_ & 0xf; }

References id_.

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

◆ rocname()

std::string PixelROCName::rocname ( ) const

Definition at line 235 of file PixelROCName.cc.

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 }

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().

◆ sec()

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

Definition at line 57 of file PixelROCName.h.

57  {
58  assert((id_ & 0x80000000) != 0);
59  return ((id_ >> 14) & 0x7) + 1;
60  }

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

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

◆ 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.

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 }

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

Referenced by parsename().

◆ 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.

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 }

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

Referenced by parsename().

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
pos::PixelROCName::parsename
void parsename(std::string name)
Definition: PixelROCName.cc:97
pos::PixelROCName::rocname
std::string rocname() const
Definition: PixelROCName.cc:235
pos::PixelROCName::setIdBPix
void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
Definition: PixelROCName.cc:51
pos::PixelROCName::disk
int disk() const
Definition: PixelROCName.h:39
pos::PixelROCName::layer
int layer() const
Definition: PixelROCName.h:61
pos::PixelROCName::ladder
int ladder() const
Definition: PixelROCName.h:65
pos::PixelROCName::roc
int roc() const
Definition: PixelROCName.h:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
np
int np
Definition: AMPTWrapper.h:43
cms::cuda::assert
assert(be >=bs)
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
pos::PixelROCName::IO
char IO() const
Definition: PixelROCName.h:35
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
pos::PixelROCName::check
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:85
pos::PixelROCName::plaquet
int plaquet() const
Definition: PixelROCName.h:51
pos::PixelROCName::panel
int panel() const
Definition: PixelROCName.h:47
pos::PixelROCName::id_
unsigned int id_
Definition: PixelROCName.h:122
pos::PixelROCName::mp
char mp() const
Definition: PixelROCName.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelROCName::module
int module() const
Definition: PixelROCName.h:73
pos::PixelROCName::blade
int blade() const
Definition: PixelROCName.h:43
module
Definition: vlib.h:198
pos::PixelROCName::setIdFPix
void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc)
Definition: PixelROCName.cc:21
pos::PixelROCName::detsub
char detsub() const
Definition: PixelROCName.h:33
pos::PixelROCName::HF
char HF() const
Definition: PixelROCName.h:69
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pos::PixelROCName::sec
int sec() const
Definition: PixelROCName.h:57
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78