CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
L1MuBMAssignmentUnit Class Reference

#include <L1MuBMAssignmentUnit.h>

Public Member Functions

 L1MuBMAssignmentUnit (L1MuBMSectorProcessor &sp, int id)
 constructor More...
 
void PhiAU (const L1TMuonBarrelParams &)
 assign phi More...
 
void PtAU (const L1TMuonBarrelParams &)
 assign pt and charge More...
 
void QuaAU ()
 assign quality More...
 
unsigned int Quality ()
 
void reset ()
 reset Assignment Unit More...
 
void run (const L1TMuonBarrelParams &mbtfParams)
 run Assignment Unit More...
 
 ~L1MuBMAssignmentUnit ()
 destructor More...
 

Static Public Member Functions

static void setPrecision ()
 set precision of phi and phib More...
 

Private Member Functions

int getPt1Address (L1MuBMLUTHandler::PtAssMethod) const
 
L1MuBMLUTHandler::PtAssMethod getPt1Method (L1MuBMLUTHandler::PtAssMethod) const
 
int getPt2Address (L1MuBMLUTHandler::PtAssMethod) const
 
L1MuBMLUTHandler::PtAssMethod getPt2Method (L1MuBMLUTHandler::PtAssMethod) const
 
int getPtAddress (L1MuBMLUTHandler::PtAssMethod, int bendcharge=0) const
 calculate bend angle More...
 
L1MuBMLUTHandler::PtAssMethod getPtMethod () const
 determine pt assignment method More...
 
const L1MuBMTrackSegPhigetTSphi (int station) const
 get track segment from a given station More...
 
int phiDiff (int stat1, int stat2) const
 build difference of two phi values More...
 
void TSR ()
 Track Segment Router. More...
 

Static Private Member Functions

static int convertSector (int)
 convert sector Id to 8 bit code (= sector center) More...
 
static int getCharge (L1MuBMLUTHandler::PtAssMethod)
 determine charge More...
 

Private Attributes

L1MuBMAddressArray m_addArray
 
int m_id
 
L1MuBMLUTHandler::PtAssMethod m_ptAssMethod
 
L1MuBMSectorProcessorm_sp
 
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
 
L1MuBMLUTHandlerthePhiLUTs
 phi-assignment look-up tables More...
 
L1MuBMLUTHandlerthePtaLUTs
 pt-assignment look-up tables More...
 

Static Private Attributes

static unsigned short nbit_phi = 12
 

of bits used for pt-assignment

More...
 
static unsigned short nbit_phib = 10
 

of bits used for pt-assignment

More...
 

Detailed Description

Assignment Unit:

assigns pt, charge, phi and quality to a muon candidate found by the Track Assembler

N. Neumeister CERN EP J. Troconiz UAM Madrid

Definition at line 51 of file L1MuBMAssignmentUnit.h.

Constructor & Destructor Documentation

◆ L1MuBMAssignmentUnit()

L1MuBMAssignmentUnit::L1MuBMAssignmentUnit ( L1MuBMSectorProcessor sp,
int  id 
)

constructor

Definition at line 56 of file L1MuBMAssignmentUnit.cc.

References m_TSphi, reset(), and setPrecision().

58  m_TSphi.reserve(4); // a track candidate can consist of max 4 TS
59  reset();
60  setPrecision();
61 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
static void setPrecision()
set precision of phi and phib
L1MuBMAddressArray m_addArray
void reset()
reset Assignment Unit
L1MuBMSectorProcessor & m_sp
L1MuBMLUTHandler::PtAssMethod m_ptAssMethod

◆ ~L1MuBMAssignmentUnit()

L1MuBMAssignmentUnit::~L1MuBMAssignmentUnit ( )

destructor

Definition at line 67 of file L1MuBMAssignmentUnit.cc.

67 {}

Member Function Documentation

◆ convertSector()

int L1MuBMAssignmentUnit::convertSector ( int  sector)
staticprivate

convert sector Id to 8 bit code (= sector center)

Definition at line 410 of file L1MuBMAssignmentUnit.cc.

References hgcalTBTopologyTester_cfi::sector.

410  {
411  // assert( sector >=0 && sector < 12 );
412  const int sectorvalues[12] = {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132};
413 
414  return sectorvalues[sector];
415 }

◆ getCharge()

int L1MuBMAssignmentUnit::getCharge ( L1MuBMLUTHandler::PtAssMethod  method)
staticprivate

determine charge

Definition at line 420 of file L1MuBMAssignmentUnit.cc.

References AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, L1MuBMLUTHandler::PT12H, L1MuBMLUTHandler::PT12L, L1MuBMLUTHandler::PT13H, L1MuBMLUTHandler::PT13L, L1MuBMLUTHandler::PT14H, L1MuBMLUTHandler::PT14L, L1MuBMLUTHandler::PT23H, L1MuBMLUTHandler::PT23L, L1MuBMLUTHandler::PT24H, L1MuBMLUTHandler::PT24L, L1MuBMLUTHandler::PT34H, and L1MuBMLUTHandler::PT34L.

