CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

L1MuDTExtrapolationUnit Class Reference

#include <L1MuDTExtrapolationUnit.h>

Inheritance diagram for L1MuDTExtrapolationUnit:
L1AbstractProcessor

List of all members.

Public Types

typedef std::pair
< Extrapolation, unsigned int > 
SEUId
typedef std::map< SEUId,
L1MuDTSEU *, std::less< SEUId > > 
SEUmap

Public Member Functions

unsigned short int getAddress (Extrapolation ext, unsigned int startAdr, int id) const
 get extrapolation address from a given ERS
const std::bitset< 12 > & getEXTable (Extrapolation ext, unsigned int startAdr) const
 get Extrapolator table for a given SEU
const std::bitset< 12 > & getQSTable (Extrapolation ext, unsigned int startAdr) const
 get Quality Sorter table for a given SEU
unsigned short int getQuality (Extrapolation ext, unsigned int startAdr, int id) const
 get extrapolation quality from a given ERS
 L1MuDTExtrapolationUnit (const L1MuDTSectorProcessor &)
 constructor
int numberOfExt () const
 return number of successful extrapolations
void print (int level=0) const
 print all successful extrapolations
void reset (Extrapolation ext, unsigned int startAdr, unsigned int relAdr)
 reset a single extrapolation
virtual void reset ()
 reset Extrapolation Unit
virtual void run (const edm::EventSetup &c)
 run Extrapolation Unit
virtual ~L1MuDTExtrapolationUnit ()
 destructor

Static Public Member Functions

static std::pair< int, int > which_ext (Extrapolation ext)
 return station of start and target track segment for a given extrapolation

Private Attributes

SEUmap m_SEUs
const L1MuDTSectorProcessorm_sp
edm::ESHandle< L1MuDTTFParameterspars

Detailed Description

Extrapolation Unit:

The Extrapolation Unit attempts to join track segment pairs of different stations. it contains 12 Single Extrapolation Units to perform all extrapolations in its own wheel and 6 Single Extrapolation Units to perform all extrapolations in the adjacent wheel (next wheel neighbour)

Date:
2008/11/28 10:30:51
Revision:
1.5

N. Neumeister CERN EP

Definition at line 54 of file L1MuDTExtrapolationUnit.h.


Member Typedef Documentation

typedef std::pair<Extrapolation, unsigned int> L1MuDTExtrapolationUnit::SEUId

Definition at line 58 of file L1MuDTExtrapolationUnit.h.

typedef std::map<SEUId, L1MuDTSEU*, std::less<SEUId> > L1MuDTExtrapolationUnit::SEUmap

Definition at line 59 of file L1MuDTExtrapolationUnit.h.


Constructor & Destructor Documentation

L1MuDTExtrapolationUnit::L1MuDTExtrapolationUnit ( const L1MuDTSectorProcessor sp)

constructor

Definition at line 56 of file L1MuDTExtrapolationUnit.cc.

References gather_cfg::cout, L1MuDTTFConfig::Debug(), EX12, EX13, EX14, EX21, EX23, EX24, EX34, m_SEUs, and MAX_EXT.

                                                                                :
                    m_sp(sp), m_SEUs() {

  for ( int ext_idx = 0; ext_idx < MAX_EXT; ext_idx++ ) {
  
    Extrapolation ext = static_cast<Extrapolation>(ext_idx);   

    if ( ext == EX12 || ext == EX13 || ext == EX14 ||
         ext == EX21 || ext == EX23 || ext == EX24 || ext == EX34 ) {
         
      unsigned int maxaddr = 4;   
      
      if ( ext == EX12 || ext == EX13 || ext == EX14 ) maxaddr = 2;

      for ( unsigned int startAddress = 0; startAddress < maxaddr; startAddress++ ) {
        SEUId id = make_pair(ext, startAddress);
        m_SEUs[id] = new L1MuDTSEU(sp,ext,startAddress);
        if ( L1MuDTTFConfig::Debug(6) ) cout << "  creating SEU " << ext << " " << startAddress << endl;
      }  
    }
  }

}
L1MuDTExtrapolationUnit::~L1MuDTExtrapolationUnit ( ) [virtual]

destructor

Definition at line 85 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

                                                  {

  for ( SEUmap::iterator iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
    delete (*iter).second;
    (*iter).second = 0;
  }
  m_SEUs.clear();

}

Member Function Documentation

unsigned short int L1MuDTExtrapolationUnit::getAddress ( Extrapolation  ext,
unsigned int  startAdr,
int  id 
) const

get extrapolation address from a given ERS

Definition at line 190 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

                                                                                                             {

  // get extrapolation address from ERS 
  // startAdr = 0, 1  : own wheel
  // startAdr = 2, 3  : next wheel neighbour

  //  assert( startAdr >= 0 && startAdr <= 3 );
  //  assert( id == 0 || id == 1 );
  
  unsigned short int address = 15;
  
  SEUId seuid = make_pair(ext, startAdr);
  SEUmap::const_iterator iter = m_SEUs.find(seuid);
  if ( iter != m_SEUs.end() ) address = ((*iter).second)->ers()->address(id);

  return address;

}
const bitset< 12 > & L1MuDTExtrapolationUnit::getEXTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Extrapolator table for a given SEU

