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
pos::PixelFECConfig Class Reference

This class specifies which FEC boards are used and how they are addressed. More...

#include <PixelFECConfig.h>

Inheritance diagram for pos::PixelFECConfig:
pos::PixelConfigBase

Public Member Functions

unsigned int crateFromFECNumber (unsigned int fecnumber) const
 
unsigned int FECSlotFromFECNumber (unsigned int fecnumber)
 
unsigned int getCrate (unsigned int i) const
 
unsigned int getFECNumber (unsigned int i) const
 
unsigned int getFECSlot (unsigned int i)
 
unsigned int getNFECBoards () const
 
unsigned int getVMEBaseAddress (unsigned int i) const
 
 PixelFECConfig (std::string filename)
 
 PixelFECConfig (std::vector< std::vector< std::string > > &tableMat)
 
unsigned int VMEBaseAddressFromFECNumber (unsigned int fecnumber) const
 
void writeASCII (std::string dir="") const
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const
 
virtual void writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual void writeXML (std::ofstream *out) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
 
virtual void writeXMLTrailer (std::ofstream *out) const
 
virtual ~PixelConfigBase ()
 

Private Member Functions

unsigned int FECSlotFromVMEBaseAddress (unsigned int VMEBaseAddress)
 

Private Attributes

std::vector< PixelFECParametersfecconfig_
 

Detailed Description

This class specifies which FEC boards are used and how they are addressed.

" "

Definition at line 24 of file PixelFECConfig.h.

Constructor & Destructor Documentation

PixelFECConfig::PixelFECConfig ( std::string  filename)

Definition at line 96 of file PixelFECConfig.cc.

References gather_cfg::cout, TauDecayModes::dec, fecconfig_, recoMuon::in, pos::PixelFECParameters::setFECParameters(), AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

96  :
97  PixelConfigBase(" "," "," "){
98 
99  std::string mthn = "[[PixelFECConfig::PixelFECConfig()]\t\t\t " ;
100 
101  std::ifstream in(filename.c_str());
102 
103  if (!in.good()){
104  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
105  throw std::runtime_error("Failed to open file "+filename);
106  }
107  else {
108  std::cout << __LINE__ << "]\t" << mthn <<" Opened: " << filename << std::endl;
109  }
110 
111  std::string dummy;
112 
113  in >> dummy;
114  in >> dummy;
115  in >> dummy;
116  in >> dummy;
117  in >> dummy;
118  in >> dummy;
119 
120  do {
121 
122  unsigned int fecnumber;
123  unsigned int crate;
124  unsigned int vme_base_address;
125 
126  in >> fecnumber >> crate >> std::hex>> vme_base_address >>std::dec ;
127 
128  if (!in.eof() ){
129  //std::cout << __LINE__ << "]\t" << mthn << fecnumber <<" "<< crate << " "
130  // << std::hex << vme_base_address<<std::dec<<std::endl;
131 
133 
134  tmp.setFECParameters(fecnumber , crate , vme_base_address);
135 
136  fecconfig_.push_back(tmp);
137  }
138 
139  }
140  while (!in.eof());
141  in.close();
142 }
This class implements..
std::vector< PixelFECParameters > fecconfig_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
void setFECParameters(unsigned int fecnumber, unsigned int crate, unsigned int vmebaseaddress)
PixelConfigBase(std::string description, std::string creator, std::string date)
PixelFECConfig::PixelFECConfig ( std::vector< std::vector< std::string > > &  tableMat)

EXTENSION_TABLE_NAME: (VIEW: )

CONFIG_KEY NOT NULL VARCHAR2(80) KEY_TYPE NOT NULL VARCHAR2(80) KEY_ALIAS NOT NULL VARCHAR2(80) VERSION VARCHAR2(40) KIND_OF_COND NOT NULL VARCHAR2(40) PIXFEC_NAME NOT NULL VARCHAR2(200) CRATE_NUMBER NOT NULL NUMBER(38) SLOT_NUMBER NUMBER(38) VME_ADDR NOT NULL VARCHAR2(200)

