CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Modules | Functions | Variables | Friends
"Configuration Objects"

This is the base class of all configuration objects. More...

Classes

class  pos::PixelCalibConfiguration
 This class implements the steps that are used in a scan over Threshold and CalDelay. More...
 
class  pos::PixelConfigBase
 This file contains the base class for "pixel configuration data" management. More...
 
class  pos::PixelDACSettings
 This class is responsible for manipulating the DACsettings of a ROC. More...
 
class  pos::PixelDelay25Calib
 This class manages data and files used in the Delay25 calibration. More...
 
class  pos::PixelDetectorConfig
 This is the documentation about PixelDetectorConfig... More...
 
class  pos::PixelFECConfig
 This class specifies which FEC boards are used and how they are addressed. More...
 
class  pos::PixelFEDCard
 This is the documentation about PixelFEDCard... More...
 
class  pos::PixelFEDConfig
 This is the documentation about PixelFEDConfig... More...
 
class  pos::PixelGlobalDelay25
 This class specifies which delay25 channels are delayed over the entire pixel detector and by how much. More...
 
class  pos::PixelLowVoltageMap
 This is the documentation about PixelLowVoltageMap... More...
 
class  pos::PixelLTCConfig
 This is the documentation about PixelLTCConfig... More...
 
class  pos::PixelMaskAllPixels
 This is the documentation about PixelMaskAllPixels... More...
 
class  pos::PixelMaskBase
 This is the documentation about PixelMaskBase... More...
 
class  pos::PixelMaskOverride
 This is the documentation about PixelMaskOverride... More...
 
class  pos::PixelMaskOverrideBase
 This is the documentation about PixelMaskOverrideBase... More...
 
class  pos::PixelMaxVsf
 This is the documentation about PixelMaxVsf... More...
 
class  pos::PixelNameTranslation
 This is the documentation about PixelNameTranslation... More...
 
class  pos::PixelPortCardConfig
 This is the documentation about PixelNameTranslation... More...
 
class  pos::PixelTBMSettings
 This is the documentation about PixelTBMSettings... More...
 
class  pos::PixelTKFECConfig
 This class specifies which TKFEC boards are used and how they are addressed. More...
 
class  pos::PixelTrimBase
 This class implements.. More...
 
class  pos::PixelTrimCommon
 This class implements.. More...
 

Modules

 "Trim Objects"
 

Functions

void pos::PixelDACSettings::addROC (PixelROCDACSettings &rocname)
 
void pos::PixelDACSettings::generateConfiguration (PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, PixelDetectorConfig *detconfig, bool HVon=true) const
 
PixelROCDACSettings pos::PixelDACSettings::getDACSettings (int ROCId) const
 
PixelROCDACSettingspos::PixelDACSettings::getDACSettings (PixelROCName)
 
unsigned int pos::PixelDACSettings::numROCs ()
 
 pos::PixelDACSettings::PixelDACSettings (std::string filename)
 
 pos::PixelDACSettings::PixelDACSettings (std::vector< std::vector< std::string > > &tableMat)
 
 pos::PixelDACSettings::PixelDACSettings (PixelROCDACSettings &rocname)
 
bool pos::PixelDACSettings::rocIsDisabled (const PixelDetectorConfig *detconfig, const PixelROCName rocname) const
 
void pos::PixelDACSettings::setVcthrDisable (PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans) const
 
void pos::PixelDACSettings::setVcthrEnable (PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, PixelDetectorConfig *detconfig) const
 
void pos::PixelDACSettings::writeASCII (std::string dir) const
 
void pos::PixelDACSettings::writeBinary (std::string filename) const
 
void pos::PixelDACSettings::writeXML (pos::PixelConfigKey key, int version, std::string path) const
 
virtual void pos::PixelDACSettings::writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void pos::PixelDACSettings::writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
virtual void pos::PixelDACSettings::writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 

Variables

std::vector< PixelROCDACSettings > pos::PixelDACSettings::dacsettings_
 

Friends

std::ostream & pos::PixelDACSettings::operator<< (std::ostream &s, const PixelDACSettings &mask)
 

Detailed Description

This is the base class of all configuration objects.

A longer explanation of what a 'configuration object' actually is will be posted here once we find the time to write it....

Function Documentation

void PixelDACSettings::addROC ( PixelROCDACSettings rocname)

Definition at line 153 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_.

154 {
155  dacsettings_.push_back(rocname) ;
156 }
std::vector< PixelROCDACSettings > dacsettings_
void PixelDACSettings::generateConfiguration ( PixelFECConfigInterface pixelFEC,
PixelNameTranslation trans,
PixelDetectorConfig detconfig,
bool  HVon = true 
) const

Definition at line 531 of file PixelDACSettings.cc.

References pos::PixelFECConfigInterface::clrcal(), pos::PixelDACSettings::dacsettings_, pos::PixelFECConfigInterface::dcolenable(), pos::PixelNameTranslation::getHdwAddress(), pos::PixelHdwAddress::hubaddress(), i, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), pos::PixelHdwAddress::portaddress(), pos::PixelFECConfigInterface::progdac(), pos::PixelFECConfigInterface::qbufsend(), pos::PixelHdwAddress::rocid(), pos::PixelDACSettings::rocIsDisabled(), and pos::PixelFECConfigInterface::setAllDAC().

