#include <interface/PixelCalibConfiguration.h>
Public Member Functions | |
void | buildROCAndModuleLists (const PixelNameTranslation *translation, const PixelDetectorConfig *detconfig) |
const std::set< PixelChannel > & | channelList () const |
const std::vector< std::vector < unsigned int > > & | columnList () const |
bool | containsScan (std::string name) const |
std::vector< std::pair < unsigned int, std::vector < unsigned int > > > & | fedCardsAndChannels (unsigned int crate, PixelNameTranslation *translation, PixelFEDConfig *fedconfig, PixelDetectorConfig *detconfig) const |
std::set< unsigned int > | getFECCrates (const PixelNameTranslation *translation, const PixelFECConfig *fecconfig) const |
std::set< unsigned int > | getFEDCrates (const PixelNameTranslation *translation, const PixelFEDConfig *fedconfig) const |
std::map< unsigned int, std::set< unsigned int > > | getFEDsAndChannels (PixelNameTranslation *translation) |
std::string | getStreamedContent (void) const |
std::set< unsigned int > | getTKFECCrates (const PixelPortcardMap *portcardmap, const std::map< std::string, PixelPortCardConfig * > &mapNamePortCard, const PixelTKFECConfig *tkfecconfig) const |
unsigned int | iScan (std::string dac) const |
unsigned int | maxNumHitsPerROC () const |
std::string | mode () const |
const std::set< PixelModuleName > & | moduleList () const |
unsigned int | nConfigurations () const |
void | nextFECState (std::map< unsigned int, PixelFECConfigInterface * > &pixelFECs, PixelDetectorConfig *detconfig, PixelNameTranslation *trans, std::map< pos::PixelModuleName, pos::PixelMaskBase * > *masks, std::map< pos::PixelModuleName, pos::PixelTrimBase * > *trims, std::map< pos::PixelModuleName, pos::PixelDACSettings * > *dacss, unsigned int state) const |
bool | noHits () const |
unsigned int | nParameters () const |
unsigned int | nPixelPatterns () const |
unsigned int | nROC () const |
unsigned int | nScanPoints () const |
unsigned int | nScanPoints (std::string dac) const |
unsigned int | nTriggersPerPattern () const |
unsigned int | nTriggersTotal () const |
unsigned int | numberOfScanVariables () const |
std::map< std::string, std::string > | parametersList () const |
std::string | parameterValue (std::string parameterName) const |
PixelCalibConfiguration (std::vector< std::vector< std::string > > &) | |
PixelCalibConfiguration (std::string filename="") | |
std::set< std::pair< unsigned int, unsigned int > > | pixelsWithHits (unsigned int state) const |
const std::vector< PixelROCName > & | rocList () const |
const std::vector< std::vector < unsigned int > > & | rowList () const |
unsigned int | scanCounter (std::string dac, unsigned int state) const |
std::string | scanName (unsigned int iscan) const |
bool | scanningROCForState (PixelROCName roc, unsigned int state) const |
unsigned int | scanValue (std::string dac, unsigned int state) const |
unsigned int | scanValue (std::string dac, unsigned int state, PixelROCName roc) const |
double | scanValueMax (std::string dac) const |
double | scanValueMin (std::string dac) const |
std::vector< unsigned int > | scanValues (std::string dac) const |
bool | scanValuesMixedAcrossROCs (std::string dac) const |
double | scanValueStep (std::string dac) const |
bool | singleROC () const |
virtual void | writeASCII (std::string dir="") const |
virtual void | writeXML (std::ofstream *out) const |
void | writeXML (pos::PixelConfigKey key, int version, std::string path) const |
virtual void | writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const |
virtual void | writeXMLTrailer (std::ofstream *out) const |
virtual | ~PixelCalibConfiguration () |
Private Member Functions | |
void | buildObjectsDependingOnTheNameTranslation (const PixelNameTranslation *aNameTranslation) |
void | buildROCAndModuleListsFromROCSet (const std::set< PixelROCName > &rocSet) |
unsigned int | colCounter (unsigned int state) const |
void | disablePixels (PixelFECConfigInterface *pixelFEC, pos::PixelROCTrimBits *trims, PixelHdwAddress theROC) const |
void | disablePixels (PixelFECConfigInterface *pixelFEC, unsigned int irows, unsigned int icols, pos::PixelROCTrimBits *trims, PixelHdwAddress theROC) const |
void | enablePixels (PixelFECConfigInterface *pixelFEC, unsigned int irows, unsigned int icols, pos::PixelROCMaskBits *masks, pos::PixelROCTrimBits *trims, PixelHdwAddress theROC) const |
unsigned int | nScanPoints (unsigned int iscan) const |
unsigned int | numROCsCalibratedOnChannel (PixelROCName roc) const |
unsigned int | ROCNumberOnChannelAmongThoseCalibrated (PixelROCName roc) const |
unsigned int | rowCounter (unsigned int state) const |
unsigned int | scanCounter (unsigned int iscan, unsigned int state) const |
unsigned int | scanROC (unsigned int state) const |
unsigned int | scanValue (unsigned int iscan, unsigned int state, PixelROCName roc) const |
unsigned int | scanValue (unsigned int iscan, unsigned int state, unsigned int ROCNumber, unsigned int ROCsOnChannel) const |
double | scanValueMax (unsigned int iscan) const |
double | scanValueMin (unsigned int iscan) const |
std::vector< unsigned int > | scanValues (unsigned int iscan) const |
bool | scanValuesMixedAcrossROCs (unsigned int iscan) const |
double | scanValueStep (unsigned int iscan) const |
Private Attributes | |
bool | _bufferData |
std::string | calibFileContent_ |
std::set< PixelChannel > | channels_ |
std::vector< std::vector < unsigned int > > | cols_ |
std::vector< PixelDACScanRange > | dacs_ |
std::vector< std::pair < unsigned int, std::vector < unsigned int > > > | fedCardsAndChannels_ |
bool | highVCalRange_ |
std::set< PixelModuleName > | modules_ |
unsigned int | nROC_ |
unsigned int | ntrigger_ |
std::map< PixelROCName, unsigned int > | numROCsCalibratedOnChannel_ |
bool | objectsDependingOnTheNameTranslationBuilt_ |
std::vector< int > | old_icols |
std::vector< int > | old_irows |
std::map< std::string, std::string > | parameters_ |
bool | rocAndModuleListsBuilt_ |
std::vector< PixelROCInfo > | rocInfo_ |
std::vector< std::string > | rocListInstructions_ |
std::map< PixelROCName, unsigned int > | ROCNumberOnChannelAmongThoseCalibrated_ |
std::vector< PixelROCName > | rocs_ |
std::vector< std::vector < unsigned int > > | rows_ |
bool | singleROC_ |
bool | usesROCList_ |
Friends | |
std::ostream & | operator<< (std::ostream &s, const PixelCalibConfiguration &calib) |
" " " "
It features a double inheritance, both from ConfigurationObjects and CalibrationObjects
A longer explanation will be placed here later
Definition at line 63 of file PixelCalibConfiguration.h.
PixelCalibConfiguration::PixelCalibConfiguration | ( | std::string | filename = "" |
) |
Definition at line 295 of file PixelCalibConfiguration.cc.
References _bufferData, funct::abs(), buildROCAndModuleListsFromROCSet(), calibFileContent_, cols, cols_, GenMuonPlsPt100GeV_cfg::cout, dacs_, lat::endl(), first, highVCalRange_, in, index, pos::k_DACName_Vcal, prof2calltree::last, StageA43Bx_cfi::mix, pos::PixelCalibBase::mode_, name, ntrigger_, objectsDependingOnTheNameTranslationBuilt_, parameters_, rocAndModuleListsBuilt_, rocListInstructions_, rows, rows_, pos::PixelDACScanRange::setNegative(), pos::PixelDACScanRange::setRelative(), singleROC_, cmsRelvalreportInput::step, tmp, usesROCList_, and values.
00295 : 00296 PixelCalibBase(), PixelConfigBase("","","") { 00297 00298 std::string mthn = "[PixelCalibConfiguration::PixelCalibConfiguration()]\t " ; 00299 00300 _bufferData=true; 00301 00302 std::ifstream in(filename.c_str()); 00303 00304 if (!in.good()){ 00305 std::cout << mthn << "Could not open:"<<filename<<std::endl; 00306 assert(0); 00307 } 00308 else { 00309 std::cout << mthn << "Opened:"<<filename<<std::endl; 00310 } 00311 00312 std::string tmp; 00313 00314 in >> tmp; 00315 00316 if (tmp=="Mode:"){ 00317 in >> mode_; 00318 std::cout << mthn << "PixelCalibConfiguration mode="<<mode_<< std::endl; 00319 in >>tmp; 00320 } else { 00321 mode_="FEDChannelOffsetPixel"; 00322 std::cout << mthn << "PixelCalibCOnfiguration mode not set, is this an old file? " 00323 << std::endl; 00324 assert(0); 00325 } 00326 00327 singleROC_=false; 00328 00329 if (tmp=="SingleROC") { 00330 singleROC_=true; 00331 in >> tmp; 00332 } 00333 00334 // Read in parameters, if any. 00335 if (tmp=="Parameters:") { 00336 in >> tmp; 00337 while (tmp!="Rows:") 00338 { 00339 assert( !in.eof() ); 00340 std::string paramName = tmp; 00341 in >> tmp; // tmp contains the parameter value 00342 parameters_[paramName] = tmp; 00343 in >> tmp; // tmp contains the next parameter's name, or "Rows:" 00344 } 00345 } 00346 00347 assert(tmp=="Rows:"); 00348 00349 in >> tmp; 00350 00351 std::vector <unsigned int> rows; 00352 while (tmp!="Cols:"){ 00353 if (tmp=="|") { 00354 rows_.push_back(rows); 00355 rows.clear(); 00356 } 00357 else{ 00358 if (tmp!="*"){ 00359 rows.push_back(atoi(tmp.c_str())); 00360 } 00361 } 00362 in >> tmp; 00363 } 00364 rows_.push_back(rows); 00365 rows.clear(); 00366 00367 in >> tmp; 00368 00369 std::vector <unsigned int> cols; 00370 while ((tmp!="VcalLow:")&&(tmp!="VcalHigh:")&& 00371 (tmp!="Vcal:")&&(tmp!="VcalHigh")&&(tmp!="VcalLow")){ 00372 if (tmp=="|") { 00373 cols_.push_back(cols); 00374 cols.clear(); 00375 } 00376 else{ 00377 if (tmp!="*"){ 00378 cols.push_back(atoi(tmp.c_str())); 00379 } 00380 } 00381 in >> tmp; 00382 } 00383 cols_.push_back(cols); 00384 cols.clear(); 00385 00386 highVCalRange_=true; 00387 00388 if (tmp=="VcalLow") { 00389 highVCalRange_=false; 00390 in >> tmp; 00391 } 00392 00393 if (tmp=="VcalHigh") { 00394 highVCalRange_=true; 00395 in >> tmp; 00396 } 00397 00398 if (tmp=="VcalLow:") { 00399 highVCalRange_=false; 00400 } 00401 00402 if ((tmp=="VcalLow:")||(tmp=="VcalHigh:")||(tmp=="Vcal:")){ 00403 unsigned int first,last,step; 00404 in >> first >> last >> step; 00405 unsigned int index=1; 00406 if (dacs_.size()>0) { 00407 index=dacs_.back().index()*dacs_.back().getNPoints(); 00408 } 00409 in >> tmp; 00410 bool mix = false; 00411 if ( tmp=="mix" ) 00412 { 00413 mix = true; 00414 in >> tmp; 00415 } 00416 PixelDACScanRange dacrange(pos::k_DACName_Vcal,first,last,step,index,mix); 00417 dacs_.push_back(dacrange); 00418 } 00419 else{ 00420 00421 //in >> tmp; 00422 while(tmp=="Scan:"||tmp=="ScanValues:"){ 00423 if (tmp=="ScanValues:"){ 00424 std::string dacname; 00425 in >> dacname; 00426 vector<unsigned int> values; 00427 int val; 00428 in >> val; 00429 while (val!=-1) { 00430 values.push_back(val); 00431 in >> val; 00432 } 00433 unsigned int index=1; 00434 if (dacs_.size()>0) { 00435 index=dacs_.back().index()*dacs_.back().getNPoints(); 00436 } 00437 PixelDACScanRange dacrange(dacname,values,index,false); 00438 dacs_.push_back(dacrange); 00439 in >> tmp; 00440 } 00441 else { 00442 std::string dacname; 00443 in >> dacname; 00444 unsigned int first,last,step; 00445 in >> first >> last >> step; 00446 unsigned int index=1; 00447 if (dacs_.size()>0) { 00448 index=dacs_.back().index()*dacs_.back().getNPoints(); 00449 } 00450 in >> tmp; 00451 bool mix = false; 00452 if ( tmp=="mix" ) 00453 { 00454 mix = true; 00455 in >> tmp; 00456 } 00457 PixelDACScanRange dacrange(dacname,first,last,step,index,mix); 00458 dacs_.push_back(dacrange); 00459 } 00460 } 00461 00462 while ((tmp=="Set:")||(tmp=="SetRelative:")){ 00463 string name; 00464 in >> name; 00465 int val; 00466 in >> val; 00467 unsigned int absval=std::abs(val); 00468 unsigned int index=1; 00469 if (dacs_.size()>0) index=dacs_.back().index()*dacs_.back().getNPoints(); 00470 PixelDACScanRange dacrange(name,absval,absval,1,index,false); 00471 if (tmp=="SetRelative:") { 00472 dacrange.setRelative(); 00473 if (val<0) { 00474 dacrange.setNegative(); 00475 } 00476 } 00477 dacs_.push_back(dacrange); 00478 in >> tmp; 00479 } 00480 } 00481 00482 assert(tmp=="Repeat:"); 00483 00484 in >> ntrigger_; 00485 00486 in >> tmp; 00487 00488 usesROCList_=false; 00489 bool buildROCListNow = false; 00490 if ( tmp=="Rocs:" ) { 00491 buildROCListNow = true; 00492 usesROCList_=true; 00493 } 00494 else { assert(tmp=="ToCalibrate:"); buildROCListNow = false; } 00495 00496 while (!in.eof()) 00497 { 00498 tmp = ""; 00499 in >> tmp; 00500 00501 // added by F.Blekman to be able to deal with POS245 style calib.dat files in CMSSW 00502 // these files use the syntax: 00503 // Rocs: 00504 // all 00505 00506 if( tmp=="all" || tmp=="+" || tmp=="-" ){ 00507 buildROCListNow=false; 00508 } 00509 // end of addition by F.B. 00510 00511 if ( tmp=="" ) continue; 00512 rocListInstructions_.push_back(tmp); 00513 } 00514 00515 in.close(); 00516 00517 rocAndModuleListsBuilt_ = false; 00518 if ( buildROCListNow ) 00519 { 00520 std::set<PixelROCName> rocSet; 00521 for(std::vector<std::string>::iterator rocListInstructions_itr = rocListInstructions_.begin(); rocListInstructions_itr != rocListInstructions_.end(); rocListInstructions_itr++) 00522 { 00523 PixelROCName rocname(*rocListInstructions_itr); 00524 rocSet.insert(rocname); 00525 } 00526 buildROCAndModuleListsFromROCSet(rocSet); 00527 } 00528 00529 objectsDependingOnTheNameTranslationBuilt_ = false; 00530 00531 // Added by Dario as a temporary patch for Debbie (this will disappear in the future) 00532 std::ifstream inTmp(filename.c_str()); 00533 calibFileContent_ = "" ; 00534 while(!inTmp.eof()) 00535 { 00536 std::string tmpString ; 00537 getline (inTmp, tmpString); 00538 calibFileContent_ += tmpString + "\n"; 00539 //cout << "[PixelCalibConfiguration::~PixelCalibConfiguration()]\t\t" << calibFileContent_ << endl ; 00540 } 00541 inTmp.close() ; 00542 // End of temporary patch 00543 00544 return; 00545 00546 }
PixelCalibConfiguration::PixelCalibConfiguration | ( | std::vector< std::vector< std::string > > & | tableMat | ) |
View's name: CONF_KEY_PIXEL_CALIB_MV CONFIG_KEY_ID NOT NULL NUMBER(38) CONFG_KEY NOT NULL VARCHAR2(80) VERSION VARCHAR2(40) KIND_OF_COND NOT NULL VARCHAR2(40) RUN_TYPE VARCHAR2(40) RUN_NUMBER NUMBER(38) CALIB_OBJ_DATA_FILE NOT NULL VARCHAR2(200) CALIB_OBJ_DATA_CLOB NOT NULL CLOB
Definition at line 21 of file PixelCalibConfiguration.cc.
References _bufferData, buildROCAndModuleListsFromROCSet(), c, calibFileContent_, TestMuL1L2Filter_cff::cerr, cols, cols_, GenMuonPlsPt100GeV_cfg::cout, dacs_, lat::endl(), first, highVCalRange_, in, index, pos::k_DACName_Vcal, prof2calltree::last, StageA43Bx_cfi::mix, pos::PixelCalibBase::mode_, n, name, ntrigger_, objectsDependingOnTheNameTranslationBuilt_, parameters_, rocAndModuleListsBuilt_, rocListInstructions_, rows, rows_, pos::PixelDACScanRange::setRelative(), singleROC_, cmsRelvalreportInput::step, tmp, usesROCList_, and values.
00021 : 00022 PixelCalibBase(), PixelConfigBase("","","") 00023 { 00024 std::map<std::string , int > colM; 00025 std::vector<std::string > colNames; 00039 colNames.push_back("CONFIG_KEY_ID" ); 00040 colNames.push_back("CONFG_KEY" ); 00041 colNames.push_back("VERSION" ); 00042 colNames.push_back("KIND_OF_COND" ); 00043 colNames.push_back("RUN_TYPE" ); 00044 colNames.push_back("RUN_NUMBER" ); 00045 colNames.push_back("CALIB_OBJ_DATA_FILE"); 00046 colNames.push_back("CALIB_OBJ_DATA_CLOB"); 00047 00048 for(unsigned int c = 0 ; c < tableMat[0].size() ; c++) 00049 { 00050 for(unsigned int n=0; n<colNames.size(); n++) 00051 { 00052 if(tableMat[0][c] == colNames[n]) 00053 { 00054 colM[colNames[n]] = c; 00055 break; 00056 } 00057 } 00058 }//end for 00059 for(unsigned int n=0; n<colNames.size(); n++) 00060 { 00061 if(colM.find(colNames[n]) == colM.end()) 00062 { 00063 std::cerr << "[PixelCalibConfiguration::PixelCalibConfiguration()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl; 00064 assert(0); 00065 } 00066 } 00067 00068 _bufferData=true; 00069 00070 std::istringstream in ; 00071 in.str(tableMat[1][colM["CALIB_OBJ_DATA_CLOB"]]) ; 00072 00073 std::string tmp; 00074 00075 in >> tmp; 00076 00077 if (tmp=="Mode:"){ 00078 in >> mode_; 00079 std::cout << "PixelCalibConfiguration mode="<<mode_<< std::endl; 00080 in >>tmp; 00081 } else { 00082 mode_="FEDChannelOffsetPixel"; 00083 std::cout << "PixelCalibCOnfiguration mode not set, is this an old file? " 00084 << std::endl; 00085 assert(0); 00086 } 00087 00088 singleROC_=false; 00089 00090 if (tmp=="SingleROC") { 00091 singleROC_=true; 00092 in >> tmp; 00093 } 00094 00095 // Read in parameters, if any. 00096 if (tmp=="Parameters:") { 00097 in >> tmp; 00098 while (tmp!="Rows:") 00099 { 00100 assert( !in.eof() ); 00101 std::string paramName = tmp; 00102 in >> tmp; // tmp contains the parameter value 00103 parameters_[paramName] = tmp; 00104 in >> tmp; // tmp contains the next parameter's name, or "Rows:" 00105 } 00106 } 00107 00108 assert(tmp=="Rows:"); 00109 00110 in >> tmp; 00111 00112 std::vector <unsigned int> rows; 00113 while (tmp!="Cols:"){ 00114 if (tmp=="|") { 00115 rows_.push_back(rows); 00116 rows.clear(); 00117 } 00118 else{ 00119 if (tmp!="*"){ 00120 rows.push_back(atoi(tmp.c_str())); 00121 } 00122 } 00123 in >> tmp; 00124 } 00125 rows_.push_back(rows); 00126 rows.clear(); 00127 00128 in >> tmp; 00129 00130 std::vector <unsigned int> cols; 00131 while ((tmp!="VcalLow:")&&(tmp!="VcalHigh:")&& 00132 (tmp!="Vcal:")&&(tmp!="VcalHigh")&&(tmp!="VcalLow")){ 00133 if (tmp=="|") { 00134 cols_.push_back(cols); 00135 cols.clear(); 00136 } 00137 else{ 00138 if (tmp!="*"){ 00139 cols.push_back(atoi(tmp.c_str())); 00140 } 00141 } 00142 in >> tmp; 00143 } 00144 cols_.push_back(cols); 00145 cols.clear(); 00146 00147 highVCalRange_=true; 00148 00149 if (tmp=="VcalLow") { 00150 highVCalRange_=false; 00151 in >> tmp; 00152 } 00153 00154 if (tmp=="VcalHigh") { 00155 highVCalRange_=true; 00156 in >> tmp; 00157 } 00158 00159 if (tmp=="VcalLow:") { 00160 highVCalRange_=false; 00161 } 00162 00163 if ((tmp=="VcalLow:")||(tmp=="VcalHigh:")||(tmp=="Vcal:")){ 00164 unsigned int first,last,step; 00165 in >> first >> last >> step; 00166 unsigned int index=1; 00167 if (dacs_.size()>0) { 00168 index=dacs_.back().index()*dacs_.back().getNPoints(); 00169 } 00170 in >> tmp; 00171 bool mix = false; 00172 if ( tmp=="mix" ) 00173 { 00174 mix = true; 00175 in >> tmp; 00176 } 00177 PixelDACScanRange dacrange(pos::k_DACName_Vcal,first,last,step,index,mix); 00178 dacs_.push_back(dacrange); 00179 } 00180 else{ 00181 00182 //in >> tmp; 00183 while(tmp=="Scan:"||tmp=="ScanValues:"){ 00184 if (tmp=="ScanValues:"){ 00185 std::string dacname; 00186 in >> dacname; 00187 vector<unsigned int> values; 00188 int val; 00189 in >> val; 00190 while (val!=-1) { 00191 values.push_back(val); 00192 in >> val; 00193 } 00194 unsigned int index=1; 00195 if (dacs_.size()>0) { 00196 index=dacs_.back().index()*dacs_.back().getNPoints(); 00197 } 00198 PixelDACScanRange dacrange(dacname,values,index,false); 00199 dacs_.push_back(dacrange); 00200 in >> tmp; 00201 } 00202 else { 00203 std::string dacname; 00204 in >> dacname; 00205 unsigned int first,last,step; 00206 in >> first >> last >> step; 00207 unsigned int index=1; 00208 if (dacs_.size()>0) { 00209 index=dacs_.back().index()*dacs_.back().getNPoints(); 00210 } 00211 in >> tmp; 00212 bool mix = false; 00213 if ( tmp=="mix" ) 00214 { 00215 mix = true; 00216 in >> tmp; 00217 } 00218 PixelDACScanRange dacrange(dacname,first,last,step,index,mix); 00219 dacs_.push_back(dacrange); 00220 } 00221 } 00222 00223 while ((tmp=="Set:")||(tmp=="SetRelative:")){ 00224 string name; 00225 in >> name; 00226 int val; 00227 in >> val; 00228 unsigned int index=1; 00229 if (dacs_.size()>0) index=dacs_.back().index()*dacs_.back().getNPoints(); 00230 PixelDACScanRange dacrange(name,val,val,1,index,false); 00231 if (tmp=="SetRelative:") { 00232 dacrange.setRelative(); 00233 } 00234 dacs_.push_back(dacrange); 00235 in >> tmp; 00236 } 00237 } 00238 00239 assert(tmp=="Repeat:"); 00240 00241 in >> ntrigger_; 00242 00243 in >> tmp; 00244 00245 usesROCList_=false; 00246 bool buildROCListNow = false; 00247 if ( tmp=="Rocs:" ) { 00248 buildROCListNow = true; 00249 usesROCList_=true; 00250 } 00251 else { assert(tmp=="ToCalibrate:"); buildROCListNow = false; } 00252 00253 while (!in.eof()) 00254 { 00255 tmp = ""; 00256 in >> tmp; 00257 00258 // added by F.Blekman to be able to deal with POS245 style calib.dat files in CMSSW 00259 // these files use the syntax: 00260 // Rocs: 00261 // all 00262 00263 if( tmp=="all" || tmp=="+" || tmp=="-" ){ 00264 buildROCListNow=false; 00265 } 00266 // end of addition by F.B. 00267 00268 if ( tmp=="" ) continue; 00269 rocListInstructions_.push_back(tmp); 00270 } 00271 00272 rocAndModuleListsBuilt_ = false; 00273 if ( buildROCListNow ) 00274 { 00275 std::set<PixelROCName> rocSet; 00276 for(std::vector<std::string>::iterator rocListInstructions_itr = rocListInstructions_.begin(); rocListInstructions_itr != rocListInstructions_.end(); rocListInstructions_itr++) 00277 { 00278 PixelROCName rocname(*rocListInstructions_itr); 00279 rocSet.insert(rocname); 00280 } 00281 buildROCAndModuleListsFromROCSet(rocSet); 00282 } 00283 00284 objectsDependingOnTheNameTranslationBuilt_ = false; 00285 00286 // Added by Dario as a temporary patch for Debbie (this will disappear in the future) 00287 calibFileContent_ = in.str() ; 00288 // End of temporary patch 00289 00290 return; 00291 00292 }
PixelCalibConfiguration::~PixelCalibConfiguration | ( | ) | [virtual] |
void PixelCalibConfiguration::buildObjectsDependingOnTheNameTranslation | ( | const PixelNameTranslation * | aNameTranslation | ) | [private] |
Definition at line 712 of file PixelCalibConfiguration.cc.
References channels_, find(), pos::PixelNameTranslation::getChannelForROC(), pos::PixelNameTranslation::getROCsFromChannel(), numROCsCalibratedOnChannel_, objectsDependingOnTheNameTranslationBuilt_, rocAndModuleListsBuilt_, ROCNumberOnChannelAmongThoseCalibrated_, rocs_, and python::multivaluedict::sort().
Referenced by buildROCAndModuleLists().
00713 { 00714 assert( !objectsDependingOnTheNameTranslationBuilt_ ); 00715 assert( rocAndModuleListsBuilt_ ); 00716 assert( aNameTranslation != 0 ); 00717 00718 // Build the channel list. 00719 assert ( channels_.empty() ); 00720 for (std::vector<PixelROCName>::const_iterator rocs_itr = rocs_.begin(); rocs_itr != rocs_.end(); ++rocs_itr) 00721 { 00722 channels_.insert( aNameTranslation->getChannelForROC(*rocs_itr) ); 00723 } 00724 00725 // Build the maps from ROC to ROC number. 00726 assert ( ROCNumberOnChannelAmongThoseCalibrated_.empty() && numROCsCalibratedOnChannel_.empty() ); 00727 for ( std::set<PixelChannel>::const_iterator channels_itr = channels_.begin(); channels_itr != channels_.end(); channels_itr++ ) 00728 { 00729 std::vector<PixelROCName> rocsOnChannel = aNameTranslation->getROCsFromChannel(*channels_itr); 00730 std::sort( rocsOnChannel.begin(), rocsOnChannel.end() ); 00731 00732 std::set<PixelROCName> foundROCs; 00733 for ( std::vector<PixelROCName>::const_iterator rocsOnChannel_itr = rocsOnChannel.begin(); rocsOnChannel_itr != rocsOnChannel.end(); rocsOnChannel_itr++ ) 00734 { 00735 if ( std::find(rocs_.begin(), rocs_.end(), *rocsOnChannel_itr) != rocs_.end() ) 00736 { 00737 ROCNumberOnChannelAmongThoseCalibrated_[*rocsOnChannel_itr] = foundROCs.size(); 00738 foundROCs.insert(*rocsOnChannel_itr); 00739 } 00740 } 00741 00742 for ( std::set<PixelROCName>::const_iterator foundROCs_itr = foundROCs.begin(); foundROCs_itr != foundROCs.end(); foundROCs_itr++ ) 00743 { 00744 numROCsCalibratedOnChannel_[*foundROCs_itr] = foundROCs.size(); 00745 } 00746 } 00747 00748 objectsDependingOnTheNameTranslationBuilt_ = true; 00749 }
void PixelCalibConfiguration::buildROCAndModuleLists | ( | const PixelNameTranslation * | translation, | |
const PixelDetectorConfig * | detconfig | |||
) |
Definition at line 551 of file PixelCalibConfiguration.cc.
References buildObjectsDependingOnTheNameTranslation(), buildROCAndModuleListsFromROCSet(), pos::PixelDetectorConfig::containsModule(), pos::PixelDetectorConfig::getModuleList(), pos::PixelNameTranslation::getROCs(), pos::PixelNameTranslation::getROCsFromModule(), moduleList(), pos::PixelModuleName::modulename(), rocAndModuleListsBuilt_, and rocListInstructions_.
00552 { 00553 assert( translation != 0 ); 00554 assert( detconfig != 0 ); 00555 00556 if ( rocAndModuleListsBuilt_ ) 00557 { 00558 buildObjectsDependingOnTheNameTranslation(translation); 00559 return; 00560 } 00561 00562 // Build the ROC set from the instructions. 00563 std::set<PixelROCName> rocSet; 00564 bool addNext = true; 00565 for(std::vector<std::string>::iterator rocListInstructions_itr = rocListInstructions_.begin(); rocListInstructions_itr != rocListInstructions_.end(); rocListInstructions_itr++) 00566 { 00567 std::string instruction = *rocListInstructions_itr; 00568 00569 if ( instruction == "+" ) 00570 { 00571 addNext = true; 00572 continue; 00573 } 00574 if ( instruction == "-" ) 00575 { 00576 addNext = false; 00577 continue; 00578 } 00579 00580 if ( instruction == "all" ) 00581 { 00582 if ( addNext ) // add all ROCs in the configuration 00583 { 00584 const std::vector <PixelModuleName>& moduleList = detconfig->getModuleList(); 00585 for ( std::vector <PixelModuleName>::const_iterator moduleList_itr = moduleList.begin(); moduleList_itr != moduleList.end(); moduleList_itr++ ) 00586 { 00587 std::vector<PixelROCName> ROCsOnThisModule = translation->getROCsFromModule( *moduleList_itr ); 00588 for ( std::vector<PixelROCName>::iterator ROCsOnThisModule_itr = ROCsOnThisModule.begin(); ROCsOnThisModule_itr != ROCsOnThisModule.end(); ROCsOnThisModule_itr++ ) 00589 { 00590 rocSet.insert(*ROCsOnThisModule_itr); 00591 } 00592 } 00593 } 00594 else // remove all ROCs 00595 { 00596 rocSet.clear(); 00597 } 00598 addNext = true; 00599 continue; 00600 } 00601 00602 // Assume it's a ROC or module name. 00603 PixelModuleName modulename(instruction); 00604 00605 // Skip if this module (or the module this ROC is on) isn't in the detector config. 00606 if ( !(detconfig->containsModule(modulename)) ) 00607 { 00608 addNext = true; 00609 continue; 00610 } 00611 00612 if ( modulename.modulename() == instruction ) // it's a module 00613 { 00614 std::vector<PixelROCName> ROCsOnThisModule = translation->getROCsFromModule( modulename ); 00615 for ( std::vector<PixelROCName>::iterator ROCsOnThisModule_itr = ROCsOnThisModule.begin(); ROCsOnThisModule_itr != ROCsOnThisModule.end(); ROCsOnThisModule_itr++ ) 00616 { 00617 if ( addNext ) rocSet.insert(*ROCsOnThisModule_itr); 00618 else rocSet.erase( *ROCsOnThisModule_itr); 00619 } 00620 addNext = true; 00621 continue; 00622 } 00623 else // it's a ROC 00624 { 00625 PixelROCName rocname(instruction); 00626 if ( addNext ) 00627 { 00628 // Only add this ROC if it's in the configuration. 00629 bool foundIt = false; 00630 std::list<const PixelROCName*> allROCs = translation->getROCs(); 00631 for ( std::list<const PixelROCName*>::iterator allROCs_itr = allROCs.begin(); allROCs_itr != allROCs.end(); allROCs_itr++ ) 00632 { 00633 if ( (*(*allROCs_itr)) == rocname ) 00634 { 00635 foundIt = true; 00636 break; 00637 } 00638 } 00639 if (foundIt) rocSet.insert(rocname); 00640 } 00641 else 00642 { 00643 rocSet.erase(rocname); 00644 } 00645 addNext = true; 00646 continue; 00647 } 00648 00649 // should never get here 00650 assert(0); 00651 } 00652 // done building ROC set 00653 00654 buildROCAndModuleListsFromROCSet(rocSet); 00655 buildObjectsDependingOnTheNameTranslation(translation); 00656 }
void PixelCalibConfiguration::buildROCAndModuleListsFromROCSet | ( | const std::set< PixelROCName > & | rocSet | ) | [private] |
Definition at line 658 of file PixelCalibConfiguration.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), modules_, nROC_, old_icols, old_irows, rocAndModuleListsBuilt_, rocs_, and singleROC_.
Referenced by buildROCAndModuleLists(), and PixelCalibConfiguration().
00659 { 00660 assert( !rocAndModuleListsBuilt_ ); 00661 00662 // Build the ROC list from the ROC set. 00663 for (std::set<PixelROCName>::iterator rocSet_itr = rocSet.begin(); rocSet_itr != rocSet.end(); rocSet_itr++ ) 00664 { 00665 rocs_.push_back(*rocSet_itr); 00666 } 00667 00668 // Build the module set from the ROC set. 00669 std::map <PixelModuleName,unsigned int> countROC; 00670 for (std::set<PixelROCName>::iterator rocSet_itr = rocSet.begin(); rocSet_itr != rocSet.end(); rocSet_itr++ ) 00671 { 00672 PixelModuleName modulename(rocSet_itr->rocname()); 00673 modules_.insert( modulename ); 00674 countROC[modulename]++; 00675 } 00676 00677 // Test printout. 00678 /*cout << "\nROC list:\n"; 00679 for ( std::vector<PixelROCName>::iterator rocs_itr = rocs_.begin(); rocs_itr != rocs_.end(); rocs_itr++ ) 00680 { 00681 cout << rocs_itr->rocname() << "\n"; 00682 } 00683 cout << "\nModule list:\n"; 00684 for ( std::set<PixelModuleName>::iterator modules_itr = modules_.begin(); modules_itr != modules_.end(); modules_itr++ ) 00685 { 00686 cout << modules_itr->modulename() << "\n"; 00687 } 00688 cout << "\n";*/ 00689 00690 // Determine max ROCs on a module for singleROC mode. 00691 nROC_=1; 00692 if (singleROC_) 00693 { 00694 unsigned maxROCs=0; 00695 for (std::map<PixelModuleName,unsigned int>::iterator imodule=countROC.begin();imodule!=countROC.end();++imodule) 00696 { 00697 if (imodule->second>maxROCs) maxROCs=imodule->second; 00698 } 00699 nROC_=maxROCs; 00700 00701 std::cout << "Max ROCs on a module="<<nROC_<<std::endl; 00702 } 00703 00704 for(unsigned int irocs=0;irocs<rocs_.size();irocs++){ 00705 old_irows.push_back(-1); 00706 old_icols.push_back(-1); 00707 } 00708 00709 rocAndModuleListsBuilt_ = true; 00710 }
const std::set<PixelChannel>& pos::PixelCalibConfiguration::channelList | ( | ) | const [inline] |
Definition at line 153 of file PixelCalibConfiguration.h.
References channels_, and objectsDependingOnTheNameTranslationBuilt_.
00153 {assert( objectsDependingOnTheNameTranslationBuilt_ ); return channels_;}
Definition at line 853 of file PixelCalibConfiguration.cc.
References cols_, nScanPoints(), rowCounter(), rows_, and scanROC().
Referenced by nextFECState(), and pixelsWithHits().
00854 { 00855 unsigned int i_col=( state - scanROC(state)*cols_.size()*rows_.size()*nScanPoints() - rowCounter(state)*cols_.size()*nScanPoints() )/(nScanPoints()); 00856 assert(i_col<cols_.size()); 00857 return i_col; 00858 }
const std::vector<std::vector<unsigned int> >& pos::PixelCalibConfiguration::columnList | ( | ) | const [inline] |
Definition at line 149 of file PixelCalibConfiguration.h.
References cols_.
Referenced by SiPixelCalibConfiguration::SiPixelCalibConfiguration().
00149 {return cols_;}
bool PixelCalibConfiguration::containsScan | ( | std::string | name | ) | const |
Definition at line 1612 of file PixelCalibConfiguration.cc.
References i, numberOfScanVariables(), and scanName().
01613 { 01614 for ( unsigned int i = 0; i < numberOfScanVariables(); i++ ) 01615 { 01616 if ( scanName(i) == name ) 01617 { 01618 return true; 01619 } 01620 } 01621 return false; 01622 }
void PixelCalibConfiguration::disablePixels | ( | PixelFECConfigInterface * | pixelFEC, | |
pos::PixelROCTrimBits * | trims, | |||
PixelHdwAddress | theROC | |||
) | const [private] |
Definition at line 1460 of file PixelCalibConfiguration.cc.
References _bufferData, bits, parsecf::pyparsing::col(), pos::PixelHdwAddress::hubaddress(), pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), pos::PixelHdwAddress::portaddress(), pos::PixelFECConfigInterface::progpix(), pos::PixelHdwAddress::rocid(), row, and pos::PixelROCTrimBits::trim().
01462 { 01463 01464 //cout<<" disable ROC "<<theROC.hubaddress()<<" "<<theROC.rocid()<<endl; 01465 //FIXME This should be done with more efficient commands! 01466 for (unsigned int row=0;row<80;row++){ 01467 for (unsigned int col=0;col<52;col++){ 01468 unsigned int bits=trims->trim(col,row); 01469 pixelFEC->progpix(theROC.mfec(), 01470 theROC.mfecchannel(), 01471 theROC.hubaddress(), 01472 theROC.portaddress(), 01473 theROC.rocid(), 01474 col, 01475 row, 01476 bits,_bufferData); 01477 } 01478 } 01479 }
void PixelCalibConfiguration::disablePixels | ( | PixelFECConfigInterface * | pixelFEC, | |
unsigned int | irows, | |||
unsigned int | icols, | |||
pos::PixelROCTrimBits * | trims, | |||
PixelHdwAddress | theROC | |||
) | const [private] |
Definition at line 1435 of file PixelCalibConfiguration.cc.
References _bufferData, bits, cols_, pos::PixelHdwAddress::hubaddress(), icol, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), pos::PixelHdwAddress::portaddress(), pos::PixelFECConfigInterface::progpix(), pos::PixelHdwAddress::rocid(), rows_, and pos::PixelROCTrimBits::trim().
Referenced by nextFECState().
01438 { 01439 01440 for (unsigned int irow=0;irow<rows_[irows].size();irow++){ 01441 for (unsigned int icol=0;icol<cols_[icols].size();icol++){ 01442 /* std::cout << "Will turn off pixel col=" 01443 <<cols_[old_icols][icol] 01444 <<" row="<<rows_[old_irows][irow]<<std::endl; 01445 */ 01446 unsigned int bits=trims->trim(cols_[icols][icol],rows_[irows][irow]); 01447 pixelFEC->progpix(theROC.mfec(), 01448 theROC.mfecchannel(), 01449 theROC.hubaddress(), 01450 theROC.portaddress(), 01451 theROC.rocid(), 01452 cols_[icols][icol], 01453 rows_[irows][irow], 01454 bits,_bufferData); 01455 } 01456 } 01457 }
void PixelCalibConfiguration::enablePixels | ( | PixelFECConfigInterface * | pixelFEC, | |
unsigned int | irows, | |||
unsigned int | icols, | |||
pos::PixelROCMaskBits * | masks, | |||
pos::PixelROCTrimBits * | trims, | |||
PixelHdwAddress | theROC | |||
) | const [private] |
Definition at line 1404 of file PixelCalibConfiguration.cc.
References _bufferData, bits, cols_, pos::PixelHdwAddress::hubaddress(), icol, pos::PixelROCMaskBits::mask(), pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), pos::PixelHdwAddress::portaddress(), pos::PixelFECConfigInterface::progpix(), pos::PixelHdwAddress::rocid(), rows_, and pos::PixelROCTrimBits::trim().
Referenced by nextFECState().
01409 { 01410 01411 for (unsigned int irow=0;irow<rows_[irows].size();irow++){ 01412 for (unsigned int icol=0;icol<cols_[icols].size();icol++){ 01413 /* std::cout << "Will turn on pixel col=" 01414 <<cols_[icols][icol] 01415 <<" row="<<rows_[irows][irow]<<std::endl; 01416 */ 01417 unsigned int bits=trims->trim(cols_[icols][icol],rows_[irows][irow]); 01418 01419 //if masks==0 always enable pixel 01420 if (masks==0|| 01421 masks->mask(cols_[icols][icol],rows_[irows][irow])) bits|=0x80; 01422 01423 pixelFEC->progpix(theROC.mfec(), 01424 theROC.mfecchannel(), 01425 theROC.hubaddress(), 01426 theROC.portaddress(), 01427 theROC.rocid(), 01428 cols_[icols][icol], 01429 rows_[irows][irow], 01430 bits,_bufferData); 01431 } 01432 } 01433 }
std::vector< std::pair< unsigned int, std::vector< unsigned int > > > & PixelCalibConfiguration::fedCardsAndChannels | ( | unsigned int | crate, | |
PixelNameTranslation * | translation, | |||
PixelFEDConfig * | fedconfig, | |||
PixelDetectorConfig * | detconfig | |||
) | const |
Definition at line 1214 of file PixelCalibConfiguration.cc.
References pos::PixelDetectorConfig::containsModule(), pos::PixelFEDConfig::crateFromFEDNumber(), fedCardsAndChannels_, pos::PixelHdwAddress::fedchannel(), pos::PixelHdwAddress::fednumber(), first, pos::PixelNameTranslation::getHdwAddress(), i, index, j, k, module(), rocAndModuleListsBuilt_, rocs_, tmp, and tmp2.
01217 { 01218 01219 assert(rocAndModuleListsBuilt_); 01220 01221 assert(rocs_.size()!=0); 01222 01223 for(unsigned int i=0;i<rocs_.size();i++){ 01224 PixelModuleName module(rocs_[i].rocname()); 01225 if (!detconfig->containsModule(module)) continue; 01226 const PixelHdwAddress* hdw=translation->getHdwAddress(rocs_[i]); 01227 assert(hdw!=0); 01228 //std::cout << "ROC, fednumber:"<<rocs_[i]<<" "<<hdw->fednumber() 01229 // << std::endl; 01230 //first check if fed associated with the roc is in the right crate 01231 if (fedconfig->crateFromFEDNumber(hdw->fednumber())!=crate) continue; 01232 //next look if we have already found fed number 01233 unsigned int index=fedCardsAndChannels_.size(); 01234 for(unsigned int j=0;j<fedCardsAndChannels_.size();j++){ 01235 if (fedCardsAndChannels_[j].first==hdw->fednumber()){ 01236 index=j; 01237 break; 01238 } 01239 } 01240 //If we didn't find the fedcard we will create it 01241 if (index==fedCardsAndChannels_.size()){ 01242 std::vector<unsigned int> tmp; 01243 tmp.push_back(hdw->fedchannel()); 01244 std::pair<unsigned int, std::vector<unsigned int> > tmp2(hdw->fednumber(),tmp); 01245 fedCardsAndChannels_.push_back(tmp2); 01246 continue; 01247 } 01248 //Now look and see if the channel has been added 01249 std::vector<unsigned int>& channels=fedCardsAndChannels_[index].second; 01250 bool found=false; 01251 for(unsigned int k=0;k<channels.size();k++){ 01252 if (channels[k]==hdw->fedchannel()) { 01253 found=true; 01254 break; 01255 } 01256 } 01257 if (found) continue; 01258 channels.push_back(hdw->fedchannel()); 01259 01260 } 01261 01262 01263 return fedCardsAndChannels_; 01264 01265 }
std::set< unsigned int > PixelCalibConfiguration::getFECCrates | ( | const PixelNameTranslation * | translation, | |
const PixelFECConfig * | fecconfig | |||
) | const |
Definition at line 1307 of file PixelCalibConfiguration.cc.
References pos::PixelFECConfig::crateFromFECNumber(), pos::PixelHdwAddress::fecnumber(), pos::PixelNameTranslation::getChannelsOnModule(), pos::PixelNameTranslation::getHdwAddress(), modules_, and rocAndModuleListsBuilt_.
01307 { 01308 01309 assert(rocAndModuleListsBuilt_); 01310 01311 std::set<unsigned int> feccrates; 01312 assert(modules_.size()!=0); 01313 std::set<PixelModuleName>::iterator imodule=modules_.begin(); 01314 01315 for (;imodule!=modules_.end();++imodule) 01316 { 01317 std::set<PixelChannel> channelsOnThisModule = translation->getChannelsOnModule(*imodule); 01318 for ( std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin(); channelsOnThisModule_itr != channelsOnThisModule.end(); channelsOnThisModule_itr++ ) 01319 { 01320 const PixelHdwAddress& channel_hdwaddress = translation->getHdwAddress(*channelsOnThisModule_itr); 01321 unsigned int fecnumber=channel_hdwaddress.fecnumber(); 01322 feccrates.insert(fecconfig->crateFromFECNumber(fecnumber)); 01323 } 01324 } 01325 01326 return feccrates; 01327 }
std::set< unsigned int > PixelCalibConfiguration::getFEDCrates | ( | const PixelNameTranslation * | translation, | |
const PixelFEDConfig * | fedconfig | |||
) | const |
Definition at line 1285 of file PixelCalibConfiguration.cc.
References pos::PixelFEDConfig::crateFromFEDNumber(), pos::PixelHdwAddress::fednumber(), pos::PixelNameTranslation::getChannelsOnModule(), pos::PixelNameTranslation::getHdwAddress(), modules_, and rocAndModuleListsBuilt_.
01285 { 01286 01287 assert(rocAndModuleListsBuilt_); 01288 01289 std::set<unsigned int> fedcrates; 01290 assert(modules_.size()!=0); 01291 std::set<PixelModuleName>::iterator imodule=modules_.begin(); 01292 01293 for (;imodule!=modules_.end();++imodule) 01294 { 01295 std::set<PixelChannel> channelsOnThisModule = translation->getChannelsOnModule(*imodule); 01296 for ( std::set<PixelChannel>::const_iterator channelsOnThisModule_itr = channelsOnThisModule.begin(); channelsOnThisModule_itr != channelsOnThisModule.end(); channelsOnThisModule_itr++ ) 01297 { 01298 const PixelHdwAddress& channel_hdwaddress = translation->getHdwAddress(*channelsOnThisModule_itr); 01299 unsigned int fednumber=channel_hdwaddress.fednumber(); 01300 fedcrates.insert(fedconfig->crateFromFEDNumber(fednumber)); 01301 } 01302 } 01303 01304 return fedcrates; 01305 }
std::map< unsigned int, std::set< unsigned int > > PixelCalibConfiguration::getFEDsAndChannels | ( | PixelNameTranslation * | translation | ) |
Definition at line 1267 of file PixelCalibConfiguration.cc.
References pos::PixelHdwAddress::fedchannel(), pos::PixelHdwAddress::fednumber(), pos::PixelNameTranslation::getHdwAddress(), rocAndModuleListsBuilt_, and rocs_.
01267 { 01268 01269 assert(rocAndModuleListsBuilt_); 01270 01271 std::map <unsigned int, std::set<unsigned int> > fedsChannels; 01272 assert(rocs_.size()!=0); 01273 std::vector<PixelROCName>::iterator iroc=rocs_.begin(); 01274 01275 for (;iroc!=rocs_.end();++iroc){ 01276 const PixelHdwAddress *roc_hdwaddress=translation->getHdwAddress(*iroc); 01277 unsigned int fednumber=roc_hdwaddress->fednumber(); 01278 unsigned int fedchannel=roc_hdwaddress->fedchannel(); 01279 fedsChannels[fednumber].insert(fedchannel); 01280 } 01281 01282 return fedsChannels; 01283 }
std::string pos::PixelCalibConfiguration::getStreamedContent | ( | void | ) | const [inline] |
Definition at line 167 of file PixelCalibConfiguration.h.
References calibFileContent_.
00167 {return calibFileContent_;} ;
std::set< unsigned int > PixelCalibConfiguration::getTKFECCrates | ( | const PixelPortcardMap * | portcardmap, | |
const std::map< std::string, PixelPortCardConfig * > & | mapNamePortCard, | |||
const PixelTKFECConfig * | tkfecconfig | |||
) | const |
Definition at line 1329 of file PixelCalibConfiguration.cc.
References pos::PixelTKFECConfig::crateFromTKFECID(), modules_, pos::PixelPortcardMap::portcards(), and rocAndModuleListsBuilt_.
01329 { 01330 01331 assert(rocAndModuleListsBuilt_); 01332 01333 std::set<unsigned int> tkfeccrates; 01334 assert(modules_.size()!=0); 01335 std::set<PixelModuleName>::iterator imodule=modules_.begin(); 01336 01337 for (;imodule!=modules_.end();++imodule) 01338 { 01339 // implement this by module --(PixelPortcardMap)-> port card(s) --(PixelPortCardConfig)-> FEC # --(PixelFECConfig theTKFECConfiguration_)-> crate 01340 const std::set< std::string > portCards = portcardmap->portcards(*imodule); 01341 for ( std::set< std::string >::const_iterator portCards_itr = portCards.begin(); portCards_itr != portCards.end(); ++portCards_itr) 01342 { 01343 const std::string portcardname=*portCards_itr; 01344 std::map<std::string,PixelPortCardConfig*>::const_iterator portcardconfig_itr = mapNamePortCard.find(portcardname); 01345 assert(portcardconfig_itr != mapNamePortCard.end()); 01346 PixelPortCardConfig* portcardconfig = portcardconfig_itr->second; 01347 std::string TKFECID = portcardconfig->getTKFECID(); 01348 tkfeccrates.insert(tkfecconfig->crateFromTKFECID(TKFECID)); 01349 } 01350 } 01351 01352 return tkfeccrates; 01353 }
unsigned int PixelCalibConfiguration::iScan | ( | std::string | dac | ) | const |
Definition at line 751 of file PixelCalibConfiguration.cc.
References GenMuonPlsPt100GeV_cfg::cout, dacs_, lat::endl(), i, and name.
Referenced by nScanPoints(), scanCounter(), scanValue(), scanValueMax(), scanValueMin(), scanValues(), scanValuesMixedAcrossROCs(), and scanValueStep().
00751 { 00752 00753 for (unsigned int i=0;i<dacs_.size();i++){ 00754 if (dac==dacs_[i].name()) return i; 00755 } 00756 00757 std::cout << "In PixelCalibConfiguration::iScan could not find dac=" 00758 << dac <<std::endl; 00759 00760 assert(0); 00761 00762 return 0; 00763 00764 }
unsigned int PixelCalibConfiguration::maxNumHitsPerROC | ( | ) | const |
Definition at line 1582 of file PixelCalibConfiguration.cc.
References cols_, max, and rows_.
Referenced by noHits().
01583 { 01584 unsigned int returnValue = 0; 01585 for ( std::vector<std::vector<unsigned int> >::const_iterator rows_itr = rows_.begin(); rows_itr != rows_.end(); rows_itr++ ) 01586 { 01587 for ( std::vector<std::vector<unsigned int> >::const_iterator cols_itr = cols_.begin(); cols_itr != cols_.end(); cols_itr++ ) 01588 { 01589 unsigned int theSize = rows_itr->size()*cols_itr->size(); 01590 returnValue = max( returnValue, theSize ); 01591 } 01592 } 01593 return returnValue; 01594 }
std::string pos::PixelCalibConfiguration::mode | ( | ) | const [inline, virtual] |
Reimplemented from pos::PixelCalibBase.
Definition at line 155 of file PixelCalibConfiguration.h.
References pos::PixelCalibBase::mode_.
Referenced by nextFECState(), and SiPixelCalibConfiguration::SiPixelCalibConfiguration().
00155 {return mode_;}
const std::set<PixelModuleName>& pos::PixelCalibConfiguration::moduleList | ( | ) | const [inline] |
Definition at line 152 of file PixelCalibConfiguration.h.
References modules_, and rocAndModuleListsBuilt_.
Referenced by buildROCAndModuleLists().
00152 {assert(rocAndModuleListsBuilt_); return modules_;}
unsigned int pos::PixelCalibConfiguration::nConfigurations | ( | ) | const [inline] |
Definition at line 108 of file PixelCalibConfiguration.h.
References nPixelPatterns(), nROC(), and nScanPoints().
Referenced by nextFECState(), nTriggersTotal(), scanCounter(), and scanROC().
00108 { return nPixelPatterns()*nScanPoints()*nROC();}
void PixelCalibConfiguration::nextFECState | ( | std::map< unsigned int, PixelFECConfigInterface * > & | pixelFECs, | |
PixelDetectorConfig * | detconfig, | |||
PixelNameTranslation * | trans, | |||
std::map< pos::PixelModuleName, pos::PixelMaskBase * > * | masks, | |||
std::map< pos::PixelModuleName, pos::PixelTrimBase * > * | trims, | |||
std::map< pos::PixelModuleName, pos::PixelDACSettings * > * | dacss, | |||
unsigned int | state | |||
) | const |
Definition at line 860 of file PixelCalibConfiguration.cc.
References _bufferData, parsecf::pyparsing::col(), colCounter(), cols_, GenMuonPlsPt100GeV_cfg::cout, dacs_, pos::PixelROCInfo::defaultDACs_, disablePixels(), enablePixels(), lat::endl(), pos::PixelHdwAddress::fecnumber(), first, pos::PixelNameTranslation::getChannelForROC(), pos::PixelNameTranslation::getHdwAddress(), pos::PixelROCInfo::hdwadd_, highVCalRange_, pos::PixelHdwAddress::hubaddress(), i, icol, j, pos::k_DACAddress_WBC, pos::PixelROCInfo::masks_, max, pos::PixelHdwAddress::mfec(), pos::PixelHdwAddress::mfecchannel(), mode(), module(), n, name, nConfigurations(), btag::LeptonSelector::negative, parameterValue(), pos::PixelHdwAddress::portaddress(), rocAndModuleListsBuilt_, pos::PixelHdwAddress::rocid(), rocInfo_, rocs_, row, rowCounter(), rows_, scanCounter(), scanningROCForState(), scanValue(), pos::PixelROCInfo::tbmChannel_, pos::PixelChannel::TBMChannelString(), pos::PixelROCInfo::trims_, and pos::PixelROCInfo::use_.
00867 { 00868 00869 std::string modeName=parameterValue("ScanMode"); 00870 00871 int mode=-1; 00872 00873 if (modeName=="maskAllPixel") mode=0; 00874 if (modeName=="useAllPixel"||modeName=="") mode=1; 00875 if (modeName=="default") mode=2; 00876 00877 static bool first=true; 00878 00879 if (first) { 00880 cout << "PixelCalibConfiguration::nextFECState mode="<<mode<<endl; 00881 first=false; 00882 } 00883 00884 if (mode==-1) { 00885 cout << "In PixelCalibConfiguration: ScanMode="<<modeName 00886 << " not understood."<<endl; 00887 ::abort(); 00888 } 00889 00890 if (rocInfo_.size()==0){ 00891 //here we will do some initialization... 00892 for(unsigned int i=0;i<rocs_.size();i++){ 00893 const PixelHdwAddress* hdwadd=trans->getHdwAddress(rocs_[i]); 00894 PixelROCInfo rocInfo; 00895 rocInfo.use_=true; 00896 //FIXME This is very inefficient 00897 PixelModuleName module(rocs_[i].rocname()); 00898 00899 std::map<pos::PixelModuleName,pos::PixelMaskBase*>::const_iterator foundMask = masks->find(module); 00900 if (foundMask==masks->end()){ 00901 rocInfo.use_=false; 00902 rocInfo_.push_back(rocInfo); 00903 continue; 00904 } 00905 00906 00907 00908 rocInfo.hdwadd_=hdwadd; 00909 rocInfo.trims_=(*trims)[module]->getTrimBits(rocs_[i]); 00910 rocInfo.masks_=(*masks)[module]->getMaskBits(rocs_[i]); 00911 00912 #ifdef BPIX 00913 const PixelChannel channel = trans->getChannelForROC(rocs_[i]); 00914 string tbmChannel = channel.TBMChannelString(); 00915 //cout<<" tbm channel "<<tbmChannel<<endl; 00916 rocInfo.tbmChannel_ = tbmChannel; 00917 #endif 00918 00919 std::map<std::string, unsigned int> defaultDACValues; 00920 (*dacs)[PixelModuleName(rocs_[i].rocname())]->getDACSettings(rocs_[i])->getDACs(defaultDACValues); 00921 00922 for ( std::vector<PixelDACScanRange>::const_iterator dacs_itr = dacs_.begin(); dacs_itr != dacs_.end(); dacs_itr++ ) 00923 { 00924 std::map<std::string, unsigned int>::const_iterator foundThisDAC = defaultDACValues.find(dacs_itr->name()); 00925 assert( foundThisDAC != defaultDACValues.end() ); 00926 00927 pair<unsigned int, unsigned int> 00928 dacchannelAndValue(dacs_itr->dacchannel(), 00929 foundThisDAC->second); 00930 00931 rocInfo.defaultDACs_.push_back(dacchannelAndValue); 00932 } 00933 rocInfo_.push_back(rocInfo); 00934 } 00935 } 00936 00937 assert(rocs_.size()==rocInfo_.size()); 00938 00939 bool changedWBC=false; 00940 00941 std::map<unsigned int, PixelFECConfigInterface*>::iterator iPixelFEC=pixelFECs.begin(); 00942 //for(;iPixelFEC!=pixelFECs.end();++iPixelFEC){ 00943 //iPixelFEC->second->fecDebug(1); 00944 //} 00945 00946 //unsigned long version=0; 00947 //pixelFEC->getversion(&version); 00948 //std::cout<<"mfec firmware version:"<<version<<std::endl; 00949 00950 assert(rocAndModuleListsBuilt_); 00951 00952 assert(state<nConfigurations()); 00953 00954 // Which set of rows we're on. 00955 unsigned int i_row=rowCounter(state); 00956 00957 // Which set of columns we're on. 00958 unsigned int i_col=colCounter(state); 00959 00960 // Whether we're beginning a new scan over the DACs after changing which ROC or which pixel pattern. 00961 unsigned int first_scan=true; 00962 for (unsigned int i=0;i<dacs_.size();i++){ 00963 if (scanCounter(i,state)!=0) first_scan=false; 00964 } 00965 00966 // Disable all pixels at the beginning. 00967 if (state==0&&(mode==0||mode==1)) { 00968 00969 for(unsigned int i=0;i<rocs_.size();i++){ 00970 00971 if (!rocInfo_[i].use_) continue; 00972 00973 PixelHdwAddress theROC=*rocInfo_[i].hdwadd_; 00974 PixelROCTrimBits* rocTrims=rocInfo_[i].trims_; 00975 00976 //Turn off all pixels 00977 disablePixels(pixelFECs[theROC.fecnumber()], rocTrims, theROC); 00978 00979 } 00980 00981 // reset 00982 //cout<<"finish init"<<endl; 00983 //sleep(1); 00984 //pixelFEC->injectrstroc(7,1); 00985 // or do pixelFEC->rocreset(theROC.mfec(), 00986 // theROC.mfecchannel(), 00987 // 14, //FIXME hardcode for Channel A 00988 // theROC.hubaddress()); 00989 00990 00991 } 00992 00993 // When a scan is complete for a given ROC or pixel pattern, reset the DACs to default values and disable the previously-enabled pixels. 00994 if (first_scan && state!=0 && mode!=2){ 00995 00996 unsigned int previousState=state-1; 00997 00998 unsigned int i_row_previous=rowCounter(previousState); 00999 01000 unsigned int i_col_previous=colCounter(previousState); 01001 01002 for(unsigned int i=0;i<rocs_.size();i++){ 01003 01004 if (!rocInfo_[i].use_) continue; 01005 01006 PixelHdwAddress theROC=*rocInfo_[i].hdwadd_; 01007 01008 if ( !scanningROCForState(rocs_[i], previousState) ) continue; 01009 01010 // Set the DACs back to their default values when we're done with a scan. 01011 for ( unsigned int j=0; j< dacs_.size(); j++ ) { 01012 01013 01014 //Try to not reprogram DACs as often.. 01015 if (state!=0){ 01016 if (scanCounter(dacs_[j].name(),state)==scanCounter(dacs_[j].name(),state-1)){ 01017 continue; 01018 } 01019 } 01020 01021 pixelFECs[theROC.fecnumber()]->progdac(theROC.mfec(), 01022 theROC.mfecchannel(), 01023 theROC.hubaddress(), 01024 theROC.portaddress(), 01025 theROC.rocid(), 01026 rocInfo_[i].defaultDACs_[j].first, 01027 rocInfo_[i].defaultDACs_[j].second, 01028 _bufferData); 01029 01030 if (dacs_[j].dacchannel()==k_DACAddress_WBC) { 01031 changedWBC=true; 01032 //cout << "Changed WBC 1"<<endl; 01033 } 01034 01035 } 01036 01037 PixelROCTrimBits* rocTrims=rocInfo_[i].trims_; 01038 01039 disablePixels(pixelFECs[theROC.fecnumber()], 01040 i_row_previous, 01041 i_col_previous, 01042 rocTrims, 01043 theROC); 01044 01045 } 01046 } 01047 01048 // Set each ROC with the new settings for this state. 01049 for(unsigned int i=0;i<rocs_.size();i++){ 01050 01051 if (!rocInfo_[i].use_) continue; 01052 01053 01054 PixelHdwAddress theROC=*rocInfo_[i].hdwadd_; 01055 01056 01057 // Skip this ROC if we're in SingleROC mode and we're not on this ROC number. 01058 if ( !scanningROCForState(rocs_[i], state) ) continue; 01059 01060 // std::cout << "Will call progdac for vcal:"<< vcal << std::endl; 01061 01062 // Program all the DAC values. 01063 for (unsigned int ii=0;ii<dacs_.size();ii++){ 01064 01065 //Try to not reprogram DACs as often.. 01066 if (state!=0){ 01067 if (scanCounter(dacs_[ii].name(),state)==scanCounter(dacs_[ii].name(),state-1)){ 01068 continue; 01069 } 01070 } 01071 01072 int dacvalue = scanValue(ii, state, rocs_[i]); 01073 01074 //cout << "dacname ii:"<<dacs_[ii].name()<<" "<<ii<<endl; 01075 01076 if (dacs_[ii].relative()){ 01077 01078 //We have to find the default DAC setting so that we can 01079 //add the offset as we are in relative mode. 01080 01081 if (dacs_[ii].negative()) dacvalue=-dacvalue; 01082 01083 dacvalue+=rocInfo_[i].defaultDACs_[ii].second; 01084 //cout << "[PixelCalibConfiguration::nextFECState] ROC="<<rocs_[i] 01085 // << " dac="<<dacs_[ii].name()<<" new value="<<dacvalue<<endl; 01086 } 01087 01088 pixelFECs[theROC.fecnumber()]->progdac(theROC.mfec(), 01089 theROC.mfecchannel(), 01090 theROC.hubaddress(), 01091 theROC.portaddress(), 01092 theROC.rocid(), 01093 rocInfo_[i].defaultDACs_[ii].first, 01094 dacvalue,_bufferData); 01095 01096 if (dacs_[ii].dacchannel()==k_DACAddress_WBC) { 01097 changedWBC=true; 01098 //cout << "Changed WBC 2"<<endl; 01099 } 01100 01101 } 01102 01103 // At the beginning of a scan, set the pixel pattern. 01104 if (first_scan){ 01105 01106 // Set masks and trims. 01107 if (mode!=2){ 01108 01109 01110 PixelROCMaskBits* rocMasks=rocInfo_[i].masks_; 01111 PixelROCTrimBits* rocTrims=rocInfo_[i].trims_; 01112 01113 if (mode==1) rocMasks=0; 01114 01115 //std::cout << "Will enable pixels!" <<std::endl; 01116 enablePixels(pixelFECs[theROC.fecnumber()], 01117 i_row, 01118 i_col, 01119 rocMasks, 01120 rocTrims, 01121 theROC); 01122 01123 } 01124 01125 // Set high or low Vcal range. 01126 01127 if (state==0) { 01128 01129 PixelModuleName module(rocs_[i].rocname()); 01130 01131 unsigned int roccontrolword=(*dacs)[module]->getDACSettings(rocs_[i])->getControlRegister(); 01132 01133 //range is controlled here by one bit, but rest must match config 01134 //bit 0 on/off= 20/40 MHz speed; bit 1 on/off=disabled/enable; bit 3=Vcal range 01135 01136 if (highVCalRange_) roccontrolword|=0x4; //turn range bit on 01137 else roccontrolword&=0xfb; //turn range bit off 01138 01139 pixelFECs[theROC.fecnumber()]->progdac(theROC.mfec(), 01140 theROC.mfecchannel(), 01141 theROC.hubaddress(), 01142 theROC.portaddress(), 01143 theROC.rocid(), 01144 0xfd, 01145 roccontrolword,_bufferData); 01146 01147 01148 } 01149 01150 // Clear all pixels before setting the pixel pattern. 01151 pixelFECs[theROC.fecnumber()]->clrcal(theROC.mfec(), 01152 theROC.mfecchannel(), 01153 theROC.hubaddress(), 01154 theROC.portaddress(), 01155 theROC.rocid(),_bufferData); 01156 01157 // Program the pixel pattern. 01158 unsigned int nrow=rows_[i_row].size(); 01159 unsigned int ncol=cols_[i_col].size(); 01160 unsigned int nmax=std::max(nrow,ncol); 01161 if (nrow==0||ncol==0) nmax=0; 01162 for (unsigned int n=0;n<nmax;n++){ 01163 unsigned int irow=n; 01164 unsigned int icol=n; 01165 if (irow>=nrow) irow=nrow-1; 01166 if (icol>=ncol) icol=ncol-1; 01167 unsigned int row=rows_[i_row][irow]; 01168 unsigned int col=cols_[i_col][icol]; 01169 01170 pixelFECs[theROC.fecnumber()]->calpix(theROC.mfec(), 01171 theROC.mfecchannel(), 01172 theROC.hubaddress(), 01173 theROC.portaddress(), 01174 theROC.rocid(), 01175 col, 01176 row, 01177 1,_bufferData); 01178 } 01179 01180 } // end of instructions for the beginning of a scan 01181 } // end of loop over ROCs 01182 01183 if (_bufferData) { 01184 std::map<unsigned int, PixelFECConfigInterface*>::iterator iPixelFEC=pixelFECs.begin(); 01185 for(;iPixelFEC!=pixelFECs.end();++iPixelFEC){ 01186 iPixelFEC->second->qbufsend(); 01187 } 01188 } 01189 01190 if (changedWBC){ 01191 for(unsigned int i=0;i<rocs_.size();i++){ 01192 01193 if (!rocInfo_[i].use_) continue; 01194 01195 PixelHdwAddress theROC=*rocInfo_[i].hdwadd_; 01196 01197 int tbmRegister = 14; // define for TBM-A 01198 #ifdef BPIX 01199 string tbmChannel = rocInfo_[i].tbmChannel_; // get TBM channel 01200 if( tbmChannel=="B") tbmRegister = 15; // for TBM=B 01201 #endif 01202 01203 pixelFECs[theROC.fecnumber()]->rocreset(theROC.mfec(), 01204 theROC.mfecchannel(), 01205 tbmRegister, 01206 theROC.hubaddress()); 01207 } // for rocs 01208 } 01209 01210 return; 01211 }
bool pos::PixelCalibConfiguration::noHits | ( | ) | const [inline] |
Definition at line 111 of file PixelCalibConfiguration.h.
References maxNumHitsPerROC().
00111 {return (maxNumHitsPerROC()==0);} // returns true if no hits will be produced
unsigned int pos::PixelCalibConfiguration::nParameters | ( | ) | const [inline] |
Definition at line 159 of file PixelCalibConfiguration.h.
References parameters_.
00159 {return parameters_.size();}
unsigned int pos::PixelCalibConfiguration::nPixelPatterns | ( | ) | const [inline] |
unsigned int pos::PixelCalibConfiguration::nROC | ( | ) | const [inline] |
Definition at line 97 of file PixelCalibConfiguration.h.
References nROC_, and rocAndModuleListsBuilt_.
Referenced by nConfigurations().
00097 { assert(rocAndModuleListsBuilt_); return nROC_; }
unsigned int pos::PixelCalibConfiguration::nScanPoints | ( | unsigned int | iscan | ) | const [inline, private] |
Definition at line 189 of file PixelCalibConfiguration.h.
References dacs_.
00189 { return dacs_[iscan].getNPoints(); }
unsigned int pos::PixelCalibConfiguration::nScanPoints | ( | ) | const [inline] |
Definition at line 102 of file PixelCalibConfiguration.h.
Referenced by colCounter(), nConfigurations(), nScanPoints(), rowCounter(), scanCounter(), scanROC(), scanValue(), and scanValueMax().
00102 {unsigned int points=1; 00103 for(unsigned int i=0;i<dacs_.size();i++) { 00104 points*=nScanPoints(i); 00105 } 00106 return points; 00107 }
unsigned int pos::PixelCalibConfiguration::nScanPoints | ( | std::string | dac | ) | const [inline] |
Definition at line 100 of file PixelCalibConfiguration.h.
References iScan(), and nScanPoints().
00100 { return nScanPoints(iScan(dac)); }
unsigned int pos::PixelCalibConfiguration::nTriggersPerPattern | ( | ) | const [inline] |
Definition at line 99 of file PixelCalibConfiguration.h.
References ntrigger_.
Referenced by nTriggersTotal(), and SiPixelCalibConfiguration::SiPixelCalibConfiguration().
00099 { return ntrigger_; }
unsigned int pos::PixelCalibConfiguration::nTriggersTotal | ( | ) | const [inline] |
Definition at line 109 of file PixelCalibConfiguration.h.
References nConfigurations(), and nTriggersPerPattern().
00109 {return nConfigurations()*nTriggersPerPattern();}
unsigned int pos::PixelCalibConfiguration::numberOfScanVariables | ( | ) | const [inline] |
Definition at line 135 of file PixelCalibConfiguration.h.
References dacs_.
Referenced by containsScan().
00135 {return dacs_.size();}
unsigned int PixelCalibConfiguration::numROCsCalibratedOnChannel | ( | PixelROCName | roc | ) | const [private] |
Definition at line 820 of file PixelCalibConfiguration.cc.
References numROCsCalibratedOnChannel_, and objectsDependingOnTheNameTranslationBuilt_.
Referenced by scanValue().
00821 { 00822 assert( objectsDependingOnTheNameTranslationBuilt_ ); 00823 std::map <PixelROCName, unsigned int>::const_iterator foundROC = numROCsCalibratedOnChannel_.find(roc); 00824 assert( foundROC != numROCsCalibratedOnChannel_.end() ); 00825 return foundROC->second; 00826 }
std::map<std::string, std::string> pos::PixelCalibConfiguration::parametersList | ( | ) | const [inline] |
Definition at line 162 of file PixelCalibConfiguration.h.
References parameters_.
00162 {return parameters_;}
std::string PixelCalibConfiguration::parameterValue | ( | std::string | parameterName | ) | const |
Definition at line 1481 of file PixelCalibConfiguration.cc.
References parameters_.
Referenced by nextFECState().
01482 { 01483 std::map<std::string, std::string>::const_iterator itr = parameters_.find(parameterName); 01484 if (itr == parameters_.end()) // parameterName is not in the list 01485 { 01486 return ""; 01487 } 01488 else 01489 { 01490 return itr->second; 01491 } 01492 }
std::set< std::pair< unsigned int, unsigned int > > PixelCalibConfiguration::pixelsWithHits | ( | unsigned int | state | ) | const |
Definition at line 1596 of file PixelCalibConfiguration.cc.
References begin, colCounter(), cols_, rowCounter(), and rows_.
01597 { 01598 std::set< std::pair<unsigned int, unsigned int> > pixels; 01599 // column # row # 01600 01601 for ( std::vector<unsigned int>::const_iterator col_itr = cols_[colCounter(state)].begin(); col_itr != cols_[colCounter(state)].end(); col_itr++ ) 01602 { 01603 for ( std::vector<unsigned int>::const_iterator row_itr = rows_[rowCounter(state)].begin(); row_itr != rows_[rowCounter(state)].end(); row_itr++ ) 01604 { 01605 pixels.insert( std::pair<unsigned int, unsigned int>( *col_itr, *row_itr ) ); 01606 } 01607 } 01608 01609 return pixels; 01610 }
const std::vector<PixelROCName>& pos::PixelCalibConfiguration::rocList | ( | ) | const [inline] |
Definition at line 151 of file PixelCalibConfiguration.h.
References rocAndModuleListsBuilt_, and rocs_.
00151 {assert(rocAndModuleListsBuilt_); return rocs_;}
unsigned int PixelCalibConfiguration::ROCNumberOnChannelAmongThoseCalibrated | ( | PixelROCName | roc | ) | const [private] |
Definition at line 812 of file PixelCalibConfiguration.cc.
References objectsDependingOnTheNameTranslationBuilt_, and ROCNumberOnChannelAmongThoseCalibrated_.
Referenced by scanningROCForState(), and scanValue().
00813 { 00814 assert( objectsDependingOnTheNameTranslationBuilt_ ); 00815 std::map <PixelROCName, unsigned int>::const_iterator foundROC = ROCNumberOnChannelAmongThoseCalibrated_.find(roc); 00816 assert( foundROC != ROCNumberOnChannelAmongThoseCalibrated_.end() ); 00817 return foundROC->second; 00818 }
Definition at line 846 of file PixelCalibConfiguration.cc.
References cols_, nScanPoints(), rows_, and scanROC().
Referenced by colCounter(), nextFECState(), and pixelsWithHits().
00847 { 00848 unsigned int i_row=( state - scanROC(state)*cols_.size()*rows_.size()*nScanPoints() )/( cols_.size()*nScanPoints() ); 00849 assert(i_row<rows_.size()); 00850 return i_row; 00851 }
const std::vector<std::vector<unsigned int> >& pos::PixelCalibConfiguration::rowList | ( | ) | const [inline] |
Definition at line 150 of file PixelCalibConfiguration.h.
References rows_.
Referenced by SiPixelCalibConfiguration::SiPixelCalibConfiguration().
00150 {return rows_;}
unsigned int PixelCalibConfiguration::scanCounter | ( | unsigned int | iscan, | |
unsigned int | state | |||
) | const [private] |
Definition at line 828 of file PixelCalibConfiguration.cc.
References i, nConfigurations(), and nScanPoints().
00829 { 00830 00831 00832 assert(state<nConfigurations()); 00833 00834 unsigned int i_scan=state%nScanPoints(); 00835 00836 for(unsigned int i=0;i<iscan;i++){ 00837 i_scan/=nScanPoints(i); 00838 } 00839 00840 unsigned int i_threshold=i_scan%nScanPoints(iscan); 00841 00842 return i_threshold; 00843 00844 }
unsigned int pos::PixelCalibConfiguration::scanCounter | ( | std::string | dac, | |
unsigned int | state | |||
) | const [inline] |
Definition at line 121 of file PixelCalibConfiguration.h.
References iScan().
Referenced by nextFECState(), and scanValue().
00121 { 00122 return scanCounter(iScan(dac),state); 00123 }
std::string pos::PixelCalibConfiguration::scanName | ( | unsigned int | iscan | ) | const [inline] |
Definition at line 139 of file PixelCalibConfiguration.h.
References dacs_.
Referenced by containsScan(), and SiPixelCalibConfiguration::SiPixelCalibConfiguration().
00139 {return dacs_[iscan].name();}
bool PixelCalibConfiguration::scanningROCForState | ( | PixelROCName | roc, | |
unsigned int | state | |||
) | const |
Definition at line 796 of file PixelCalibConfiguration.cc.
References ROCNumberOnChannelAmongThoseCalibrated(), scanROC(), and singleROC_.
Referenced by nextFECState().
00797 { 00798 if (!singleROC_) return true; 00799 return scanROC(state) == ROCNumberOnChannelAmongThoseCalibrated(roc); 00800 }
Definition at line 768 of file PixelCalibConfiguration.cc.
References cols_, nConfigurations(), nScanPoints(), and rows_.
Referenced by colCounter(), rowCounter(), and scanningROCForState().
00768 { 00769 00770 assert(state<nConfigurations()); 00771 00772 unsigned int i_ROC=state/(cols_.size()*rows_.size()*nScanPoints()); 00773 00774 return i_ROC; 00775 }
unsigned int PixelCalibConfiguration::scanValue | ( | unsigned int | iscan, | |
unsigned int | state, | |||
PixelROCName | roc | |||
) | const [private] |
Definition at line 802 of file PixelCalibConfiguration.cc.
References numROCsCalibratedOnChannel(), ROCNumberOnChannelAmongThoseCalibrated(), and scanValue().
00804 { 00805 00806 unsigned int ROCNumber = ROCNumberOnChannelAmongThoseCalibrated(roc); 00807 unsigned int ROCsOnChannel = numROCsCalibratedOnChannel(roc); 00808 00809 return scanValue( iscan, state, ROCNumber, ROCsOnChannel ); 00810 }
unsigned int PixelCalibConfiguration::scanValue | ( | unsigned int | iscan, | |
unsigned int | state, | |||
unsigned int | ROCNumber, | |||
unsigned int | ROCsOnChannel | |||
) | const [private] |
Definition at line 778 of file PixelCalibConfiguration.cc.
References dacs_, nScanPoints(), scanCounter(), and dimuonsSequences_cff::threshold.
00781 { 00782 00783 unsigned int i_threshold = scanCounter(iscan, state); 00784 00785 // Spread the DAC values on the different ROCs uniformly across the scan range. 00786 if ( dacs_[iscan].mixValuesAcrossROCs() ) i_threshold = (i_threshold + (nScanPoints(iscan)*ROCNumber)/ROCsOnChannel)%nScanPoints(iscan); 00787 00788 unsigned int threshold=dacs_[iscan].value(i_threshold); 00789 00790 //assert(threshold==dacs_[iscan].first()+i_threshold*dacs_[iscan].step()); 00791 00792 return threshold; 00793 00794 }
unsigned int pos::PixelCalibConfiguration::scanValue | ( | std::string | dac, | |
unsigned int | state | |||
) | const [inline] |
Definition at line 130 of file PixelCalibConfiguration.h.
References dacs_, iScan(), and scanValue().
00130 { 00131 assert( !(dacs_[iScan(dac)].mixValuesAcrossROCs()) ); 00132 return scanValue(iScan(dac), state, 0, 1); 00133 }
unsigned int pos::PixelCalibConfiguration::scanValue | ( | std::string | dac, | |
unsigned int | state, | |||
PixelROCName | roc | |||
) | const [inline] |
Definition at line 125 of file PixelCalibConfiguration.h.
References iScan().
Referenced by nextFECState(), and scanValue().
double pos::PixelCalibConfiguration::scanValueMax | ( | unsigned int | iscan | ) | const [inline, private] |
Definition at line 199 of file PixelCalibConfiguration.h.
References dacs_, and nScanPoints().
00199 {return dacs_[iscan].first()+ 00200 dacs_[iscan].step()*(nScanPoints(iscan)-1);}
double pos::PixelCalibConfiguration::scanValueMax | ( | std::string | dac | ) | const [inline] |
Definition at line 143 of file PixelCalibConfiguration.h.
References iScan().
00143 {return scanValueMax(iScan(dac));}
double pos::PixelCalibConfiguration::scanValueMin | ( | unsigned int | iscan | ) | const [inline, private] |
Definition at line 198 of file PixelCalibConfiguration.h.
References dacs_.
00198 {return dacs_[iscan].first();}
double pos::PixelCalibConfiguration::scanValueMin | ( | std::string | dac | ) | const [inline] |
Definition at line 142 of file PixelCalibConfiguration.h.
References iScan().
00142 {return scanValueMin(iScan(dac));}
std::vector<unsigned int> pos::PixelCalibConfiguration::scanValues | ( | unsigned int | iscan | ) | const [inline, private] |
Definition at line 196 of file PixelCalibConfiguration.h.
References dacs_.
00196 {return dacs_[iscan].values();}
std::vector<unsigned int> pos::PixelCalibConfiguration::scanValues | ( | std::string | dac | ) | const [inline] |
Definition at line 140 of file PixelCalibConfiguration.h.
References iScan().
Referenced by SiPixelCalibConfiguration::SiPixelCalibConfiguration().
00140 {return scanValues(iScan(dac));}
bool pos::PixelCalibConfiguration::scanValuesMixedAcrossROCs | ( | unsigned int | iscan | ) | const [inline, private] |
Definition at line 202 of file PixelCalibConfiguration.h.
References dacs_.
00202 {return dacs_[iscan].mixValuesAcrossROCs();}
bool pos::PixelCalibConfiguration::scanValuesMixedAcrossROCs | ( | std::string | dac | ) | const [inline] |
Definition at line 145 of file PixelCalibConfiguration.h.
References iScan().
00145 {return scanValuesMixedAcrossROCs(iScan(dac));}
double pos::PixelCalibConfiguration::scanValueStep | ( | unsigned int | iscan | ) | const [inline, private] |
Definition at line 201 of file PixelCalibConfiguration.h.
References dacs_.
00201 {return dacs_[iscan].step();}
double pos::PixelCalibConfiguration::scanValueStep | ( | std::string | dac | ) | const [inline] |
Definition at line 144 of file PixelCalibConfiguration.h.
References iScan().
00144 {return scanValueStep(iScan(dac));}
bool pos::PixelCalibConfiguration::singleROC | ( | ) | const [inline] |
Definition at line 157 of file PixelCalibConfiguration.h.
References singleROC_.
00157 {return singleROC_;}
void PixelCalibConfiguration::writeASCII | ( | std::string | dir = "" |
) | const [virtual] |
Implements pos::PixelConfigBase.
Definition at line 1494 of file PixelCalibConfiguration.cc.
References cols_, GenMuonPlsPt100GeV_cfg::cout, dacs_, lat::endl(), EgammaValidation_cff::filename, first, highVCalRange_, i, it, j, pos::PixelCalibBase::mode_, ntrigger_, out, parameters_, rocListInstructions_, rows_, singleROC_, and usesROCList_.
01494 { 01495 01496 01497 //FIXME this is not tested for all the use cases... 01498 01499 if (dir!="") dir+="/"; 01500 std::string filename=dir+"calib.dat"; 01501 std::ofstream out(filename.c_str()); 01502 01503 out << "Mode: "<<mode_<<endl; 01504 if (singleROC_) out << "SingleROC"<<endl; 01505 if (!parameters_.empty()){ 01506 out << "Parameters:"<<endl; 01507 std::map<std::string, std::string>::const_iterator it=parameters_.begin(); 01508 for (;it!=parameters_.end();++it){ 01509 out << it->first << " " << it->second <<endl; 01510 } 01511 } 01512 out << "Rows:" <<endl; 01513 for (unsigned int i=0;i<rows_.size();i++){ 01514 for (unsigned int j=0;j<rows_[i].size();j++){ 01515 out << rows_[i][j] <<" "; 01516 } 01517 if (i!=rows_.size()-1) out <<"|"; 01518 out <<endl; 01519 } 01520 out << "Cols:" <<endl; 01521 for (unsigned int i=0;i<cols_.size();i++){ 01522 for (unsigned int j=0;j<cols_[i].size();j++){ 01523 out << cols_[i][j] <<" "; 01524 } 01525 if (i!=cols_.size()-1) out <<"|"; 01526 out <<endl; 01527 } 01528 01529 if (highVCalRange_) { 01530 out << "VcalHigh" << endl; 01531 } 01532 else { 01533 out << "VcalLow" << endl; 01534 } 01535 01536 01537 for (unsigned int i=0;i<dacs_.size();i++){ 01538 if (dacs_[i].uniformSteps()) { 01539 if (dacs_[i].first()!=dacs_[i].last()) { 01540 out << "Scan: "<<dacs_[i].name()<<" "; 01541 out <<dacs_[i].first()<<" "; 01542 out <<dacs_[i].last()<<" "; 01543 out <<dacs_[i].step()<<endl; 01544 } 01545 else { 01546 out << "Set: "<<dacs_[i].name()<<" "; 01547 out <<dacs_[i].first()<<endl; 01548 } 01549 } 01550 else { 01551 out << "ScanValues: "<<dacs_[i].name()<<" "; 01552 for(unsigned int ival=0;ival<dacs_[i].getNPoints();ival++){ 01553 out << dacs_[i].value(ival)<<" "; 01554 } 01555 out<<" -1"<<endl; 01556 } 01557 } 01558 01559 out << "Repeat:" <<endl; 01560 out << ntrigger_ << endl; 01561 01562 if (usesROCList_){ 01563 out << "Rocs:"<< endl; 01564 } 01565 else{ 01566 out << "ToCalibrate:"<< endl; 01567 } 01568 for (unsigned int i=0;i<rocListInstructions_.size();i++){ 01569 out << rocListInstructions_[i] <<endl; 01570 if (rocListInstructions_[i]=="+"||rocListInstructions_[i]=="-"){ 01571 cout << " "; 01572 } 01573 else { 01574 cout << endl; 01575 } 01576 } 01577 01578 out.close(); 01579 01580 }
virtual void pos::PixelCalibConfiguration::writeXML | ( | std::ofstream * | out | ) | const [inline, virtual] |
void pos::PixelCalibConfiguration::writeXML | ( | pos::PixelConfigKey | key, | |
int | version, | |||
std::string | path | |||
) | const [inline, virtual] |
virtual void pos::PixelCalibConfiguration::writeXMLHeader | ( | pos::PixelConfigKey | key, | |
int | version, | |||
std::string | path, | |||
std::ofstream * | out | |||
) | const [inline, virtual] |
virtual void pos::PixelCalibConfiguration::writeXMLTrailer | ( | std::ofstream * | out | ) | const [inline, virtual] |
std::ostream& operator<< | ( | std::ostream & | s, | |
const PixelCalibConfiguration & | calib | |||
) | [friend] |
Definition at line 1355 of file PixelCalibConfiguration.cc.
01355 { 01356 if (!calib.parameters_.empty()) 01357 { 01358 s<< "Parameters:"<<std::endl; 01359 for ( std::map<std::string, std::string>::const_iterator paramItr = calib.parameters_.begin(); paramItr != calib.parameters_.end(); ++paramItr ) 01360 { 01361 s<< paramItr->first << " " << paramItr->second << std::endl; 01362 } 01363 } 01364 01365 s<< "Rows:"<<std::endl; 01366 for (unsigned int i=0;i<calib.rows_.size();i++){ 01367 for (unsigned int j=0;j<calib.rows_[i].size();j++){ 01368 s<<calib.rows_[i][j]<<" "<<std::endl; 01369 } 01370 s<< "|"<<std::endl; 01371 } 01372 01373 s<< "Cols:"<<std::endl; 01374 for (unsigned int i=0;i<calib.cols_.size();i++){ 01375 for (unsigned int j=0;j<calib.cols_[i].size();j++){ 01376 s<<calib.cols_[i][j]<<" "<<std::endl; 01377 } 01378 s<< "|"<<std::endl; 01379 } 01380 01381 s << "Vcal:"<<std::endl; 01382 01383 //s << calib.vcal_<<std::endl; 01384 01385 s << "Vcthr:"<<std::endl; 01386 01387 s << calib.dacs_[0].first() << " " << calib.dacs_[0].last() 01388 << " "<< calib.dacs_[0].step()<<std::endl; 01389 01390 s << "CalDel:"<<std::endl; 01391 01392 s << calib.dacs_[1].first() << " " << calib.dacs_[0].last() 01393 << " "<< calib.dacs_[1].step()<<std::endl; 01394 01395 s << "Repeat:"<<std::endl; 01396 01397 s << calib.ntrigger_<<std::endl; 01398 01399 return s; 01400 01401 }
Definition at line 268 of file PixelCalibConfiguration.h.
Referenced by disablePixels(), enablePixels(), nextFECState(), and PixelCalibConfiguration().
std::string pos::PixelCalibConfiguration::calibFileContent_ [private] |
Definition at line 273 of file PixelCalibConfiguration.h.
Referenced by getStreamedContent(), and PixelCalibConfiguration().
std::set<PixelChannel> pos::PixelCalibConfiguration::channels_ [private] |
Definition at line 224 of file PixelCalibConfiguration.h.
Referenced by buildObjectsDependingOnTheNameTranslation(), and channelList().
std::vector<std::vector<unsigned int> > pos::PixelCalibConfiguration::cols_ [private] |
Definition at line 215 of file PixelCalibConfiguration.h.
Referenced by colCounter(), columnList(), disablePixels(), enablePixels(), maxNumHitsPerROC(), nextFECState(), nPixelPatterns(), pos::operator<<(), PixelCalibConfiguration(), pixelsWithHits(), rowCounter(), scanROC(), and writeASCII().
std::vector<PixelDACScanRange> pos::PixelCalibConfiguration::dacs_ [private] |
Definition at line 234 of file PixelCalibConfiguration.h.
Referenced by iScan(), nextFECState(), nScanPoints(), numberOfScanVariables(), pos::operator<<(), PixelCalibConfiguration(), scanName(), scanValue(), scanValueMax(), scanValueMin(), scanValues(), scanValuesMixedAcrossROCs(), scanValueStep(), and writeASCII().
std::vector<std::pair<unsigned int, std::vector<unsigned int> > > pos::PixelCalibConfiguration::fedCardsAndChannels_ [mutable, private] |
Definition at line 245 of file PixelCalibConfiguration.h.
Referenced by nextFECState(), PixelCalibConfiguration(), and writeASCII().
std::set<PixelModuleName> pos::PixelCalibConfiguration::modules_ [private] |
Definition at line 219 of file PixelCalibConfiguration.h.
Referenced by buildROCAndModuleListsFromROCSet(), getFECCrates(), getFEDCrates(), getTKFECCrates(), and moduleList().
unsigned int pos::PixelCalibConfiguration::nROC_ [private] |
Definition at line 243 of file PixelCalibConfiguration.h.
Referenced by buildROCAndModuleListsFromROCSet(), and nROC().
unsigned int pos::PixelCalibConfiguration::ntrigger_ [private] |
Definition at line 242 of file PixelCalibConfiguration.h.
Referenced by nTriggersPerPattern(), pos::operator<<(), PixelCalibConfiguration(), and writeASCII().
std::map<PixelROCName, unsigned int> pos::PixelCalibConfiguration::numROCsCalibratedOnChannel_ [private] |
Definition at line 226 of file PixelCalibConfiguration.h.
Referenced by buildObjectsDependingOnTheNameTranslation(), and numROCsCalibratedOnChannel().
Definition at line 227 of file PixelCalibConfiguration.h.
Referenced by buildObjectsDependingOnTheNameTranslation(), channelList(), numROCsCalibratedOnChannel(), PixelCalibConfiguration(), and ROCNumberOnChannelAmongThoseCalibrated().
std::vector<int> pos::PixelCalibConfiguration::old_icols [mutable, private] |
Definition at line 263 of file PixelCalibConfiguration.h.
Referenced by buildROCAndModuleListsFromROCSet().
std::vector<int> pos::PixelCalibConfiguration::old_irows [mutable, private] |
Definition at line 262 of file PixelCalibConfiguration.h.
Referenced by buildROCAndModuleListsFromROCSet().
std::map<std::string, std::string> pos::PixelCalibConfiguration::parameters_ [private] |
Definition at line 265 of file PixelCalibConfiguration.h.
Referenced by nParameters(), pos::operator<<(), parametersList(), parameterValue(), PixelCalibConfiguration(), and writeASCII().
Definition at line 220 of file PixelCalibConfiguration.h.
Referenced by buildObjectsDependingOnTheNameTranslation(), buildROCAndModuleLists(), buildROCAndModuleListsFromROCSet(), fedCardsAndChannels(), getFECCrates(), getFEDCrates(), getFEDsAndChannels(), getTKFECCrates(), moduleList(), nextFECState(), nROC(), PixelCalibConfiguration(), and rocList().
std::vector<PixelROCInfo> pos::PixelCalibConfiguration::rocInfo_ [mutable, private] |
std::vector<std::string> pos::PixelCalibConfiguration::rocListInstructions_ [private] |
Definition at line 221 of file PixelCalibConfiguration.h.
Referenced by buildROCAndModuleLists(), PixelCalibConfiguration(), and writeASCII().
std::map<PixelROCName, unsigned int> pos::PixelCalibConfiguration::ROCNumberOnChannelAmongThoseCalibrated_ [private] |
Definition at line 225 of file PixelCalibConfiguration.h.
Referenced by buildObjectsDependingOnTheNameTranslation(), and ROCNumberOnChannelAmongThoseCalibrated().
std::vector<PixelROCName> pos::PixelCalibConfiguration::rocs_ [mutable, private] |
Definition at line 217 of file PixelCalibConfiguration.h.
Referenced by buildObjectsDependingOnTheNameTranslation(), buildROCAndModuleListsFromROCSet(), fedCardsAndChannels(), getFEDsAndChannels(), nextFECState(), and rocList().
std::vector<std::vector<unsigned int> > pos::PixelCalibConfiguration::rows_ [private] |
Definition at line 214 of file PixelCalibConfiguration.h.
Referenced by colCounter(), disablePixels(), enablePixels(), maxNumHitsPerROC(), nextFECState(), nPixelPatterns(), pos::operator<<(), PixelCalibConfiguration(), pixelsWithHits(), rowCounter(), rowList(), scanROC(), and writeASCII().
bool pos::PixelCalibConfiguration::singleROC_ [private] |
Definition at line 212 of file PixelCalibConfiguration.h.
Referenced by buildROCAndModuleListsFromROCSet(), PixelCalibConfiguration(), scanningROCForState(), singleROC(), and writeASCII().
Definition at line 270 of file PixelCalibConfiguration.h.
Referenced by PixelCalibConfiguration(), and writeASCII().