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

55  :
56  m_sp(sp), m_id(id),
58 
59  m_TSphi.reserve(4); // a track candidate can consist of max 4 TS
60  reset();
61  setPrecision();
62 
63 }
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 70 of file L1MuBMAssignmentUnit.cc.

70  {
71 }

Member Function Documentation

int L1MuBMAssignmentUnit::convertSector ( int  sector)
staticprivate

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

Definition at line 369 of file L1MuBMAssignmentUnit.cc.

369  {
370 
371  // assert( sector >=0 && sector < 12 );
372  const int sectorvalues[12] = { 0, 12, 24, 36, 48, 60, 72, 84,
373  96, 108, 120, 132 };
374 
375  return sectorvalues[sector];
376 
377 }
int L1MuBMAssignmentUnit::getCharge ( L1MuBMLUTHandler::PtAssMethod  method)
staticprivate

determine charge

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

383  {
384 
385  int chargesign = 0;
386  switch ( method ) {
387  case L1MuBMLUTHandler::PT12L : { chargesign = -1; break; }
388  case L1MuBMLUTHandler::PT12H : { chargesign = -1; break; }
389  case L1MuBMLUTHandler::PT13L : { chargesign = -1; break; }
390  case L1MuBMLUTHandler::PT13H : { chargesign = -1; break; }
391  case L1MuBMLUTHandler::PT14L : { chargesign = -1; break; }
392  case L1MuBMLUTHandler::PT14H : { chargesign = -1; break; }
393  case L1MuBMLUTHandler::PT23L : { chargesign = -1; break; }
394  case L1MuBMLUTHandler::PT23H : { chargesign = -1; break; }
395  case L1MuBMLUTHandler::PT24L : { chargesign = -1; break; }
396  case L1MuBMLUTHandler::PT24H : { chargesign = -1; break; }
397  case L1MuBMLUTHandler::PT34L : { chargesign = 1; break; }
398  case L1MuBMLUTHandler::PT34H : { chargesign = 1; break; }
399 
400  case L1MuBMLUTHandler::NODEF : { chargesign = 0;
401  // cerr << "AssignmentUnit::getCharge : undefined PtAssMethod!"
402  // << endl;
403  break;
404  }
405  default : { chargesign = 0; }
406  }
407 
408  return chargesign;
409 
410 }
int L1MuBMAssignmentUnit::getPt1Address ( L1MuBMLUTHandler::PtAssMethod  method) const
private

Definition at line 593 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

593  {
594 
595  // phib values of track segments from stations 1, 2 and 4
596  int phib1 = ( getTSphi(1) != nullptr ) ? getTSphi(1)->phib() : -999;
597  int phib2 = ( getTSphi(2) != nullptr ) ? getTSphi(2)->phib() : -999;
598  int phib4 = ( getTSphi(4) != nullptr ) ? getTSphi(4)->phib() : -999;
599 
600 
601  int bendangle = -999;
602  switch (method) {
603  case L1MuBMLUTHandler::PT12H : { bendangle = phib1; break; }
604  case L1MuBMLUTHandler::PT13H : { bendangle = phib1; break; }
605  case L1MuBMLUTHandler::PT14H : { bendangle = phib1; break; }
606  case L1MuBMLUTHandler::PT23H : { bendangle = phib2; break; }
607  case L1MuBMLUTHandler::PT24H : { bendangle = phib2; break; }
608  case L1MuBMLUTHandler::PT34H : { bendangle = phib4; break; }
609  case L1MuBMLUTHandler::NODEF : { bendangle = -999; break; }
610  default : { bendangle = -999; }
611  }
612 
613  return bendangle;
614 
615 }
#define nullptr
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 538 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), L1MuBMLUTHandler::NODEF, nullptr, 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().

