CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes

DTSC Class Reference

#include <DTSC.h>

List of all members.

Classes

class  h

Public Member Functions

void addCand (DTTSCand *cand)
 Add a TSM candidate to the Sect Coll, ifs is first/second track flag.
void addDTSectCollPhCand (DTSectCollPhCand *cand)
 Add a Sector Collector.
void addPhCand (DTSectCollPhCand *cand)
 Add a TSM candidate to the Sect Coll, ifs is first/second track flag.
void addThCand (DTSectCollThCand *cand)
 Add a Theta candidate to sect coll.
void clear ()
 Clear.
void clear ()
 Clear.
DTConfigSectCollconfig () const
 Configuration set.
DTConfigSectCollconfig () const
 Configuration set.
 DTSC (int istat)
 Constructor.
 DTSC (DTConfigSectColl *)
 Constructor.
DTSectCollPhCandDTSectCollsort1 ()
 Phi Sort 1.
DTTSCandDTSectCollsort1 ()
 Sort 1.
DTSectCollPhCandDTSectCollsort2 ()
 Phi Sort 2.
DTTSCandDTSectCollsort2 ()
 Sort 2.
DTSectCollPhCandgetDTSectCollPhCand (int ifs, unsigned n) const
 Return requested TSS candidate.
DTSectCollThCandgetDTSectCollThCand (unsigned n) const
 Return requested Theta candidate.
DTTSCandgetDTTSCand (int ifs, unsigned n) const
 Return requested TSS candidate.
DTTSCandgetTrack (int n) const
 Return the requested track.
DTSectCollPhCandgetTrackPh (int n) const
 Return the requested Phi track.
DTSectCollThCandgetTrackTh (int n) const
 Return the requested Theta track.
const DTTracoTrigDatagetTracoT (int ifs, unsigned n) const
 Return requested TRACO trigger.
void ignoreSecondTrack ()
 Set a flag to skip sort2.
void ignoreSecondTrack ()
 Set a flag to skip sort2.
unsigned nCand (int ifs) const
 Return the number of input tracks (first/second)
unsigned nCandPh (int ifs) const
 Return the number of Phi input tracks (first/second)
unsigned nCandTh () const
 Return the number of Theta input tracks.
int nFirstT () const
 Return the number of input first tracks.
int nFirstTPh () const
 Return the number of input first tracks.
int nSecondT () const
 Return the number of input second tracks.
int nSecondTPh () const
 Return the number of input second tracks.
int nTracks () const
 Return the number of sorted tracks.
int nTracksPh () const
 Return the number of output Phi tracks.
int nTracksTh () const
 Return the number of output Theta tracks.
void run ()
 Run the Sector Collector algorithm.
void run ()
 Run the Sector Collector algorithm.
void setConfig (DTConfigSectColl *conf)
 Set configuration.
 ~DTSC ()
 Destructor.
 ~DTSC ()
 Destructor.

Private Attributes

std::vector< DTSectCollThCand * > _cand_th
DTConfigSectColl_config
int _ignoreSecondTrack
std::vector< DTTSCand * > _incand [2]
std::vector< DTSectCollPhCand * > _incand_ph [2]
std::vector< DTTSCand * > _outcand
std::vector< DTSectCollPhCand * > _outcand_ph
int _stat

Detailed Description

Definition at line 43 of file DTSC.h.


Constructor & Destructor Documentation

DTSC::DTSC ( int  istat)

Constructor.

Definition at line 42 of file DTSC.cc.

                    : _ignoreSecondTrack(0) ,_stat(istat){

  // reserve the appropriate amount of space for vectors
  // test _incand[0].reserve(DTConfigSectColl::NTSMSC);
  // test_incand[1].reserve(DTConfigSectColl::NTSMSC);
  // test _outcand.reserve(2);
 
}
DTSC::~DTSC ( )

Destructor.

Definition at line 55 of file DTSC.cc.

References clear().

            {

  clear();

}
DTSC::DTSC ( DTConfigSectColl )

Constructor.

DTSC::~DTSC ( )

Destructor.


Member Function Documentation

void DTSC::addCand ( DTTSCand cand)

Add a TSM candidate to the Sect Coll, ifs is first/second track flag.

void DTSC::addDTSectCollPhCand ( DTSectCollPhCand cand)

Add a Sector Collector.

Definition at line 303 of file DTSC.cc.

References _incand_ph, and DTSectCollPhCand::isFirst().

Referenced by DTSectColl::addTSPhi().

                                                {

  int ifs = (cand->isFirst()) ? 0 : 1;
 
  _incand_ph[ifs].push_back(cand); 

}
void DTSC::addPhCand ( DTSectCollPhCand cand)

