CMS 3D CMS Logo

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 override
 
void pos::PixelDACSettings::writeBinary (std::string filename) const
 
void pos::PixelDACSettings::writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void pos::PixelDACSettings::writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void pos::PixelDACSettings::writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void pos::PixelDACSettings::writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 

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 161 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_.

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

Definition at line 544 of file PixelDACSettings.cc.

References pos::PixelFECConfigInterface::calpix(), pos::PixelFECConfigInterface::clrcal(), cuy::col, gather_cfg::cout, pos::PixelDACSettings::dacsettings_, pos::PixelFECConfigInterface::dcolenable(), pos::PixelNameTranslation::getHdwAddress(), pos::PixelHdwAddress::hubaddress(), mps_fire::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().

Referenced by pos::PixelDACSettings::numROCs().

545  {
546 
547  bool bufferData=true;
548 
549  std::vector<unsigned int> dacs;
550 
551  //pixelFEC->fecDebug(1); //FIXME someday maybe don't want to take the time
552 
553  for(unsigned int i=0;i<dacsettings_.size();i++){ // loop over ROCs
554 
555  bool disableRoc = rocIsDisabled(detconfig, dacsettings_[i].getROCName());
556 
557  dacsettings_[i].getDACs(dacs);
558 
559  PixelHdwAddress theROC=*(trans->getHdwAddress(dacsettings_[i].getROCName()));
560 
561  //Need to set readout speed (40MHz) and Vcal range (0-1800 mV) and enable the chip
562 
563 
564 
565  // This is not needed. The ControlReg is programmed in setAllDAC(). d.k. 21.01.11
566 // pixelFEC->progdac(theROC.mfec(),
567 // theROC.mfecchannel(),
568 // theROC.hubaddress(),
569 // theROC.portaddress(),
570 // theROC.rocid(),
571 // 0xfd,
572 // controlreg,
573 // bufferData);
574 
575  if (!HVon || disableRoc) dacs[11]=0; //set Vcthr DAC to 0 (Vcthr is DAC 12=11+1)
576  // std::cout<<" ; setting VcThr to "<<dacs[11]<<std::endl; //for debugging
577  pixelFEC->setAllDAC(theROC,dacs,bufferData);
578 
579  // start with no pixels on for calibration
580  pixelFEC->clrcal(theROC.mfec(),
581  theROC.mfecchannel(),
582  theROC.hubaddress(),
583  theROC.portaddress(),
584  theROC.rocid(),
585  bufferData);
586 
587  const bool kmeKLUDGE=false;
588  if(kmeKLUDGE) //enable one pixel per ROC for calibration (all the time!)
589  {
590  unsigned int col=0;
591  //for(unsigned int col=0;col<52;col+=50) //try 0, 50
592  {
593  pixelFEC->calpix(theROC.mfec(),
594  theROC.mfecchannel(),
595  theROC.hubaddress(),
596  theROC.portaddress(),
597  theROC.rocid(),
598  col, //column
599  0, //row
600  1, //caldata
601  bufferData);
602  }
603  }
604 
605  // enable all the double columns
606  for(int dcol=0;dcol<26;dcol++){
607  pixelFEC->dcolenable(theROC.mfec(),
608  theROC.mfecchannel(),
609  theROC.hubaddress(),
610  theROC.portaddress(),
611  theROC.rocid(),
612  dcol,
613  1,
614  bufferData);
615  }
616 
617  if (!HVon || disableRoc) { //HV off
618  int controlreg=dacsettings_[i].getControlRegister();
619  // std::cout << "[PixelDACSettings::generateConfiguration] HV off! ROC control reg to be set to: " << (controlreg|0x2) <<std::endl;
620  pixelFEC->progdac(theROC.mfec(),
621  theROC.mfecchannel(),
622  theROC.hubaddress(),
623  theROC.portaddress(),
624  theROC.rocid(),
625  0xfd,
626  controlreg | 0x2, //=010 in binary. should disable the chip
627  bufferData);
628  } //HV off
629 
630 
631  // Now program (again) the temperature register to make sure it is the last one
632  // and appears in the LastDAC
633  if(readTemperatures) {
634  // std::cout<<"ROC="<<dacsettings_[i].getROCName()<<" ; VcThr set to "<<dacs[11]
635  // << " ROC control reg to be set to: " << dacs[28] <<" LastDAC=Temp"<<std::endl;
636  if( (theROC.mfec()==1) && (theROC.mfecchannel()==1) && (theROC.hubaddress()==0) &&
637  (theROC.portaddress()==0) && (theROC.rocid()) )
638  std::cout<<"ROC="<<dacsettings_[i].getROCName()<< " ROC control reg to be set to: "
639  << dacs[28] <<" LastDAC=Temp "<<temperatureReg<<std::endl;
640  //int temperatureReg = dacs[26]; // overwrite with the number from DB
641  pixelFEC->progdac(theROC.mfec(),
642  theROC.mfecchannel(),
643  theROC.hubaddress(),
644  theROC.portaddress(),
645  theROC.rocid(),
646  0x1B,
647  temperatureReg,bufferData);
648  } else {
649  // std::cout<<"ROC="<<dacsettings_[i].getROCName()<<" ; VcThr set to "<<dacs[11]
650  // << " ROC control reg to be set to: " << dacs[28] <<" LastDAC=Vcal"<<std::endl;
651  if( (theROC.mfec()==1) && (theROC.mfecchannel()==1) && (theROC.hubaddress()==0) &&
652  (theROC.portaddress()==0) && (theROC.rocid()) )
653  std::cout<<"ROC="<<dacsettings_[i].getROCName()
654  << " ROC control reg to be set to: " << dacs[28] <<" LastDAC=Vcal"<<std::endl;
655  // VCAL
656  pixelFEC->progdac(theROC.mfec(),
657  theROC.mfecchannel(),
658  theROC.hubaddress(),
659  theROC.portaddress(),
660  theROC.rocid(),
661  0x19,
662  200,
663  bufferData);
664  }
665 
666  } // end ROC loop
667 
668  if (bufferData) { // Send data to the FEC
669  pixelFEC->qbufsend();
670  }
671 
672 }
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
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 calpix(int mfec, int mfecchannel, int hubaddress, int portaddress, int rocid, int coladdr, int rowaddress, int caldata, bool buffermode=false)=0
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
col
Definition: cuy.py:1009
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 377 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_.

