CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | 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...
 
void setPrecision ()
 set precision of phi and phib More...
 
 ~L1MuBMAssignmentUnit ()
 destructor 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
 
unsigned short nbit_phi = 12
 

of bits used for pt-assignment

More...
 
unsigned short nbit_phib = 10
 

of bits used for pt-assignment

More...
 
L1MuBMLUTHandlerthePhiLUTs
 phi-assignment look-up tables More...
 
L1MuBMLUTHandlerthePtaLUTs
 pt-assignment look-up tables 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 50 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
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 409 of file L1MuBMAssignmentUnit.cc.

References nano_mu_digi_cff::sector.

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

◆ getCharge()

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

determine charge

Definition at line 419 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().

419  {
420  int chargesign = 0;
421  switch (method) {
423  chargesign = -1;
424  break;
425  }
427  chargesign = -1;
428  break;
429  }
431  chargesign = -1;
432  break;
433  }
435  chargesign = -1;
436  break;
437  }
439  chargesign = -1;
440  break;
441  }
443  chargesign = -1;
444  break;
445  }
447  chargesign = -1;
448  break;
449  }
451  chargesign = -1;
452  break;
453  }
455  chargesign = -1;
456  break;
457  }
459  chargesign = -1;
460  break;
461  }
463  chargesign = 1;
464  break;
465  }
467  chargesign = 1;
468  break;
469  }
470 
472  chargesign = 0;
473  // cerr << "AssignmentUnit::getCharge : undefined PtAssMethod!"
474  // << endl;
475  break;
476  }
477  default: {
478  chargesign = 0;
479  }
480  }
481 
482  return chargesign;
483 }

◆ getPt1Address()

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

Definition at line 755 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().

755  {
756  // phib values of track segments from stations 1, 2 and 4
757  int phib1 = (getTSphi(1) != nullptr) ? getTSphi(1)->phib() : -999;
758  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : -999;
759  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : -999;
760 
761  int bendangle = -999;
762  switch (method) {
764  bendangle = phib1;
765  break;
766  }
768  bendangle = phib1;
769  break;
770  }
772  bendangle = phib1;
773  break;
774  }
776  bendangle = phib2;
777  break;
778  }
780  bendangle = phib2;
781  break;
782  }
784  bendangle = phib4;
785  break;
786  }
788  bendangle = -999;
789  break;
790  }
791  default: {
792  bendangle = -999;
793  }
794  }
795 
796  return bendangle;
797 }
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 668 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().

668  {
669  // quality values of track segments from stations 1, 2 and 4
670  int qual1 = (getTSphi(1) != nullptr) ? getTSphi(1)->quality() : 0;
671  int qual2 = (getTSphi(2) != nullptr) ? getTSphi(2)->quality() : 0;
672  int qual4 = (getTSphi(4) != nullptr) ? getTSphi(4)->quality() : 0;
673 
675 
676  switch (method) {
678  if (qual1 > 3)
680  break;
681  }
683  if (qual1 > 3)
685  break;
686  }
688  if (qual1 > 3)
690  break;
691  }
693  if (qual2 > 3)
695  break;
696  }
698  if (qual2 > 3)
700  break;
701  }
703  if (qual4 > 3)
705  break;
706  }
709  break;
710  }
711  default: {
713  }
714  }
715 
716  return pam;
717 }
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 802 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

802  {
803  // phib values of track segments from stations 1, 2 and 4
804  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : -999;
805  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : -999;
806 
807  int bendangle = -999;
808  switch (method) {
810  bendangle = phib2;
811  break;
812  }
814  bendangle = phib4;
815  break;
816  }
818  bendangle = phib4;
819  break;
820  }
821  //case L1MuBMLUTHandler::PT12HO : { bendangle = phib2; break; }
822  //case L1MuBMLUTHandler::PT14HO : { bendangle = phib4; break; }
823  //case L1MuBMLUTHandler::PT24HO : { bendangle = phib4; break; }
825  bendangle = -999;
826  break;
827  }
828  default: {
829  bendangle = -999;
830  }
831  }
832 
833  return bendangle;
834 }
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 722 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

722  {
723  // quality values of track segments from stations 2 and 4
724  int qual2 = (getTSphi(2) != nullptr) ? getTSphi(2)->quality() : 0;
725  // int qual4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->quality() : 0;
726 
728 
729  switch (method) {
731  if (qual2 > 3)
733  break;
734  }
735  // case PT14H : { if (qual4 > 3) pam = PB34H; break; }
736  // case PT24H : { if (qual4 > 3) pam = PB34H; break; }
737  //case PT12HO : { if (qual2 > 3) pam = PB21HO; break; }
738  // case PT14HO : { if (qual4 > 3) pam = PB34HO; break; }
739  // case PT24HO : { if (qual4 > 3) pam = PB34HO; break; }
742  break;
743  }
744  default: {
746  }
747  }
748 
749  return pam;
750 }
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 555 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().