538  {
539 
540  // quality values of track segments from stations 1, 2 and 4
541  int qual1 = ( getTSphi(1) != nullptr ) ? getTSphi(1)->quality() : 0;
542  int qual2 = ( getTSphi(2) != nullptr ) ? getTSphi(2)->quality() : 0;
543  int qual4 = ( getTSphi(4) != nullptr ) ? getTSphi(4)->quality() : 0;
544 
546 
547  switch ( method ) {
548  case L1MuBMLUTHandler::PT12H : { if (qual1 > 3) pam = L1MuBMLUTHandler::PB12H; break; }
549  case L1MuBMLUTHandler::PT13H : { if (qual1 > 3) pam = L1MuBMLUTHandler::PB13H; break; }
550  case L1MuBMLUTHandler::PT14H : { if (qual1 > 3) pam = L1MuBMLUTHandler::PB14H; break; }
551  case L1MuBMLUTHandler::PT23H : { if (qual2 > 3) pam = L1MuBMLUTHandler::PB23H; break; }
552  case L1MuBMLUTHandler::PT24H : { if (qual2 > 3) pam = L1MuBMLUTHandler::PB24H; break; }
553  case L1MuBMLUTHandler::PT34H : { if (qual4 > 3) pam = L1MuBMLUTHandler::PB34H; break; }
554  case L1MuBMLUTHandler::NODEF : { pam = L1MuBMLUTHandler::NODEF; break;}
555  default : { pam = L1MuBMLUTHandler::NODEF; }
556  }
557 
558  return pam;
559 
560 }
#define nullptr
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 621 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

621  {
622 
623  // phib values of track segments from stations 1, 2 and 4
624  int phib2 = ( getTSphi(2) != nullptr ) ? getTSphi(2)->phib() : -999;
625  int phib4 = ( getTSphi(4) != nullptr ) ? getTSphi(4)->phib() : -999;
626 
627 
628  int bendangle = -999;
629  switch (method) {
630  case L1MuBMLUTHandler::PT12H : { bendangle = phib2; break; }
631  case L1MuBMLUTHandler::PT14H : { bendangle = phib4; break; }
632  case L1MuBMLUTHandler::PT24H : { bendangle = phib4; break; }
633  //case L1MuBMLUTHandler::PT12HO : { bendangle = phib2; break; }
634  //case L1MuBMLUTHandler::PT14HO : { bendangle = phib4; break; }
635  //case L1MuBMLUTHandler::PT24HO : { bendangle = phib4; break; }
636  case L1MuBMLUTHandler::NODEF : { bendangle = -999; break; }
637  default : { bendangle = -999; }
638  }
639 
640  return bendangle;
641 
642 }
#define nullptr
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 566 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

566  {
567 
568  // quality values of track segments from stations 2 and 4
569  int qual2 = ( getTSphi(2) != nullptr ) ? getTSphi(2)->quality() : 0;
570  // int qual4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->quality() : 0;
571 
573 
574  switch ( method ) {
575  case L1MuBMLUTHandler::PT12H : { if (qual2 > 3) pam = L1MuBMLUTHandler::PB21H; break; }
576  // case PT14H : { if (qual4 > 3) pam = PB34H; break; }
577  // case PT24H : { if (qual4 > 3) pam = PB34H; break; }
578  //case PT12HO : { if (qual2 > 3) pam = PB21HO; break; }
579  // case PT14HO : { if (qual4 > 3) pam = PB34HO; break; }
580  // case PT24HO : { if (qual4 > 3) pam = PB34HO; break; }
581  case L1MuBMLUTHandler::NODEF : { pam = L1MuBMLUTHandler::NODEF; break; }
582  default : { pam = L1MuBMLUTHandler::NODEF; }
583  }
584 
585  return pam;
586 
587 }
#define nullptr
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 462 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().

462  {
463 
464  // calculate bend angle as difference of two azimuthal positions
465 
466  int bendangle = 0;
467  switch (method) {
468  case L1MuBMLUTHandler::PT12L : { bendangle = phiDiff(1,2); break; }
469  case L1MuBMLUTHandler::PT12H : { bendangle = phiDiff(1,2); break; }
470  case L1MuBMLUTHandler::PT13L : { bendangle = phiDiff(1,3); break; }
471  case L1MuBMLUTHandler::PT13H : { bendangle = phiDiff(1,3); break; }
472  case L1MuBMLUTHandler::PT14L : { bendangle = phiDiff(1,4); break; }
473  case L1MuBMLUTHandler::PT14H : { bendangle = phiDiff(1,4); break; }
474  case L1MuBMLUTHandler::PT23L : { bendangle = phiDiff(2,3); break; }
475  case L1MuBMLUTHandler::PT23H : { bendangle = phiDiff(2,3); break; }
476  case L1MuBMLUTHandler::PT24L : { bendangle = phiDiff(2,4); break; }
477  case L1MuBMLUTHandler::PT24H : { bendangle = phiDiff(2,4); break; }
478  case L1MuBMLUTHandler::PT34L : { bendangle = phiDiff(4,3); break; }
479  case L1MuBMLUTHandler::PT34H : { bendangle = phiDiff(4,3); break; }
480  case L1MuBMLUTHandler::NODEF : { bendangle = 0;
481  // cerr << "AssignmentUnit::getPtAddress : undefined PtAssMethod" << endl;
482  break;
483  }
484  default : { bendangle = 0; }
485 
486  }
487 
488  int signo = 1;
489  bendangle = (bendangle+8192)%4096;
490  if ( bendangle > 2047 ) bendangle -= 4096;
491  if ( bendangle < 0 ) signo = -1;
492 
493  if (bendcharge) return signo;
494 
495  bendangle = (bendangle+2048)%1024;
496  if ( bendangle > 511 ) bendangle -= 1024;
497 
498  return bendangle;
499 
500 }
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 417 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), L1MuBMLUTHandler::getPtLutThreshold(), getTSphi(), m_id, m_sp, AlcaSiPixelAliHarvester0T_cff::method, L1MuBMLUTHandler::NODEF, nullptr, 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, electronIdCutBased_cfi::threshold, and L1MuBMTrackAssembler::trackBitMap().

