test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
virtual void reset ()
 reset Assignment Unit More...
 
virtual void run (const edm::EventSetup &c)
 run Assignment Unit More...
 
virtual ~L1MuBMAssignmentUnit ()
 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
< L1TMuonBarrelParams
bmtfParamsHandle
 
L1MuBMAddressArray m_addArray
 
int m_id
 
L1MuBMLUTHandler::PtAssMethod m_ptAssMethod
 
L1MuBMSectorProcessorm_sp
 
std::vector< const
L1MuBMTrackSegPhi * > 
m_TSphi
 
L1MuBMLUTHandlerthePhiLUTs
 phi-assignment look-up tables More...
 
L1MuBMLUTHandlerthePtaLUTs
 pt-assignment look-up tables More...
 

Static Private Attributes

static unsigned short nbit_phi = 12
 

of bits used for pt-assignment

More...
 
static unsigned short nbit_phib = 10
 

of bits used for pt-assignment

More...
 

Detailed Description

Assignment Unit:

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

N. Neumeister CERN EP J. Troconiz UAM Madrid

Definition at line 51 of file L1MuBMAssignmentUnit.h.

Constructor & Destructor Documentation

L1MuBMAssignmentUnit::L1MuBMAssignmentUnit ( L1MuBMSectorProcessor sp,
int  id 
)

constructor

Definition at line 54 of file L1MuBMAssignmentUnit.cc.

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

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

destructor

Definition at line 69 of file L1MuBMAssignmentUnit.cc.

69  {
70 }

Member Function Documentation

int L1MuBMAssignmentUnit::convertSector ( int  sector)
staticprivate

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

Definition at line 363 of file L1MuBMAssignmentUnit.cc.

363  {
364 
365  // assert( sector >=0 && sector < 12 );
366  const int sectorvalues[12] = { 0, 12, 24, 36, 48, 60, 72, 84,
367  96, 108, 120, 132 };
368 
369  return sectorvalues[sector];
370 
371 }
int L1MuBMAssignmentUnit::getCharge ( L1MuBMLUTHandler::PtAssMethod  method)
staticprivate

determine charge

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

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

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

587  {
588 
589  // phib values of track segments from stations 1, 2 and 4
590  int phib1 = ( getTSphi(1) != 0 ) ? getTSphi(1)->phib() : -999;
591  int phib2 = ( getTSphi(2) != 0 ) ? getTSphi(2)->phib() : -999;
592  int phib4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->phib() : -999;
593 
594 
595  int bendangle = -999;
596  switch (method) {
597  case L1MuBMLUTHandler::PT12H : { bendangle = phib1; break; }
598  case L1MuBMLUTHandler::PT13H : { bendangle = phib1; break; }
599  case L1MuBMLUTHandler::PT14H : { bendangle = phib1; break; }
600  case L1MuBMLUTHandler::PT23H : { bendangle = phib2; break; }
601  case L1MuBMLUTHandler::PT24H : { bendangle = phib2; break; }
602  case L1MuBMLUTHandler::PT34H : { bendangle = phib4; break; }
603  case L1MuBMLUTHandler::NODEF : { bendangle = -999; break; }
604  default : { bendangle = -999; }
605  }
606 
607  return bendangle;
608 
609 }
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 532 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().

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

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

Referenced by PtAU().

615  {
616 
617  // phib values of track segments from stations 1, 2 and 4
618  int phib2 = ( getTSphi(2) != 0 ) ? getTSphi(2)->phib() : -999;
619  int phib4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->phib() : -999;
620 
621 
622  int bendangle = -999;
623  switch (method) {
624  case L1MuBMLUTHandler::PT12H : { bendangle = phib2; break; }
625  case L1MuBMLUTHandler::PT14H : { bendangle = phib4; break; }
626  case L1MuBMLUTHandler::PT24H : { bendangle = phib4; break; }
627  //case L1MuBMLUTHandler::PT12HO : { bendangle = phib2; break; }
628  //case L1MuBMLUTHandler::PT14HO : { bendangle = phib4; break; }
629  //case L1MuBMLUTHandler::PT24HO : { bendangle = phib4; break; }
630  case L1MuBMLUTHandler::NODEF : { bendangle = -999; break; }
631  default : { bendangle = -999; }
632  }
633 
634  return bendangle;
635 
636 }
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 560 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

