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::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 19 of file PixelModuleName.cc.

19  :
20  id_(0)
21 {}
pos::PixelModuleName::PixelModuleName ( std::string  rocname)
explicit
PixelModuleName::PixelModuleName ( PixelROCName  roc)
explicit

Definition at line 24 of file PixelModuleName.cc.

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

25 {
26 
27  unsigned int id=roc.id();
28  unsigned int idtmp=(id&0x1FFFFFFF)>>4;
29  if ((id&0x80000000)==0) idtmp=(idtmp&0xFFFFFFFC);
30 
31  id_=idtmp|(id&0xE0000000);
32 
33 }
unsigned int id() const
Definition: PixelROCName.h:68
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 id_.

Referenced by modulename().

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

Definition at line 101 of file PixelModuleName.cc.

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

Referenced by parsename().

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

Definition at line 41 of file PixelModuleName.h.

References id_.

Referenced by modulename().

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

Definition at line 46 of file PixelModuleName.h.

References id_.

Referenced by modulename(), and parsename().

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

Definition at line 54 of file PixelModuleName.h.

References id_.

Referenced by modulename(), and parsename().

54 {assert((id_&0x80000000)!=0); return id_&0x00000080?'F':'H';}
char pos::PixelModuleName::IO ( ) const
inline

Definition at line 43 of file PixelModuleName.h.

References id_.

Referenced by modulename().

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

Definition at line 53 of file PixelModuleName.h.

References id_.

Referenced by modulename(), and parsename().

53 {assert((id_&0x80000000)!=0); return (id_>>2)&0x1f;}
int pos::PixelModuleName::layer ( ) const
inline

Definition at line 52 of file PixelModuleName.h.

References id_.

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

52 {assert((id_&0x80000000)!=0); return (id_>>8)&0x3;}
int pos::PixelModuleName::module ( ) const
inline

Definition at line 55 of file PixelModuleName.h.

References id_.

Referenced by modulename().

55 {assert((id_&0x80000000)!=0); return ((id_)&0x3)+1;}
string PixelModuleName::modulename ( ) const

Definition at line 228 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::operator<<(), pos::PixelPortcardMap::PixelPortcardMap(), pos::PixelPortcardMap::PortCardAndAOHs(), pos::PixelMaskAllPixels::writeASCII(), pos::PixelTrimAllPixels::writeASCII(), and pos::PixelDACSettings::writeASCII().

228  {
229 
230  string s;
231 
232  std::ostringstream s1;
233 
234  if (detsub()=='F') {
235  s1<<"FPix";
236  s1<<"_B";
237  s1<<mp();
238  s1<<IO();
239  s1<<"_D";
240  s1<<disk();
241  s1<<"_BLD";
242  s1<<blade();
243  s1<<"_PNL";
244  s1<<panel();
245 
246  }
247  else{
248  s1<<"BPix";
249  s1<<"_B";
250  s1<<mp();
251  s1<<IO();
252  s1<<"_SEC";
253  s1<<sec();
254  s1<<"_LYR";
255  s1<<layer();
256  s1<<"_LDR";
257  s1<<ladder();
258  s1<<HF();
259  s1<<"_MOD";
260  s1<<module();
261 
262  }
263 
264  s=s1.str();
265 
266  return s;
267 
268 }
char detsub() const
char pos::PixelModuleName::mp ( ) const
inline

Definition at line 42 of file PixelModuleName.h.

References id_.

Referenced by modulename().

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

Definition at line 64 of file PixelModuleName.h.

References id_.

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

Definition at line 283 of file PixelModuleName.cc.

References id_.

283  {
284 
285  id_=aROC.id_;
286 
287  return *this;
288 
289 }
const bool pos::PixelModuleName::operator== ( const PixelModuleName aModule) const
inline

Definition at line 68 of file PixelModuleName.h.

References id_.

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

Definition at line 48 of file PixelModuleName.h.

References id_.

Referenced by modulename().