Referenced by PtAU().

420  {
421  int chargesign = 0;
422  switch (method) {
424  chargesign = -1;
425  break;
426  }
428  chargesign = -1;
429  break;
430  }
432  chargesign = -1;
433  break;
434  }
436  chargesign = -1;
437  break;
438  }
440  chargesign = -1;
441  break;
442  }
444  chargesign = -1;
445  break;
446  }
448  chargesign = -1;
449  break;
450  }
452  chargesign = -1;
453  break;
454  }
456  chargesign = -1;
457  break;
458  }
460  chargesign = -1;
461  break;
462  }
464  chargesign = 1;
465  break;
466  }
468  chargesign = 1;
469  break;
470  }
471 
473  chargesign = 0;
474  // cerr << "AssignmentUnit::getCharge : undefined PtAssMethod!"
475  // << endl;
476  break;
477  }
478  default: {
479  chargesign = 0;
480  }
481  }
482 
483  return chargesign;
484 }

◆ getPt1Address()

int L1MuBMAssignmentUnit::getPt1Address ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 756 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, L1MuBMTrackSegPhi::phib(), L1MuBMLUTHandler::PT12H, L1MuBMLUTHandler::PT13H, L1MuBMLUTHandler::PT14H, L1MuBMLUTHandler::PT23H, L1MuBMLUTHandler::PT24H, and L1MuBMLUTHandler::PT34H.

Referenced by PtAU().

756  {
757  // phib values of track segments from stations 1, 2 and 4
758  int phib1 = (getTSphi(1) != nullptr) ? getTSphi(1)->phib() : -999;
759  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : -999;
760  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : -999;
761 
762  int bendangle = -999;
763  switch (method) {
765  bendangle = phib1;
766  break;
767  }
769  bendangle = phib1;
770  break;
771  }
773  bendangle = phib1;
774  break;
775  }
777  bendangle = phib2;
778  break;
779  }
781  bendangle = phib2;
782  break;
783  }
785  bendangle = phib4;
786  break;
787  }
789  bendangle = -999;
790  break;
791  }
792  default: {
793  bendangle = -999;
794  }
795  }
796 
797  return bendangle;
798 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int phib() const
return phib

◆ getPt1Method()

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::getPt1Method ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 669 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, L1MuBMLUTHandler::PB12H, L1MuBMLUTHandler::PB13H, L1MuBMLUTHandler::PB14H, L1MuBMLUTHandler::PB23H, L1MuBMLUTHandler::PB24H, L1MuBMLUTHandler::PB34H, L1MuBMLUTHandler::PT12H, L1MuBMLUTHandler::PT13H, L1MuBMLUTHandler::PT14H, L1MuBMLUTHandler::PT23H, L1MuBMLUTHandler::PT24H, L1MuBMLUTHandler::PT34H, and L1MuBMTrackSegPhi::quality().

Referenced by PtAU().

669  {
670  // quality values of track segments from stations 1, 2 and 4
671  int qual1 = (getTSphi(1) != nullptr) ? getTSphi(1)->quality() : 0;
672  int qual2 = (getTSphi(2) != nullptr) ? getTSphi(2)->quality() : 0;
673  int qual4 = (getTSphi(4) != nullptr) ? getTSphi(4)->quality() : 0;
674 
676 
677  switch (method) {
679  if (qual1 > 3)
681  break;
682  }
684  if (qual1 > 3)
686  break;
687  }
689  if (qual1 > 3)
691  break;
692  }
694  if (qual2 > 3)
696  break;
697  }
699  if (qual2 > 3)
701  break;
702  }
704  if (qual4 > 3)
706  break;
707  }
710  break;
711  }
712  default: {
714  }
715  }
716 
717  return pam;
718 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int quality() const
return quality code

◆ getPt2Address()

int L1MuBMAssignmentUnit::getPt2Address ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 803 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, L1MuBMTrackSegPhi::phib(), L1MuBMLUTHandler::PT12H, L1MuBMLUTHandler::PT14H, and L1MuBMLUTHandler::PT24H.

Referenced by PtAU().

803  {
804  // phib values of track segments from stations 1, 2 and 4
805  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : -999;
806  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : -999;
807 
808  int bendangle = -999;
809  switch (method) {
811  bendangle = phib2;
812  break;
813  }
815  bendangle = phib4;
816  break;
817  }
819  bendangle = phib4;
820  break;
821  }
822  //case L1MuBMLUTHandler::PT12HO : { bendangle = phib2; break; }
823  //case L1MuBMLUTHandler::PT14HO : { bendangle = phib4; break; }
824  //case L1MuBMLUTHandler::PT24HO : { bendangle = phib4; break; }
826  bendangle = -999;
827  break;
828  }
829  default: {
830  bendangle = -999;
831  }
832  }
833 
834  return bendangle;
835 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int phib() const
return phib