532  {
533 
534  bool bufferData=true;
535 
536  std::vector<unsigned int> dacs;
537 
538  //pixelFEC->fecDebug(1); //FIXME someday maybe don't want to take the time
539 
540  for(unsigned int i=0;i<dacsettings_.size();i++){
541 
542  bool disableRoc = rocIsDisabled(detconfig, dacsettings_[i].getROCName());
543 
544  dacsettings_[i].getDACs(dacs);
545 
546  PixelHdwAddress theROC=*(trans->getHdwAddress(dacsettings_[i].getROCName()));
547 
548  //Need to set readout speed (40MHz) and Vcal range (0-1800 mV) and enable the chip
549 
550  int controlreg=dacsettings_[i].getControlRegister();
551  //std::cout << "[PixelDACSettings::generateConfiguration] ROC control reg to be set to: " << controlreg <<std::endl;
552 
553  pixelFEC->progdac(theROC.mfec(),
554  theROC.mfecchannel(),
555  theROC.hubaddress(),
556  theROC.portaddress(),
557  theROC.rocid(),
558  0xfd,
559  controlreg,
560  bufferData);
561 
562  // std::cout<<"ROC="<<dacsettings_[i].getROCName()<<" ; VcThr set to "<<dacs[11]<<std::flush; //for debugging
563  if (!HVon || disableRoc) dacs[11]=0; //set Vcthr DAC to 0 (Vcthr is DAC 12=11+1)
564  // std::cout<<" ; setting VcThr to "<<dacs[11]<<std::endl; //for debugging
565  pixelFEC->setAllDAC(theROC,dacs,bufferData);
566 
567  // start with no pixels on for calibration
568  pixelFEC->clrcal(theROC.mfec(),
569  theROC.mfecchannel(),
570  theROC.hubaddress(),
571  theROC.portaddress(),
572  theROC.rocid(),
573  bufferData);
574 
575  // enable all the double columns
576  for(int dcol=0;dcol<26;dcol++){
577  pixelFEC->dcolenable(theROC.mfec(),
578  theROC.mfecchannel(),
579  theROC.hubaddress(),
580  theROC.portaddress(),
581  theROC.rocid(),
582  dcol,
583  1,
584  bufferData);
585  }
586 
587  if (!HVon || disableRoc) { //HV off
588  // std::cout << "[PixelDACSettings::generateConfiguration] HV off! ROC control reg to be set to: " << (controlreg|0x2) <<std::endl;
589  pixelFEC->progdac(theROC.mfec(),
590  theROC.mfecchannel(),
591  theROC.hubaddress(),
592  theROC.portaddress(),
593  theROC.rocid(),
594  0xfd,
595  controlreg | 0x2, //=010 in binary. should disable the chip
596  bufferData);
597  }
598  }
599 
600  if (bufferData) {
601  pixelFEC->qbufsend();
602  }
603 
604 }
unsigned int mfec() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
virtual int clrcal(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, bool buffermode=false)=0
int i
Definition: DBlmapReader.cc:9
bool rocIsDisabled(const PixelDetectorConfig *detconfig, const PixelROCName rocname) const
virtual int progdac(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, int dacaddress, int dacvalue, bool buffermode=false)=0
unsigned int portaddress() const
virtual int dcolenable(int mfec, int mfecchannel, int hubaddress, int portaddress, int rocid, int dcol, int dcolstate, bool buffermode=false)=0
unsigned int rocid() const
unsigned int mfecchannel() const
unsigned int hubaddress() const
Store mfec, mfecchannel etc.
std::vector< PixelROCDACSettings > dacsettings_
virtual int qbufsend(void)=0
virtual void setAllDAC(const PixelHdwAddress &theROC, const std::vector< unsigned int > &dacs, const bool buffermode=false)=0
PixelROCDACSettings PixelDACSettings::getDACSettings ( int  ROCId) const

Definition at line 365 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_.

Referenced by operator<<().

365  {
366 
367  return dacsettings_[ROCId];
368 
369 }
std::vector< PixelROCDACSettings > dacsettings_
PixelROCDACSettings * PixelDACSettings::getDACSettings ( PixelROCName  name)

Definition at line 371 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, i, and mergeVDriftHistosByStation::name.