48 {assert((id_&0x80000000)==0); return ((id_>>2)&0x1)+1;}
void PixelModuleName::parsename ( std::string  name)
private

Definition at line 113 of file PixelModuleName.cc.

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

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

Definition at line 51 of file PixelModuleName.h.

References id_.

Referenced by modulename(), and parsename().

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

Definition at line 69 of file PixelModuleName.cc.

References id_.

Referenced by parsename().

71  {
72 
73  std::string mthn = "[PixelModuleName::setIdBPix()]\t\t\t " ;
74  id_=0;
75 
76  //cout<< __LINE__ << "]\t" << mthn << "BPix ladder: " << ladder << endl;
77  //cout<< __LINE__ << "]\t" << mthn << "np : " << np << endl;
78  //cout<< __LINE__ << "]\t" << mthn << "LR : " << LR << endl;
79  //cout<< __LINE__ << "]\t" << mthn << "disk : " << disk << endl;
80 
81 
82  id_=0x80000000;
83 
84  if (np=='p') id_=(id_|0x40000000);
85  //cout<< __LINE__ << "]\t" << mthn <<"2 id_=" << hex << id_ << dec << endl;
86  if (LR=='I') id_=(id_|0x20000000);
87  //cout<< __LINE__ << "]\t" << mthn <<"3 id_=" << hex << id_ << dec << endl;
88  id_=(id_|((sec-1)<<10));
89  //cout<< __LINE__ << "]\t" << mthn <<"4 id_=" << hex << id_ << dec << endl;
90  if (HF=='F') id_=(id_|0x00000080);
91 
92  id_=(id_|(layer<<8));
93  //cout<< __LINE__ << "]\t" << mthn <<"5 id_=" << hex << id_ << dec << endl;
94  id_=(id_|(ladder<<2));
95  //cout<< __LINE__ << "]\t" << mthn <<"6 id_=" << hex << id_ << dec << endl;
96  id_=(id_|((module-1)));
97  //cout<< __LINE__ << "]\t" << mthn <<"7 id_=" << hex << id_ << dec << endl;
98 
99 }
int np
Definition: AMPTWrapper.h:33
Definition: vlib.h:209
void PixelModuleName::setIdFPix ( char  np,
char  LR,
int  disk,
int  blade,
int  panel 
)
private

Definition at line 43 of file PixelModuleName.cc.

References id_.

Referenced by parsename().

44  {
45 
46  std::string mthn = "[PixelModuleName::setIdFPix()]\t\t\t " ;
47  id_=0;
48 
49  //cout<< __LINE__ << "]\t" << mthn << "subdet: " << subdet <<endl;
50  //cout<< __LINE__ << "]\t" << mthn << "np : " << np <<endl;
51  //cout<< __LINE__ << "]\t" << mthn << "LR : " << LR <<endl;
52  //cout<< __LINE__ << "]\t" << mthn << "disk : " << disk <<endl;
53 
54 
55  if (np=='p') id_=(id_|0x40000000);
56  //cout<< __LINE__ << "]\t" << mthn <<"2 id_=" << hex << id_ << dec << endl;
57  if (LR=='I') id_=(id_|0x20000000);
58  //cout<< __LINE__ << "]\t" << mthn <<"3 id_=" << hex << id_ << dec << endl;
59  id_=(id_|(disk<<8));
60  //cout<< __LINE__ << "]\t" << mthn <<"4 id_=" << hex << id_ << dec << endl;
61  id_=(id_|(blade<<3));
62  //cout<< __LINE__ << "]\t" << mthn <<"5 id_=" << hex << id_ << dec << endl;
63  id_=(id_|((panel-1)<<2));
64  //cout<< __LINE__ << "]\t" << mthn <<"6 id_=" << hex << id_ << dec << endl;
65 
66 }
int np
Definition: AMPTWrapper.h:33

Friends And Related Function Documentation

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

Member Data Documentation

unsigned int pos::PixelModuleName::id_
private