560  {
561 
562  // quality values of track segments from stations 2 and 4
563  int qual2 = ( getTSphi(2) != 0 ) ? getTSphi(2)->quality() : 0;
564  // int qual4 = ( getTSphi(4) != 0 ) ? getTSphi(4)->quality() : 0;
565 
567 
568  switch ( method ) {
569  case L1MuBMLUTHandler::PT12H : { if (qual2 > 3) pam = L1MuBMLUTHandler::PB21H; break; }
570  // case PT14H : { if (qual4 > 3) pam = PB34H; break; }
571  // case PT24H : { if (qual4 > 3) pam = PB34H; break; }
572  //case PT12HO : { if (qual2 > 3) pam = PB21HO; break; }
573  // case PT14HO : { if (qual4 > 3) pam = PB34HO; break; }
574  // case PT24HO : { if (qual4 > 3) pam = PB34HO; break; }
575  case L1MuBMLUTHandler::NODEF : { pam = L1MuBMLUTHandler::NODEF; break; }
576  default : { pam = L1MuBMLUTHandler::NODEF; }
577  }
578 
579  return pam;
580 
581 }
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 456 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().

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

References funct::abs(), L1MuBMLUTHandler::getPtLutThreshold(), getTSphi(), m_id, m_sp, PFRecoTauDiscriminationAgainstElectronMVA3GBR_cfi::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, dtDQMClient_cfg::threshold, and L1MuBMTrackAssembler::trackBitMap().

Referenced by PtAU().

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

References m_TSphi, and L1MuBMTrackSegPhi::station().

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

344  {
345 
346  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
347  for ( iter = m_TSphi.begin(); iter != m_TSphi.end(); iter++ ) {
348  int stat = (*iter)->station();
349  if ( station == stat ) {
350  return (*iter);
351  break;
352  }
353  }
354 
355  return 0;
356 
357 }
std::vector< const L1MuBMTrackSegPhi * > m_TSphi
void L1MuBMAssignmentUnit::PhiAU ( const edm::EventSetup c)

assign phi

< phi-assignment look-up tables

Definition at line 134 of file L1MuBMAssignmentUnit.cc.

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

Referenced by run().

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

build difference of two phi values

Definition at line 500 of file L1MuBMAssignmentUnit.cc.

References getTSphi(), nbit_phi, hltrates_dqm_sourceclient-live_cfg::offset, L1MuBMTrackSegPhi::phi(), and L1MuBMTrackSegPhi::sector().

Referenced by getPtAddress().

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

References funct::abs(), bmtfParamsHandle, RecoTauCleanerPlugins::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< class >::product(), EnergyCorrector::pt, Quality(), L1MuBMTrack::setCharge(), L1MuBMTrack::setPt(), thePtaLUTs, L1MuBMSectorProcessor::track(), and L1MuBMSectorProcessor::tracK().

Referenced by run().

208  {
209 
210  const L1TMuonBarrelParamsRcd& bmtfParamsRcd = c.get<L1TMuonBarrelParamsRcd>();
211  bmtfParamsRcd.get(bmtfParamsHandle);
212  const L1TMuonBarrelParams& bmtfParams1 = *bmtfParamsHandle.product();
213  const L1TMuonBarrelParamsAllPublic& bmtfParams = L1TMuonBarrelParamsAllPublic(bmtfParams1);
214  thePtaLUTs = new L1MuBMLUTHandler(bmtfParams);
215  //thePtaLUTs->print();
216  // get pt-assignment method as function of track class and TS phib values
217  //m_ptAssMethod = getPtMethod(bmtfParams);
219  // get input address for look-up table
220  int bend_angle = getPtAddress(m_ptAssMethod);
221  int bend_carga = getPtAddress(m_ptAssMethod, 1);
222 
223  // retrieve pt value from look-up table
224  int lut_idx = m_ptAssMethod;
225  int pt = thePtaLUTs->getPt(lut_idx,bend_angle );
226  //int pt = getPt(lut_idx, bend_angle, bmtfParams->pta_lut());
227 
228 if(!bmtfParams.get_DisableNewAlgo()){
229 
230  if (Quality() < 4) {
231  int ptj = pt;
234  if (jj1 != L1MuBMLUTHandler::NODEF) {
235  lut_idx = jj1;
236  bend_angle = getPt1Address(m_ptAssMethod);
237  if (abs(bend_angle) < 512) ptj = thePtaLUTs->getPt(lut_idx,bend_angle );
238  }
239  else if (jj2 != L1MuBMLUTHandler::NODEF) {
240  lut_idx = jj2;
241  bend_angle = getPt2Address(m_ptAssMethod);
242  if (abs(bend_angle) < 512) ptj = thePtaLUTs->getPt(lut_idx,bend_angle );
243  }
244  if (ptj < pt) pt = ptj;
245  }
246 }
247 
248  m_sp.track(m_id)->setPt(pt);
249  m_sp.tracK(m_id)->setPt(pt);
250 
251  // assign charge
252  int chsign = getCharge(m_ptAssMethod);
253  int charge = ( bend_carga >= 0 ) ? chsign : -1 * chsign;
254  m_sp.track(m_id)->setCharge(charge);
255  m_sp.tracK(m_id)->setCharge(charge);
256  delete thePtaLUTs;
257 
258 }
L1MuBMLUTHandler::PtAssMethod getPtMethod() const
determine pt assignment method
void setPt(int pt)
set pt-code of muon candidate
Definition: L1MuBMTrack.h:157
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:160
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:56
T const * product() const
Definition: ESHandle.h:86
static int getCharge(L1MuBMLUTHandler::PtAssMethod)
determine charge
int getPt2Address(L1MuBMLUTHandler::PtAssMethod) const
L1MuBMLUTHandler::PtAssMethod getPt2Method(L1MuBMLUTHandler::PtAssMethod) const
L1MuBMSectorProcessor & m_sp
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 264 of file L1MuBMAssignmentUnit.cc.

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