Add a TSM candidate to the Sect Coll, ifs is first/second track flag.

Definition at line 235 of file DTSC.cc.

References _incand_ph, and DTSectCollPhCand::isFirst().

                                      {

  _incand_ph[(1-cand->isFirst())].push_back(cand); 

}
void DTSC::addThCand ( DTSectCollThCand cand)

Add a Theta candidate to sect coll.

Definition at line 242 of file DTSC.cc.

References _cand_th.

Referenced by DTSectColl::addTSTheta().

                                      {

  _cand_th.push_back(cand); 

}
void DTSC::clear ( void  )

Clear.

Definition at line 67 of file DTSC.cc.

References _cand_th, _ignoreSecondTrack, _incand_ph, and _outcand_ph.

Referenced by DTSectColl::localClear(), and ~DTSC().

            {

  _ignoreSecondTrack=0;

  for(int itk=0;itk<=1;itk++){
 
    _incand_ph[itk].clear();
  }

  _outcand_ph.clear();
  _cand_th.clear();

}
void DTSC::clear ( )

Clear.

DTConfigSectColl* DTSC::config ( void  ) const [inline]

Configuration set.

Definition at line 87 of file DTSC.h.

References _config.

Referenced by DTSectCollPhCand::config(), DTSectCollThCand::config(), DTSectCollsort1(), and run().

{ return _config; }
DTConfigSectColl* DTSC::config ( void  ) const [inline]

Configuration set.

Definition at line 75 of file DTSCCand.h.

References _config.

{ return _config; }
DTTSCand* DTSC::DTSectCollsort1 ( )

Sort 1.

DTSectCollPhCand * DTSC::DTSectCollsort1 ( )

Phi Sort 1.

Definition at line 141 of file DTSC.cc.

References _incand_ph, _stat, begin, config(), AlCaHLTBitMon_ParallelJobs::p, DTSectCollPhCand::setBitsSectColl(), and DTSectCollPhCand::setSecondTrack().

Referenced by run().

                      {

  // Do a sort 1
  DTSectCollPhCand* best=0;
  DTSectCollPhCand* carry=0;
  std::vector<DTSectCollPhCand*>::iterator p;
  for(p=_incand_ph[0].begin(); p!=_incand_ph[0].end(); p++) {
    DTSectCollPhCand* curr=(*p);

    curr->setBitsSectColl();    // SM sector collector set bits in dataword to make SC sorting
    
    // NO Carry in Sector Collector sorting in default 
    if(config()->SCGetCarryFlag(_stat)) {  // get carry

      if(best==0){
        best=curr;
      } 
      else if((*curr)<(*best)){
        carry=best;
        best=curr;
      } 
      else if(carry==0){
        carry=curr;
      } 
      else if((*curr)<(*carry)){
        carry=curr;
      } 

    }
    else if(config()->SCGetCarryFlag(_stat)==0){ // no carry (default)
      if(best==0){
        best=curr;
      } 
      else if((*curr)<(*best)){
        
        best=curr;
      } 
      
    }
    
    if(carry!=0 && config()->SCGetCarryFlag(_stat)) { // reassign carry to sort 2 candidates
      carry->setSecondTrack(); // change value of 1st/2nd track bit
      _incand_ph[1].push_back(carry); // add to list of 2nd track
 
    }
  } 
  
  return best;

}
DTSectCollPhCand * DTSC::DTSectCollsort2 ( )

Phi Sort 2.

Definition at line 194 of file DTSC.cc.

References _ignoreSecondTrack, _incand_ph, begin, gather_cfg::cout, nTracksPh(), AlCaHLTBitMon_ParallelJobs::p, edm::second(), and DTSectCollPhCand::setBitsSectColl().

Referenced by run().

                      {

  // Check if there are second tracks

  if(nTracksPh()<1){
    std::cout << "DTSC::DTSectCollsort2: called with no first Phi track.";
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }
  // If a first track at the following BX is present, ignore second tracks of any kind
  if(_ignoreSecondTrack){

    for(std::vector<DTSectCollPhCand*>::iterator p=_incand_ph[1].begin(); p!=_incand_ph[1].end(); p++) {

    }
    return 0;
  }

  // If no first tracks at the following BX, do a sort 2
  //  DTSectCollCand* best=getTrack(1);  ! not needed as lons as there is no comparison with best in sort 2
  DTSectCollPhCand* second=0;
  std::vector<DTSectCollPhCand*>::iterator p;
  for(p=_incand_ph[1].begin(); p!=_incand_ph[1].end(); p++) {
    DTSectCollPhCand* curr=(*p);
    curr->setBitsSectColl();    // SM sector collector set bits in dataword to make SC sorting
    
    if(second==0){
      second=curr;
    } 
    else if((*curr)<(*second)){
      second=curr;
    } 
    
  }

  return second;

}
DTTSCand* DTSC::DTSectCollsort2 ( )

