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>

Inheritance diagram for L1MuBMAssignmentUnit:
L1AbstractProcessor

Public Member Functions

 L1MuBMAssignmentUnit (L1MuBMSectorProcessor &sp, int id)
 constructor More...
 
void PhiAU (const edm::EventSetup &c)
 assign phi More...
 
void PtAU (const edm::EventSetup &c)
 assign pt and charge More...
 
void QuaAU ()
 assign quality More...
 
unsigned int Quality ()
 
void reset () override
 reset Assignment Unit More...
 
void run (const edm::EventSetup &c) override
 run Assignment Unit More...
 
 ~L1MuBMAssignmentUnit () override
 destructor More...
 
- Public Member Functions inherited from L1AbstractProcessor
virtual void run ()
 run processor logic More...
 
virtual void run ()
 run processor logic More...
 
virtual ~L1AbstractProcessor ()
 destructor More...
 
virtual ~L1AbstractProcessor ()
 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

edm::ESHandle< L1TMuonBarrelParamsbmtfParamsHandle
 
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 52 of file L1MuBMAssignmentUnit.h.

Constructor & Destructor Documentation

L1MuBMAssignmentUnit::L1MuBMAssignmentUnit ( L1MuBMSectorProcessor sp,
int  id 
)

constructor

Definition at line 55 of file L1MuBMAssignmentUnit.cc.

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

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

destructor

Definition at line 66 of file L1MuBMAssignmentUnit.cc.

66 {}

Member Function Documentation

int L1MuBMAssignmentUnit::convertSector ( int  sector)
staticprivate

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

Definition at line 413 of file L1MuBMAssignmentUnit.cc.

413  {
414  // assert( sector >=0 && sector < 12 );
415  const int sectorvalues[12] = {0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132};
416 
417  return sectorvalues[sector];
418 }
int L1MuBMAssignmentUnit::getCharge ( L1MuBMLUTHandler::PtAssMethod  method)
staticprivate

determine charge

Definition at line 423 of file L1MuBMAssignmentUnit.cc.

References 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().

423  {
424  int chargesign = 0;
425  switch (method) {
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  }
471  chargesign = 1;
472  break;
473  }
474 
476  chargesign = 0;
477  // cerr << "AssignmentUnit::getCharge : undefined PtAssMethod!"
478  // << endl;
479  break;
480  }
481  default: { chargesign = 0; }
482  }
483 
484  return chargesign;
485 }
int L1MuBMAssignmentUnit::getPt1Address ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 751 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

751  {
752  // phib values of track segments from stations 1, 2 and 4
753  int phib1 = (getTSphi(1) != nullptr) ? getTSphi(1)->phib() : -999;
754  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : -999;
755  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : -999;
756 
757  int bendangle = -999;
758  switch (method) {
760  bendangle = phib1;
761  break;
762  }
764  bendangle = phib1;
765  break;
766  }
768  bendangle = phib1;
769  break;
770  }
772  bendangle = phib2;
773  break;
774  }
776  bendangle = phib2;
777  break;
778  }
780  bendangle = phib4;
781  break;
782  }
784  bendangle = -999;
785  break;
786  }
787  default: { bendangle = -999; }
788  }
789 
790  return bendangle;
791 }
int phib() const
return phib
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::getPt1Method ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 668 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), 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: { pam = L1MuBMLUTHandler::NODEF; }
712  }
713 
714  return pam;
715 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int quality() const
return quality code
int L1MuBMAssignmentUnit::getPt2Address ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 796 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

796  {
797  // phib values of track segments from stations 1, 2 and 4
798  int phib2 = (getTSphi(2) != nullptr) ? getTSphi(2)->phib() : -999;
799  int phib4 = (getTSphi(4) != nullptr) ? getTSphi(4)->phib() : -999;
800 
801  int bendangle = -999;
802  switch (method) {
804  bendangle = phib2;
805  break;
806  }
808  bendangle = phib4;
809  break;
810  }
812  bendangle = phib4;
813  break;
814  }
815  //case L1MuBMLUTHandler::PT12HO : { bendangle = phib2; break; }
816  //case L1MuBMLUTHandler::PT14HO : { bendangle = phib4; break; }
817  //case L1MuBMLUTHandler::PT24HO : { bendangle = phib4; break; }
819  bendangle = -999;
820  break;
821  }
822  default: { bendangle = -999; }
823  }
824 
825  return bendangle;
826 }
int phib() const
return phib
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::getPt2Method ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 720 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

