CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTSCand Class Reference

#include <DTTSCand.h>

List of all members.

Public Member Functions

void clear ()
 Clear the trigger.
void clearBits ()
 Clear (set to 1) the quality bits (but first/second track bit)
void clearBitsBkmod ()
 Clear (set to 1) all the bits (back-up mode)
DTConfigTSPhiconfig () const
 Configuration set.
unsigned dataword () const
 Return an uint16 with the content of the data word (for debugging)
 DTTSCand (DTTSS *, const DTTracoTrigData *, int, int)
 Constructor.
 DTTSCand ()
 Constructor.
 DTTSCand (const DTTSCand &tscand)
 Constructor.
int is0H () const
 Return if H outer.
int is0L () const
 Return if L outer.
int isCarry () const
 Return the carry bit.
int isCorr () const
 Return correlation bit.
int isFirst () const
 Return the first/second track bit.
int isH0 () const
 Return if H inner.
int isHHorHL () const
 Return if HH or HL.
int isHtrig () const
 Return HTRIG/LTRIG bit.
int isInner () const
 Return Inner/Outer bit.
int isL0 () const
 Return if L inner.
int isLH () const
 Return if LH.
int isLL () const
 Return if LL.
bool operator< (const DTTSCand &c) const
 Operator < used for sorting.
bool operator<= (const DTTSCand &c) const
 Operator <= used for sorting.
DTTSCandoperator= (const DTTSCand &tscand)
 Assignment operator.
void print () const
 Print the trigger.
void resetCarry ()
 Reset the carry bit.
void setBitsBkmod ()
 Set the bits for TSM back-up mode.
void setBitsTsm ()
 Set the quality bits for DTTSM analysis.
void setBitsTss ()
 Set the quality bits for DTTSS analysis.
void setSecondTrack ()
 Set the first track bit to second track (used for carry)
int TcPos () const
 Retrun the TRACO position inside the TSS.
int tracoNumber () const
 Return the TRACO number.
const DTTracoTrigDatatracoTr () const
 Return associated TRACO trigger.
DTTSStss () const
 Return the DTTSS.
int tssNumber () const
 Return the DTTSS number.
 ~DTTSCand ()
 Destructor.

Private Attributes

BitArray< 15 > _dataword
int _isCarry
int _tcPos
const DTTracoTrigData_tctrig
DTTSS_tss

Detailed Description

A Trigger Server Candidate

Date:
2008/06/30 13:43:31
Revision:
1.5
Author:
C. Grandi, D. Bonacorsi, S. Marcellini

Definition at line 37 of file DTTSCand.h.


Constructor & Destructor Documentation

DTTSCand::DTTSCand ( DTTSS tss,
const DTTracoTrigData tctrig,
int  ifs,
int  pos 
)

Constructor.

Definition at line 36 of file DTTSCand.cc.

References _dataword, BitArray< N >::one(), and BitArray< N >::unset().

  : _tss(tss), _tctrig(tctrig), _tcPos(pos), _isCarry(0) {

   _dataword.one();              // reset dataword to 0x1ff

   // SM sector collector Set bit 14 instead of 8, for 1st/2nd track to allow extra space 
   //      if(ifs==1)_dataword.unset(8); // set bit 8 (0=first, 1=second tracks)
      if(ifs==1)_dataword.unset(14); // set bit 14 (0=first, 1=second tracks)

}
DTTSCand::DTTSCand ( )

Constructor.

Definition at line 56 of file DTTSCand.cc.

{}
DTTSCand::DTTSCand ( const DTTSCand tscand)

Constructor.

Definition at line 48 of file DTTSCand.cc.

  : _tss(tscand._tss), _tctrig(tscand._tctrig), _tcPos(tscand._tcPos), 
  _isCarry(tscand._isCarry) {

 
}
DTTSCand::~DTTSCand ( )

Destructor.

Definition at line 61 of file DTTSCand.cc.

                   {
}

Member Function Documentation

void DTTSCand::clear ( void  ) [inline]

Clear the trigger.

Definition at line 81 of file DTTSCand.cc.

References _dataword, _isCarry, _tctrig, and BitArray< N >::one().

                 { 
  _tctrig=0; 
  _dataword.one();

  _isCarry=0;

}
void DTTSCand::clearBits ( ) [inline]