Definition at line 236 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

Referenced by run().

                                                                                                    {

  // startAdr = 0, 1  : own wheel
  // startAdr = 2, 3  : next wheel neighbour

  //  assert( startAdr >= 0 && startAdr <= 3 );
  
  SEUId seuid = make_pair(ext, startAdr);
  return m_SEUs[seuid]->exTable();

}
const bitset< 12 > & L1MuDTExtrapolationUnit::getQSTable ( Extrapolation  ext,
unsigned int  startAdr 
) const

get Quality Sorter table for a given SEU

Definition at line 252 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuDTTrackAssembler::run().

                                                                                                    {

  // startAdr = 0, 1  : own wheel
  // startAdr = 2, 3  : next wheel neighbour

  //  assert( startAdr >= 0 && startAdr <= 3 );
  
  SEUId seuid = make_pair(ext, startAdr);
  return m_SEUs[seuid]->qsTable();

}
unsigned short int L1MuDTExtrapolationUnit::getQuality ( Extrapolation  ext,
unsigned int  startAdr,
int  id 
) const

get extrapolation quality from a given ERS

Definition at line 213 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

                                                                                                             {

  // get extrapolation quality from ERS 
  // startAdr = 0, 1  : own wheel
  // startAdr = 2, 3  : next wheel neighbour

  //  assert( startAdr >= 0 && startAdr <= 3 );
  //  assert( id == 0 || id == 1 );
  
  unsigned short int quality = 0;

  SEUId seuid = make_pair(ext, startAdr);
  SEUmap::const_iterator iter = m_SEUs.find(seuid);
  if ( iter != m_SEUs.end() ) quality = ((*iter).second)->ers()->quality(id);

  return quality;
  
}
int L1MuDTExtrapolationUnit::numberOfExt ( ) const

return number of successful extrapolations

Definition at line 268 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuDTSectorProcessor::run().

                                               {

  int number = 0;
  SEUmap::const_iterator iter;
  for ( iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
    number += ((*iter).second)->numberOfExt();
  }
 
  return number;

}
void L1MuDTExtrapolationUnit::print ( int  level = 0) const

print all successful extrapolations

Definition at line 284 of file L1MuDTExtrapolationUnit.cc.

References gather_cfg::cout, L1MuDTSectorProcessor::id(), m_SEUs, and m_sp.

Referenced by L1MuDTSectorProcessor::run().

                                                   {

  SEUmap::const_iterator iter_seu;

  if ( level == 0 ) {
    for ( iter_seu = m_SEUs.begin(); iter_seu != m_SEUs.end(); iter_seu++ ) {
      vector<L1MuDTEUX*> vec_eux = ((*iter_seu).second)->eux();
      vector<L1MuDTEUX*>::const_iterator iter_eux;
      for ( iter_eux  = vec_eux.begin(); 
            iter_eux != vec_eux.end(); iter_eux++ ) {
        if ( (*iter_eux)->result() ) {
          cout << ((*iter_seu).second)->ext() << " "
               << ((*iter_seu).second)->tsId() << " " 
               << (*iter_eux)->id() << endl; 
          cout << "start  : " << *(*iter_eux)->ts().first << endl;
          cout << "target : " << *(*iter_eux)->ts().second << endl;
          cout << "result : " << "quality = " << (*iter_eux)->quality() << '\t' 
                              << "address = " << (*iter_eux)->address() << endl;
        }
      }
    }
  }

  //
  // print all results from Extrapolator and Quality Sorter
  //
  if ( level == 1 ) {
    cout << "Results from Extrapolator and Quality Sorter of " << m_sp.id()
         << " : \n" << endl;

    cout << "             EXT            QSU      " << endl;
    cout << "  S E U   11            11           " << endl;
    cout << "          109876543210  109876543210 " << endl;
    cout << "-------------------------------------" << endl;     
    for ( iter_seu = m_SEUs.begin(); iter_seu != m_SEUs.end(); iter_seu++ ) {

      cout << ((*iter_seu).second)->ext() << "_ "
           << ((*iter_seu).second)->tsId() << ": "
           << ((*iter_seu).second)->exTable() << "  "
           << ((*iter_seu).second)->qsTable() << endl; 

    }
  
    cout << endl;
  }

}
void L1MuDTExtrapolationUnit::reset ( void  ) [virtual]

reset Extrapolation Unit

Implements L1AbstractProcessor.

Definition at line 162 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