371  {
372 
373  for(unsigned int i=0;i<dacsettings_.size();i++){
374  if (dacsettings_[i].getROCName()==name) return &(dacsettings_[i]);
375  }
376 
377  return 0;
378 
379 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelROCDACSettings > dacsettings_
unsigned int pos::PixelDACSettings::numROCs ( )
inline

Definition at line 76 of file PixelDACSettings.h.

References pos::PixelDACSettings::dacsettings_.

76 {return dacsettings_.size();}
std::vector< PixelROCDACSettings > dacsettings_
PixelDACSettings::PixelDACSettings ( std::string  filename)

Definition at line 26 of file PixelDACSettings.cc.

References trackerHits::c, gather_cfg::cout, pos::PixelDACSettings::dacsettings_, i, recoMuon::in, pos::PixelROCDACSettings::read(), pos::PixelROCDACSettings::readBinary(), GlobalPosition_Frontier_DevDB_cff::tag, and tmp.

26  :
27  PixelConfigBase("","",""){
28 
29  std::string mthn = "[PixelDACSettings::PixelDACSettings()]\t\t\t " ;
30 
31  if (filename[filename.size()-1]=='t'){
32 
33  std::ifstream in(filename.c_str());
34 
35  if (!in.good()){
36  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
37  // assert(0); //in case of failure, we don't want POS to die here
38  throw std::runtime_error("Failed to open file "+filename);
39  }
40  else {
41  // std::cout << "Opened:"<<filename<<std::endl;
42  }
43 
44 
45  dacsettings_.clear();
46 
47  std::string tag;
48 
49  in >> tag;
50 
51  while (!in.eof()){
52 
53 
54  PixelROCName rocid(in);
55 
56  // std::cout << "[PixelDACSettings::PixelDACSettings()] DAC setting ROC id:"<<rocid<<std::endl;
57 
59 
60  tmp.read(in,rocid);
61 
62  // std::cout << "[PixelDACSettings::PixelDACSettings()] DACSetting: " << std::endl << tmp << std::endl ;
63  dacsettings_.push_back(tmp);
64 
65  in >> tag;
66 
67  assert(dacsettings_.size()<100);
68 
69  }
70 
71  in.close();
72 
73  }
74  else{
75 
76  std::ifstream in(filename.c_str(),std::ios::binary);
77 
78  if (!in.good()){
79  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
80  assert(0);
81  }
82  else {
83  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
84  }
85 
86  char nchar;
87 
88  in.read(&nchar,1);
89 
90  std::string s1;
91 
92  //wrote these lines of code without ref. needs to be fixed
93  for(int i=0;i< nchar; i++){
94  char c;
95  in >>c;
96  s1.push_back(c);
97  }
98 
99  //std::cout << __LINE__ << "]\t" << mthn << "READ ROC name: " << s1 << std::endl;
100 
101  dacsettings_.clear();
102 
103 
104  while (!in.eof()){
105 
106  //std::cout << __LINE__ << "]\t" << mthn << "read s1 : " << s1 << std::endl;
107 
108  PixelROCName rocid(s1);
109 
110  //std::cout << __LINE__ << "]\t" << mthn << "read rocid: " << rocid << std::endl;
111 
113 
114  tmp.readBinary(in, rocid);
115 
116  dacsettings_.push_back(tmp);
117 
118 
119  in.read(&nchar,1);
120 
121  s1.clear();
122 
123  if (in.eof()) continue;
124 
125  //wrote these lines of code without ref. needs to be fixed
126  for(int i=0;i< nchar; i++){
127  char c;
128  in >>c;
129  s1.push_back(c);
130  }
131 
132 
133  }
134 
135  in.close();
136 
137 
138 
139  }
140 
141 
142  //std::cout << __LINE__ << "]\t" << mthn << "Read dac settings for "<<dacsettings_.size()<<" ROCs"<<std::endl;
143 
144 
145 }
int i
Definition: DBlmapReader.cc:9
int read(std::ifstream &in, const PixelROCName &rocid)
std::vector< PixelROCDACSettings > dacsettings_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
This class implements..
Definition: PixelROCName.h:23
tuple filename
Definition: lut2db_cfg.py:20
int readBinary(std::ifstream &in, const PixelROCName &rocid)
This class implements..
tuple cout
Definition: gather_cfg.py:121
PixelConfigBase(std::string description, std::string creator, std::string date)
PixelDACSettings::PixelDACSettings ( std::vector< std::vector< std::string > > &  tableMat)

Definition at line 158 of file PixelDACSettings.cc.

References trackerHits::c, dtNoiseDBValidation_cfg::cerr, pos::PixelDACSettings::dacsettings_, pos::k_DACName_CalDel, pos::k_DACName_ChipContReg, pos::k_DACName_TempRange, pos::k_DACName_Vana, pos::k_DACName_VbiasOp, pos::k_DACName_Vcal, pos::k_DACName_Vcomp, pos::k_DACName_VcThr, pos::k_DACName_Vdd, pos::k_DACName_VHldDel, pos::k_DACName_VIbias_bus, pos::k_DACName_VIbias_DAC, pos::k_DACName_VIbias_PH, pos::k_DACName_VIbias_roc, pos::k_DACName_VIbias_sf, pos::k_DACName_VIColOr, pos::k_DACName_VIon, pos::k_DACName_Vleak, pos::k_DACName_Vnpix, pos::k_DACName_VOffsetOp, pos::k_DACName_VOffsetRO, pos::k_DACName_VrgPr, pos::k_DACName_VrgSh, pos::k_DACName_Vsf, pos::k_DACName_VsumCol, pos::k_DACName_Vtrim, pos::k_DACName_VwllPr, pos::k_DACName_VwllSh, pos::k_DACName_WBC, n, alignCSCRings::r, pos::PixelROCDACSettings::read(), and tmp.

158  : PixelConfigBase("","","")
159 {
160 
161 /*
162  EXTENSION_TABLE_NAME: ROC_DAC_SETTINGS_COL (VIEW: CONF_KEY_ROCDAC_COL_V)
163 
164  CONFIG_KEY NOT NULL VARCHAR2(80)
165  KEY_TYPE NOT NULL VARCHAR2(80)
166  KEY_ALIAS NOT NULL VARCHAR2(80)
167  VERSION VARCHAR2(40)
168  KIND_OF_COND NOT NULL VARCHAR2(40)
169  ROC_NAME VARCHAR2(200)
170  VDD NOT NULL NUMBER(38)
171  VANA NOT NULL NUMBER(38)
172  VSF NOT NULL NUMBER(38)
173  VCOMP NOT NULL NUMBER(38)
174  VLEAK NOT NULL NUMBER(38)
175  VRGPR NOT NULL NUMBER(38)
176  VWLLPR NOT NULL NUMBER(38)
177  VRGSH NOT NULL NUMBER(38)
178  VWLLSH NOT NULL NUMBER(38)
179  VHLDDEL NOT NULL NUMBER(38)
180  VTRIM NOT NULL NUMBER(38)
181  VCTHR NOT NULL NUMBER(38)
182  VIBIAS_BUS NOT NULL NUMBER(38)
183  VIBIAS_SF NOT NULL NUMBER(38)
184  VOFFSETOP NOT NULL NUMBER(38)
185  VBIASOP NOT NULL NUMBER(38)
186  VOFFSETRO NOT NULL NUMBER(38)
187  VION NOT NULL NUMBER(38)
188  VIBIAS_PH NOT NULL NUMBER(38)
189  VIBIAS_DAC NOT NULL NUMBER(38)
190  VIBIAS_ROC NOT NULL NUMBER(38)
191  VICOLOR NOT NULL NUMBER(38)
192  VNPIX NOT NULL NUMBER(38)
193  VSUMCOL NOT NULL NUMBER(38)
194  VCAL NOT NULL NUMBER(38)
195  CALDEL NOT NULL NUMBER(38)
196  TEMPRANGE NOT NULL NUMBER(38)
197  WBC NOT NULL NUMBER(38)
198  CHIPCONTREG NOT NULL NUMBER(38)
199 */
200 // std::multimap<std::string,std::pair<std::string,int > > pDSM;
201  // std::stringstream currentRocName;
202  std::vector< std::string > ins = tableMat[0];
203  std::string mthn("[PixelDACSettings::PixelDACSettings()] ") ;
204  std::string dacName;
205  std::istringstream dbin ;
206 // int dacValue;
207  int skipColumns = 0 ;
208  std::map<std::string , int > colM;
209  std::vector<std::string > colNames;
210  std::map<std::string, std::string> nameTranslation ;
211 
212  colNames.push_back("CONFIG_KEY" );
213  colNames.push_back("KEY_TYPE" );
214  colNames.push_back("KEY_ALIAS" );
215  colNames.push_back("VERSION" );
216  colNames.push_back("KIND_OF_COND");
217  colNames.push_back("ROC_NAME" );
218  colNames.push_back("VDD" );
219  colNames.push_back("VANA" );
220  colNames.push_back("VSF" );
221  colNames.push_back("VCOMP" );
222  colNames.push_back("VLEAK" );
223  colNames.push_back("VRGPR" );
224  colNames.push_back("VWLLPR" );
225  colNames.push_back("VRGSH" );
226  colNames.push_back("VWLLSH" );
227  colNames.push_back("VHLDDEL" );
228  colNames.push_back("VTRIM" );
229  colNames.push_back("VCTHR" );
230  colNames.push_back("VIBIAS_BUS" );
231  colNames.push_back("VIBIAS_SF" );
232  colNames.push_back("VOFFSETOP" );
233  colNames.push_back("VBIASOP" );
234  colNames.push_back("VOFFSETRO" );
235  colNames.push_back("VION" );
236  colNames.push_back("VIBIAS_PH" );
237  colNames.push_back("VIBIAS_DAC" );
238  colNames.push_back("VIBIAS_ROC" );
239  colNames.push_back("VICOLOR" );
240  colNames.push_back("VNPIX" );
241  colNames.push_back("VSUMCOL" );
242  colNames.push_back("VCAL" );
243  colNames.push_back("CALDEL" );
244  colNames.push_back("TEMPRANGE" );
245  colNames.push_back("WBC" );
246  colNames.push_back("CHIPCONTREG" );
247 
248  nameTranslation["VDD"] = k_DACName_Vdd ;
249  nameTranslation["VANA"] = k_DACName_Vana;
250  nameTranslation["VSF"] = k_DACName_Vsf;
251  nameTranslation["VCOMP"] = k_DACName_Vcomp;
252  nameTranslation["VLEAK"] = k_DACName_Vleak;
253  nameTranslation["VRGPR"] = k_DACName_VrgPr;
254  nameTranslation["VWLLPR"] = k_DACName_VwllPr;
255  nameTranslation["VRGSH"] = k_DACName_VrgSh;
256  nameTranslation["VWLLSH"] = k_DACName_VwllSh;
257  nameTranslation["VHLDDEL"] = k_DACName_VHldDel;
258  nameTranslation["VTRIM"] = k_DACName_Vtrim;
259  nameTranslation["VCTHR"] = k_DACName_VcThr;
260  nameTranslation["VIBIAS_BUS"] = k_DACName_VIbias_bus;
261  nameTranslation["VIBIAS_SF"] = k_DACName_VIbias_sf;
262  nameTranslation["VOFFSETOP"] = k_DACName_VOffsetOp;
263  nameTranslation["VBIASOP"] = k_DACName_VbiasOp;
264  nameTranslation["VOFFSETRO"] = k_DACName_VOffsetRO;
265  nameTranslation["VION"] = k_DACName_VIon;
266  nameTranslation["VIBIAS_PH"] = k_DACName_VIbias_PH;
267  nameTranslation["VIBIAS_DAC"] = k_DACName_VIbias_DAC;
268  nameTranslation["VIBIAS_ROC"] = k_DACName_VIbias_roc;
269  nameTranslation["VICOLOR"] = k_DACName_VIColOr;
270  nameTranslation["VNPIX"] = k_DACName_Vnpix;
271  nameTranslation["VSUMCOL"] = k_DACName_VsumCol;
272  nameTranslation["VCAL"] = k_DACName_Vcal;
273  nameTranslation["CALDEL"] = k_DACName_CalDel;
274  nameTranslation["TEMPRANGE"] = k_DACName_TempRange;
275  nameTranslation["WBC"] = k_DACName_WBC;
276  nameTranslation["CHIPCONTREG"] = k_DACName_ChipContReg;
277 
278  // modified by MR on 25-02-2008 10:00:45
279  // colM stores the index (referred to tableMat) where the specified dac setting is store!!!
280  for(unsigned int c = skipColumns ; c < ins.size() ; c++){
281  for(unsigned int n=0; n<colNames.size(); n++){
282  if(tableMat[0][c] == colNames[n]){
283  colM[colNames[n]] = c;
284  break;
285  }
286  }
287  }//end for
288  for(unsigned int n=skipColumns; n<colNames.size(); n++){
289  if(colM.find(colNames[n]) == colM.end()){
290  std::cerr << "[PixelDACSettings::PixelDACSettings()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
291  assert(0);
292  }
293  }
294 
295 
296  dacsettings_.clear();
297 // struct timeval start_time ;
298 // struct timeval end_time ;
299 // gettimeofday(&start_time, (struct timezone *)0 );
300  for(unsigned int r = 1 ; r < tableMat.size() ; r++){ //Goes to every row of the Matrix
301  // currentRocName.str("");
302  // currentRocName << tableMat[r][colM["NAME"]] ;
303  //currentRocName << "FPix_BmI_D" << tableMat[r][colM["HDISK_POSN"]]
304  // << "_BLD" << tableMat[r][colM["BLD_POSN"]]
305  // << "_PNL" << tableMat[r][colM["PANEL_POSITION"]]
306  // << "_PLQ" << tableMat[r][colM["PLAQ_POS"]]
307  // << "_ROC" << tableMat[r][colM["ROC_POSN"]];
308 
309  // modified by MR on 25-02-2008 10:04:55
310  PixelROCName rocid(tableMat[r][colM["ROC_NAME"]]);
311  PixelROCDACSettings tmp(rocid);
312  std::ostringstream dacs("") ;
313  // +6 to get rid of the first 5 columns not pertaining DAC Settings...
314  for(unsigned int n=skipColumns+6; n<colNames.size(); n++)
315  {
316  dacs << nameTranslation[colNames[n]] <<": "<< atoi(tableMat[r][colM[colNames[n]]].c_str()) << std::endl ;
317  // dacName = colNames[n];
318  // dacValue = atoi(tableMat[r][colM[colNames[n]]].c_str());
319  // pDSM.insert(std::pair<std::string,std::pair<std::string,int> >(tableMat[r][colM["ROC_NAME"]],std::pair<std::string,int>(dacName,dacValue)));
320  // std::cout << "On " << tableMat[r][colM["ROC_NAME"]] << " DAC:\t" << dacName << " value:\t" << dacValue<< std::endl ;
321  // tmp.setDac(dacName, dacValue) ;
322  }
323 // tmp.setDACs(tmpDACs) ;
324  dbin.str(dacs.str()) ;
325  tmp.read(dbin, rocid) ;
326  dacsettings_.push_back(tmp) ;
327  }//end for r
328 // gettimeofday(&end_time, (struct timezone *)0 );
329 // int total_usecs = (end_time.tv_sec - start_time.tv_sec)*1000000 + (end_time.tv_usec - start_time.tv_usec);
330 // std::cout << mthn << "Time taken : " << total_usecs / 1000000. << " secs" << std::endl;
331 
332 // dacsettings_.clear();
333 // std::string currentRocName2 = "";
334 // for(std::multimap<std::string,std::pair<std::string,int> >::iterator tableMapIt=pDSM.begin(); tableMapIt!= pDSM.end(); tableMapIt++){
335 // if(currentRocName2 != tableMapIt->first){
336 // std::cout << tableMapIt->first << std::endl;
337 // std::cout << tableMapIt->second.first << std::endl;
338 // std::cout << tableMapIt->second.second << std::endl;
339 // currentRocName2 = tableMapIt->first;
340 // PixelROCName rocid(currentRocName2);
341 
342 // // std::cout << "DAC setting ROC id:"<<rocid<<std::endl;
343 
344 // PixelROCDACSettings tmp(rocid);
345 
346 // // tmp.read(in,rocid);
347 
348 // dacsettings_.push_back(tmp);
349 // }//end if
350 // dacsettings_[dacsettings_.size()-1].setDac(tableMapIt->second.first,tableMapIt->second.second);
351 // }//end for
352 
353 
354 // for(unsigned int w = 0 ; w < dacsettings_.size() ; w++)
355 // {
356 
357 // PixelROCDACSettings tmp2 = dacsettings_[w];
358 // // std::cout<<tmp2<<std::endl;
359 // }
360  // std::cout<<"Number of ROCs in the PixelDACSettings::PixelDACSettings(vector <vector<string> >):"<<dacsettings_.size()<<std::endl;
361  // std::cout << "[PixelDACSettings::PixelDACSettings(std::vector)] before end of constructor" << std::endl ;
362 }//end PDSMatrix constructor
const std::string k_DACName_VcThr
Definition: PixelDACNames.h:24
const std::string k_DACName_VrgPr
Definition: PixelDACNames.h:18
const std::string k_DACName_ChipContReg
Definition: PixelDACNames.h:41
const std::string k_DACName_Vsf
Definition: PixelDACNames.h:15
const std::string k_DACName_CalDel
Definition: PixelDACNames.h:38
const std::string k_DACName_TempRange
Definition: PixelDACNames.h:39
const std::string k_DACName_VIbias_sf
Definition: PixelDACNames.h:26
const std::string k_DACName_Vtrim
Definition: PixelDACNames.h:23
const std::string k_DACName_VIbias_DAC
Definition: PixelDACNames.h:32
const std::string k_DACName_VwllSh
Definition: PixelDACNames.h:21
const std::string k_DACName_Vnpix
Definition: PixelDACNames.h:35
const std::string k_DACName_Vleak
Definition: PixelDACNames.h:17
const std::string k_DACName_VIbias_PH
Definition: PixelDACNames.h:31
const std::string k_DACName_VOffsetRO
Definition: PixelDACNames.h:29
const std::string k_DACName_VIbias_bus
Definition: PixelDACNames.h:25
const std::string k_DACName_VIColOr
Definition: PixelDACNames.h:34
const std::string k_DACName_VOffsetOp
Definition: PixelDACNames.h:27
std::vector< PixelROCDACSettings > dacsettings_
const std::string k_DACName_VbiasOp
Definition: PixelDACNames.h:28
const std::string k_DACName_VIbias_roc
Definition: PixelDACNames.h:33
const std::string k_DACName_Vcal
Definition: PixelDACNames.h:37
const std::string k_DACName_VrgSh
Definition: PixelDACNames.h:20
const std::string k_DACName_VIon
Definition: PixelDACNames.h:30
const std::string k_DACName_Vcomp
Definition: PixelDACNames.h:16
const std::string k_DACName_WBC
Definition: PixelDACNames.h:40
const std::string k_DACName_Vdd
Definition: PixelDACNames.h:13
const std::string k_DACName_VHldDel
Definition: PixelDACNames.h:22
const std::string k_DACName_VsumCol
Definition: PixelDACNames.h:36
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
This class implements..
Definition: PixelROCName.h:23
This class implements..
const std::string k_DACName_Vana
Definition: PixelDACNames.h:14
PixelConfigBase(std::string description, std::string creator, std::string date)
const std::string k_DACName_VwllPr
Definition: PixelDACNames.h:19
PixelDACSettings::PixelDACSettings ( PixelROCDACSettings rocname)

Definition at line 147 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_.

147  :
148  PixelConfigBase("","","") {
149  dacsettings_.push_back(rocname) ;
150 }
std::vector< PixelROCDACSettings > dacsettings_
PixelConfigBase(std::string description, std::string creator, std::string date)
bool PixelDACSettings::rocIsDisabled ( const PixelDetectorConfig detconfig,
const PixelROCName  rocname 
) const
private

Definition at line 700 of file PixelDACSettings.cc.

References pos::PixelROCStatus::get(), pos::PixelDetectorConfig::getROCsList(), and pos::PixelROCStatus::noAnalogSignal.

Referenced by pos::PixelDACSettings::generateConfiguration(), and pos::PixelDACSettings::setVcthrEnable().

700  {
701 
702  const std::map<PixelROCName, PixelROCStatus> & roclist=detconfig->getROCsList();
703  const std::map<PixelROCName, PixelROCStatus>::const_iterator iroc = roclist.find(rocname);
704  assert(iroc != roclist.end()); // the roc name should always be found
705  PixelROCStatus thisROCstatus = iroc->second;
706 
707  return thisROCstatus.get(PixelROCStatus::noAnalogSignal);
708 
709 }
bool get(ROCstatus stat) const
This class implements..
const std::map< PixelROCName, PixelROCStatus > & getROCsList() const
void PixelDACSettings::setVcthrDisable ( PixelFECConfigInterface pixelFEC,
PixelNameTranslation trans 
) const

Definition at line 606 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, pos::PixelNameTranslation::getHdwAddress(), pos::PixelHdwAddress::hubaddress(), i, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), pos::PixelHdwAddress::portaddress(), pos::PixelFECConfigInterface::progdac(), pos::PixelFECConfigInterface::qbufsend(), and pos::PixelHdwAddress::rocid().