720  {
721  // quality values of track segments from stations 2 and 4
722  int qual2 = (getTSphi(2) != nullptr) ? getTSphi(2)->quality() : 0;
723  // int qual4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->quality() : 0;
724 
726 
727  switch (method) {
729  if (qual2 > 3)
731  break;
732  }
733  // case PT14H : { if (qual4 > 3) pam = PB34H; break; }
734  // case PT24H : { if (qual4 > 3) pam = PB34H; break; }
735  //case PT12HO : { if (qual2 > 3) pam = PB21HO; break; }
736  // case PT14HO : { if (qual4 > 3) pam = PB34HO; break; }
737  // case PT24HO : { if (qual4 > 3) pam = PB34HO; break; }
740  break;
741  }
742  default: { pam = L1MuBMLUTHandler::NODEF; }
743  }
744 
745  return pam;
746 }
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
int quality() const
return quality code
int L1MuBMAssignmentUnit::getPtAddress ( L1MuBMLUTHandler::PtAssMethod  method,
int  bendcharge = 0 
) const
private

calculate bend angle

Definition at line 557 of file L1MuBMAssignmentUnit.cc.

References 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().

557  {
558  // calculate bend angle as difference of two azimuthal positions
559 
560  int bendangle = 0;
561  switch (method) {
563  bendangle = phiDiff(1, 2);
564  break;
565  }
567  bendangle = phiDiff(1, 2);
568  break;
569  }
571  bendangle = phiDiff(1, 3);
572  break;
573  }
575  bendangle = phiDiff(1, 3);
576  break;
577  }
579  bendangle = phiDiff(1, 4);
580  break;
581  }
583  bendangle = phiDiff(1, 4);
584  break;
585  }
587  bendangle = phiDiff(2, 3);
588  break;
589  }
591  bendangle = phiDiff(2, 3);
592  break;
593  }
595  bendangle = phiDiff(2, 4);
596  break;
597  }
599  bendangle = phiDiff(2, 4);
600  break;
601  }
603  bendangle = phiDiff(4, 3);
604  break;
605  }
607  bendangle = phiDiff(4, 3);
608  break;
609  }
611  bendangle = 0;
612  // cerr << "AssignmentUnit::getPtAddress : undefined PtAssMethod" << endl;
613  break;
614  }
615  default: { bendangle = 0; }
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
L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::getPtMethod ( ) const
private

determine pt assignment method

Definition at line 491 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, MessageLogger_cff::threshold, and L1MuBMTrackAssembler::trackBitMap().

Referenced by PtAU().

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

get track segment from a given station

Definition at line 397 of file L1MuBMAssignmentUnit.cc.

References m_TSphi.

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

397  {
398  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
399  for (iter = m_TSphi.begin(); iter != m_TSphi.end(); iter++) {
400  int stat = (*iter)->station();
401  if (station == stat) {
402  return (*iter);
403  break;
404  }
405  }
406 
407  return nullptr;
408 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
void L1MuBMAssignmentUnit::PhiAU ( const edm::EventSetup c)

assign phi

< phi-assignment look-up tables

Definition at line 123 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), bmtfParamsHandle, dqmdumpme::first, edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), L1MuBMLUTHandler::getDeltaPhi(), L1MuBMTFConfig::getNbitsPhiPhi(), L1MuBMTFConfig::getNbitsPhiPhib(), getTSphi(), L1MuBMSectorProcessor::id(), dqmdumpme::k, m_id, m_sp, phi, L1MuBMTrackSegPhi::phi(), L1MuBMTrackSegPhi::phib(), edm::ESHandle< T >::product(), edm::second(), L1MuBMSecProcId::sector(), L1MuBMTrackSegPhi::sector(), L1MuBMTrack::setPhi(), thePhiLUTs, L1MuBMSectorProcessor::track(), and L1MuBMSectorProcessor::tracK().

Referenced by run().

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

build difference of two phi values