264  {
265 
266  unsigned int quality = 0;
267 
268  const TrackClass tc = m_sp.TA()->trackClass(m_id);
269 
271  switch ( tc ) {
272  case T1234 : { quality = 3; break; }
273  case T123 : { quality = 2; break; }
274  case T124 : { quality = 2; break; }
275  case T134 : { quality = 2; break; }
276  case T234 : { quality = 2; break; }
277  case T12 : { quality = 1; break; }
278  case T13 : { quality = 1; break; }
279  case T14 : { quality = 1; break; }
280  case T23 : { quality = 0; break; }
281  case T24 : { quality = 0; break; }
282  case T34 : { quality = 0; break; }
283  default : { quality = 0; break; }
284  }
285 
287  quality += 12;
288 
289  m_sp.track(m_id)->setQuality(quality);
290  m_sp.tracK(m_id)->setQuality(quality);
291 
292 }
void setQuality(unsigned int quality)
set quality of muon candidate
Definition: L1MuBMTrack.h:166
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 298 of file L1MuBMAssignmentUnit.cc.

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

Referenced by PtAU().

298  {
299 
300  unsigned int quality = 0;
301 
302  const TrackClass tc = m_sp.TA()->trackClass(m_id);
303 
304  switch ( tc ) {
305  case T1234 : { quality = 7; break; }
306  case T123 : { quality = 6; break; }
307  case T124 : { quality = 6; break; }
308  case T134 : { quality = 5; break; }
309  case T234 : { quality = 4; break; }
310  case T12 : { quality = 3; break; }
311  case T13 : { quality = 3; break; }
312  case T14 : { quality = 3; break; }
313  case T23 : { quality = 2; break; }
314  case T24 : { quality = 2; break; }
315  case T34 : { quality = 1; break; }
316  default : { quality = 0; }
317  }
318 
319  return quality;
320 
321 }
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  )
virtual

reset Assignment Unit

Implements L1AbstractProcessor.

Definition at line 122 of file L1MuBMAssignmentUnit.cc.

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

Referenced by L1MuBMAssignmentUnit().

122  {
123 
124  m_addArray.reset();
125  m_TSphi.clear();
127 
128 }
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)
virtual

run Assignment Unit

Reimplemented from L1AbstractProcessor.

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

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

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

Referenced by L1MuBMAssignmentUnit().

642  {
643 
646 
647 }
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 326 of file L1MuBMAssignmentUnit.cc.

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

Referenced by run().

326  {
327 
328  // get the track segments from the data buffer
329  const L1MuBMTrackSegPhi* ts = 0;
330  for ( int stat = 1; stat <= 4; stat++ ) {
331  int adr = m_addArray.station(stat);
332  if ( adr != 15 ) {
333  ts = m_sp.data()->getTSphi(stat,adr);
334  if ( ts != 0 ) m_TSphi.push_back( ts );
335  }
336  }
337 
338 }
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 116 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU(), and PtAU().

L1MuBMAddressArray L1MuBMAssignmentUnit::m_addArray
private

Definition at line 112 of file L1MuBMAssignmentUnit.h.

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

int L1MuBMAssignmentUnit::m_id
private

Definition at line 110 of file L1MuBMAssignmentUnit.h.

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

L1MuBMLUTHandler::PtAssMethod L1MuBMAssignmentUnit::m_ptAssMethod
private

Definition at line 114 of file L1MuBMAssignmentUnit.h.

Referenced by PtAU(), and reset().

L1MuBMSectorProcessor& L1MuBMAssignmentUnit::m_sp
private

Definition at line 109 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 113 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 119 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 120 of file L1MuBMAssignmentUnit.h.

Referenced by setPrecision().

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePhiLUTs
private

phi-assignment look-up tables

Definition at line 118 of file L1MuBMAssignmentUnit.h.

Referenced by PhiAU().

L1MuBMLUTHandler* L1MuBMAssignmentUnit::thePtaLUTs
private

pt-assignment look-up tables

Definition at line 117 of file L1MuBMAssignmentUnit.h.

Referenced by getPtMethod(), and PtAU().