606  {
607  //the point here is to set Vcthr to 0
608  //then disable the ROCs
609 
610  //note -- no need to look at the detconfig here, because we're going to disable everything no matter what
611 
612  bool bufferData=true;
613 
614  std::vector<unsigned int> dacs;
615 
616  for(unsigned int i=0;i<dacsettings_.size();i++){ //loop over the ROCs
617 
618  dacsettings_[i].getDACs(dacs);
619  int controlreg=dacsettings_[i].getControlRegister();
620 
621  PixelHdwAddress theROC=*(trans->getHdwAddress(dacsettings_[i].getROCName()));
622 
623  //std::cout<<"disabling ROC="<<dacsettings_[i].getROCName()<<std::endl;
624  pixelFEC->progdac(theROC.mfec(),
625  theROC.mfecchannel(),
626  theROC.hubaddress(),
627  theROC.portaddress(),
628  theROC.rocid(),
629  12, //12 == Vcthr
630  0, //set Vcthr to 0
631  bufferData);
632 
633  //this should disable the roc
634  pixelFEC->progdac(theROC.mfec(),
635  theROC.mfecchannel(),
636  theROC.hubaddress(),
637  theROC.portaddress(),
638  theROC.rocid(),
639  0xfd,
640  controlreg | 0x2,
641  bufferData);
642 
643  }
644 
645  if (bufferData) { //just copying the way it was done in the existing method
646  pixelFEC->qbufsend();
647  }
648 }
unsigned int mfec() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
int i
Definition: DBlmapReader.cc:9
virtual int progdac(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, int dacaddress, int dacvalue, bool buffermode=false)=0
unsigned int portaddress() const
unsigned int rocid() const
unsigned int mfecchannel() const
unsigned int hubaddress() const
Store mfec, mfecchannel etc.
std::vector< PixelROCDACSettings > dacsettings_
virtual int qbufsend(void)=0
void PixelDACSettings::setVcthrEnable ( PixelFECConfigInterface pixelFEC,
PixelNameTranslation trans,
PixelDetectorConfig detconfig 
) const