Clear (set to 1) the quality bits (but first/second track bit)

Definition at line 73 of file DTTSCand.h.

References _dataword, and BitArray< N >::assign().

Referenced by setBitsTsm(), and setBitsTss().

{ _dataword.assign(5,3,0x7); }
void DTTSCand::clearBitsBkmod ( ) [inline]

Clear (set to 1) all the bits (back-up mode)

Definition at line 76 of file DTTSCand.h.

References _dataword, and BitArray< N >::assign().

Referenced by setBitsBkmod().

{ _dataword.assign(0,7,0xff); }
DTConfigTSPhi* DTTSCand::config ( void  ) const [inline]

Configuration set.

Definition at line 82 of file DTTSCand.h.

References _tss, and DTTSS::config().

Referenced by setBitsTsm(), and setBitsTss().

{ return _tss->config(); }
unsigned DTTSCand::dataword ( ) const [inline]

Return an uint16 with the content of the data word (for debugging)

Definition at line 136 of file DTTSCand.h.

References _dataword, and BitArray< N >::dataWord().

Referenced by DTTSS::sortTSS1(), and DTTSS::sortTSS2().

{ return _dataword.dataWord(0)&0x1ff; }
int DTTSCand::is0H ( ) const [inline]

Return if H outer.

Definition at line 127 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

{ return !_tctrig->pvCorr() && _tctrig->pvCode()==8; }
int DTTSCand::is0L ( ) const [inline]

Return if L outer.

Definition at line 133 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

{  return !_tctrig->pvCorr() && _tctrig->pvCode()<8; }
int DTTSCand::isCarry ( ) const [inline]

Return the carry bit.

Definition at line 112 of file DTTSCand.h.

References _isCarry.

Referenced by setBitsTsm(), setBitsTss(), and DTTSS::sortTSS2().

{ return _isCarry; }
int DTTSCand::isCorr ( ) const [inline]

Return correlation bit.

Definition at line 109 of file DTTSCand.h.

References _tctrig, and DTTracoTrigData::pvCorr().

Referenced by print(), DTTSPhi::runTSPhi(), setBitsTsm(), setBitsTss(), DTTSM::sortTSM1(), DTTSM::sortTSM2(), DTTSS::sortTSS1(), and DTTSS::sortTSS2().

{ return _tctrig->pvCorr(); }
int DTTSCand::isFirst ( ) const [inline]

Return the first/second track bit.

Definition at line 100 of file DTTSCand.h.

References _dataword, and BitArray< N >::element().

Referenced by DTTSM::addCand(), DTTSS::addDTTSCand(), print(), DTTSS::sortTSS1(), and DTTSS::sortTSS2().

{ return _dataword.element(14)==0; }
int DTTSCand::isH0 ( ) const [inline]

Return if H inner.

Definition at line 124 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

{ return !_tctrig->pvCorr() && _tctrig->pvCode()==80; }
int DTTSCand::isHHorHL ( ) const [inline]

Return if HH or HL.

Definition at line 115 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

{ return _tctrig->pvCorr() && _tctrig->pvCode()==80; }
int DTTSCand::isHtrig ( ) const [inline]

Return HTRIG/LTRIG bit.

Definition at line 103 of file DTTSCand.h.

References _tctrig, and DTTracoTrigData::pvCode().

Referenced by print(), DTTSPhi::runTSPhi(), setBitsTsm(), and setBitsTss().

                               { return _tctrig->pvCode()==8 || 
                                        _tctrig->pvCode()==80; }
int DTTSCand::isInner ( ) const [inline]

Return Inner/Outer bit.

Definition at line 106 of file DTTSCand.h.

References _tctrig, and DTTracoTrigData::pvCode().

Referenced by print(), DTTSPhi::runTSPhi(), setBitsTsm(), setBitsTss(), DTTSM::sortTSM1(), DTTSM::sortTSM2(), DTTSS::sortTSS1(), and DTTSS::sortTSS2().

{ return _tctrig->pvCode()>8; }
int DTTSCand::isL0 ( ) const [inline]

Return if L inner.

Definition at line 130 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

                            {  return !_tctrig->pvCorr() && _tctrig->pvCode()<80 &&
                                                            _tctrig->pvCode()>8; }