Sort 2.

DTSectCollPhCand * DTSC::getDTSectCollPhCand ( int  ifs,
unsigned  n 
) const

Return requested TSS candidate.

Definition at line 270 of file DTSC.cc.

References _incand_ph, gather_cfg::cout, n, nCandPh(), and AlCaHLTBitMon_ParallelJobs::p.

                                                   {

  if(ifs<1||ifs>2){
    std::cout << "DTSC::getDTSectCollPhCand: wrong track number: " << ifs;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }
  if(n<1 || n>nCandPh(ifs)) {
    std::cout << "DTSC::getDTSectCollPhCand: requested trigger not present: " << n;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }

  std::vector<DTSectCollPhCand*>::const_iterator p = _incand_ph[ifs-1].begin()+n-1;
  return (*p);

}
DTSectCollThCand * DTSC::getDTSectCollThCand ( unsigned  n) const

Return requested Theta candidate.

Definition at line 289 of file DTSC.cc.

References _cand_th, gather_cfg::cout, n, nCandTh(), and AlCaHLTBitMon_ParallelJobs::p.

                                          {

  if(n<1 || n>nCandTh()) {
    std::cout << "DTSC::getDTSectCollThCand: requested trigger not present: " << n;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }

  std::vector<DTSectCollThCand*>::const_iterator p = _cand_th.begin()+n-1;
  return (*p);

}
DTTSCand* DTSC::getDTTSCand ( int  ifs,
unsigned  n 
) const

Return requested TSS candidate.

DTTSCand* DTSC::getTrack ( int  n) const

Return the requested track.

DTSectCollPhCand * DTSC::getTrackPh ( int  n) const

Return the requested Phi track.

Definition at line 312 of file DTSC.cc.

