CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::PixelROCName ( )

Definition at line 18 of file PixelROCName.cc.

18  :
19  id_(0)
20 {}
unsigned int id_
Definition: PixelROCName.h:112
PixelROCName::PixelROCName ( std::string  rocname)
explicit

Definition at line 22 of file PixelROCName.cc.

References parsename().

23 {
24 
26 
27 }
std::string rocname() const
void parsename(std::string name)
PixelROCName::PixelROCName ( std::ifstream &  s)
explicit

Definition at line 248 of file PixelROCName.cc.

References parsename(), and tmp.

248  {
249 
250  std::string tmp;
251 
252  s >> tmp;
253 
254  parsename(tmp);
255 
256 }
void parsename(std::string name)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Function Documentation

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

Definition at line 43 of file PixelROCName.h.

References id_.

Referenced by rocname().

43 {assert((id_&0x80000000)==0); return (id_>>7)&0x1f;}
unsigned int id_
Definition: PixelROCName.h:112
void PixelROCName::check ( bool  check,
const std::string &  name 
)
private

Definition at line 99 of file PixelROCName.cc.

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

Referenced by parsename().

99  {
100 
101  static std::string mthn = "[PixelROCName::check()]\t\t\t\t " ;
102 
103  if (check) return;
104 
105  cout << __LINE__ << "]\t" << mthn << "ERROR tried to parse string:'"<<name;
106  cout << "' as a ROC name. Will terminate."<<endl;
107 
108  ::abort();
109 
110 }
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:99
tuple cout
Definition: gather_cfg.py:121
char pos::PixelROCName::detsub ( ) const
inline

Definition at line 36 of file PixelROCName.h.

References id_.

Referenced by rocname().

36 {return (id_&0x80000000)?'B':'F';}
unsigned int id_
Definition: PixelROCName.h:112
int pos::PixelROCName::disk ( ) const
inline

Definition at line 42 of file PixelROCName.h.

References id_.

Referenced by parsename(), and rocname().

42 {assert((id_&0x80000000)==0); return (id_>>12)&0x3;}
unsigned int id_
Definition: PixelROCName.h:112
char pos::PixelROCName::HF ( ) const
inline

Definition at line 51 of file PixelROCName.h.

References id_.

Referenced by parsename(), and rocname().

51 {assert((id_&0x80000000)!=0); return id_&0x00000800?'F':'H';}
unsigned int id_
Definition: PixelROCName.h:112
unsigned int pos::PixelROCName::id ( void  ) const
inline

Definition at line 68 of file PixelROCName.h.

References id_.

Referenced by pos::PixelModuleName::PixelModuleName().

68 {return id_;}
unsigned int id_
Definition: PixelROCName.h:112
char pos::PixelROCName::IO ( ) const
inline

Definition at line 38 of file PixelROCName.h.

References id_.

Referenced by rocname().

38 {return id_&0x20000000?'I':'O';}
unsigned int id_
Definition: PixelROCName.h:112
int pos::PixelROCName::ladder ( ) const
inline

Definition at line 50 of file PixelROCName.h.

References id_.

Referenced by parsename(), and rocname().

50 {assert((id_&0x80000000)!=0); return (id_>>6)&0x1f;}
unsigned int id_
Definition: PixelROCName.h:112
int pos::PixelROCName::layer ( ) const
inline

Definition at line 49 of file PixelROCName.h.

References id_.

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

49 {assert((id_&0x80000000)!=0); return (id_>>12)&0x3;}
unsigned int id_
Definition: PixelROCName.h:112
int pos::PixelROCName::module ( ) const
inline

Definition at line 52 of file PixelROCName.h.

References id_.

Referenced by rocname().

52 {assert((id_&0x80000000)!=0); return ((id_>>4)&0x3)+1;}
unsigned int id_
Definition: PixelROCName.h:112
char pos::PixelROCName::mp ( ) const
inline

Definition at line 37 of file PixelROCName.h.

References id_.

Referenced by rocname().

37 {return id_&0x40000000?'p':'m';}
unsigned int id_
Definition: PixelROCName.h:112
const bool pos::PixelROCName::operator< ( const PixelROCName aROC) const
inline

Definition at line 60 of file PixelROCName.h.

References id_.

60  {
61  return id_<aROC.id_;
62  }
unsigned int id_
Definition: PixelROCName.h:112
const PixelROCName & PixelROCName::operator= ( const PixelROCName aROC)

Definition at line 322 of file PixelROCName.cc.

References id_.