int DTTSCand::isLH ( ) const [inline]

Return if LH.

Definition at line 118 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

{ return _tctrig->pvCorr() && _tctrig->pvCode()==8; }
int DTTSCand::isLL ( ) const [inline]

Return if LL.

Definition at line 121 of file DTTSCand.h.

References _tctrig, DTTracoTrigData::pvCode(), and DTTracoTrigData::pvCorr().

                            { return _tctrig->pvCorr() && !_tctrig->pvCode()==8 &&
                                                          !_tctrig->pvCode()==80; }  
bool DTTSCand::operator< ( const DTTSCand c) const [inline]

Operator < used for sorting.

Definition at line 139 of file DTTSCand.h.

References _dataword.

{ return _dataword<c._dataword; }
bool DTTSCand::operator<= ( const DTTSCand c) const [inline]

Operator <= used for sorting.

Definition at line 142 of file DTTSCand.h.

References _dataword.

{ return _dataword<=c._dataword; }
DTTSCand & DTTSCand::operator= ( const DTTSCand tscand)

Assignment operator.

Definition at line 70 of file DTTSCand.cc.

References _isCarry, _tcPos, _tctrig, and _tss.

                                          {
  if(this != &tscand){
    _tss = tscand._tss;
    _tctrig = tscand._tctrig;
    _tcPos = tscand._tcPos;
    _isCarry = tscand._isCarry;
  }
  return *this;
}
void DTTSCand::print ( void  ) const

Print the trigger.

Definition at line 263 of file DTTSCand.cc.

References _dataword, gather_cfg::cout, isCorr(), isFirst(), isHtrig(), isInner(), BitArray< N >::print(), DTTracoTrigData::pvK(), and tracoTr().

                      {
  std::cout << " First=" << isFirst();
  std::cout << " HTRIG=" << isHtrig();
  std::cout << " Inner=" << isInner();
  std::cout << " Corr="  << isCorr();
  std::cout << " Kpv="   << tracoTr()->pvK();
  std::cout << " dataword=";
  _dataword.print();
  std::cout << std::endl;
}
void DTTSCand::resetCarry ( ) [inline]

Reset the carry bit.

Definition at line 70 of file DTTSCand.h.

References _isCarry.

{ _isCarry=0; }
void DTTSCand::setBitsBkmod ( )

Set the bits for TSM back-up mode.

Definition at line 163 of file DTTSCand.cc.

References _dataword, _tctrig, clearBitsBkmod(), DTTracoTrigData::qdec(), and BitArray< N >::unset().

Referenced by DTTSM::sortTSM1(), and DTTSM::sortTSM2().

                       {
  // first/second track already set. Set other 4 bits (1 for null, 3 for a2, a1, a0)
  clearBitsBkmod();
  //  std::cout << " clearbits in TSM bk mode " << _dataword.print() << std::endl;

  int a2  = 6;
  int a1  = 5;
  int a0  = 4;
  //
  // std::cout << " _tctrig->qdec(): " << _tctrig->qdec() << std::endl;
  if( _tctrig->qdec()==6 ) { _dataword.unset(a2); _dataword.unset(a1); _dataword.unset(a0); }  // 1-000
  if( _tctrig->qdec()==5 ) { _dataword.unset(a2); _dataword.unset(a1); }                         // 1-001
  if( _tctrig->qdec()==4 ) { _dataword.unset(a2); _dataword.unset(a0); }                         // 1-010
  if( _tctrig->qdec()==3 ) { _dataword.unset(a1); }                                                // 1-101
  if( _tctrig->qdec()==2 ) { _dataword.unset(a1); _dataword.unset(a0); }                         // 1-100

  if( _tctrig->qdec()==0 ) { _dataword.unset(a0); }                                                // 1-110

  //    std::cout << " set Bits TSM back up " << _dataword.print() << std::endl;    
}
void DTTSCand::setBitsTsm ( )

Set the quality bits for DTTSM analysis.

Definition at line 186 of file DTTSCand.cc.

