CMS 3D CMS Logo

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

This class implements.. More...

#include "interface/PixelModuleName.h"

Public Member Functions

int blade () const
 
char detsub () const
 
int disk () const
 
char HF () const
 
char IO () const
 
int ladder () const
 
int layer () const
 
int module () const
 
std::string modulename () const
 
char mp () const
 
const bool operator< (const PixelModuleName &aROC) const
 
const PixelModuleNameoperator= (const PixelModuleName &aROC)
 
const bool operator== (const PixelModuleName &aModule) const
 
int panel () const
 
 PixelModuleName ()
 
 PixelModuleName (std::string rocname)
 
 PixelModuleName (PixelROCName roc)
 
 PixelModuleName (std::ifstream &s)
 
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)
 
void setIdFPix (char np, char LR, int disk, int blade, int panel)
 

Private Attributes

unsigned int id_
 

Friends

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

Detailed Description

This class implements..

A longer explanation will be placed here later

Definition at line 26 of file PixelModuleName.h.

Constructor & Destructor Documentation

PixelModuleName::PixelModuleName ( )

Definition at line 17 of file PixelModuleName.cc.

17 : id_(0) {}
pos::PixelModuleName::PixelModuleName ( std::string  rocname)
explicit
PixelModuleName::PixelModuleName ( PixelROCName  roc)
explicit

Definition at line 19 of file PixelModuleName.cc.

References pos::PixelROCName::id(), and id_.

19  {
20  unsigned int id = roc.id();
21  unsigned int idtmp = (id & 0x1FFFFFFF) >> 4;
22  if ((id & 0x80000000) == 0)
23  idtmp = (idtmp & 0xFFFFFFFC);
24 
25  id_ = idtmp | (id & 0xE0000000);
26 }
unsigned int id() const
Definition: PixelROCName.h:86
pos::PixelModuleName::PixelModuleName ( std::ifstream &  s)
explicit

Member Function Documentation

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

Definition at line 47 of file PixelModuleName.h.

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

Referenced by modulename().

47  {
48  assert((id_ & 0x80000000) == 0);
49  return (id_ >> 3) & 0x1f;
50  }
assert(be >=bs)
void PixelModuleName::check ( bool  check,
const std::string &  name 
)
private

Definition at line 83 of file PixelModuleName.cc.

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

Referenced by parsename().

83  {
84  std::string mthn = "[PixelModuleName::check()]\t\t\t ";
85  if (check)
86  return;
87 
88  cout << __LINE__ << "]\t" << mthn << "ERROR tried to parse string: '" << name;
89  cout << "' as a module name. Will terminate." << endl;
90 
91  ::abort();
92 }
void check(bool check, const std::string &name)
tuple cout
Definition: gather_cfg.py:144
char pos::PixelModuleName::detsub ( ) const
inline

Definition at line 38 of file PixelModuleName.h.

References id_.

Referenced by modulename().

38 { return (id_ & 0x80000000) ? 'B' : 'F'; }
int pos::PixelModuleName::disk ( ) const
inline

Definition at line 43 of file PixelModuleName.h.

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

Referenced by modulename(), and parsename().

43  {
44  assert((id_ & 0x80000000) == 0);
45  return (id_ >> 8) & 0x3;
46  }
assert(be >=bs)
char pos::PixelModuleName::HF ( ) const
inline

Definition at line 69 of file PixelModuleName.h.

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

Referenced by modulename(), and parsename().

69  {
70  assert((id_ & 0x80000000) != 0);
71  return id_ & 0x00000080 ? 'F' : 'H';
72  }
assert(be >=bs)
char pos::PixelModuleName::IO ( ) const
inline

Definition at line 40 of file PixelModuleName.h.

References id_.

Referenced by modulename().

40 { return id_ & 0x20000000 ? 'I' : 'O'; }
int pos::PixelModuleName::ladder ( ) const
inline