322  {
323 
324  id_=aROC.id_;
325 
326  return *this;
327 
328 }
unsigned int id_
Definition: PixelROCName.h:112
const bool pos::PixelROCName::operator== ( const PixelROCName aROC) const
inline

Definition at line 64 of file PixelROCName.h.

References id_.

64  {
65  return id_==aROC.id_;
66  }
unsigned int id_
Definition: PixelROCName.h:112
int pos::PixelROCName::panel ( ) const
inline

Definition at line 44 of file PixelROCName.h.

References id_.

Referenced by rocname().

44 {assert((id_&0x80000000)==0); return ((id_>>6)&0x1)+1;}
unsigned int id_
Definition: PixelROCName.h:112
void PixelROCName::parsename ( std::string  name)
private

Definition at line 114 of file PixelROCName.cc.

References check(), disk(), HF(), ladder(), layer(), np, evf::evtn::offset(), roc(), sec(), setIdBPix(), and setIdFPix().

Referenced by PixelROCName().

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

Definition at line 45 of file PixelROCName.h.

References id_.

Referenced by rocname().

45 {assert((id_&0x80000000)==0); return ((id_>>4)&0x3)+1;}
unsigned int id_
Definition: PixelROCName.h:112
int pos::PixelROCName::roc ( ) const
inline

Definition at line 39 of file PixelROCName.h.

References id_.

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

39 {return id_&0xf;}
unsigned int id_
Definition: PixelROCName.h:112
std::string PixelROCName::rocname ( ) const

Definition at line 259 of file PixelROCName.cc.

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

Referenced by pos::operator<<(), pos::PixelNameTranslation::PixelNameTranslation(), 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().

259  {
260 
261  std::string s;
262 
263  std::ostringstream s1;
264 
265  if (detsub()=='F') {
266  s1<<"FPix";
267  s1<<"_B";
268  s1<<mp();
269  s1<<IO();
270  s1<<"_D";
271  s1<<disk();
272  s1<<"_BLD";
273  s1<<blade();
274  s1<<"_PNL";
275  s1<<panel();
276  s1<<"_PLQ";
277  s1<<plaquet();
278  s1<<"_ROC";
279  s1<<roc();
280 
281  assert(roc()>=0&&roc()<=10);
282  }
283  else{
284  s1<<"BPix";
285  s1<<"_B";
286  s1<<mp();
287  s1<<IO();
288  s1<<"_SEC";
289  s1<<sec();
290  s1<<"_LYR";
291  s1<<layer();
292  s1<<"_LDR";
293  s1<<ladder();
294  s1<<HF();
295  s1<<"_MOD";
296  s1<<module();
297  s1<<"_ROC";
298  s1<<roc();
299 
300  assert(roc()>=0&&roc()<=15);
301  }
302 
303  s=s1.str();
304 
305  return s;
306 
307 }
int plaquet() const
Definition: PixelROCName.h:45
int ladder() const
Definition: PixelROCName.h:50
int panel() const
Definition: PixelROCName.h:44
int layer() const
Definition: PixelROCName.h:49
int blade() const
Definition: PixelROCName.h:43
char IO() const
Definition: PixelROCName.h:38
char HF() const
Definition: PixelROCName.h:51
int module() const
Definition: PixelROCName.h:52
int roc() const
Definition: PixelROCName.h:39
int sec() const
Definition: PixelROCName.h:48
int disk() const
Definition: PixelROCName.h:42
char detsub() const
Definition: PixelROCName.h:36
char mp() const
Definition: PixelROCName.h:37
int pos::PixelROCName::sec ( ) const
inline

Definition at line 48 of file PixelROCName.h.

References id_.

Referenced by parsename(), and rocname().

48 {assert((id_&0x80000000)!=0); return ((id_>>14)&0x7)+1;}
unsigned int id_
Definition: PixelROCName.h:112
void PixelROCName::setIdBPix ( char  np,
char  LR,
int  sec,
int  layer,
int  ladder,
char  HF,
int  module,
int  roc 
)
private

Definition at line 62 of file PixelROCName.cc.

References id_, and roc().

Referenced by parsename().