References _dataword, _tctrig, BitArray< N >::assign(), clearBits(), config(), gather_cfg::cout, BitArray< N >::element(), isCarry(), isCorr(), isHtrig(), isInner(), DTTracoTrigData::pvK(), DTConfigTSPhi::TsmCorrEna(), DTConfigTSPhi::TsmCorrEnaCarry(), DTConfigTSPhi::TsmHtrigEna(), DTConfigTSPhi::TsmHtrigEnaCarry(), DTConfigTSPhi::TsmInOutEna(), DTConfigTSPhi::TsmInOutEnaCarry(), DTConfigTSPhi::TsmMasking(), DTConfigTSPhi::TssMasking(), and BitArray< N >::unset().

                     {
  // first/second track already set. Set other 3 bits
   int itk=_dataword.element(14); // first tracks 0, second tracks 1

  clearBits();

  if(_tctrig->pvK()>31|| _tctrig->pvK()<0){ // Check K within 5 bits range
    std::cout << "DTTSCand::setBitsTsm pvK outside valid range: " << _tctrig->pvK();
    std::cout << " deltaPsiR set to 31" << std::endl;
  }
  else {
    // SM double TSM
    // assign preview in dataword (common to any other assignment)
     _dataword.assign(0,5,_tctrig->pvK());
     //  _dataword.assign(0,5,0);
    // 
    
    int posH=-1;
    int posI=-1;
    int posC=-1;
    switch(config()->TsmMasking(itk)) {
    case 123: // H/L, In/Out, Corr/NotC
      posH = 7;
      posI = 6;
      posC = 5;
      break;
    case 132: // H/L, Corr/NotC, In/Out
      posH = 7;
      posI = 5;
      posC = 6;
      break;
    case 213: // In/Out, H/L, Corr/NotC 
      posH = 6;
      posI = 7;
      posC = 5;
      break;
    case 231: // In/Out, Corr/NotC, H/L 
      posH = 5;
      posI = 7;
      posC = 6;
      break;
    case 312: // Corr/NotC, H/L, In/Out
      posH = 6;
      posI = 5;
      posC = 7;
      break;
    case 321: // Corr/NotC, In/Out, H/L
      posH = 5;
      posI = 6;
      posC = 7;
      break;
    default:
      std::cout << "DTTSCand::DTTSCand(): masking not correct: ";
      std::cout << config()->TssMasking(itk);
      std::cout << " All bits set to 1" << std::endl;
      
    // Masking:
      bool enaH = config()->TsmHtrigEna(itk);
      bool enaI = config()->TsmInOutEna(itk);
      bool enaC = config()->TsmCorrEna(itk) ;
      if(isCarry()) {
        // Special setting for carry
        enaH = config()->TsmHtrigEnaCarry();
        enaI = config()->TsmInOutEnaCarry();
        enaC = config()->TsmCorrEnaCarry() ;
      }
      // Bits set to 0 give higher priority:
      if(isHtrig()&&enaH&&posH>0)_dataword.unset(posH);
      if(isInner()&&enaI&&posI>0)_dataword.unset(posI);
      if(isCorr() &&enaC&&posC>0)_dataword.unset(posC);
            
    }
  }


}
void DTTSCand::setBitsTss ( )

Set the quality bits for DTTSS analysis.

Definition at line 90 of file DTTSCand.cc.

References _dataword, _tctrig, BitArray< N >::assign(), clearBits(), config(), gather_cfg::cout, BitArray< N >::element(), isCarry(), isCorr(), isHtrig(), isInner(), DTTracoTrigData::pvK(), DTConfigTSPhi::TssCorrEna(), DTConfigTSPhi::TssCorrEnaCarry(), DTConfigTSPhi::TssHtrigEna(), DTConfigTSPhi::TssHtrigEnaCarry(), DTConfigTSPhi::TssInOutEna(), DTConfigTSPhi::TssInOutEnaCarry(), DTConfigTSPhi::TssMasking(), and BitArray< N >::unset().