Definition at line 65 of file PixelModuleName.h.

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

Referenced by modulename(), and parsename().

65  {
66  assert((id_ & 0x80000000) != 0);
67  return (id_ >> 2) & 0x1f;
68  }
assert(be >=bs)
int pos::PixelModuleName::layer ( ) const
inline

Definition at line 61 of file PixelModuleName.h.

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

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

61  {
62  assert((id_ & 0x80000000) != 0);
63  return (id_ >> 8) & 0x3;
64  }
assert(be >=bs)
int pos::PixelModuleName::module ( ) const
inline

Definition at line 73 of file PixelModuleName.h.

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

Referenced by modulename(), and parsename().

73  {
74  assert((id_ & 0x80000000) != 0);
75  return ((id_)&0x3) + 1;
76  }
assert(be >=bs)
string PixelModuleName::modulename ( ) const

Definition at line 203 of file PixelModuleName.cc.

References blade(), detsub(), disk(), HF(), IO(), ladder(), layer(), module(), mp(), panel(), alignCSCRings::s, and sec().

Referenced by pos::PixelCalibConfiguration::buildROCAndModuleLists(), pos::PixelChannel::modulename(), pos::PixelPortcardMap::PixelPortcardMap(), pos::PixelPortcardMap::PortCardAndAOHs(), pos::PixelMaskAllPixels::writeASCII(), pos::PixelTrimAllPixels::writeASCII(), and pos::PixelDACSettings::writeASCII().

203  {
204  string s;
205 
206  std::ostringstream s1;
207 
208  if (detsub() == 'F') {
209  s1 << "FPix";
210  s1 << "_B";
211  s1 << mp();
212  s1 << IO();
213  s1 << "_D";
214  s1 << disk();
215  s1 << "_BLD";
216  s1 << blade();
217  s1 << "_PNL";
218  s1 << panel();
219 
220  } else {
221  s1 << "BPix";
222  s1 << "_B";
223  s1 << mp();
224  s1 << IO();
225  s1 << "_SEC";
226  s1 << sec();
227  s1 << "_LYR";
228  s1 << layer();
229  s1 << "_LDR";
230  s1 << ladder();
231  s1 << HF();
232  s1 << "_MOD";
233  s1 << module();
234  }
235 
236  s = s1.str();
237 
238  return s;
239 }
char detsub() const
char pos::PixelModuleName::mp ( ) const
inline

Definition at line 39 of file PixelModuleName.h.

References id_.

Referenced by modulename().

39 { return id_ & 0x40000000 ? 'p' : 'm'; }
const bool pos::PixelModuleName::operator< ( const PixelModuleName aROC) const
inline

Definition at line 82 of file PixelModuleName.h.

References id_.

82 { return id_ < aROC.id_; }
const PixelModuleName & PixelModuleName::operator= ( const PixelModuleName aROC)

Definition at line 249 of file PixelModuleName.cc.

References id_.

249  {
250  id_ = aROC.id_;
251 
252  return *this;
253 }
const bool pos::PixelModuleName::operator== ( const PixelModuleName aModule) const
inline

Definition at line 84 of file PixelModuleName.h.

References id_.

84 { return id_ == aModule.id_; }
int pos::PixelModuleName::panel ( ) const
inline

Definition at line 51 of file PixelModuleName.h.

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

Referenced by modulename().

51  {
52  assert((id_ & 0x80000000) == 0);
53  return ((id_ >> 2) & 0x1) + 1;
54  }
assert(be >=bs)
void PixelModuleName::parsename ( std::string  name)
private

Definition at line 94 of file PixelModuleName.cc.

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