Referenced by PtAU().

417  {
418 
419  // determine which pt-assignment method should be used as a function
420  // of the track class and
421  // of the phib values of the track segments making up this track candidate.
422 
423  // get bitmap of track candidate
424  const bitset<4> s = m_sp.TA()->trackBitMap(m_id);
425 
426  int method = -1;
427 
428  if ( s.test(0) && s.test(3) ) method = 2; // stations 1 and 4
429  if ( s.test(0) && s.test(2) ) method = 1; // stations 1 and 3
430  if ( s.test(0) && s.test(1) ) method = 0; // stations 1 and 2
431  if ( !s.test(0) && s.test(1) && s.test(3) ) method = 4; // stations 2 and 4
432  if ( !s.test(0) && s.test(1) && s.test(2) ) method = 3; // stations 2 and 3
433  if ( !s.test(0) && !s.test(1) && s.test(2) && s.test(3) ) method = 5; // stations 3 and 4
434  int threshold = thePtaLUTs->getPtLutThreshold(method);
435 
436  // phib values of track segments from stations 1, 2 and 4
437  int phib1 = ( getTSphi(1) != nullptr ) ? getTSphi(1)->phib() : 0;
438  int phib2 = ( getTSphi(2) != nullptr ) ? getTSphi(2)->phib() : 0;
439  int phib4 = ( getTSphi(4) != nullptr ) ? getTSphi(4)->phib() : 0;
440 
442 
443  switch ( method ) {
444  case 0 : { pam = ( abs(phib1) < threshold ) ? L1MuBMLUTHandler::PT12H : L1MuBMLUTHandler::PT12L; break; }
445  case 1 : { pam = ( abs(phib1) < threshold ) ? L1MuBMLUTHandler::PT13H : L1MuBMLUTHandler::PT13L; break; }
446  case 2 : { pam = ( abs(phib1) < threshold ) ? L1MuBMLUTHandler::PT14H : L1MuBMLUTHandler::PT14L; break; }
447  case 3 : { pam = ( abs(phib2) < threshold ) ? L1MuBMLUTHandler::PT23H : L1MuBMLUTHandler::PT23L; break; }
448  case 4 : { pam = ( abs(phib2) < threshold ) ? L1MuBMLUTHandler::PT24H : L1MuBMLUTHandler::PT24L; break; }
449  case 5 : { pam = ( abs(phib4) < threshold ) ? L1MuBMLUTHandler::PT34H : L1MuBMLUTHandler::PT34L; break; }
450  default : ;
451  //cout << "L1MuBMAssignmentUnit : Error in PT ass method evaluation" << endl;
452  }
453 
454  return pam;
455 
456 }
L1MuBMLUTHandler * thePtaLUTs
pt-assignment look-up tables
#define nullptr
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 350 of file L1MuBMAssignmentUnit.cc.

References m_TSphi.

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

350  {
351 
352  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
353  for ( iter = m_TSphi.begin(); iter != m_TSphi.end(); iter++ ) {
354  int stat = (*iter)->station();
355  if ( station == stat ) {
356  return (*iter);
357  break;
358  }
359  }
360 
361  return nullptr;
362 
363 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
void L1MuBMAssignmentUnit::PhiAU ( const edm::EventSetup c)

assign phi

< phi-assignment look-up tables

Definition at line 135 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), bmtfParamsHandle, plotBeamSpotDB::first, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), L1MuBMLUTHandler::getDeltaPhi(), L1MuBMTFConfig::getNbitsPhiPhi(), L1MuBMTFConfig::getNbitsPhiPhib(), getTSphi(), L1MuBMSectorProcessor::id(), gen::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().