64  {
65 
66  id_=0;
67 
68  //std::cout<< __LINE__ << "]\t" << mthn <<"BPix ladder:"<<ladder<<std::endl;
69  //std::cout<< __LINE__ << "]\t" << mthn <<"np : " << np << std::endl;
70  //std::cout<< __LINE__ << "]\t" << mthn <<"LR : " << LR << std::endl;
71  //std::cout<< __LINE__ << "]\t" << mthn <<"disk: " << disk << std::endl;
72 
73 
74  assert(roc>=0&&roc<16);
75 
76  id_=0x80000000;
77 
78  if (np=='p') id_=(id_|0x40000000);
79  //std::cout<< __LINE__ << "]\t" << mthn <<"2 id_="<<std::hex<<id_<<std::dec<<std::endl;
80  if (LR=='I') id_=(id_|0x20000000);
81  //std::cout<< __LINE__ << "]\t" << mthn <<"3 id_="<<std::hex<<id_<<std::dec<<std::endl;
82  id_=(id_|((sec-1)<<14));
83  //std::cout<< __LINE__ << "]\t" << mthn <<"4 id_="<<std::hex<<id_<<std::dec<<std::endl;
84  if (HF=='F') id_=(id_|0x00000800);
85 
86  id_=(id_|(layer<<12));
87  //std::cout<< __LINE__ << "]\t" << mthn <<"5 id_="<<std::hex<<id_<<std::dec<<std::endl;
88  id_=(id_|(ladder<<6));
89  //std::cout<< __LINE__ << "]\t" << mthn <<"6 id_="<<std::hex<<id_<<std::dec<<std::endl;
90  id_=(id_|((module-1)<<4));
91  //std::cout<< __LINE__ << "]\t" << mthn <<"7 id_="<<std::hex<<id_<<std::dec<<std::endl;
92  id_=(id_|roc);
93 
94  //std::cout<< __LINE__ << "]\t" << mthn <<"final id_="<<std::hex<<id_<<std::dec<<std::endl;
95 
96 }
int ladder() const
Definition: PixelROCName.h:50
unsigned int id_
Definition: PixelROCName.h:112
int layer() const
Definition: PixelROCName.h:49
int np
Definition: AMPTWrapper.h:33
char HF() const
Definition: PixelROCName.h:51
int roc() const
Definition: PixelROCName.h:39
int sec() const
Definition: PixelROCName.h:48
Definition: vlib.h:209
void PixelROCName::setIdFPix ( char  np,
char  LR,
int  disk,
int  blade,
int  panel,
int  plaquet,
int  roc 
)
private

Definition at line 29 of file PixelROCName.cc.

References id_, and roc().

Referenced by parsename().

30  {
31 
32  std::string mthn = "[PixelROCName::setIdFPix()]\t\t\t\t " ;
33  id_=0;
34 
35  //std::cout << __LINE__ << "]\t" << mthn << "subdet: " << subdet << std::endl;
36  //std::cout << __LINE__ << "]\t" << mthn << "np : " << np << std::endl;
37  //std::cout << __LINE__ << "]\t" << mthn << "LR : " << LR << std::endl;
38  //std::cout << __LINE__ << "]\t" << mthn << "disk : " << disk << std::endl;
39 
40 
41  assert(roc>=0&&roc<10);
42 
43  if (np=='p') id_=(id_|0x40000000);
44  //std::cout<< __LINE__ << "]\t" << mthn <<"2 id_="<<std::hex<<id_<<std::dec<<std::endl;
45  if (LR=='I') id_=(id_|0x20000000);
46  //std::cout<< __LINE__ << "]\t" << mthn <<"3 id_="<<std::hex<<id_<<std::dec<<std::endl;
47  id_=(id_|(disk<<12));
48  //std::cout<< __LINE__ << "]\t" << mthn <<"4 id_="<<std::hex<<id_<<std::dec<<std::endl;
49  id_=(id_|(blade<<7));
50  //std::cout<< __LINE__ << "]\t" << mthn <<"5 id_="<<std::hex<<id_<<std::dec<<std::endl;
51  id_=(id_|((panel-1)<<6));
52  //std::cout<< __LINE__ << "]\t" << mthn <<"6 id_="<<std::hex<<id_<<std::dec<<std::endl;
53  id_=(id_|((plaquet-1)<<4));
54  //std::cout<< __LINE__ << "]\t" << mthn <<"7 id_="<<std::hex<<id_<<std::dec<<std::endl;
55  id_=(id_|roc);
56 
57  //std::cout<< __LINE__ << "]\t" << mthn <<"final id_="<<std::hex<<id_<<std::dec<<std::endl;
58 
59 }
int plaquet() const
Definition: PixelROCName.h:45
int panel() const
Definition: PixelROCName.h:44
unsigned int id_
Definition: PixelROCName.h:112
int blade() const
Definition: PixelROCName.h:43
int np
Definition: AMPTWrapper.h:33
int roc() const
Definition: PixelROCName.h:39
int disk() const
Definition: PixelROCName.h:42

Friends And Related Function Documentation

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

Member Data Documentation

unsigned int pos::PixelROCName::id_
private