◆ getPt2Method()

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::getPt2Method ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 723 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, L1MuBMLUTHandler::PB21H, L1MuBMLUTHandler::PT12H, and L1MuBMTrackSegPhi::quality().

Referenced by PtAU().

723  {
724  // quality values of track segments from stations 2 and 4
725  int qual2 = (getTSphi(2) != nullptr) ? getTSphi(2)->quality() : 0;
726  // int qual4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->quality() : 0;
727 
729 
730  switch (method) {
732  if (qual2 > 3)
734  break;
735  }
736  // case PT14H : { if (qual4 > 3) pam = PB34H; break; }
737  // case PT24H : { if (qual4 > 3) pam = PB34H; break; }
738  //case PT12HO : { if (qual2 > 3) pam = PB21HO; break; }
739  // case PT14HO : { if (qual4 > 3) pam = PB34HO; break; }
740  // case PT24HO : { if (qual4 > 3) pam = PB34HO; break; }
743  break;
744  }
745  default: {
747  }
748  }
749 
750  return pam;
751 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int quality() const
return quality code

◆ getPtAddress()

int L1MuBMAssignmentUnit::getPtAddress ( L1MuBMLUTHandler::PtAssMethod  method,
int  bendcharge = 0 
) const
private

calculate bend angle

Definition at line 556 of file L1MuBMAssignmentUnit.cc.

References AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, phiDiff(), L1MuBMLUTHandler::PT12H, L1MuBMLUTHandler::PT12L, L1MuBMLUTHandler::PT13H, L1MuBMLUTHandler::PT13L, L1MuBMLUTHandler::PT14H, L1MuBMLUTHandler::PT14L, L1MuBMLUTHandler::PT23H, L1MuBMLUTHandler::PT23L, L1MuBMLUTHandler::PT24H, L1MuBMLUTHandler::PT24L, L1MuBMLUTHandler::PT34H, and L1MuBMLUTHandler::PT34L.

Referenced by PtAU().

556  {
557  // calculate bend angle as difference of two azimuthal positions
558 
559  int bendangle = 0;
560  switch (method) {
562  bendangle = phiDiff(1, 2);
563  break;
564  }
566  bendangle = phiDiff(1, 2);
567  break;
568  }
570  bendangle = phiDiff(1, 3);
571  break;
572  }
574  bendangle = phiDiff(1, 3);
575  break;
576  }
578  bendangle = phiDiff(1, 4);
579  break;
580  }
582  bendangle = phiDiff(1, 4);
583  break;
584  }
586  bendangle = phiDiff(2, 3);
587  break;
588  }
590  bendangle = phiDiff(2, 3);
591  break;
592  }
594  bendangle = phiDiff(2, 4);
595  break;
596  }
598  bendangle = phiDiff(2, 4);
599  break;
600  }
602  bendangle = phiDiff(4, 3);
603  break;
604  }
606  bendangle = phiDiff(4, 3);
607  break;
608  }
610  bendangle = 0;
611  // cerr << "AssignmentUnit::getPtAddress : undefined PtAssMethod" << endl;
612  break;
613  }
614  default: {
615  bendangle = 0;
616  }
617  }
618 
619  int signo = 1;
620  bendangle = (bendangle + 8192) % 4096;
621  if (bendangle > 2047)
622  bendangle -= 4096;
623  if (bendangle < 0)
624  signo = -1;
625 
626  if (bendcharge)
627  return signo;
628 
629  bendangle = (bendangle + 2048) % 1024;
630  if (bendangle > 511)
631  bendangle -= 1024;
632 
633  return bendangle;
634 }
int phiDiff(int stat1, int stat2) const
build difference of two phi values

◆ getPtMethod()

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::getPtMethod ( ) const
private

determine pt assignment method

Definition at line 490 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), L1MuBMLUTHandler::getPtLutThreshold(), getTSphi(), m_id, m_sp, AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, L1MuBMTrackSegPhi::phib(), L1MuBMLUTHandler::PT12H, L1MuBMLUTHandler::PT12L, L1MuBMLUTHandler::PT13H, L1MuBMLUTHandler::PT13L, L1MuBMLUTHandler::PT14H, L1MuBMLUTHandler::PT14L, L1MuBMLUTHandler::PT23H, L1MuBMLUTHandler::PT23L, L1MuBMLUTHandler::PT24H, L1MuBMLUTHandler::PT24L, L1MuBMLUTHandler::PT34H, L1MuBMLUTHandler::PT34L, alignCSCRings::s, L1MuBMSectorProcessor::TA(), thePtaLUTs, remoteMonitoring_LASER_era2018_cfg::threshold, and L1MuBMTrackAssembler::trackBitMap().

Referenced by PtAU().