135  {
136 
137  const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get<L1TMuonBarrelParamsRcd>();
138  bmtfParamsRcd.get(bmtfParamsHandle);
139  const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product();
140  thePhiLUTs = new L1MuBMLUTHandler(bmtfParams);
141  //thePhiLUTs->print();
142  // calculate phi at station 2 using 8 bits (precision = 0.625 degrees)
143  int sh_phi = 12 - L1MuBMTFConfig::getNbitsPhiPhi();
144  int sh_phib = 10 - L1MuBMTFConfig::getNbitsPhiPhib();
145 
146  const L1MuBMTrackSegPhi* second = getTSphi(2); // track segment at station 2
147  const L1MuBMTrackSegPhi* first = getTSphi(1); // track segment at station 1
148  const L1MuBMTrackSegPhi* forth = getTSphi(4); // track segment at station 4
149 
150  int phi2 = 0; // phi-value at station 2
151  int sector = 0;
152  if ( second ) {
153  phi2 = second->phi() >> sh_phi;
154  sector = second->sector();
155  }
156  else if ( second == nullptr && first ) {
157  phi2 = first->phi() >> sh_phi;
158  sector = first->sector();
159  }
160  else if ( second == nullptr && forth ) {
161  phi2 = forth->phi() >> sh_phi;
162  sector = forth->sector();
163  }
164 
165  int sector0 = m_sp.id().sector();
166 
167  // convert sector difference to values in the range -6 to +5
168 
169  int sectordiff = (sector - sector0)%12;
170  if ( sectordiff >= 6 ) sectordiff -= 12;
171  if ( sectordiff < -6 ) sectordiff += 12;
172 
173  // convert phi to 0.625 degree precision
174  int phi_precision = 4096 >> sh_phi;
175  const double k = 57.2958/0.625/static_cast<float>(phi_precision);
176  double phi_f = static_cast<double>(phi2);
177  int bit_div_phi=static_cast<int>(phi2)%4;
178  if (bit_div_phi<0) bit_div_phi+=4;
179  phi_f=phi_f-std::abs(bit_div_phi);
180  int phi_8 = static_cast<int>(floor(phi_f*k));
181 
182  if ( second == nullptr && first ) {
183  int bend_angle = (first->phib() >> sh_phib) << sh_phib;
184  phi_8 = phi_8 + thePhiLUTs->getDeltaPhi(0,bend_angle);
185  //phi_8 = phi_8 + getDeltaPhi(0, bend_angle, bmtfParams->phi_lut());
186  }
187  else if ( second == nullptr && forth ) {
188 
189  int bend_angle = (forth->phib() >> sh_phib) << sh_phib;
190  phi_8 = phi_8 + thePhiLUTs->getDeltaPhi(1,bend_angle);
191  //phi_8 = phi_8 + getDeltaPhi(1, bend_angle, bmtfParams->phi_lut());
192  }
193 
194  //If muon is found at the neighbour sector - second station
195  //a shift is needed by 48
196  phi_8 += sectordiff*48;
197 
198  int phi = phi_8 + 24;
199  // 78 phi bins (-8 to 69) correspond 30 degree sector plus
200  // additional lower and higher bins for neighboring sectors.
201  if (phi > 69) phi = 69;
202  if (phi < -8) phi = -8;
203 
204  m_sp.track(m_id)->setPhi(phi); // Regional
205  m_sp.tracK(m_id)->setPhi(phi);
206 
207 delete thePhiLUTs;
208 }
static int getNbitsPhiPhi()
static int getNbitsPhiPhib()
edm::ESHandle< L1TMuonBarrelParams > bmtfParamsHandle
void setPhi(int phi)
set phi-code of muon candidate
Definition: L1MuBMTrack.h:147
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
void get(HolderT &iHolder) const
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 k[5][pyjets_maxn]
int getDeltaPhi(int idx, int address) const
get delta-phi for a given address (bend-angle)
const T & get() const
Definition: EventSetup.h:55
const L1MuBMTrackSegPhi * getTSphi(int station) const
get track segment from a given station
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 506 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), nbit_phi, PFRecoTauDiscriminationByIsolation_cfi::offset, L1MuBMTrackSegPhi::phi(), and L1MuBMTrackSegPhi::sector().

Referenced by getPtAddress().