555  {
556  // calculate bend angle as difference of two azimuthal positions
557 
558  int bendangle = 0;
559  switch (method) {
561  bendangle = phiDiff(1, 2);
562  break;
563  }
565  bendangle = phiDiff(1, 2);
566  break;
567  }
569  bendangle = phiDiff(1, 3);
570  break;
571  }
573  bendangle = phiDiff(1, 3);
574  break;
575  }
577  bendangle = phiDiff(1, 4);
578  break;
579  }
581  bendangle = phiDiff(1, 4);
582  break;
583  }
585  bendangle = phiDiff(2, 3);
586  break;
587  }
589  bendangle = phiDiff(2, 3);
590  break;
591  }
593  bendangle = phiDiff(2, 4);
594  break;
595  }
597  bendangle = phiDiff(2, 4);
598  break;
599  }
601  bendangle = phiDiff(4, 3);
602  break;
603  }
605  bendangle = phiDiff(4, 3);
606  break;
607  }
609  bendangle = 0;
610  // cerr << "AssignmentUnit::getPtAddress : undefined PtAssMethod" << endl;
611  break;
612  }
613  default: {
614  bendangle = 0;
615  }
616  }
617 
618  int signo = 1;
619  bendangle = (bendangle + 8192) % 4096;
620  if (bendangle > 2047)
621  bendangle -= 4096;
622  if (bendangle < 0)
623  signo = -1;
624 
625  if (bendcharge)
626  return signo;
627 
628  bendangle = (bendangle + 2048) % 1024;
629  if (bendangle > 511)
630  bendangle -= 1024;
631 
632  return bendangle;
633 }
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 489 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, DiMuonV_cfg::threshold, and L1MuBMTrackAssembler::trackBitMap().

Referenced by PtAU().

489  {
490  // determine which pt-assignment method should be used as a function
491  // of the track class and
492  // of the phib values of the track segments making up this track candidate.
493 
494  // get bitmap of track candidate
495  const bitset<4> s = m_sp.TA().trackBitMap(m_id);
496 
497  int method = -1;
498 
499  if (s.test(0) && s.test(3))
500  method = 2; // stations 1 and 4
501  if (s.test(0) && s.test(2))
502  method = 1; // stations 1 and 3
503  if (s.test(0) && s.test(1))
504  method = 0; // stations 1 and 2
505  if (!s.test(0) && s.test(1) && s.test(3))
506  method = 4; // stations 2 and 4
507  if (!s.test(0) && s.test(1) && s.test(2))
508  method = 3; // stations 2 and 3
509  if (!s.test(0) && !s.test(1) && s.test(2) && s.test(3))
510  method = 5; // stations 3 and 4
512 
513  // phib values of track segments from stations 1, 2 and 4
514  int phib1 = (getTSphi(1) != nullptr) ? getTSphi(1)->phib() : 0;
515  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : 0;
516  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : 0;
517 
519 
520  switch (method) {
521  case 0: {
523  break;
524  }
525  case 1: {
527  break;
528  }
529  case 2: {
531  break;
532  }
533  case 3: {
535  break;
536  }
537  case 4: {
539  break;
540  }
541  case 5: {
543  break;
544  }
545  default:;
546  //cout << "L1MuBMAssignmentUnit : Error in PT ass method evaluation" << endl;
547  }
548 
549  return pam;
550 }
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
int phib() const
return phib
const std::bitset< 4 > & trackBitMap(int id) const
return bitmap of found track
const L1MuBMTrackAssembler & TA() const
return Track Assembler
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 393 of file L1MuBMAssignmentUnit.cc.

References m_TSphi, and relativeConstraints::station.

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

393  {
394  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
395  for (iter = m_TSphi.begin(); iter != m_TSphi.end(); iter++) {
396  int stat = (*iter)->station();
397  if (station == stat) {
398  return (*iter);
399  break;
400  }
401  }
402 
403  return nullptr;
404 }
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(), L1MuBMSectorProcessor::config(), dqmdumpme::first, L1MuBMLUTHandler::getDeltaPhi(), L1MuBMTFConfig::getNbitsPhiPhi(), L1MuBMTFConfig::getNbitsPhiPhib(), getTSphi(), L1MuBMSectorProcessor::id(), isotrackApplyRegressor::k, m_id, m_sp, phi, L1MuBMTrackSegPhi::phi(), L1MuBMTrackSegPhi::phib(), edm::second(), nano_mu_digi_cff::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 - m_sp.config().getNbitsPhiPhi();
129  int sh_phib = 10 - m_sp.config().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
192 
193  delete thePhiLUTs;
194 }
const L1MuBMSecProcId & id() const
return Sector Processor identifier
L1MuBMTrack const & track(int id) const
return muon candidate, index [0,1]
L1MuBMTrack const & tracK(int id) const
return 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
const L1MuBMTFConfig & config() const
access configuration
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int getNbitsPhiPhi() const
int phib() const
return phib
int sector() const
return sector number
int getDeltaPhi(int idx, int address) const
get delta-phi for a given address (bend-angle)
int getNbitsPhiPhib() const
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 638 of file L1MuBMAssignmentUnit.cc.

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

Referenced by getPtAddress().

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

◆ PtAU()

void L1MuBMAssignmentUnit::PtAU ( const L1TMuonBarrelParams bmtfParams)