94  {
95  //
96  // The name should be on the format
97  //
98  // FPix_BpR_D1_BLD1_PNL1
99  //
100 
101  //cout << "ROC name:"<<name<<endl;
102 
103  check(name[0] == 'F' || name[0] == 'B', name);
104 
105  if (name[0] == 'F') {
106  check(name[0] == 'F', name);
107  check(name[1] == 'P', name);
108  check(name[2] == 'i', name);
109  check(name[3] == 'x', name);
110  check(name[4] == '_', name);
111  check(name[5] == 'B', name);
112  check((name[6] == 'm') || (name[6] == 'p'), name);
113  char np = name[6];
114  check((name[7] == 'I') || (name[7] == 'O'), name);
115  char LR = name[7];
116  check(name[8] == '_', name);
117  check(name[9] == 'D', name);
118  char digit[2] = {0, 0};
119  digit[0] = name[10];
120  int disk = atoi(digit);
121  check(name[11] == '_', name);
122  check(name[12] == 'B', name);
123  check(name[13] == 'L', name);
124  check(name[14] == 'D', name);
125  check(isdigit(name[15]), name);
126  digit[0] = name[15];
127  int bld = atoi(digit);
128  unsigned int offset = 0;
129  if (isdigit(name[16])) {
130  digit[0] = name[16];
131  bld = 10 * bld + atoi(digit);
132  offset++;
133  }
134 
135  check(name[16 + offset] == '_', name);
136  check(name[17 + offset] == 'P', name);
137  check(name[18 + offset] == 'N', name);
138  check(name[19 + offset] == 'L', name);
139  check(isdigit(name[20 + offset]), name);
140  digit[0] = name[20 + offset];
141  int pnl = atoi(digit);
142 
143  setIdFPix(np, LR, disk, bld, pnl);
144  } else {
145  check(name[0] == 'B', name);
146  check(name[1] == 'P', name);
147  check(name[2] == 'i', name);
148  check(name[3] == 'x', name);
149  check(name[4] == '_', name);
150  check(name[5] == 'B', name);
151  check((name[6] == 'm') || (name[6] == 'p'), name);
152  char np = name[6];
153  check((name[7] == 'I') || (name[7] == 'O'), name);
154  char LR = name[7];
155  check(name[8] == '_', name);
156  check(name[9] == 'S', name);
157  check(name[10] == 'E', name);
158  check(name[11] == 'C', name);
159  char digit[2] = {0, 0};
160  digit[0] = name[12];
161  int sec = atoi(digit);
162  check(name[13] == '_', name);
163  check(name[14] == 'L', name);
164  check(name[15] == 'Y', name);
165  check(name[16] == 'R', name);
166  check(isdigit(name[17]), name);
167  digit[0] = name[17];
168  int layer = atoi(digit);
169  check(name[18] == '_', name);
170  check(name[19] == 'L', name);
171  check(name[20] == 'D', name);
172  check(name[21] == 'R', name);
173  check(isdigit(name[22]), name);
174  digit[0] = name[22];
175  int ladder = atoi(digit);
176  unsigned int offset = 0;
177  if (isdigit(name[23])) {
178  offset++;
179  digit[0] = name[22 + offset];
180  ladder = 10 * ladder + atoi(digit);
181  }
182  check(name[23 + offset] == 'H' || name[23 + offset] == 'F', name);
183  char HF = name[23 + offset];
184  check(name[24 + offset] == '_', name);
185  check(name[25 + offset] == 'M', name);
186  check(name[26 + offset] == 'O', name);
187  check(name[27 + offset] == 'D', name);
188  check(isdigit(name[28 + offset]), name);
189  digit[0] = name[28 + offset];
190  int module = atoi(digit);
191  setIdBPix(np, LR, sec, layer, ladder, HF, module);
192  }
193 }
void check(bool check, const std::string &name)
int np
Definition: AMPTWrapper.h:43
void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module)
void setIdFPix(char np, char LR, int disk, int blade, int panel)
int pos::PixelModuleName::sec ( ) const
inline

Definition at line 57 of file PixelModuleName.h.

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

Referenced by modulename(), and parsename().