Referenced by operator<<().

377  {
378 
379  return dacsettings_[ROCId];
380 
381 }
std::vector< PixelROCDACSettings > dacsettings_
PixelROCDACSettings * PixelDACSettings::getDACSettings ( PixelROCName  name)

Definition at line 383 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, mps_fire::i, and dataset::name.

383  {
384 
385 
386  for(unsigned int i=0;i<dacsettings_.size();i++){
387  if (dacsettings_[i].getROCName()==name) return &(dacsettings_[i]);
388  }
389 
390  return nullptr;
391 
392 }
std::vector< PixelROCDACSettings > dacsettings_
unsigned int pos::PixelDACSettings::numROCs ( )
inline
PixelDACSettings::PixelDACSettings ( std::string  filename)

Definition at line 33 of file PixelDACSettings.cc.

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

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

Definition at line 168 of file PixelDACSettings.cc.

References EnergyCorrector::c, MessageLogger_cfi::cerr, pos::PixelDACSettings::dacsettings_, cuy::ins, 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, gen::n, alignCSCRings::r, pos::PixelROCDACSettings::read(), AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

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

References pos::PixelDACSettings::dacsettings_.

154  :
155  PixelConfigBase("","","") {
156  dacsettings_.push_back(rocname) ;
157 
158 }
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 820 of file PixelDACSettings.cc.

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

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

820  {
821 
822  const std::map<PixelROCName, PixelROCStatus> & roclist=detconfig->getROCsList();
823  const std::map<PixelROCName, PixelROCStatus>::const_iterator iroc = roclist.find(rocname);
824  assert(iroc != roclist.end()); // the roc name should always be found
825  PixelROCStatus thisROCstatus = iroc->second;
826 
827  return thisROCstatus.get(PixelROCStatus::noAnalogSignal);
828 
829 }
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 674 of file PixelDACSettings.cc.

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

Referenced by pos::PixelDACSettings::numROCs().