506  {
507 
508  // calculate bit shift
509 
510  int sh_phi = 12 - nbit_phi;
511 
512  // get 2 phi values and add offset (30 degrees ) for adjacent sector
513  int sector1 = getTSphi(stat1)->sector();
514  int sector2 = getTSphi(stat2)->sector();
515  int phi1 = getTSphi(stat1)->phi() >> sh_phi;
516  int phi2 = getTSphi(stat2)->phi() >> sh_phi;
517 
518  // convert sector difference to values in the range -6 to +5
519 
520  int sectordiff = (sector2 - sector1)%12;
521  if ( sectordiff >= 6 ) sectordiff -= 12;
522  if ( sectordiff < -6 ) sectordiff += 12;
523 
524  // assert( abs(sectordiff) <= 1 );
525 
526  int offset = (2144 >> sh_phi) * sectordiff;
527  int bendangle = (phi2 - phi1 + offset) << sh_phi;
528 
529  return bendangle;
530 
531 }
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 214 of file L1MuBMAssignmentUnit.cc.

References funct::abs(), bmtfParamsHandle, ALCARECOTkAlJpsiMuMu_cff::charge, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::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(), EnergyCorrector::pt, Quality(), L1MuBMTrack::setCharge(), L1MuBMTrack::setPt(), thePtaLUTs, L1MuBMSectorProcessor::track(), and L1MuBMSectorProcessor::tracK().

Referenced by run().

214  {
215 
216  const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get<L1TMuonBarrelParamsRcd>();
217  bmtfParamsRcd.get(bmtfParamsHandle);
218  const L1TMuonBarrelParams& bmtfParams1 = *bmtfParamsHandle.product();
219  const L1TMuonBarrelParamsAllPublic& bmtfParams = L1TMuonBarrelParamsAllPublic(bmtfParams1);
220  thePtaLUTs = new L1MuBMLUTHandler(bmtfParams);
221  //thePtaLUTs->print();
222  // get pt-assignment method as function of track class and TS phib values
223  //m_ptAssMethod = getPtMethod(bmtfParams);
225  // get input address for look-up table
226  int bend_angle = getPtAddress(m_ptAssMethod);
227  int bend_carga = getPtAddress(m_ptAssMethod, 1);
228 
229  // retrieve pt value from look-up table
230  int lut_idx = m_ptAssMethod;
231  int pt = thePtaLUTs->getPt(lut_idx,bend_angle );
232  //int pt = getPt(lut_idx, bend_angle, bmtfParams->pta_lut());
233 
234 if(!bmtfParams.get_DisableNewAlgo()){
235 
236  if (Quality() < 4) {
237  int ptj = pt;
240  if (jj1 != L1MuBMLUTHandler::NODEF) {
241  lut_idx = jj1;
242  bend_angle = getPt1Address(m_ptAssMethod);
243  if (abs(bend_angle) < 512) ptj = thePtaLUTs->getPt(lut_idx,bend_angle );
244  }
245  else if (jj2 != L1MuBMLUTHandler::NODEF) {
246  lut_idx = jj2;
247  bend_angle = getPt2Address(m_ptAssMethod);
248  if (abs(bend_angle) < 512) ptj = thePtaLUTs->getPt(lut_idx,bend_angle );
249  }
250  if (ptj < pt) pt = ptj;
251  }
252 }
253 
254  m_sp.track(m_id)->setPt(pt);
255  m_sp.tracK(m_id)->setPt(pt);
256 
257  // assign charge
258  int chsign = getCharge(m_ptAssMethod);
259  int charge = ( bend_carga >= 0 ) ? chsign : -1 * chsign;
260  m_sp.track(m_id)->setCharge(charge);
261  m_sp.tracK(m_id)->setCharge(charge);
262  delete thePtaLUTs;
263 
264 }
L1MuBMLUTHandler::PtAssMethod getPtMethod() const
determine pt assignment method
void setPt(int pt)
set pt-code of muon candidate
Definition: L1MuBMTrack.h:156
edm::ESHandle< L1TMuonBarrelParams > bmtfParamsHandle
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
L1MuBMLUTHandler::PtAssMethod getPt1Method(L1MuBMLUTHandler::PtAssMethod) const
L1MuBMTrack * tracK(int id) const
return pointer to muon candidate, index [0,1]
void get(HolderT &iHolder) const
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
const T & get() const
Definition: EventSetup.h:55
static int getCharge(L1MuBMLUTHandler::PtAssMethod)
determine charge
int getPt2Address(L1MuBMLUTHandler::PtAssMethod) const
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 270 of file L1MuBMAssignmentUnit.cc.

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