490  {
491  // determine which pt-assignment method should be used as a function
492  // of the track class and
493  // of the phib values of the track segments making up this track candidate.
494 
495  // get bitmap of track candidate
496  const bitset<4> s = m_sp.TA()->trackBitMap(m_id);
497 
498  int method = -1;
499 
500  if (s.test(0) && s.test(3))
501  method = 2; // stations 1 and 4
502  if (s.test(0) && s.test(2))
503  method = 1; // stations 1 and 3
504  if (s.test(0) && s.test(1))
505  method = 0; // stations 1 and 2
506  if (!s.test(0) && s.test(1) && s.test(3))
507  method = 4; // stations 2 and 4
508  if (!s.test(0) && s.test(1) && s.test(2))
509  method = 3; // stations 2 and 3
510  if (!s.test(0) && !s.test(1) && s.test(2) && s.test(3))
511  method = 5; // stations 3 and 4
513 
514  // phib values of track segments from stations 1, 2 and 4
515  int phib1 = (getTSphi(1) != nullptr) ? getTSphi(1)->phib() : 0;
516  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : 0;
517  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : 0;
518 
520 
521  switch (method) {
522  case 0: {
524  break;
525  }
526  case 1: {
528  break;
529  }
530  case 2: {
532  break;
533  }
534  case 3: {
536  break;
537  }
538  case 4: {
540  break;
541  }
542  case 5: {
544  break;
545  }
546  default:;
547  //cout << "L1MuBMAssignmentUnit : Error in PT ass method evaluation" << endl;
548  }
549 
550  return pam;
551 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
L1MuBMLUTHandler * thePtaLUTs
pt-assignment look-up tables
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const L1MuBMTrackAssembler * TA() const
return pointer to Track Assembler
int phib() const
return phib
const std::bitset< 4 > & trackBitMap(int id) const
return bitmap of found track
int getPtLutThreshold(int pta_ind) const
get pt-assignment LUT threshold
L1MuBMSectorProcessor & m_sp

◆ getTSphi()

const L1MuBMTrackSegPhi * L1MuBMAssignmentUnit::getTSphi ( int  station) const
private

get track segment from a given station

Definition at line 394 of file L1MuBMAssignmentUnit.cc.

References m_TSphi, and relativeConstraints::station.

Referenced by getPt1Address(), getPt1Method(), getPt2Address(), getPt2Method(), getPtMethod(), PhiAU(), and phiDiff().

394  {
395  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
396  for (iter = m_TSphi.begin(); iter != m_TSphi.end(); iter++) {
397  int stat = (*iter)->station();
398  if (station == stat) {
399  return (*iter);
400  break;
401  }
402  }
403 
404  return nullptr;
405 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi

◆ PhiAU()

void L1MuBMAssignmentUnit::PhiAU ( const L1TMuonBarrelParams bmtfParams)

assign phi

< phi-assignment look-up tables

Definition at line 124 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), l1t::bitShift(), dqmdumpme::first, L1MuBMLUTHandler::getDeltaPhi(), L1MuBMTFConfig::getNbitsPhiPhi(), L1MuBMTFConfig::getNbitsPhiPhib(), getTSphi(), L1MuBMSectorProcessor::id(), dqmdumpme::k, m_id, m_sp, phi, L1MuBMTrackSegPhi::phi(), L1MuBMTrackSegPhi::phib(), edm::second(), hgcalTBTopologyTester_cfi::sector, L1MuBMSecProcId::sector(), L1MuBMTrackSegPhi::sector(), L1MuBMTrack::setPhi(), thePhiLUTs, L1MuBMSectorProcessor::track(), and L1MuBMSectorProcessor::tracK().

Referenced by run().

124  {
125  thePhiLUTs = new L1MuBMLUTHandler(bmtfParams);
126  //thePhiLUTs->print();
127  // calculate phi at station 2 using 8 bits (precision = 0.625 degrees)
128  int sh_phi = 12 - L1MuBMTFConfig::getNbitsPhiPhi();
129  int sh_phib = 10 - L1MuBMTFConfig::getNbitsPhiPhib();
130 
131  const L1MuBMTrackSegPhi* second = getTSphi(2); // track segment at station 2
132  const L1MuBMTrackSegPhi* first = getTSphi(1); // track segment at station 1
133  const L1MuBMTrackSegPhi* forth = getTSphi(4); // track segment at station 4
134 
135  int phi2 = 0; // phi-value at station 2
136  int sector = 0;
137  if (second) {
138  phi2 = second->phi() >> sh_phi;
139  sector = second->sector();
140  } else if (second == nullptr && first) {
141  phi2 = first->phi() >> sh_phi;
142  sector = first->sector();
143  } else if (second == nullptr && forth) {
144  phi2 = forth->phi() >> sh_phi;
145  sector = forth->sector();
146  }
147 
148  int sector0 = m_sp.id().sector();
149 
150  // convert sector difference to values in the range -6 to +5
151 
152  int sectordiff = (sector - sector0) % 12;
153  if (sectordiff >= 6)
154  sectordiff -= 12;
155  if (sectordiff < -6)
156  sectordiff += 12;
157 
158  // convert phi to 0.625 degree precision
159  int phi_precision = 4096 >> sh_phi;
160  const double k = 57.2958 / 0.625 / static_cast<float>(phi_precision);
161  double phi_f = static_cast<double>(phi2);
162  int bit_div_phi = static_cast<int>(phi2) % 4;
163  if (bit_div_phi < 0)
164  bit_div_phi += 4;
165  phi_f = phi_f - std::abs(bit_div_phi);
166  int phi_8 = static_cast<int>(floor(phi_f * k));
167 
168  if (second == nullptr && first) {
169  int bend_angle = l1t::bitShift((first->phib() >> sh_phib), sh_phib);
170  phi_8 = phi_8 + thePhiLUTs->getDeltaPhi(0, bend_angle);
171  //phi_8 = phi_8 + getDeltaPhi(0, bend_angle, bmtfParams->phi_lut());
172  } else if (second == nullptr && forth) {
173  int bend_angle = l1t::bitShift((forth->phib() >> sh_phib), sh_phib);
174  phi_8 = phi_8 + thePhiLUTs->getDeltaPhi(1, bend_angle);
175  //phi_8 = phi_8 + getDeltaPhi(1, bend_angle, bmtfParams->phi_lut());
176  }
177 
178  //If muon is found at the neighbour sector - second station
179  //a shift is needed by 48
180  phi_8 += sectordiff * 48;
181 
182  int phi = phi_8 + 24;
183  // 78 phi bins (-8 to 69) correspond 30 degree sector plus
184  // additional lower and higher bins for neighboring sectors.
185  if (phi > 69)
186  phi = 69;
187  if (phi < -8)
188  phi = -8;
189 
190  m_sp.track(m_id)->setPhi(phi); // Regional
191  m_sp.tracK(m_id)->setPhi(phi);
192 
193  delete thePhiLUTs;
194 }
const L1MuBMSecProcId & id() const
return Sector Processor identifier
static int getNbitsPhiPhi()
static int getNbitsPhiPhib()
L1MuBMTrack * track(int id) const
return pointer to muon candidate, index [0,1]
void setPhi(int phi)
set phi-code of muon candidate
Definition: L1MuBMTrack.h:145
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
U second(std::pair< T, U > const &p)
L1MuBMLUTHandler * thePhiLUTs
phi-assignment look-up tables
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int phib() const
return phib
int sector() const
return sector number
L1MuBMTrack * tracK(int id) const
return pointer to muon candidate, index [0,1]
int getDeltaPhi(int idx, int address) const
get delta-phi for a given address (bend-angle)
int sector() const
return sector
int phi() const
return phi
L1MuBMSectorProcessor & m_sp
int bitShift(int num, int bits)
Definition: BitShift.h:6

◆ phiDiff()

int L1MuBMAssignmentUnit::phiDiff ( int  stat1,
int  stat2 
) const
private

build difference of two phi values

Definition at line 639 of file L1MuBMAssignmentUnit.cc.

References l1t::bitShift(), getTSphi(), nbit_phi, hltrates_dqm_sourceclient-live_cfg::offset, L1MuBMTrackSegPhi::phi(), L1MuBMTrackSegPhi::sector(), hgcalTopologyTester_cfi::sector1, and hgcalTopologyTester_cfi::sector2.

Referenced by getPtAddress().

639  {
640  // calculate bit shift
641 
642  int sh_phi = 12 - nbit_phi;
643 
644  // get 2 phi values and add offset (30 degrees ) for adjacent sector
645  int sector1 = getTSphi(stat1)->sector();
646  int sector2 = getTSphi(stat2)->sector();
647  int phi1 = getTSphi(stat1)->phi() >> sh_phi;
648  int phi2 = getTSphi(stat2)->phi() >> sh_phi;
649 
650  // convert sector difference to values in the range -6 to +5
651 
652  int sectordiff = (sector2 - sector1) % 12;
653  if (sectordiff >= 6)
654  sectordiff -= 12;
655  if (sectordiff < -6)
656  sectordiff += 12;
657 
658  // assert( abs(sectordiff) <= 1 );
659 
660  int offset = (2144 >> sh_phi) * sectordiff;
661  int bendangle = l1t::bitShift((phi2 - phi1 + offset), sh_phi);
662 
663  return bendangle;
664 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int sector() const
return sector
int phi() const
return phi
static unsigned short nbit_phi
of bits used for pt-assignment
int bitShift(int num, int bits)
Definition: BitShift.h:6

◆ PtAU()

void L1MuBMAssignmentUnit::PtAU ( const L1TMuonBarrelParams bmtfParams1)

assign pt and charge

< pt-assignment look-up tables

Definition at line 199 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, L1TMuonBarrelParamsAllPublic::get_DisableNewAlgo(), getCharge(), L1MuBMLUTHandler::getPt(), getPt1Address(), getPt1Method(), getPt2Address(), getPt2Method(), getPtAddress(), getPtMethod(), m_id, m_ptAssMethod, m_sp, L1MuBMLUTHandler::NODEF, DiDispStaMuonMonitor_cfi::pt, Quality(), L1MuBMTrack::setCharge(), L1MuBMTrack::setPt(), thePtaLUTs, L1MuBMSectorProcessor::track(), and L1MuBMSectorProcessor::tracK().

Referenced by run().

199  {
200  const L1TMuonBarrelParamsAllPublic bmtfParams(bmtfParams1);
201  thePtaLUTs = new L1MuBMLUTHandler(bmtfParams);
202  //thePtaLUTs->print();
203  // get pt-assignment method as function of track class and TS phib values
204  //m_ptAssMethod = getPtMethod(bmtfParams);
206  // get input address for look-up table
207  int bend_angle = getPtAddress(m_ptAssMethod);
208  int bend_carga = getPtAddress(m_ptAssMethod, 1);
209 
210  // retrieve pt value from look-up table
211  int lut_idx = m_ptAssMethod;
212  int pt = thePtaLUTs->getPt(lut_idx, bend_angle);
213  //int pt = getPt(lut_idx, bend_angle, bmtfParams->pta_lut());
214 
215  if (!bmtfParams.get_DisableNewAlgo()) {
216  if (Quality() < 4) {
217  int ptj = pt;
220  if (jj1 != L1MuBMLUTHandler::NODEF) {
221  lut_idx = jj1;
222  bend_angle = getPt1Address(m_ptAssMethod);
223  if (abs(bend_angle) < 512)
224  ptj = thePtaLUTs->getPt(lut_idx, bend_angle);
225  } else if (jj2 != L1MuBMLUTHandler::NODEF) {
226  lut_idx = jj2;
227  bend_angle = getPt2Address(m_ptAssMethod);
228  if (abs(bend_angle) < 512)
229  ptj = thePtaLUTs->getPt(lut_idx, bend_angle);
230  }
231  if (ptj < pt)
232  pt = ptj;
233  }
234  }
235 
236  m_sp.track(m_id)->setPt(pt);
237  m_sp.tracK(m_id)->setPt(pt);
238 
239  // assign charge
240  int chsign = getCharge(m_ptAssMethod);
241  int charge = (bend_carga >= 0) ? chsign : -1 * chsign;
244  delete thePtaLUTs;
245 }
void setPt(int pt)
set pt-code of muon candidate
Definition: L1MuBMTrack.h:154
L1MuBMTrack * track(int id) const
return pointer to muon candidate, index [0,1]
void setCharge(int charge)
set charge of muon candidate
Definition: L1MuBMTrack.h:157
L1MuBMLUTHandler * thePtaLUTs
pt-assignment look-up tables
int getPt2Address(L1MuBMLUTHandler::PtAssMethod) const
L1MuBMLUTHandler::PtAssMethod getPtMethod() const
determine pt assignment method
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuBMLUTHandler::PtAssMethod getPt2Method(L1MuBMLUTHandler::PtAssMethod) const
int getPt(int pta_ind, int address) const
get pt-value for a given address
int getPt1Address(L1MuBMLUTHandler::PtAssMethod) const
L1MuBMTrack * tracK(int id) const
return pointer to muon candidate, index [0,1]
L1MuBMLUTHandler::PtAssMethod getPt1Method(L1MuBMLUTHandler::PtAssMethod) const
static int getCharge(L1MuBMLUTHandler::PtAssMethod)
determine charge
int getPtAddress(L1MuBMLUTHandler::PtAssMethod, int bendcharge=0) const
calculate bend angle
L1MuBMSectorProcessor & m_sp
L1MuBMLUTHandler::PtAssMethod m_ptAssMethod

◆ QuaAU()

void L1MuBMAssignmentUnit::QuaAU ( )

assign quality

Two LSBs of BMTF Q = Nstations-1

Two MSB of BMTF Q = 11

Definition at line 250 of file L1MuBMAssignmentUnit.cc.

References m_id, m_sp, quality, L1MuBMTrack::setQuality(), T12, T123, T1234, T124, T13, T134, T14, T23, T234, T24, T34, L1MuBMSectorProcessor::TA(), L1MuBMSectorProcessor::track(), L1MuBMSectorProcessor::tracK(), and L1MuBMTrackAssembler::trackClass().

Referenced by run().

250  {
251  unsigned int quality = 0;
252 
253  const TrackClass tc = m_sp.TA()->trackClass(m_id);
254 
256  switch (tc) {
257  case T1234: {
258  quality = 3;
259  break;
260  }
261  case T123: {
262  quality = 2;
263  break;
264  }
265  case T124: {
266  quality = 2;
267  break;
268  }
269  case T134: {
270  quality = 2;
271  break;
272  }
273  case T234: {
274  quality = 2;
275  break;
276  }
277  case T12: {
278  quality = 1;
279  break;
280  }
281  case T13: {
282  quality = 1;
283  break;
284  }
285  case T14: {
286  quality = 1;
287  break;
288  }
289  case T23: {
290  quality = 0;
291  break;
292  }
293  case T24: {
294  quality = 0;
295  break;
296  }
297  case T34: {
298  quality = 0;
299  break;
300  }
301  default: {
302  quality = 0;
303  break;
304  }
305  }
306 
308  quality += 12;
309 
312 }
L1MuBMTrack * track(int id) const
return pointer to muon candidate, index [0,1]
void setQuality(unsigned int quality)
set quality of muon candidate
Definition: L1MuBMTrack.h:163
string quality
const L1MuBMTrackAssembler * TA() const
return pointer to Track Assembler
L1MuBMTrack * tracK(int id) const
return pointer to muon candidate, index [0,1]
L1MuBMSectorProcessor & m_sp
TrackClass trackClass(int id) const
return Track Class of found track

◆ Quality()

unsigned int L1MuBMAssignmentUnit::Quality ( )

Definition at line 317 of file L1MuBMAssignmentUnit.cc.

References m_id, m_sp, quality, T12, T123, T1234, T124, T13, T134, T14, T23, T234, T24, T34, L1MuBMSectorProcessor::TA(), and L1MuBMTrackAssembler::trackClass().

Referenced by PtAU().

317  {
318  unsigned int quality = 0;
319 
320  const TrackClass tc = m_sp.TA()->trackClass(m_id);
321 
322  switch (tc) {
323  case T1234: {
324  quality = 7;
325  break;
326  }
327  case T123: {
328  quality = 6;
329  break;
330  }
331  case T124: {
332  quality = 6;
333  break;
334  }
335  case T134: {
336  quality = 5;
337  break;
338  }
339  case T234: {
340  quality = 4;
341  break;
342  }
343  case T12: {
344  quality = 3;
345  break;
346  }
347  case T13: {
348  quality = 3;
349  break;
350  }
351  case T14: {
352  quality = 3;
353  break;
354  }
355  case T23: {
356  quality = 2;
357  break;
358  }
359  case T24: {
360  quality = 2;
361  break;
362  }
363  case T34: {
364  quality = 1;
365  break;
366  }
367  default: {
368  quality = 0;
369  }
370  }
371 
372  return quality;
373 }
string quality
const L1MuBMTrackAssembler * TA() const
return pointer to Track Assembler
L1MuBMSectorProcessor & m_sp
TrackClass trackClass(int id) const
return Track Class of found track

◆ reset()

void L1MuBMAssignmentUnit::reset ( void  )

reset Assignment Unit

Definition at line 115 of file L1MuBMAssignmentUnit.cc.

References m_addArray, m_ptAssMethod, m_TSphi, L1MuBMLUTHandler::NODEF, and L1MuBMAddressArray::reset().

Referenced by L1MuBMAssignmentUnit().

115  {
116  m_addArray.reset();
117  m_TSphi.clear();
119 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
L1MuBMAddressArray m_addArray
void reset()
reset address array
L1MuBMLUTHandler::PtAssMethod m_ptAssMethod

◆ run()

void L1MuBMAssignmentUnit::run ( const L1TMuonBarrelParams mbtfParams)

run Assignment Unit

Definition at line 76 of file L1MuBMAssignmentUnit.cc.

References L1MuBMTrackAssembler::address(), simKBmtfDigis_cfi::bx, L1MuBMTrack::enable(), m_addArray, m_id, m_sp, m_TSphi, PhiAU(), PtAU(), QuaAU(), L1MuBMTrack::setAddresses(), L1MuBMTrack::setBx(), L1MuBMTrack::setTC(), L1MuBMTrack::setTSphi(), L1MuBMSectorProcessor::TA(), L1MuBMSectorProcessor::track(), L1MuBMSectorProcessor::tracK(), L1MuBMTrackAssembler::trackClass(), and TSR().

76  {
77  // enable track candidate
78  m_sp.track(m_id)->enable();
79  m_sp.tracK(m_id)->enable();
80 
81  // set track class
82  TrackClass tc = m_sp.TA()->trackClass(m_id);
83  m_sp.track(m_id)->setTC(tc);
84  m_sp.tracK(m_id)->setTC(tc);
85 
86  // get relative addresses of matching track segments
90 
91  // get track segments (track segment router)
92  TSR();
95 
96  // set bunch-crossing (use first track segment)
97  vector<const L1MuBMTrackSegPhi*>::const_iterator iter = m_TSphi.begin();
98  int bx = (*iter)->bx();
99  m_sp.track(m_id)->setBx(bx);
100  m_sp.tracK(m_id)->setBx(bx);
101 
102  // assign phi
103  PhiAU(bmtfParams);
104 
105  // assign pt and charge
106  PtAU(bmtfParams);
107 
108  // assign quality
109  QuaAU();
110 }
void setTC(TrackClass tc)
set track-class of muon candidate
Definition: L1MuBMTrack.h:142
L1MuBMTrack * track(int id) const
return pointer to muon candidate, index [0,1]
void QuaAU()
assign quality
int address(int id, int stat) const
get address of a single station of selected track candidate
void setAddresses(const L1MuBMAddressArray &addr)
set relative addresses of muon candidate
Definition: L1MuBMTrack.h:166
void TSR()
Track Segment Router.
void enable()
enable muon candidate
Definition: L1MuBMTrack.h:130
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
const L1MuBMTrackAssembler * TA() const
return pointer to Track Assembler
void setTSphi(const std::vector< const L1MuBMTrackSegPhi *> &tsList)
set phi track segments used to form the muon candidate
Definition: L1MuBMTrack.cc:147
void setBx(int bx)
set charge of muon candidate
Definition: L1MuBMTrack.h:160
void PtAU(const L1TMuonBarrelParams &)
assign pt and charge
void PhiAU(const L1TMuonBarrelParams &)
assign phi
L1MuBMTrack * tracK(int id) const
return pointer to muon candidate, index [0,1]
L1MuBMAddressArray m_addArray
L1MuBMSectorProcessor & m_sp
TrackClass trackClass(int id) const
return Track Class of found track

◆ setPrecision()

void L1MuBMAssignmentUnit::setPrecision ( )
static

set precision of phi and phib

Definition at line 841 of file L1MuBMAssignmentUnit.cc.

References L1MuBMTFConfig::getNbitsPtaPhi(), L1MuBMTFConfig::getNbitsPtaPhib(), nbit_phi, and nbit_phib.

Referenced by L1MuBMAssignmentUnit().

841  {
844 }
static int getNbitsPtaPhi()
static int getNbitsPtaPhib()
static unsigned short nbit_phib
of bits used for pt-assignment
static unsigned short nbit_phi
of bits used for pt-assignment

◆ TSR()

void L1MuBMAssignmentUnit::TSR ( )
private

Track Segment Router.

Definition at line 378 of file L1MuBMAssignmentUnit.cc.

References L1MuBMSectorProcessor::data(), L1MuBMDataBuffer::getTSphi(), m_addArray, m_sp, m_TSphi, and L1MuBMAddressArray::station().

Referenced by run().

378  {
379  // get the track segments from the data buffer
380  const L1MuBMTrackSegPhi* ts = nullptr;
381  for (int stat = 1; stat <= 4; stat++) {
382  int adr = m_addArray.station(stat);
383  if (adr != 15) {
384  ts = m_sp.data()->getTSphi(stat, adr);
385  if (ts != nullptr)
386  m_TSphi.push_back(ts);
387  }
388  }
389 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
const L1MuBMDataBuffer * data() const
return pointer to Data Buffer
unsigned short station(int stat) const
get address of a given station [1-4]
const TSPhivector & getTSphi() const
get all track segments from the buffer
L1MuBMAddressArray m_addArray
L1MuBMSectorProcessor & m_sp

Member Data Documentation

◆ m_addArray

L1MuBMAddressArray L1MuBMAssignmentUnit::m_addArray
private

Definition at line 108 of file L1MuBMAssignmentUnit.h.

Referenced by reset(), run(), and TSR().

◆ m_id

int L1MuBMAssignmentUnit::m_id
private

Definition at line 106 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), PhiAU(), PtAU(), QuaAU(), Quality(), and run().

◆ m_ptAssMethod

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::m_ptAssMethod
private

Definition at line 110 of file L1MuBMAssignmentUnit.h.

Referenced by PtAU(), and reset().

◆ m_sp

L1MuBMSectorProcessor& L1MuBMAssignmentUnit::m_sp
private

Definition at line 105 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), PhiAU(), PtAU(), QuaAU(), Quality(), run(), and TSR().

◆ m_TSphi

std::vector<const L1MuBMTrackSegPhi*> L1MuBMAssignmentUnit::m_TSphi
private

Definition at line 109 of file L1MuBMAssignmentUnit.h.

Referenced by getTSphi(), L1MuBMAssignmentUnit(), reset(), run(), and TSR().

◆ nbit_phi

unsigned short int L1MuBMAssignmentUnit::nbit_phi = 12
staticprivate

of bits used for pt-assignment

Definition at line 114 of file L1MuBMAssignmentUnit.h.

Referenced by phiDiff(), and setPrecision().

◆ nbit_phib

unsigned short int L1MuBMAssignmentUnit::nbit_phib = 10
staticprivate

of bits used for pt-assignment

Definition at line 115 of file L1MuBMAssignmentUnit.h.

Referenced by setPrecision().

◆ thePhiLUTs

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePhiLUTs
private

phi-assignment look-up tables

Definition at line 113 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU().

◆ thePtaLUTs

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePtaLUTs
private

pt-assignment look-up tables

Definition at line 112 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), and PtAU().