Referenced by DTTSM::sortTSM1(), DTTSM::sortTSM2(), DTTSS::sortTSS1(), and DTTSS::sortTSS2().

                     {
  // first/second track already set. Set other 3 bits
  int itk=_dataword.element(14); // first tracks 0, second tracks 1
 
   clearBits();
      if(_tctrig->pvK()>32|| _tctrig->pvK()<0){ // Check K within 5 bits range
     std::cout << "DTTSCand::setBitsTss() pvK outside valid range: " << _tctrig->pvK();
     std::cout << " deltaPsiR set to 31" << std::endl;
   }
   else { 
     // assign preview in dataword (common to any other assignment)
        _dataword.assign(0,5,_tctrig->pvK());
     //  _dataword.assign(0,5,0);
     
     int posH=-1;
     int posI=-1;
     int posC=-1;
     switch(config()->TssMasking(itk)) {
     case 123: // H/L, In/Out, Corr/NotC
       posH = 7;
       posI = 6;
       posC = 5;
       break;
     case 132: // H/L, Corr/NotC, In/Out
       posH = 7;
       posI = 5;
       posC = 6;
       break;
     case 213: // In/Out, H/L, Corr/NotC 
       posH = 6;
       posI = 7;
       posC = 5;
       break;
     case 231: // In/Out, Corr/NotC, H/L 
       posH = 5;
       posI = 7;
       posC = 6;
       break;
     case 312: // Corr/NotC, H/L, In/Out
       posH = 6;
       posI = 5;
       posC = 7;
       break;
     case 321: // Corr/NotC, In/Out, H/L
       posH = 5;
       posI = 6;
       posC = 7;
       break;
     default:
       std::cout << "DTTSCand::DTTSCand(): masking not correct: ";
       std::cout << config()->TssMasking(itk);
       std::cout << " All bits set to 1" << std::endl;
     }
     // Masking:
     bool enaH = config()->TssHtrigEna(itk);
     bool enaI = config()->TssInOutEna(itk);
     bool enaC = config()->TssCorrEna(itk) ;
     if(isCarry()) {
       // Special setting for carry
       enaH = config()->TssHtrigEnaCarry();
       enaI = config()->TssInOutEnaCarry();
       enaC = config()->TssCorrEnaCarry() ;
     }
     // Bits set to 0 give higher priority:
     if(isHtrig()&&enaH&&posH>0)_dataword.unset(posH);
     if(isInner()&&enaI&&posI>0)_dataword.unset(posI);
     if(isCorr() &&enaC&&posC>0)_dataword.unset(posC);
   }
          
}
void DTTSCand::setSecondTrack ( ) [inline]

Set the first track bit to second track (used for carry)

Definition at line 67 of file DTTSCand.h.

References _dataword, _isCarry, and BitArray< N >::set().

Referenced by DTTSM::sortTSM1(), and DTTSS::sortTSS1().

{ _dataword.set(14); _isCarry=1; }
int DTTSCand::TcPos ( ) const [inline]

Retrun the TRACO position inside the TSS.

Definition at line 88 of file DTTSCand.h.

References _tcPos.

Referenced by DTTSM::sortTSM1(), DTTSM::sortTSM2(), DTTSS::sortTSS1(), and DTTSS::sortTSS2().

{ return _tcPos; }
int DTTSCand::tracoNumber ( ) const [inline]

Return the TRACO number.

Definition at line 97 of file DTTSCand.h.

References _tctrig, and DTTracoTrigData::tracoNumber().

{ return _tctrig->tracoNumber(); }
const DTTracoTrigData* DTTSCand::tracoTr ( ) const [inline]

Return associated TRACO trigger.

Definition at line 85 of file DTTSCand.h.

References _tctrig.

Referenced by DTTSM::getTracoT(), DTTSS::getTracoT(), print(), and DTTSPhi::runTSPhi().

{ return _tctrig; }
DTTSS* DTTSCand::tss ( ) const [inline]

Return the DTTSS.

Definition at line 91 of file DTTSCand.h.

References _tss.

{ return _tss; }
int DTTSCand::tssNumber ( ) const [inline]

Return the DTTSS number.

Definition at line 94 of file DTTSCand.h.

References _tss, and DTTSS::number().

Referenced by DTTSM::sortTSM1(), and DTTSM::sortTSM2().

{ return _tss->number(); }

Member Data Documentation

int DTTSCand::_isCarry [private]

Definition at line 157 of file DTTSCand.h.

Referenced by clear(), isCarry(), operator=(), resetCarry(), and setSecondTrack().

int DTTSCand::_tcPos [private]

Definition at line 155 of file DTTSCand.h.

Referenced by operator=(), and TcPos().

DTTSS* DTTSCand::_tss [private]

Definition at line 151 of file DTTSCand.h.

Referenced by config(), operator=(), tss(), and tssNumber().