270  {
271 
272  unsigned int quality = 0;
273 
274  const TrackClass tc = m_sp.TA()->trackClass(m_id);
275 
277  switch ( tc ) {
278  case T1234 : { quality = 3; break; }
279  case T123 : { quality = 2; break; }
280  case T124 : { quality = 2; break; }
281  case T134 : { quality = 2; break; }
282  case T234 : { quality = 2; break; }
283  case T12 : { quality = 1; break; }
284  case T13 : { quality = 1; break; }
285  case T14 : { quality = 1; break; }
286  case T23 : { quality = 0; break; }
287  case T24 : { quality = 0; break; }
288  case T34 : { quality = 0; break; }
289  default : { quality = 0; break; }
290  }
291 
293  quality += 12;
294 
295  m_sp.track(m_id)->setQuality(quality);
296  m_sp.tracK(m_id)->setQuality(quality);
297 
298 }
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 304 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

304  {
305 
306  unsigned int quality = 0;
307 
308  const TrackClass tc = m_sp.TA()->trackClass(m_id);
309 
310  switch ( tc ) {
311  case T1234 : { quality = 7; break; }
312  case T123 : { quality = 6; break; }
313  case T124 : { quality = 6; break; }
314  case T134 : { quality = 5; break; }
315  case T234 : { quality = 4; break; }
316  case T12 : { quality = 3; break; }
317  case T13 : { quality = 3; break; }
318  case T14 : { quality = 3; break; }
319  case T23 : { quality = 2; break; }
320  case T24 : { quality = 2; break; }
321  case T34 : { quality = 1; break; }
322  default : { quality = 0; }
323  }
324 
325  return quality;
326 
327 }
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 123 of file L1MuBMAssignmentUnit.cc.

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

Referenced by L1MuBMAssignmentUnit().

123  {
124 
125  m_addArray.reset();
126  m_TSphi.clear();
128 
129 }
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 81 of file L1MuBMAssignmentUnit.cc.

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

81  {
82 
83  // enable track candidate
84  m_sp.track(m_id)->enable();
85  m_sp.tracK(m_id)->enable();
86 
87  // set track class
88  TrackClass tc = m_sp.TA()->trackClass(m_id);
89  m_sp.track(m_id)->setTC(tc);
90  m_sp.tracK(m_id)->setTC(tc);
91 
92  // get relative addresses of matching track segments
96 
97  // get track segments (track segment router)
98  TSR();
101 
102  // set bunch-crossing (use first track segment)
103  vector<const L1MuBMTrackSegPhi*>::const_iterator iter = m_TSphi.begin();
104  int bx = (*iter)->bx();
105  m_sp.track(m_id)->setBx(bx);
106  m_sp.tracK(m_id)->setBx(bx);
107 
108  // assign phi
109  PhiAU(c);
110 
111  // assign pt and charge
112  PtAU(c);
113 
114  // assign quality
115  QuaAU();
116 
117 }
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:135
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:171
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 648 of file L1MuBMAssignmentUnit.cc.

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

Referenced by L1MuBMAssignmentUnit().

648  {
649 
652 
653 }
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 332 of file L1MuBMAssignmentUnit.cc.

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

Referenced by run().

332  {
333 
334  // get the track segments from the data buffer
335  const L1MuBMTrackSegPhi* ts = nullptr;
336  for ( int stat = 1; stat <= 4; stat++ ) {
337  int adr = m_addArray.station(stat);
338  if ( adr != 15 ) {
339  ts = m_sp.data()->getTSphi(stat,adr);
340  if ( ts != nullptr ) m_TSphi.push_back( ts );
341  }
342  }
343 
344 }
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 117 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU(), and PtAU().

L1MuBMAddressArray L1MuBMAssignmentUnit::m_addArray
private

Definition at line 113 of file L1MuBMAssignmentUnit.h.

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

int L1MuBMAssignmentUnit::m_id
private

Definition at line 111 of file L1MuBMAssignmentUnit.h.

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

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::m_ptAssMethod
private

Definition at line 115 of file L1MuBMAssignmentUnit.h.

Referenced by PtAU(), and reset().

L1MuBMSectorProcessor& L1MuBMAssignmentUnit::m_sp
private

Definition at line 110 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 114 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 120 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 121 of file L1MuBMAssignmentUnit.h.

Referenced by setPrecision().

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePhiLUTs
private

phi-assignment look-up tables

Definition at line 119 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU().

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePtaLUTs
private

pt-assignment look-up tables

Definition at line 118 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), and PtAU().