References _outcand_ph, gather_cfg::cout, n, nTracksPh(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by DTSectColl::runSectColl().

                            {

  if(n<1 || n>nTracksPh()) {
    std::cout << "DTSC::getTrackPh: requested track not present: " << n;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }

  std::vector<DTSectCollPhCand*>::const_iterator p = _outcand_ph.begin()+n-1;

  return (*p);

}
DTSectCollThCand * DTSC::getTrackTh ( int  n) const

Return the requested Theta track.

Definition at line 328 of file DTSC.cc.

References _cand_th, gather_cfg::cout, n, nTracksTh(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by DTSectColl::runSectColl().

                            {

  if(n<1 || n>nTracksTh()) {
    std::cout << "DTSC::getTrackTh: requested track not present: " << n;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }

  std::vector<DTSectCollThCand*>::const_iterator p = _cand_th.begin()+n-1;

  return (*p);

}
const DTTracoTrigData* DTSC::getTracoT ( int  ifs,
unsigned  n 
) const

Return requested TRACO trigger.

void DTSC::ignoreSecondTrack ( ) [inline]

Set a flag to skip sort2.

Definition at line 70 of file DTSC.h.

References _ignoreSecondTrack.

void DTSC::ignoreSecondTrack ( ) [inline]

Set a flag to skip sort2.

Definition at line 58 of file DTSCCand.h.

References _ignoreSecondTrack.

unsigned DTSC::nCand ( int  ifs) const

Return the number of input tracks (first/second)

unsigned DTSC::nCandPh ( int  ifs) const

Return the number of Phi input tracks (first/second)

Definition at line 250 of file DTSC.cc.

References _incand_ph, and gather_cfg::cout.

Referenced by getDTSectCollPhCand().

                           {

  if(ifs<1||ifs>2){
    std::cout << "DTSC::nCandPh: wrong track number: " << ifs;
    std::cout << " 0 returned!" << std::endl;
    return 0;
  }
  return _incand_ph[ifs-1].size();

}
unsigned DTSC::nCandTh ( ) const

Return the number of Theta input tracks.

Definition at line 262 of file DTSC.cc.

References _cand_th.

Referenced by getDTSectCollThCand(), and run().

                    {

  return _cand_th.size();

}
int DTSC::nFirstT ( ) const [inline]

Return the number of input first tracks.

Definition at line 81 of file DTSCCand.h.

References _incand.

{ return _incand[0].size(); }
int DTSC::nFirstTPh ( ) const [inline]

Return the number of input first tracks.

Definition at line 96 of file DTSC.h.

References _incand_ph.

Referenced by run().

{ return _incand_ph[0].size(); }
int DTSC::nSecondT ( ) const [inline]

Return the number of input second tracks.

Definition at line 84 of file DTSCCand.h.

References _incand.

{ return _incand[1].size(); }
int DTSC::nSecondTPh ( ) const [inline]

Return the number of input second tracks.

Definition at line 99 of file DTSC.h.

References _incand_ph.

Referenced by run().

{ return _incand_ph[1].size(); }
int DTSC::nTracks ( ) const [inline]

Return the number of sorted tracks.

Definition at line 93 of file DTSCCand.h.

References _outcand.

{ return _outcand.size(); }
int DTSC::nTracksPh ( ) const [inline]

Return the number of output Phi tracks.

Definition at line 108 of file DTSC.h.

References _outcand_ph.

Referenced by DTSectCollsort2(), and getTrackPh().

{ return _outcand_ph.size(); }
int DTSC::nTracksTh ( ) const [inline]

Return the number of output Theta tracks.

Definition at line 111 of file DTSC.h.

References _cand_th.

Referenced by getTrackTh().

{ return _cand_th.size(); }
void DTSC::run ( void  )

Run the Sector Collector algorithm.

Definition at line 84 of file DTSC.cc.

References _incand_ph, _outcand_ph, begin, config(), gather_cfg::cout, debug, DTSectCollsort1(), DTSectCollsort2(), first, nCandTh(), nFirstTPh(), nSecondTPh(), AlCaHLTBitMon_ParallelJobs::p, and edm::second().

Referenced by DTSectColl::runSectColl().

          {

  if(config()->debug()){
    std::cout << "DTSC::run: Processing DTSectColl: ";
    std::cout << nFirstTPh() << " first & " << nSecondTPh() << " second Phi tracks ";
    std::cout << " - "<< nCandTh() << " Theta tracks" << std::endl;
  
  }

  if(nFirstTPh()<1)return; // skip if no first tracks
  //
  // SORT 1
  //

  // debugging
    if(config()->debug()){
     std::cout << "Vector of first Phi tracks in DTSectColl: " << std::endl;
    std::vector<DTSectCollPhCand*>::const_iterator p;
    for(p=_incand_ph[0].begin(); p!=_incand_ph[0].end(); p++) {
           (*p)->print();
    }
   }
  // end debugging
 
  DTSectCollPhCand* first=DTSectCollsort1();
  if(config()->debug()){
    std::cout << "SC: DTSC::run: first Phi track is = " << first << std::endl;
  }
  if(first!=0) {
    _outcand_ph.push_back(first); 

  }
  if(nSecondTPh()<1)return; // skip if no second tracks

  //
  // SORT 2
  //

  // debugging
  if(config()->debug()){
    std::vector<DTSectCollPhCand*>::const_iterator p;
    std::cout << "Vector of second Phi tracks in DTSectColl: " << std::endl;
    for(p=_incand_ph[1].begin(); p!=_incand_ph[1].end(); p++) {
       (*p)->print();
    }
  }
  // end debugging

  DTSectCollPhCand* second=DTSectCollsort2();
  if(second!=0) {
    _outcand_ph.push_back(second); 
  }
  
}
void DTSC::run ( )

Run the Sector Collector algorithm.

void DTSC::setConfig ( DTConfigSectColl conf) [inline]

Set configuration.

Definition at line 56 of file DTSC.h.

References _config, and dbtoconf::conf.

Referenced by DTSectColl::setConfig().

{ _config=conf; };

Member Data Documentation

std::vector<DTSectCollThCand*> DTSC::_cand_th [private]

Definition at line 131 of file DTSC.h.

Referenced by addThCand(), clear(), getDTSectCollThCand(), getTrackTh(), nCandTh(), and nTracksTh().

Definition at line 122 of file DTSC.h.

Referenced by config(), and setConfig().

int DTSC::_ignoreSecondTrack [private]

Definition at line 134 of file DTSC.h.

Referenced by clear(), DTSectCollsort2(), and ignoreSecondTrack().

std::vector<DTTSCand*> DTSC::_incand[2] [private]

Definition at line 105 of file DTSCCand.h.

Referenced by nFirstT(), and nSecondT().

std::vector<DTSectCollPhCand*> DTSC::_incand_ph[2] [private]
std::vector<DTTSCand*> DTSC::_outcand [private]

Definition at line 108 of file DTSCCand.h.

Referenced by nTracks().

std::vector<DTSectCollPhCand*> DTSC::_outcand_ph [private]

Definition at line 128 of file DTSC.h.

Referenced by clear(), getTrackPh(), nTracksPh(), and run().

int DTSC::_stat [private]

Definition at line 137 of file DTSC.h.

Referenced by DTSectCollsort1().