5 out <<
"L1 BMTF Parameters" << std::endl;
7 out <<
"Firmware version: " <<
fwVersion_ << std::endl;
38 std::vector<LUT>
pta_lut(0); pta_lut.reserve(19);
40 if (
load_pt(pta_lut,pta_threshold, allInts[
"PT_Assignment_nbits_Phi"], AssLUTpath) != 0 ) {
41 cout <<
"Can not open files to load pt-assignment look-up tables for L1TMuonBarrelTrackProducer!" << endl;
47 std::vector<LUT>
phi_lut(0); phi_lut.reserve(2);
48 if (
load_phi(phi_lut, allInts[
"PHI_Assignment_nbits_Phi"], allInts[
"PHI_Assignment_nbits_PhiB"], AssLUTpath) != 0 ) {
49 cout <<
"Can not open files to load phi-assignment look-up tables for L1TMuonBarrelTrackProducer!" << endl;
64 for(
int wh=-3; wh<4; wh++ ) {
66 for(
char&
c : allMasks[
"mask_phtf_st1"].at(wh+3) ) {
72 for(
char&
c : allMasks[
"mask_phtf_st2"].at(wh+3) ) {
78 for(
char&
c : allMasks[
"mask_phtf_st3"].at(wh+3) ) {
84 for(
char&
c : allMasks[
"mask_phtf_st4"].at(wh+3) ) {
90 for(
char&
c : allMasks[
"mask_ettf_st1"].at(wh+3) ) {
96 for(
char&
c : allMasks[
"mask_ettf_st2"].at(wh+3) ) {
102 for(
char&
c : allMasks[
"mask_ettf_st3"].at(wh+3) ) {
114 std::vector<L1TMuonBarrelParams::LUTParams::extLUT>
ext_lut(0); ext_lut.reserve(12);
115 if (
load_ext(ext_lut, allInts[
"PHI_Assignment_nbits_Phi"], allInts[
"PHI_Assignment_nbits_PhiB"]) != 0 ) {
116 cout <<
"Can not open files to load extrapolation look-up tables for L1TMuonBarrelTrackProducer!" << endl;
125 std::map<std::string, std::string> procRole = trgSys.
getProcRole();
127 for(
auto it_proc=procRole.begin(); it_proc!=procRole.end(); it_proc++ )
132 std::map<std::string, l1t::Setting> settings = trgSys.
getSettings(procId);
133 std::vector<l1t::TableRow> tRow = settings[
"regTable"].getTableRows();
134 for(
auto it=tRow.begin(); it!=tRow.end(); it++)
136 if (it->getRowValue<
std::string>(
"register_path").find(
"open_lut") != std::string::npos){
140 if (it->getRowValue<
std::string>(
"register_path").find(
"sel_21") != std::string::npos){
145 if (it->getRowValue<
std::string>(
"register_path").find(
"dis_newalgo") != std::string::npos){
149 bool disnewalgo = (it->getRowValue<
int>(
"register_value")==1);
153 string masks[5] = {
"mask_ctrl_N2",
"mask_ctrl_N1",
"mask_ctrl_0",
"mask_ctrl_P1",
"mask_ctrl_P2"};
155 for(
int m=0;
m<5;
m++)
158 if (it->getRowValue<
std::string>(
"register_path").find(masks[
m]) != std::string::npos){
159 string mask_ctrl = it->getRowValue<
string>(
"register_value");
160 const char *hexstring = mask_ctrl.c_str();
162 int mask = (int)strtol((hexstring+7),
NULL, 16);
163 int mask_all = (int)strtol((hexstring),
NULL, 16);
165 if(!( mask_all==0x111111 || mask_all==0x222222 || mask_all==0x333333 || mask_all==0x444444 ||
166 mask_all==0x555555 || mask_all==0x666666 || mask_all==0x777777) )
167 cerr<<
"BMTF: Cannot re-emulate properly. Individual link masking cannot be handled."<<endl;
170 for(
int sec=0; sec<12; sec++){
171 if(masks[m]==
"mask_ctrl_N2"){
175 if(masks[m]==
"mask_ctrl_N1"){
180 if(masks[m]==
"mask_ctrl_0"){
186 if(masks[m]==
"mask_ctrl_P1"){
190 if(masks[m]==
"mask_ctrl_P2"){
199 for(
int sec=0; sec<12; sec++){
200 if(masks[m]==
"mask_ctrl_N2"){
204 if(masks[m]==
"mask_ctrl_N1"){
209 if(masks[m]==
"mask_ctrl_0"){
215 if(masks[m]==
"mask_ctrl_P1"){
219 if(masks[m]==
"mask_ctrl_P2"){
227 for(
int sec=0; sec<12; sec++){
228 if(masks[m]==
"mask_ctrl_N2"){
232 if(masks[m]==
"mask_ctrl_N1"){
237 if(masks[m]==
"mask_ctrl_0"){
243 if(masks[m]==
"mask_ctrl_P1"){
247 if(masks[m]==
"mask_ctrl_P2"){
255 for(
int sec=0; sec<12; sec++){
256 if(masks[m]==
"mask_ctrl_N2"){
259 if(masks[m]==
"mask_ctrl_N1"){
263 if(masks[m]==
"mask_ctrl_0"){
267 if(masks[m]==
"mask_ctrl_P1"){
270 if(masks[m]==
"mask_ctrl_P2"){
282 std::vector<int>& pta_threshold,
283 unsigned short int nbitphi,
290 const int MAX_PTASSMETHA = 12;
295 PB12H, PB13H, PB14H, PB21H, PB23H, PB24H, PB34H,
303 int nbit_phi = nbitphi;
304 int sh_phi = 12 - nbit_phi;
309 case PT12L : { pta_str =
"pta12l";
break; }
310 case PT12H : { pta_str =
"pta12h";
break; }
311 case PT13L : { pta_str =
"pta13l";
break; }
312 case PT13H : { pta_str =
"pta13h";
break; }
313 case PT14L : { pta_str =
"pta14l";
break; }
314 case PT14H : { pta_str =
"pta14h";
break; }
315 case PT23L : { pta_str =
"pta23l";
break; }
316 case PT23H : { pta_str =
"pta23h";
break; }
317 case PT24L : { pta_str =
"pta24l";
break; }
318 case PT24H : { pta_str =
"pta24h";
break; }
319 case PT34L : { pta_str =
"pta34l";
break; }
320 case PT34H : { pta_str =
"pta34h";
break; }
321 case PB12H : { pta_str =
"ptb12h_Feb2016";
break; }
322 case PB13H : { pta_str =
"ptb13h_Feb2016";
break; }
323 case PB14H : { pta_str =
"ptb14h_Feb2016";
break; }
324 case PB21H : { pta_str =
"ptb21h_Feb2016";
break; }
325 case PB23H : { pta_str =
"ptb23h_Feb2016";
break; }
326 case PB24H : { pta_str =
"ptb24h_Feb2016";
break; }
327 case PB34H : { pta_str =
"ptb34h_Feb2016";
break; }
332 string lutpath = AssLUTpath;
338 if ( file.
open() != 0 )
return -1;
342 int adr_old = -2048 >>
shift;
343 if (pam >= MAX_PTASSMETHA) adr_old = -512 >>
shift;
356 while ( file.
good() ) {
363 if ( adr != adr_old ) {
365 tmplut.insert(make_pair( adr_old, (sum_pt/number) ));
379 pta_lut.push_back(tmplut);
389 unsigned short int nbit_phi,
390 unsigned short int nbit_phib,
398 int sh_phi = 12 - nbit_phi;
399 int sh_phib = 10 - nbit_phib;
405 case 0 : { phi_str =
"phi12";
break; }
406 case 1 : { phi_str =
"phi42";
break; }
415 if ( file.
open() != 0 )
return -1;
420 int adr_old = -512 >> sh_phib;
424 while ( file.
good() ) {
431 if ( adr != adr_old ) {
433 tmplut.insert(make_pair( adr_old, ((sum_phi/number) >> sh_phi) ));
447 phi_lut.push_back(tmplut);
475 unsigned short int nbit_phi,
476 unsigned short int nbit_phib) {
486 string defaultPath =
"L1Trigger/L1TMuon/data/bmtf_luts/";
487 string ext_dir =
"LUTs_Ext/";
494 int sh_phi = 12 - nbit_phi;
495 int sh_phib = 10 - nbit_phib;
498 for (
int ext = 0; ext <
MAX_EXT; ext++ ) {
500 case EX12 : ext_str =
"ext12";
break;
501 case EX13 : ext_str =
"ext13";
break;
502 case EX14 : ext_str =
"ext14";
break;
503 case EX21 : ext_str =
"ext21";
break;
504 case EX23 : ext_str =
"ext23";
break;
505 case EX24 : ext_str =
"ext24";
break;
506 case EX34 : ext_str =
"ext34";
break;
507 case EX15 : ext_str =
"ext15";
break;
508 case EX16 : ext_str =
"ext16";
break;
509 case EX25 : ext_str =
"ext25";
break;
510 case EX26 : ext_str =
"ext26";
break;
511 case EX56 : ext_str =
"ext56";
break;
520 if ( file.
open() != 0 )
return -1;
527 int adr_old = -512 >> sh_phib;
532 while ( file.
good() ) {
540 if ( adr != adr_old ) {
542 tmplut.
low[adr_old] = sum_low >> sh_phi;
543 tmplut.
high[adr_old] = sum_high >> sh_phi;
552 if (number == 0) sum_low = low;
553 if (number == 0) sum_high = high;
559 ext_lut.push_back(tmplut);
L1MuDTEtaPatternLut l1mudttfetaplut
void configFromDB(l1t::TrigSystem &trgSys)
const std::map< std::string, std::string > & getProcRole()
L1MuDTTFParameters l1mudttfparams
void set_Extrapolation_21(bool par1)
void set_PHI_Assignment_nbits_PhiB(int par1)
void set_PT_Assignment_nbits_Phi(int par1)
void set_etsoc_chdis_st1(int wh, int sc, const bool val)
int load_phi(std::vector< LUT > &, unsigned short int, unsigned short int, std::string)
std::vector< LUT > phi_lut() const
void set_Extrapolation_nbits_PhiB(int par1)
void set_etsoc_chdis_st2(int wh, int sc, const bool val)
bool good()
return status of file stream
void set_OutOfTime_Filter(bool par1)
int load()
load pattern look-up table
void set_Extrapolation_nbits_Phi(int par1)
std::vector< LUT > pta_lut() const
std::vector< int > pta_threshold() const
void set_DisableNewAlgo(bool par1)
void set_Open_LUTs(bool par1)
std::vector< LUTParams::extLUT > ext_lut() const
void setphi_lut(std::vector< LUT > philut)
int load_ext(std::vector< L1TMuonBarrelParams::LUTParams::extLUT > &, unsigned short int, unsigned short int)
L1MuDTTFMasks l1mudttfmasks
void set_OutOfTime_Filter_Window(int par1)
void setpta_lut(std::vector< LUT > ptalut)
void set_inrec_chdis_st4(int wh, int sc, const bool val)
int load_pt(std::vector< LUT > &, std::vector< int > &, unsigned short int, std::string)
if configDB
int load()
load look-up tables
void reset()
reset parameters to zero
std::map< std::string, Setting > getSettings(const std::string &processor)
void set_PHI_Assignment_nbits_Phi(int par1)
void setAssLUTPath(std::string path)
void set_Extrapolation_Filter(int par1)
L1MuDTQualPatternLut l1mudttfqualplut
friend std::ostream& operator<<(std::ostream& o, const L1TMuonBarrelParams & p) { p...
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
void set_inrec_chdis_st2(int wh, int sc, const bool val)
void set_EtaTrackFinder(bool par1)
std::map< short, short, std::less< short > > LUT
L1MuBMPtaLut.
void set_inrec_chdis_st3(int wh, int sc, const bool val)
void setFwVersion(unsigned fwVersion)
void set_etsoc_chdis_st3(int wh, int sc, const bool val)
void setext_lut(std::vector< LUTParams::extLUT > extlut)
void configFromPy(std::map< std::string, int > &allInts, std::map< std::string, bool > &allBools, std::map< std::string, std::vector< std::string > > allMasks, unsigned int fwVersion, const std::string &AssLUTpath)
int readInteger()
read one integer from file
void set_BX_max(int par1)
constexpr uint32_t masks[]
void set_PT_Assignment_nbits_PhiB(int par1)
static unsigned int const shift
void print(std::ostream &) const
void set_BX_min(int par1)
std::string fullPath() const
L1TMuonBarrelParamsHelper()
void setpta_threshold(std::vector< int > ptathresh)
void set_inrec_chdis_csc(int wh, int sc, const bool val)
void set_inrec_chdis_st1(int wh, int sc, const bool val)