674  {
675  //the point here is to set Vcthr to 0
676  //then disable the ROCs
677 
678  //note -- no need to look at the detconfig here, because we're going to disable everything no matter what
679 
680  bool bufferData=true;
681 
682  std::vector<unsigned int> dacs;
683 
684  for(unsigned int i=0;i<dacsettings_.size();i++){ //loop over the ROCs
685 
686  dacsettings_[i].getDACs(dacs);
687  int controlreg=dacsettings_[i].getControlRegister();
688 
689  PixelHdwAddress theROC=*(trans->getHdwAddress(dacsettings_[i].getROCName()));
690 
691  //std::cout<<"disabling ROC="<<dacsettings_[i].getROCName()<<std::endl;
692  pixelFEC->progdac(theROC.mfec(),
693  theROC.mfecchannel(),
694  theROC.hubaddress(),
695  theROC.portaddress(),
696  theROC.rocid(),
697  12, //12 == Vcthr
698  0, //set Vcthr to 0
699  bufferData);
700 
701  //this should disable the roc
702  pixelFEC->progdac(theROC.mfec(),
703  theROC.mfecchannel(),
704  theROC.hubaddress(),
705  theROC.portaddress(),
706  theROC.rocid(),
707  0xfd,
708  controlreg | 0x2,
709  bufferData);
710 
711  // Now program (again) the temperature register to make sure it is the last one
712  // and appears in the LastDAC
713  if(readTemperatures) {
714  //int temperatureReg = dacs[26]; // value from DB
715  pixelFEC->progdac(theROC.mfec(),
716  theROC.mfecchannel(),
717  theROC.hubaddress(),
718  theROC.portaddress(),
719  theROC.rocid(),
720  0x1B,
721  temperatureReg,
722  bufferData);
723  } else {
724  // VCAL
725  pixelFEC->progdac(theROC.mfec(),
726  theROC.mfecchannel(),
727  theROC.hubaddress(),
728  theROC.portaddress(),
729  theROC.rocid(),
730  0x19,
731  200,
732  bufferData);
733  }
734 
735  }
736 
737  if (bufferData) { //just copying the way it was done in the existing method
738  pixelFEC->qbufsend();
739  }
740 }
unsigned int mfec() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) 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::setVcthrEnable ( PixelFECConfigInterface pixelFEC,
PixelNameTranslation trans,
PixelDetectorConfig detconfig 
) const

Definition at line 742 of file PixelDACSettings.cc.

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

Referenced by pos::PixelDACSettings::numROCs().

742  {
743  //the point here is to set Vcthr to the nominal values
744  //then enable the ROCs
745 
746  bool bufferData=true;
747 
748  std::vector<unsigned int> dacs;
749 
750  for(unsigned int i=0;i<dacsettings_.size();i++){ //loop over the ROCs
751 
752  bool disableRoc = rocIsDisabled(detconfig, dacsettings_[i].getROCName()); //don't enable ROCs that are disabled in the detconfig
753 
754 
755  //std::cout<<"ROC="<<dacsettings_[i].getROCName()<<" ; VcThr set to "<<dacs[11]
756  // << " ; ROC control reg to be set to: " << controlreg <<std::endl;
757 
758  if (!disableRoc) { // Disable
759 
760  dacsettings_[i].getDACs(dacs);
761  int controlreg=dacsettings_[i].getControlRegister();
762 
763  PixelHdwAddress theROC=*(trans->getHdwAddress(dacsettings_[i].getROCName()));
764 
765  pixelFEC->progdac(theROC.mfec(),
766  theROC.mfecchannel(),
767  theROC.hubaddress(),
768  theROC.portaddress(),
769  theROC.rocid(),
770  12, //12 == Vcthr
771  dacs[11],
772  bufferData);
773 
774  //enable the roc (assuming controlreg was set for the roc to be enabled)
775 
776  pixelFEC->progdac(theROC.mfec(),
777  theROC.mfecchannel(),
778  theROC.hubaddress(),
779  theROC.portaddress(),
780  theROC.rocid(),
781  0xfd,
782  controlreg,
783  bufferData);
784 
785  // Now program (again) the temperature register to make sure it is the last one
786  // and appears in the LastDAC
787  if(readTemperatures) {
788  //int temperatureReg = dacs[26]; // value from DB
789  pixelFEC->progdac(theROC.mfec(),
790  theROC.mfecchannel(),
791  theROC.hubaddress(),
792  theROC.portaddress(),
793  theROC.rocid(),
794  0x1B,
795  temperatureReg,
796  bufferData);
797  } else {
798  // VCAL
799  pixelFEC->progdac(theROC.mfec(),
800  theROC.mfecchannel(),
801  theROC.hubaddress(),
802  theROC.portaddress(),
803  theROC.rocid(),
804  0x19,
805  200,
806  bufferData);
807  }
808 
809  } // end disable
810 
811  } // loop over ROCs
812 
813 
814  if (bufferData) { // Send data to FEC
815  pixelFEC->qbufsend();
816  }
817 
818 }
unsigned int mfec() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
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
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 405 of file PixelDACSettings.cc.

References gather_cfg::cout, pos::PixelDACSettings::dacsettings_, corrVsCorr::filename, mps_fire::i, pos::PixelModuleName::modulename(), MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pos::PixelDACSettings::numROCs().