Definition at line 20 of file PixelFECConfig.cc.

References EnergyCorrector::c, fecconfig_, gen::n, alignCSCRings::r, and tmp.

20  : PixelConfigBase(" "," "," "){
21 
22  std::map<std::string , int > colM;
23  std::vector<std::string > colNames;
39  colNames.push_back("CONFIG_KEY" );
40  colNames.push_back("KEY_TYPE" );
41  colNames.push_back("KEY_ALIAS" );
42  colNames.push_back("VERSION" );
43  colNames.push_back("KIND_OF_COND" );
44  colNames.push_back("PIXFEC_NAME" );
45  colNames.push_back("CRATE_NUMBER" );
46  colNames.push_back("SLOT_NUMBER" );
47  colNames.push_back("VME_ADDR" );
48 
49  for(unsigned int c = 0 ; c < tableMat[0].size() ; c++)
50  {
51  for(unsigned int n=0; n<colNames.size(); n++)
52  {
53  if(tableMat[0][c] == colNames[n]){
54  colM[colNames[n]] = c;
55  break;
56  }
57  }
58  }//end for
59  /*
60  for(unsigned int n=0; n<colNames.size(); n++)
61  {
62  if(colM.find(colNames[n]) == colM.end()){
63  std::cerr << "[PixelFECConfig::PixelFECConfig()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
64  assert(0);
65  }
66  }
67  */
68 
69  fecconfig_.clear();
70  for(unsigned int r = 1 ; r < tableMat.size() ; r++) //Goes to every row of the Matrix
71  {
72  unsigned int fecnumber;
73  unsigned int crate;
74  unsigned int vme_base_address;
75 
76 // 01234567890123
77 // BPix_Pxl_FEC_1
78 // string fullFECName = tableMat[r][colM["PIXEL_FEC"]] ;
79 // fullFECName.replace(0,13,"") ;
80  fecnumber = atoi(tableMat[r][colM["PIXFEC_NAME"]].c_str()) ;
81  crate = atoi(tableMat[r][colM["CRATE_NUMBER"]].c_str()) ;
82  string hexVMEAddr = tableMat[r][colM["VME_ADDR"]] ;
83  sscanf(hexVMEAddr.c_str(), "%x", &vme_base_address) ;
85 
86  tmp.setFECParameters(fecnumber , crate , vme_base_address);
87 
88  fecconfig_.push_back(tmp);
89  }
90 
91 }// end contructor
This class implements..
std::vector< PixelFECParameters > fecconfig_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
PixelConfigBase(std::string description, std::string creator, std::string date)

Member Function Documentation

unsigned int PixelFECConfig::crateFromFECNumber ( unsigned int  fecnumber) const

Definition at line 185 of file PixelFECConfig.cc.

References assert(), gather_cfg::cout, fecconfig_, getCrate(), getFECNumber(), i, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pos::PixelCalibConfiguration::getFECCrates().

185  {
186 
187  std::string mthn = "[PixelFECConfig::crateFromFECNumber()]\t\t\t " ;
188  for(unsigned int i=0;i<fecconfig_.size();i++){
189  if (fecconfig_[i].getFECNumber()==fecnumber) return fecconfig_[i].getCrate();
190  }
191 
192  std::cout << __LINE__ << "]\t" << mthn << "Could not find FEC number: " << fecnumber << std::endl;
193 
194  assert(0);
195 
196  return 0;
197 
198 }
int i
Definition: DBlmapReader.cc:9
unsigned int getFECNumber(unsigned int i) const
assert(m_qm.get())
unsigned int getCrate(unsigned int i) const
std::vector< PixelFECParameters > fecconfig_
tuple cout
Definition: gather_cfg.py:121
unsigned int pos::PixelFECConfig::FECSlotFromFECNumber ( unsigned int  fecnumber)
inline

Definition at line 40 of file PixelFECConfig.h.

References FECSlotFromVMEBaseAddress(), and VMEBaseAddressFromFECNumber().

unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress)
unsigned int VMEBaseAddressFromFECNumber(unsigned int fecnumber) const
unsigned int pos::PixelFECConfig::FECSlotFromVMEBaseAddress ( unsigned int  VMEBaseAddress)
inlineprivate

Definition at line 64 of file PixelFECConfig.h.

References assert().

Referenced by FECSlotFromFECNumber(), and getFECSlot().

64 {assert(VMEBaseAddress%0x8000000 == 0); return VMEBaseAddress/0x8000000;}
assert(m_qm.get())
unsigned int PixelFECConfig::getCrate ( unsigned int  i) const

Definition at line 169 of file PixelFECConfig.cc.

References assert(), fecconfig_, and i.

Referenced by crateFromFECNumber().

169  {
170 
171  assert(i<fecconfig_.size());
172  return fecconfig_[i].getCrate();
173 
174 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelFECParameters > fecconfig_
unsigned int PixelFECConfig::getFECNumber ( unsigned int  i) const

Definition at line 161 of file PixelFECConfig.cc.

References assert(), fecconfig_, and i.

Referenced by crateFromFECNumber(), and VMEBaseAddressFromFECNumber().

161  {
162 
163  assert(i<fecconfig_.size());
164  return fecconfig_[i].getFECNumber();
165 
166 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelFECParameters > fecconfig_
unsigned int pos::PixelFECConfig::getFECSlot ( unsigned int  i)
inline

Definition at line 39 of file PixelFECConfig.h.

References FECSlotFromVMEBaseAddress(), and getVMEBaseAddress().

int i
Definition: DBlmapReader.cc:9
unsigned int getVMEBaseAddress(unsigned int i) const
unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress)
unsigned int PixelFECConfig::getNFECBoards ( ) const

Definition at line 155 of file PixelFECConfig.cc.

References fecconfig_.

155  {
156 
157  return fecconfig_.size();
158 
159 }
std::vector< PixelFECParameters > fecconfig_
unsigned int PixelFECConfig::getVMEBaseAddress ( unsigned int  i) const

Definition at line 177 of file PixelFECConfig.cc.

References assert(), fecconfig_, and i.

Referenced by getFECSlot(), and VMEBaseAddressFromFECNumber().

177  {
178 
179  assert(i<fecconfig_.size());
180  return fecconfig_[i].getVMEBaseAddress();
181 
182 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
std::vector< PixelFECParameters > fecconfig_
unsigned int PixelFECConfig::VMEBaseAddressFromFECNumber ( unsigned int  fecnumber) const

Definition at line 200 of file PixelFECConfig.cc.

References assert(), gather_cfg::cout, fecconfig_, getFECNumber(), getVMEBaseAddress(), i, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FECSlotFromFECNumber().

200  {
201 
202  std::string mthn = "[PixelFECConfig::VMEBaseAddressFromFECNumber()]\t\t " ;
203  for(unsigned int i=0;i<fecconfig_.size();i++){
204  if (fecconfig_[i].getFECNumber()==fecnumber) return fecconfig_[i].getVMEBaseAddress();
205  }
206 
207  std::cout << __LINE__ << "]\t" << mthn << "Could not find FEC number: " << fecnumber << std::endl;
208 
209  assert(0);
210 
211  return 0;
212 
213 }
int i
Definition: DBlmapReader.cc:9
unsigned int getFECNumber(unsigned int i) const
assert(m_qm.get())
unsigned int getVMEBaseAddress(unsigned int i) const
std::vector< PixelFECParameters > fecconfig_
tuple cout
Definition: gather_cfg.py:121
void PixelFECConfig::writeASCII ( std::string  dir = "") const
virtual

Implements pos::PixelConfigBase.

Definition at line 216 of file PixelFECConfig.cc.

References TauDecayModes::dec, fecconfig_, lut2db_cfg::filename, i, dbtoconf::out, and AlCaHLTBitMon_QueryRunRegistry::string.

216  {
217 
218  if (dir!="") dir+="/";
219  std::string filename=dir+"fecconfig.dat";
220  std::ofstream out(filename.c_str());
221 
222  std::vector< PixelFECParameters >::const_iterator i=fecconfig_.begin();
223 
224  out << "#FEC number crate vme base address" << endl;
225  for(;i!=fecconfig_.end();++i){
226  out << i->getFECNumber()<<" "
227  << i->getCrate()<<" "
228  << "0x"<<hex<<i->getVMEBaseAddress()<<dec<<endl;
229  }
230 
231 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelFECParameters > fecconfig_
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
dbl *** dir
Definition: mlp_gen.cc:35
void pos::PixelFECConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 43 of file PixelFECConfig.h.

43 {;}
void PixelFECConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 274 of file PixelFECConfig.cc.

References TauDecayModes::dec, fecconfig_, i, and AlCaHLTBitMon_QueryRunRegistry::string.

277 {
278  std::string mthn = "[PixelFECConfig::writeXML()]\t\t\t " ;
279 
280  std::vector< PixelFECParameters >::const_iterator i=fecconfig_.begin();
281 
282  for(;i!=fecconfig_.end();++i){
283  *outstream << "" << endl ;
284  *outstream << " <DATA>" << endl ;
285  *outstream << " <PIXFEC_NAME>" << i->getFECNumber() << "</PIXFEC_NAME>" << endl ;
286  *outstream << " <CRATE_NUMBER>" << i->getCrate() << "</CRATE_NUMBER>" << endl ;
287  *outstream << " <VME_ADDR>0x" << hex << i->getVMEBaseAddress() << dec << "</VME_ADDR>" << endl ;
288  *outstream << " </DATA>" << endl ;
289  }
290 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelFECParameters > fecconfig_
void PixelFECConfig::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 234 of file PixelFECConfig.cc.

References gather_cfg::cout, contentValuesFiles::fullPath, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), pos::PixelTimeFormatter::getTime(), and AlCaHLTBitMon_QueryRunRegistry::string.

240 {
241  std::string mthn = "[PixelFECConfig::writeXMLHeader()]\t\t\t " ;
242  std::stringstream fullPath ;
243  fullPath << path << "/Pixel_PixelFecParameters_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
244  cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << endl ;
245 
246  outstream->open(fullPath.str().c_str()) ;
247 
248  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << endl ;
249  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << endl ;
250  *outstream << " <HEADER>" << endl ;
251  *outstream << " <TYPE>" << endl ;
252  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_FEC_PARAMETERS</EXTENSION_TABLE_NAME>" << endl ;
253  *outstream << " <NAME>Pixel FEC Parameters</NAME>" << endl ;
254  *outstream << " </TYPE>" << endl ;
255  *outstream << " <RUN>" << endl ;
256  *outstream << " <RUN_TYPE>Pixel FEC Parameters</RUN_TYPE>" << endl ;
257  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << endl ;
258  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << endl ;
259  *outstream << " <LOCATION>CERN P5</LOCATION>" << endl ;
260  *outstream << " </RUN>" << endl ;
261  *outstream << " </HEADER>" << endl ;
262  *outstream << "" << endl ;
263  *outstream << " <DATA_SET>" << endl ;
264  *outstream << " <PART>" << endl ;
265  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << endl ;
266  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << endl ;
267  *outstream << " </PART>" << endl ;
268  *outstream << " <VERSION>" << version << "</VERSION>" << endl ;
269  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << endl ;
270  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << endl ;
271 }
static std::string getmSecTime(void)
tuple path
else: Piece not in the list, fine.
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:121
void PixelFECConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 293 of file PixelFECConfig.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

296 {
297  std::string mthn = "[PixelFECConfig::writeXMLTrailer()]\t\t\t " ;
298 
299  *outstream << "" << endl ;
300  *outstream << " </DATA_SET>" << endl ;
301  *outstream << "</ROOT> " << endl ;
302 
303  outstream->close() ;
304 }

Member Data Documentation

std::vector< PixelFECParameters > pos::PixelFECConfig::fecconfig_
private