Definition at line 638 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), nbit_phi, hltrates_dqm_sourceclient-live_cfg::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 = (phi2 - phi1 + offset) << sh_phi;
661 
662  return bendangle;
663 }
int phi() const
return phi
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
static unsigned short nbit_phi
of bits used for pt-assignment
int sector() const
return sector
void L1MuBMAssignmentUnit::PtAU ( const edm::EventSetup c)

assign pt and charge

< pt-assignment look-up tables

Definition at line 201 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), bmtfParamsHandle, ALCARECOTkAlJpsiMuMu_cff::charge, edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), L1TMuonBarrelParamsAllPublic::get_DisableNewAlgo(), getCharge(), L1MuBMLUTHandler::getPt(), getPt1Address(), getPt1Method(), getPt2Address(), getPt2Method(), getPtAddress(), getPtMethod(), m_id, m_ptAssMethod, m_sp, L1MuBMLUTHandler::NODEF, edm::ESHandle< T >::product(), DiDispStaMuonMonitor_cfi::pt, Quality(), L1MuBMTrack::setCharge(), L1MuBMTrack::setPt(), thePtaLUTs, L1MuBMSectorProcessor::track(), and L1MuBMSectorProcessor::tracK().

Referenced by run().

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

assign quality

Two LSBs of BMTF Q = Nstations-1

Two MSB of BMTF Q = 11

Definition at line 255 of file L1MuBMAssignmentUnit.cc.

References m_id, m_sp, qcdUeDQM_cfi::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().

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

Definition at line 322 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

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

reset Assignment Unit

Implements L1AbstractProcessor.

Definition at line 114 of file L1MuBMAssignmentUnit.cc.

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

Referenced by L1MuBMAssignmentUnit().

114  {
115  m_addArray.reset();
116  m_TSphi.clear();
118 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
L1MuBMAddressArray m_addArray
void reset()
reset address array
L1MuBMLUTHandler::PtAssMethod m_ptAssMethod
void L1MuBMAssignmentUnit::run ( const edm::EventSetup c)
overridevirtual

run Assignment Unit

Reimplemented from L1AbstractProcessor.

Definition at line 75 of file L1MuBMAssignmentUnit.cc.

References L1MuBMTrackAssembler::address(), l1GtPatternGenerator_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().

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

set precision of phi and phib

Definition at line 832 of file L1MuBMAssignmentUnit.cc.

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

Referenced by L1MuBMAssignmentUnit().

832  {
835 }
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
void L1MuBMAssignmentUnit::TSR ( )
private

Track Segment Router.

Definition at line 381 of file L1MuBMAssignmentUnit.cc.

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

Referenced by run().

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

Member Data Documentation

edm::ESHandle<L1TMuonBarrelParams> L1MuBMAssignmentUnit::bmtfParamsHandle
private

Definition at line 113 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU(), and PtAU().

L1MuBMAddressArray L1MuBMAssignmentUnit::m_addArray
private

Definition at line 109 of file L1MuBMAssignmentUnit.h.

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

int L1MuBMAssignmentUnit::m_id
private

Definition at line 107 of file L1MuBMAssignmentUnit.h.

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

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::m_ptAssMethod
private

Definition at line 111 of file L1MuBMAssignmentUnit.h.

Referenced by PtAU(), and reset().

L1MuBMSectorProcessor& L1MuBMAssignmentUnit::m_sp
private

Definition at line 106 of file L1MuBMAssignmentUnit.h.

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

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

Definition at line 110 of file L1MuBMAssignmentUnit.h.

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

unsigned short int L1MuBMAssignmentUnit::nbit_phi = 12
staticprivate

of bits used for pt-assignment

Definition at line 116 of file L1MuBMAssignmentUnit.h.

Referenced by phiDiff(), and setPrecision().

unsigned short int L1MuBMAssignmentUnit::nbit_phib = 10
staticprivate

of bits used for pt-assignment

Definition at line 117 of file L1MuBMAssignmentUnit.h.

Referenced by setPrecision().

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePhiLUTs
private

phi-assignment look-up tables

Definition at line 115 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU().

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePtaLUTs
private

pt-assignment look-up tables

Definition at line 114 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), and PtAU().