Definition at line 650 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, pos::PixelNameTranslation::getHdwAddress(), pos::PixelHdwAddress::hubaddress(), i, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), pos::PixelHdwAddress::portaddress(), pos::PixelFECConfigInterface::progdac(), pos::PixelFECConfigInterface::qbufsend(), pos::PixelHdwAddress::rocid(), and pos::PixelDACSettings::rocIsDisabled().

650  {
651  //the point here is to set Vcthr to the nominal values
652  //then enable the ROCs
653 
654  bool bufferData=true;
655 
656  std::vector<unsigned int> dacs;
657 
658  for(unsigned int i=0;i<dacsettings_.size();i++){ //loop over the ROCs
659 
660  bool disableRoc = rocIsDisabled(detconfig, dacsettings_[i].getROCName()); //don't enable ROCs that are disabled in the detconfig
661 
662  dacsettings_[i].getDACs(dacs);
663  int controlreg=dacsettings_[i].getControlRegister();
664 
665  PixelHdwAddress theROC=*(trans->getHdwAddress(dacsettings_[i].getROCName()));
666 
667  //std::cout<<"ROC="<<dacsettings_[i].getROCName()<<" ; VcThr set to "<<dacs[11]
668  // << " ; ROC control reg to be set to: " << controlreg <<std::endl;
669 
670  if (!disableRoc) {
671  pixelFEC->progdac(theROC.mfec(),
672  theROC.mfecchannel(),
673  theROC.hubaddress(),
674  theROC.portaddress(),
675  theROC.rocid(),
676  12, //12 == Vcthr
677  dacs[11],
678  bufferData);
679 
680  //enable the roc (assuming controlreg was set for the roc to be enabled)
681 
682  pixelFEC->progdac(theROC.mfec(),
683  theROC.mfecchannel(),
684  theROC.hubaddress(),
685  theROC.portaddress(),
686  theROC.rocid(),
687  0xfd,
688  controlreg,
689  bufferData);
690 
691  }
692  }
693 
694  if (bufferData) {
695  pixelFEC->qbufsend();
696  }
697 
698 }
unsigned int mfec() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
int i
Definition: DBlmapReader.cc:9
bool rocIsDisabled(const PixelDetectorConfig *detconfig, const PixelROCName rocname) const
virtual int progdac(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, int dacaddress, int dacvalue, bool buffermode=false)=0
unsigned int portaddress() const
unsigned int rocid() const
unsigned int mfecchannel() const
unsigned int hubaddress() const
Store mfec, mfecchannel etc.
std::vector< PixelROCDACSettings > dacsettings_
virtual int qbufsend(void)=0
void PixelDACSettings::writeASCII ( std::string  dir) const
virtual