Referenced by L1MuDTSectorProcessor::reset(), and run().

                                    {

  SEUmap::const_iterator iter; 
  for ( iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {
    ((*iter).second)->reset();
  }

}
void L1MuDTExtrapolationUnit::reset ( Extrapolation  ext,
unsigned int  startAdr,
unsigned int  relAdr 
)

reset a single extrapolation

Definition at line 175 of file L1MuDTExtrapolationUnit.cc.

References m_SEUs.

                                                                                                 {

  //  assert( startAdr >= 0 && startAdr <= 3 );
  //  assert( relAdr >= 0 && relAdr <= 12 );

  SEUId seuid = make_pair(ext, startAdr);
  SEUmap::const_iterator iter = m_SEUs.find(seuid);
  if ( iter != m_SEUs.end() ) ((*iter).second)->reset(relAdr);

}
void L1MuDTExtrapolationUnit::run ( const edm::EventSetup c) [virtual]

run Extrapolation Unit

Reimplemented from L1AbstractProcessor.

Definition at line 103 of file L1MuDTExtrapolationUnit.cc.

References gather_cfg::cout, L1MuDTSectorProcessor::data(), L1MuDTTFConfig::Debug(), L1MuDTTrackSegPhi::empty(), EX12, EX21, L1MuDTSEU::ext(), edm::EventSetup::get(), getEXTable(), L1MuDTDataBuffer::getTSphi(), L1MuDTTFConfig::getUseEX21(), L1MuDTSectorProcessor::id(), svgfig::load(), m_SEUs, m_sp, pars, reset(), L1AbstractProcessor::run(), L1MuDTSecProcId::sector(), L1MuDTSEU::tsId(), L1MuDTSecProcId::wheel(), and which_ext().

Referenced by L1MuDTSectorProcessor::run().

                                                        {

  c.get< L1MuDTTFParametersRcd >().get( pars );

  SEUmap::const_iterator iter;
  for ( iter = m_SEUs.begin(); iter != m_SEUs.end(); iter++ ) {

    pair<int,int> ext_pair = which_ext(((*iter).second)->ext());
    int start = ext_pair.first;

    const L1MuDTTrackSegPhi* ts = 0;

    //get start track segment
    ts = m_sp.data()->getTSphi(start, ((*iter).second)->tsId() );

    if ( ts != 0 && !ts->empty() ) {
      ((*iter).second)->load(ts);
      ((*iter).second)->run(c);
    }

  }

  //
  // use EX21 to cross-check EX12
  //
  bool run_21 = pars->get_soc_run_21(m_sp.id().wheel(), m_sp.id().sector());
  if ( L1MuDTTFConfig::getUseEX21() || run_21 ) {

    // search for EX12 + EX21 single extrapolation units
    for ( unsigned int startAdr = 0; startAdr < 2; startAdr++ ) {
    
      bitset<12> extab12 = this->getEXTable( EX12, startAdr );
      bitset<12> extab21 = this->getEXTable( EX21, startAdr );

      for ( int eux = 0; eux < 12; eux++ ) {
        if ( extab12.test(eux) && !extab21.test(eux) ) {
          reset(EX12,startAdr,eux); 
          if ( L1MuDTTFConfig::Debug(6) ) {
            SEUId seuid = make_pair(EX12, startAdr);
            L1MuDTSEU* SEU12 = m_SEUs[seuid];
            cout << "  EX12 - EX21 mismatch : "
                 << " EX12 : " << extab12 << " , " 
                 << " EX21 : " << extab21 << endl
                 << "  Cancel: " << SEU12->ext()
                 << " start addr = " << SEU12->tsId()
                 << " target addr = " << eux << endl;
          }  
        }
      }

    }
  }

}
pair< int, int > L1MuDTExtrapolationUnit::which_ext ( Extrapolation  ext) [static]

return station of start and target track segment for a given extrapolation

Definition at line 338 of file L1MuDTExtrapolationUnit.cc.

References EX12, EX13, EX14, EX15, EX21, EX23, EX24, EX25, EX34, LaserTracksInput_cfi::source, and filterCSVwithJSON::target.

Referenced by L1MuDTSEU::run(), and run().

                                                                  {

  int source = 0;
  int target = 0;

  //  assert( ext >= 0 && ext < MAX_EXT );

  switch ( ext ) {
    case EX12 : { source = 1; target = 2; break; }
    case EX13 : { source = 1; target = 3; break; }
    case EX14 : { source = 1; target = 4; break; }
    case EX21 : { source = 1; target = 2; break; }
    case EX23 : { source = 2; target = 3; break; }
    case EX24 : { source = 2; target = 4; break; }
    case EX34 : { source = 3; target = 4; break; }
    case EX15 : { source = 1; target = 3; break; }
    case EX25 : { source = 2; target = 3; break; }
    default : { source = 1; target = 2; break; }
  }

  return pair<int,int>(source,target);

}

Member Data Documentation

Definition at line 99 of file L1MuDTExtrapolationUnit.h.

Referenced by print(), and run().

Definition at line 103 of file L1MuDTExtrapolationUnit.h.

Referenced by run().