57  {
58  assert((id_ & 0x80000000) != 0);
59  return ((id_ >> 10) & 0x7) + 1;
60  }
assert(be >=bs)
void PixelModuleName::setIdBPix ( char  np,
char  LR,
int  sec,
int  layer,
int  ladder,
char  HF,
int  module 
)
private

Definition at line 53 of file PixelModuleName.cc.

References id_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by parsename().

53  {
54  std::string mthn = "[PixelModuleName::setIdBPix()]\t\t\t ";
55  id_ = 0;
56 
57  //cout<< __LINE__ << "]\t" << mthn << "BPix ladder: " << ladder << endl;
58  //cout<< __LINE__ << "]\t" << mthn << "np : " << np << endl;
59  //cout<< __LINE__ << "]\t" << mthn << "LR : " << LR << endl;
60  //cout<< __LINE__ << "]\t" << mthn << "disk : " << disk << endl;
61 
62  id_ = 0x80000000;
63 
64  if (np == 'p')
65  id_ = (id_ | 0x40000000);
66  //cout<< __LINE__ << "]\t" << mthn <<"2 id_=" << hex << id_ << dec << endl;
67  if (LR == 'I')
68  id_ = (id_ | 0x20000000);
69  //cout<< __LINE__ << "]\t" << mthn <<"3 id_=" << hex << id_ << dec << endl;
70  id_ = (id_ | ((sec - 1) << 10));
71  //cout<< __LINE__ << "]\t" << mthn <<"4 id_=" << hex << id_ << dec << endl;
72  if (HF == 'F')
73  id_ = (id_ | 0x00000080);
74 
75  id_ = (id_ | (layer << 8));
76  //cout<< __LINE__ << "]\t" << mthn <<"5 id_=" << hex << id_ << dec << endl;
77  id_ = (id_ | (ladder << 2));
78  //cout<< __LINE__ << "]\t" << mthn <<"6 id_=" << hex << id_ << dec << endl;
79  id_ = (id_ | ((module - 1)));
80  //cout<< __LINE__ << "]\t" << mthn <<"7 id_=" << hex << id_ << dec << endl;
81 }
int np
Definition: AMPTWrapper.h:43
void PixelModuleName::setIdFPix ( char  np,
char  LR,
int  disk,
int  blade,
int  panel 
)
private

Definition at line 30 of file PixelModuleName.cc.

References id_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by parsename().

30  {
31  std::string mthn = "[PixelModuleName::setIdFPix()]\t\t\t ";
32  id_ = 0;
33 
34  //cout<< __LINE__ << "]\t" << mthn << "subdet: " << subdet <<endl;
35  //cout<< __LINE__ << "]\t" << mthn << "np : " << np <<endl;
36  //cout<< __LINE__ << "]\t" << mthn << "LR : " << LR <<endl;
37  //cout<< __LINE__ << "]\t" << mthn << "disk : " << disk <<endl;
38 
39  if (np == 'p')
40  id_ = (id_ | 0x40000000);
41  //cout<< __LINE__ << "]\t" << mthn <<"2 id_=" << hex << id_ << dec << endl;
42  if (LR == 'I')
43  id_ = (id_ | 0x20000000);
44  //cout<< __LINE__ << "]\t" << mthn <<"3 id_=" << hex << id_ << dec << endl;
45  id_ = (id_ | (disk << 8));
46  //cout<< __LINE__ << "]\t" << mthn <<"4 id_=" << hex << id_ << dec << endl;
47  id_ = (id_ | (blade << 3));
48  //cout<< __LINE__ << "]\t" << mthn <<"5 id_=" << hex << id_ << dec << endl;
49  id_ = (id_ | ((panel - 1) << 2));
50  //cout<< __LINE__ << "]\t" << mthn <<"6 id_=" << hex << id_ << dec << endl;
51 }
int np
Definition: AMPTWrapper.h:43

Friends And Related Function Documentation

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

Member Data Documentation

unsigned int pos::PixelModuleName::id_
private