405  {
406 
407  std::string mthn = "[PixelDACSettings::writeASCII()]\t\t\t " ;
408  PixelModuleName module(dacsettings_[0].getROCName().rocname());
409 
410  std::string filename=dir+"/ROC_DAC_module_"+module.modulename()+".dat";
411  std::cout << __LINE__ << "]\t" << mthn << "Writing to file " << filename << std::endl ;
412  std::ofstream out(filename.c_str());
413 
414  for(unsigned int i=0;i<dacsettings_.size();i++){
415  dacsettings_[i].writeASCII(out);
416  }
417 
418 }
std::vector< PixelROCDACSettings > dacsettings_
This class implements..
dbl *** dir
Definition: mlp_gen.cc:35
Definition: vlib.h:208
void PixelDACSettings::writeBinary ( std::string  filename) const

Definition at line 394 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, mps_fire::i, and MillePedeFileConverter_cfg::out.

Referenced by pos::PixelDACSettings::numROCs().

394  {
395 
396  std::ofstream out(filename.c_str(),std::ios::binary);
397 
398  for(unsigned int i=0;i<dacsettings_.size();i++){
399  dacsettings_[i].writeBinary(out);
400  }
401 
402 }
std::vector< PixelROCDACSettings > dacsettings_
void pos::PixelDACSettings::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual
void PixelDACSettings::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 468 of file PixelDACSettings.cc.

References pos::PixelDACSettings::dacsettings_, mps_fire::i, and AlCaHLTBitMon_QueryRunRegistry::string.

470  {
471  std::string mthn = "[PixelDACSettings::writeXML()]\t\t\t " ;
472 
473  for(unsigned int i=0;i<dacsettings_.size();i++){
474  dacsettings_[i].writeXML(outstream);
475  }
476 }
std::vector< PixelROCDACSettings > dacsettings_
void PixelDACSettings::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 421 of file PixelDACSettings.cc.

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

Referenced by pos::PixelDACSettings::writeXML().

426  {
427  std::string mthn = "[PixelDACSettings::writeXMLHeader()]\t\t\t " ;
428  std::stringstream fullPath ;
429 
430  fullPath << path << "/Pixel_RocDacSettings_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
431  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << std::endl ;
432 
433  outstream->open(fullPath.str().c_str()) ;
434 
435  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
436  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
437  *outstream << "" << std::endl ;
438  *outstream << " <!-- " << mthn << "-->" << std::endl ;
439  *outstream << "" << std::endl ;
440  *outstream << " <HEADER>" << std::endl ;
441  *outstream << " <TYPE>" << std::endl ;
442  *outstream << " <EXTENSION_TABLE_NAME>ROC_DAC_SETTINGS_COL</EXTENSION_TABLE_NAME>" << std::endl ;
443  *outstream << " <NAME>ROC DAC Settings Col</NAME>" << std::endl ;
444  *outstream << " </TYPE>" << std::endl ;
445  *outstream << " <RUN>" << std::endl ;
446  *outstream << " <RUN_TYPE>ROC DAC Settings</RUN_TYPE>" << std::endl ;
447  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
448  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
449  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
450  *outstream << " </RUN>" << std::endl ;
451  *outstream << " </HEADER>" << std::endl ;
452  *outstream << "" << std::endl ;
453  *outstream << " <DATA_SET>" << std::endl ;
454  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
455  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
456  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
457  *outstream << " " << std::endl ;
458  *outstream << " <PART>" << std::endl ;
459  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
460  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
461  *outstream << " </PART>" << std::endl ;
462  *outstream << " " << std::endl ;
463 
464  std::cout << __LINE__ << "]\t" << mthn << "Header written" << std::endl ;
465 }
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
void PixelDACSettings::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 479 of file PixelDACSettings.cc.

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

Referenced by pos::PixelDACSettings::writeXML().

481  {
482  std::string mthn = "[PixelDACSettings::writeXMLTrailer()]\t\t\t " ;
483 
484  *outstream << " </DATA_SET>" << std::endl ;
485  *outstream << "</ROOT>" << std::endl ;
486 
487  outstream->close() ;
488  std::cout << __LINE__ << "]\t" << mthn << "Data written" << std::endl ;
489 }

Variable Documentation

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

Friends

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

Definition at line 831 of file PixelDACSettings.cc.

Referenced by pos::PixelDACSettings::writeXML().

831  {
832 
833  s << dacs.getDACSettings(0) <<std::endl;
834 
835  return s;
836 
837 }