assign pt and charge

< pt-assignment look-up tables

Definition at line 199 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, L1TMuonBarrelParams::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  thePtaLUTs = new L1MuBMLUTHandler(bmtfParams);
201  //thePtaLUTs->print();
202  // get pt-assignment method as function of track class and TS phib values
203  //m_ptAssMethod = getPtMethod(bmtfParams);
205  // get input address for look-up table
206  int bend_angle = getPtAddress(m_ptAssMethod);
207  int bend_carga = getPtAddress(m_ptAssMethod, 1);
208 
209  // retrieve pt value from look-up table
210  int lut_idx = m_ptAssMethod;
211  int pt = thePtaLUTs->getPt(lut_idx, bend_angle);
212  //int pt = getPt(lut_idx, bend_angle, bmtfParams->pta_lut());
213 
214  if (!bmtfParams.get_DisableNewAlgo()) {
215  if (Quality() < 4) {
216  int ptj = pt;
219  if (jj1 != L1MuBMLUTHandler::NODEF) {
220  lut_idx = jj1;
221  bend_angle = getPt1Address(m_ptAssMethod);
222  if (abs(bend_angle) < 512)
223  ptj = thePtaLUTs->getPt(lut_idx, bend_angle);
224  } else if (jj2 != L1MuBMLUTHandler::NODEF) {
225  lut_idx = jj2;
226  bend_angle = getPt2Address(m_ptAssMethod);
227  if (abs(bend_angle) < 512)
228  ptj = thePtaLUTs->getPt(lut_idx, bend_angle);
229  }
230  if (ptj < pt)
231  pt = ptj;
232  }
233  }
234 
235  m_sp.track(m_id).setPt(pt);
236  m_sp.tracK(m_id).setPt(pt);
237 
238  // assign charge
239  int chsign = getCharge(m_ptAssMethod);
240  int charge = (bend_carga >= 0) ? chsign : -1 * chsign;
243  delete thePtaLUTs;
244 }
void setPt(int pt)
set pt-code of muon candidate
Definition: L1MuBMTrack.h:154
L1MuBMTrack const & track(int id) const
return muon candidate, index [0,1]
L1MuBMTrack const & tracK(int id) const
return 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
bool get_DisableNewAlgo() 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
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 249 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().

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

◆ Quality()

unsigned int L1MuBMAssignmentUnit::Quality ( )

Definition at line 316 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().

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

◆ setPrecision()

void L1MuBMAssignmentUnit::setPrecision ( )

set precision of phi and phib

Definition at line 840 of file L1MuBMAssignmentUnit.cc.

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

Referenced by L1MuBMAssignmentUnit().

840  {
843 }
int getNbitsPtaPhib() const
unsigned short nbit_phib
of bits used for pt-assignment
const L1MuBMTFConfig & config() const
access configuration
unsigned short nbit_phi
of bits used for pt-assignment
int getNbitsPtaPhi() const
L1MuBMSectorProcessor & m_sp

◆ TSR()

void L1MuBMAssignmentUnit::TSR ( )
private

Track Segment Router.

Definition at line 377 of file L1MuBMAssignmentUnit.cc.

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

Referenced by run().

377  {
378  // get the track segments from the data buffer
379  const L1MuBMTrackSegPhi* ts = nullptr;
380  for (int stat = 1; stat <= 4; stat++) {
381  int adr = m_addArray.station(stat);
382  if (adr != 15) {
383  ts = m_sp.data().getTSphi(stat, adr);
384  if (ts != nullptr)
385  m_TSphi.push_back(ts);
386  }
387  }
388 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
const L1MuBMDataBuffer & data() const
return 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 107 of file L1MuBMAssignmentUnit.h.

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

◆ m_id

int L1MuBMAssignmentUnit::m_id
private

Definition at line 105 of file L1MuBMAssignmentUnit.h.

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

◆ m_ptAssMethod

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::m_ptAssMethod
private

Definition at line 109 of file L1MuBMAssignmentUnit.h.

Referenced by PtAU(), and reset().

◆ m_sp

L1MuBMSectorProcessor& L1MuBMAssignmentUnit::m_sp
private

Definition at line 104 of file L1MuBMAssignmentUnit.h.

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

◆ m_TSphi

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

Definition at line 108 of file L1MuBMAssignmentUnit.h.

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

◆ nbit_phi

unsigned short L1MuBMAssignmentUnit::nbit_phi = 12
private

of bits used for pt-assignment

Definition at line 113 of file L1MuBMAssignmentUnit.h.

Referenced by phiDiff(), and setPrecision().

◆ nbit_phib

unsigned short L1MuBMAssignmentUnit::nbit_phib = 10
private

of bits used for pt-assignment

Definition at line 114 of file L1MuBMAssignmentUnit.h.

Referenced by setPrecision().

◆ thePhiLUTs

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePhiLUTs
private

phi-assignment look-up tables

Definition at line 112 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU().

◆ thePtaLUTs

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePtaLUTs
private

pt-assignment look-up tables

Definition at line 111 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), and PtAU().