Implements pos::PixelConfigBase.

Definition at line 392 of file PixelDACSettings.cc.

References gather_cfg::cout, pos::PixelDACSettings::dacsettings_, lut2db_cfg::filename, i, python.rootplot.argparse::module, pos::PixelModuleName::modulename(), and dbtoconf::out.

392  {
393 
394  std::string mthn = "[PixelDACSettings::writeASCII()]\t\t\t " ;
395  PixelModuleName module(dacsettings_[0].getROCName().rocname());
396 
397  std::string filename=dir+"/ROC_DAC_module_"+module.modulename()+".dat";
398  std::cout << __LINE__ << "]\t" << mthn << "Writing to file " << filename << std::endl ;
399  std::ofstream out(filename.c_str());
400 
401  for(unsigned int i=0;i<dacsettings_.size();i++){
402  dacsettings_[i].writeASCII(out);
403  }
404 
405 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelROCDACSettings > dacsettings_
tuple out
Definition: dbtoconf.py:99
This class implements..
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
Definition: vlib.h:209
void PixelDACSettings::writeBinary ( std::string  filename) const

Definition at line 381 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, i, and dbtoconf::out.

381  {
382 
383  std::ofstream out(filename.c_str(),std::ios::binary);
384 
385  for(unsigned int i=0;i<dacsettings_.size();i++){
386  dacsettings_[i].writeBinary(out);
387  }
388 
389 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelROCDACSettings > dacsettings_
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
void pos::PixelDACSettings::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 87 of file PixelDACSettings.h.

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

Reimplemented from pos::PixelConfigBase.

Definition at line 455 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, and i.

457  {
458  std::string mthn = "[PixelDACSettings::writeXML()]\t\t\t " ;
459 
460  for(unsigned int i=0;i<dacsettings_.size();i++){
461  dacsettings_[i].writeXML(outstream);
462  }
463 }
int i
Definition: DBlmapReader.cc:9
std::vector< PixelROCDACSettings > dacsettings_
void PixelDACSettings::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 408 of file PixelDACSettings.cc.

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

413  {
414  std::string mthn = "[PixelDACSettings::writeXMLHeader()]\t\t\t " ;
415  std::stringstream fullPath ;
416 
417  fullPath << path << "/Pixel_RocDacSettings_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
418  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << std::endl ;
419 
420  outstream->open(fullPath.str().c_str()) ;
421 
422  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
423  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
424  *outstream << "" << std::endl ;
425  *outstream << " <!-- " << mthn << "-->" << std::endl ;
426  *outstream << "" << std::endl ;
427  *outstream << " <HEADER>" << std::endl ;
428  *outstream << " <TYPE>" << std::endl ;
429  *outstream << " <EXTENSION_TABLE_NAME>ROC_DAC_SETTINGS_COL</EXTENSION_TABLE_NAME>" << std::endl ;
430  *outstream << " <NAME>ROC DAC Settings Col</NAME>" << std::endl ;
431  *outstream << " </TYPE>" << std::endl ;
432  *outstream << " <RUN>" << std::endl ;
433  *outstream << " <RUN_TYPE>ROC DAC Settings</RUN_TYPE>" << std::endl ;
434  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
435  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
436  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
437  *outstream << " </RUN>" << std::endl ;
438  *outstream << " </HEADER>" << std::endl ;
439  *outstream << "" << std::endl ;
440  *outstream << " <DATA_SET>" << std::endl ;
441  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
442  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
443  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
444  *outstream << " " << std::endl ;
445  *outstream << " <PART>" << std::endl ;
446  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
447  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
448  *outstream << " </PART>" << std::endl ;
449  *outstream << " " << std::endl ;
450 
451  std::cout << __LINE__ << "]\t" << mthn << "Header written" << std::endl ;
452 }
static std::string getmSecTime(void)
list path
Definition: scaleCards.py:51
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:121
void PixelDACSettings::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelConfigBase.

Definition at line 466 of file PixelDACSettings.cc.

References gather_cfg::cout.

468  {
469  std::string mthn = "[PixelDACSettings::writeXMLTrailer()]\t\t\t " ;
470 
471  *outstream << " </DATA_SET>" << std::endl ;
472  *outstream << "</ROOT>" << std::endl ;
473 
474  outstream->close() ;
475  std::cout << __LINE__ << "]\t" << mthn << "Data written" << std::endl ;
476 }
tuple cout
Definition: gather_cfg.py:121

Variable Documentation

std::vector<PixelROCDACSettings> pos::PixelDACSettings::dacsettings_
private

Friends

std::ostream& operator<< ( std::ostream &  s,
const PixelDACSettings mask 
)
friend

Definition at line 711 of file PixelDACSettings.cc.

711  {
712 
713  s << dacs.getDACSettings(0) <<std::endl;
714 
715  return s;
716 
717 }