CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTTSPhi Class Reference

#include <DTTSPhi.h>

Inheritance diagram for DTTSPhi:
DTCache< T, Coll > DTGeomSupplier

List of all members.

Public Member Functions

DTConfigTSPhiconfig () const
 Return the configuration class.
 DTTSPhi (DTTrigGeom *, DTTracoCard *)
 Constructor.
LocalVector localDirection (const DTTrigData *) const
 Local direction in chamber of a trigger-data object.
LocalPoint localPosition (const DTTrigData *) const
 Local position in chamber of a trigger-data object.
int nSegm (int step)
 Return number of DTTSPhi segments.
virtual void reconstruct ()
 Load TRACO triggers and run TSPhi algorithm.
const DTChambPhSegmsegment (int step, unsigned n)
 Return the requested DTTSPhi segment.
void setConfig (const DTConfigManager *conf)
 Set configuration.
 ~DTTSPhi ()
 Destructor.

Private Member Functions

void addTracoT (int step, const DTTracoTrigData *tracotrig, int ifs)
 Add a DTTracoChip trigger to the DTTSPhi, ifs is track number (first or second)
DTTSMgetDTTSM (int step, unsigned n) const
DTTSSgetDTTSS (int step, unsigned n) const
void ignoreSecondTrack (int step, int tracon)
 Set a flag to ignore second tracks (if first track at following BX)
void loadTSPhi ()
 store DTTracoChip triggers in the DTTSS's
void localClear ()
 Clear.
void runTSPhi ()
 run DTTSPhi algorithm (DTTSS+DTTSM)

Private Attributes

DTConfigTSPhi_config
std::vector< DTTSCand * > _tctrig [DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1]
DTTracoCard_tracocard
std::vector< DTTSM * > _tsm [DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1]
std::vector< DTTSS * > _tss [DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1]

Detailed Description

Implementation of TS Phi trigger algorithm

Date:
2008/09/05 15:59:57
Revision:
1.7
Author:
C. Grandi, D. Bonacorsi, S. Marcellini

Definition at line 55 of file DTTSPhi.h.


Constructor & Destructor Documentation

DTTSPhi::DTTSPhi ( DTTrigGeom geom,
DTTracoCard tracocard 
)

Constructor.

Definition at line 44 of file DTTSPhi.cc.

References _tsm, _tss, i, DTConfig::NSTEPF, DTConfig::NSTEPL, DTConfigTSPhi::NTSMD, and DTConfigTSPhi::NTSSTSM.

                                                         : 
  DTGeomSupplier(geom), _tracocard(tracocard){

  // reserve the appropriate amount of space for vectors
  int i=0;
  for(i=0;i<DTConfigTSPhi::NSTEPL - DTConfigTSPhi::NSTEPF + 1 ;i++) {  // SM add + 1
    _tss[i].reserve(DTConfigTSPhi::NTSSTSM);
    // DBSM-doubleTSM
    _tsm[i].reserve(DTConfigTSPhi::NTSMD);
  }

  for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++) {

    // create DTTSSs  
    for(int itss=1; itss<=DTConfigTSPhi::NTSSTSM; itss++) {
      DTTSS* tss = new DTTSS(itss);
      _tss[is].push_back(tss);
    }

    // create DTTSMs     SM double TSM  
    for(int itsmd=1; itsmd<=DTConfigTSPhi::NTSMD; itsmd++) {
      DTTSM* tsm = new DTTSM(itsmd);
      _tsm[is].push_back(tsm);
    }
  }
}
DTTSPhi::~DTTSPhi ( )

Destructor.

Definition at line 75 of file DTTSPhi.cc.

References _tsm, _tss, DTCache< T, Coll >::begin(), localClear(), DTConfig::NSTEPF, and DTConfig::NSTEPL.

                 {

  std::vector<DTTSS*>::iterator ptss;
  std::vector<DTTSM*>::iterator ptsm;
  for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++){
    // clear TSSs
    for (ptss = _tss[is].begin(); ptss != _tss[is].end(); ptss++){
      delete (*ptss);
    }
    _tss[is].clear();
    // clear TSMs
    for (ptsm = _tsm[is].begin(); ptsm != _tsm[is].end(); ptsm++){
      delete (*ptsm);
    }
    _tsm[is].clear();

  }
  
  localClear();
  
  //delete _config;

}

Member Function Documentation

void DTTSPhi::addTracoT ( int  step,
const DTTracoTrigData tracotrig,
int  ifs 
) [private]

Add a DTTracoChip trigger to the DTTSPhi, ifs is track number (first or second)

Definition at line 181 of file DTTSPhi.cc.

References _tctrig, DTTSS::addDTTSCand(), DTTracoTrigData::code(), config(), gather_cfg::cout, debug, getDTTSS(), DTConfig::NSTEPF, DTConfig::NSTEPL, DTConfig::NTCTSS, DTConfigTSPhi::NTSSTSM, DTTSS::number(), pos, DTTracoTrigData::print(), DTTracoTrigData::pvCode(), launcher::step, and DTTracoTrigData::tracoNumber().

Referenced by loadTSPhi().

                                                                      {
  if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
    std::cout << "DTTSPhi::addTracoT: step out of range: " << step;
    std::cout << " trigger not added!" << std::endl;
    return;
  }
  // Check that a preview is present and code is not zero
  if(!tracotrig->pvCode() || !tracotrig->code() ) {
    std::cout << "DTTSPhi::addTracoT: preview not present in TRACO trigger or its code=0 ";
    std::cout << " trigger not added!" << std::endl;
    return;
  }
  
  // Get the appropriate TSS
  int itss = (tracotrig->tracoNumber() -1 ) / DTConfigTSPhi::NTCTSS + 1;
  if(itss<1 || itss>DTConfigTSPhi::NTSSTSM) {
    std::cout << "DTTSPhi::addTracoT: wrong TRACO number: ";
    std::cout << tracotrig->tracoNumber();
    std::cout << " trigger not added!" << std::endl;
    return;
  }
  
  // TSM status check (if it is the case, reject TRACO triggers related to broken TSMData)
  if( config()->TsmStatus().element(itss)==0){      // TSMD broken
    return;
  }

  int pos = tracotrig->tracoNumber() - (itss-1)*DTConfigTSPhi::NTCTSS;
  DTTSS* tss = getDTTSS(step,itss);
  
  // Create a new Trigger Server candidate
  DTTSCand* cand = new DTTSCand(tss, tracotrig, ifs, pos);
  
  // Add it to the buffer and to the TSS  
  _tctrig[step-DTConfigTSPhi::NSTEPF].push_back(cand);
  tss->addDTTSCand(cand);

  // Debugging...
  if(config()->debug()){
    std::cout << "DTTSPhi::addTracoT at step " << step;
    if(ifs==1) {
      std::cout << " (first track)";
    } else {
      std::cout << " (second track)";
    }
    std::cout << " from TRACO " << tracotrig->tracoNumber();
    std::cout << " to TSS " << tss->number() << ", position=" << pos << std::endl;
    tracotrig->print();
  }
  // end debugging

}
DTConfigTSPhi* DTTSPhi::config ( void  ) const [inline]

Return the configuration class.

Definition at line 66 of file DTTSPhi.h.

References _config.

Referenced by addTracoT(), ignoreSecondTrack(), loadTSPhi(), runTSPhi(), and setConfig().

{return _config; }
DTTSM * DTTSPhi::getDTTSM ( int  step,
unsigned  n 
) const [private]

Definition at line 481 of file DTTSPhi.cc.

References _tsm, gather_cfg::cout, n, DTConfig::NSTEPF, DTConfig::NSTEPL, DTCache< T, Coll >::size(), and launcher::step.

Referenced by ignoreSecondTrack(), and runTSPhi().

                                            {
  if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
    std::cout << "DTTSPhi::getDTTSM: step out of range: " << step;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }
  if(n<1 || n>_tsm[step-DTConfigTSPhi::NSTEPF].size()){
    std::cout << "DTTSPhi::getDTTSM: requested DTTSM not present: " << n;
    std::cout << " (at step " << step << ")";
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }
  std::vector<DTTSM*>::const_iterator p_tsm = _tsm[step-DTConfigTSPhi::NSTEPF].begin()+n-1;
  return *p_tsm;
}
DTTSS * DTTSPhi::getDTTSS ( int  step,
unsigned  n 
) const [private]

Definition at line 460 of file DTTSPhi.cc.

References _tss, gather_cfg::cout, n, DTConfig::NSTEPF, DTConfig::NSTEPL, AlCaHLTBitMon_ParallelJobs::p, DTCache< T, Coll >::size(), and launcher::step.

Referenced by addTracoT(), and ignoreSecondTrack().

                                            {
  if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
    std::cout << "DTTSPhi::getDTTSS: step out of range: " << step;
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }
  if(n<1 || n>_tss[step-DTConfigTSPhi::NSTEPF].size()){
    std::cout << "DTTSPhi::getDTTSS: requested DTTSS not present: " << n;
    std::cout << " (at step " << step << ")";
    std::cout << " empty pointer returned!" << std::endl;
    return 0;
  }
  
  std::vector<DTTSS*>::const_iterator p = _tss[step-DTConfigTSPhi::NSTEPF].begin()+n-1;
  return *p;
  
  
}
void DTTSPhi::ignoreSecondTrack ( int  step,
int  tracon 
) [private]

Set a flag to ignore second tracks (if first track at following BX)

Definition at line 428 of file DTTSPhi.cc.

References config(), gather_cfg::cout, BitArray< N >::element(), getDTTSM(), getDTTSS(), DTTSM::ignoreSecondTrack(), DTTSS::ignoreSecondTrack(), DTConfig::NSTEPL, DTConfig::NTCTSS, DTConfigTSPhi::NTSSTSM, DTGeomSupplier::sector(), DTGeomSupplier::station(), launcher::step, DTConfigTSPhi::TsmStatus(), and DTConfigTSPhi::TSSinTSMD().

Referenced by loadTSPhi().

                                               {
  
  int itsmd = 1; // initialize it to default
  
  if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
    std::cout << "DTTSPhi::ignoreSecondTrack: step out of range: " << step;
    std::cout << " no flag set!" << std::endl;
    return;
  }
  int itss = (tracon-1 ) / DTConfigTSPhi::NTCTSS + 1;
  if(itss<1 || itss>DTConfigTSPhi::NTSSTSM) {
    std::cout << "DTTSPhi::ignoreSecondTrack: wrong TRACO number: " << tracon;
    std::cout << " no flag set!" << std::endl;
    return;
  }
  DTTSS* tss = getDTTSS(step,itss);
  tss->ignoreSecondTrack();
  
  int bkmod = config()->TsmStatus().element(0);
  if (bkmod==0) {  // we are in back-up mode
    
    int ntsstsmd = config()->TSSinTSMD(station(),sector());
    // Get the appropriate TSMD
    itsmd = (itss -1 ) / ntsstsmd + 1;
    
  } 
  
  DTTSM* tsm = getDTTSM(step,itsmd);
  tsm->ignoreSecondTrack();
}
void DTTSPhi::loadTSPhi ( ) [private]

store DTTracoChip triggers in the DTTSS's

Definition at line 150 of file DTTSPhi.cc.

References _tracocard, addTracoT(), DTCache< T, Coll >::begin(), config(), gather_cfg::cout, debug, DTCache< T, Coll >::end(), ignoreSecondTrack(), localClear(), DTConfig::NSTEPF, AlCaHLTBitMon_ParallelJobs::p, DTGeomSupplier::sector(), DTGeomSupplier::station(), launcher::step, DTConfigTSPhi::usedTraco(), and DTGeomSupplier::wheel().

Referenced by reconstruct().

                   {

  // clear DTTSSs and DTTSM 
  localClear();
  
  if(config()->debug()){
    std::cout << "DTTSPhi::loadDTTSPhi called for wheel=" << wheel() ;
    std::cout <<                                ", station=" << station();
    std::cout <<                                ", sector="  << sector() << std::endl;
  }
  
  // loop on all TRACO triggers
  std::vector<DTTracoTrigData>::const_iterator p;
  std::vector<DTTracoTrigData>::const_iterator pend=_tracocard->end();
  for(p=_tracocard->begin();p!=pend;p++){

    if(config()->usedTraco(p->tracoNumber()) /*|| config()->usedTraco(p->tracoNumber())==1*/ ) {
      int step = p->step();
      int fs = (p->isFirst()) ? 1 : 2 ;
            
      // if first track is found inhibit second track processing in previous BX
      if( fs==1 && step>DTConfigTSPhi::NSTEPF)
        ignoreSecondTrack(step-1,p->tracoNumber());
      
      // load trigger
      addTracoT( step, &(*p), fs );   
    }
  }
}
void DTTSPhi::localClear ( ) [private]

Clear.

Definition at line 105 of file DTTSPhi.cc.

References _tctrig, _tsm, _tss, DTCache< T, Coll >::begin(), DTConfig::NSTEPF, DTConfig::NSTEPL, and p1.

Referenced by loadTSPhi(), and ~DTTSPhi().

                    {
  for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++) {
    // clear buffer
    std::vector<DTTSCand*>::iterator p1;
    for(p1 = _tctrig[is].begin(); p1 != _tctrig[is].end(); p1++) {
      delete (*p1);
    }
    _tctrig[is].clear();
    
    std::vector<DTTSS*>::iterator ptss;
    for(ptss = _tss[is].begin(); ptss != _tss[is].end(); ptss++) {
      (*ptss)->clear();
    }
    // clear all DTTSM
    std::vector<DTTSM*>::iterator ptsm;
    for(ptsm = _tsm[is].begin(); ptsm != _tsm[is].end(); ptsm++) {
      (*ptsm)->clear();
    }
  }
}
LocalVector DTTSPhi::localDirection ( const DTTrigData tr) const [virtual]

Local direction in chamber of a trigger-data object.

Implements DTGeomSupplier.

Definition at line 532 of file DTTSPhi.cc.

References _tracocard, gather_cfg::cout, DTTracoCard::localDirection(), and DTChambPhSegm::tracoTrig().

                                                   {
  DTChambPhSegm* trig = dynamic_cast<DTChambPhSegm*>(const_cast<DTTrigData*>(tr));
  //  const DTChambPhSegm* trig = dynamic_cast<const DTChambPhSegm*>(tr);
  if(!trig) {
    std::cout << "DTTSPhi::LocalDirection called with wrong argument!" << std::endl;
    return LocalVector(0,0,0);
  }
    return _tracocard->localDirection(trig->tracoTrig());
}
LocalPoint DTTSPhi::localPosition ( const DTTrigData tr) const [virtual]

Local position in chamber of a trigger-data object.

Implements DTGeomSupplier.

Definition at line 520 of file DTTSPhi.cc.

References _tracocard, gather_cfg::cout, DTTracoCard::localPosition(), and DTChambPhSegm::tracoTrig().

                                                 {
  //@@ patch for Sun 4.2 compiler
  //sm DTChambPhSegm* trig = dynamic_cast<DTChambPhSegm*>(const_cast<DTTrigData*>(tr));
    const DTChambPhSegm* trig = dynamic_cast<const DTChambPhSegm*>(tr);
  if(!trig) {
    std::cout << "DTTSPhi::LocalPosition called with wrong argument!" << std::endl;
    return LocalPoint(0,0,0);
  }
     return _tracocard->localPosition(trig->tracoTrig());
}
int DTTSPhi::nSegm ( int  step)

Return number of DTTSPhi segments.

Definition at line 500 of file DTTSPhi.cc.

References DTCache< T, Coll >::begin(), DTCache< T, Coll >::end(), n, AlCaHLTBitMon_ParallelJobs::p, and launcher::step.

Referenced by DTSCTrigUnit::nPhiSegm().

                       {
  int n=0;
  std::vector<DTChambPhSegm>::const_iterator p; //p=0;
  for(p=begin(); p<end(); p++) {
    if(p->step()==step)n++;
  }
  return n;
}
virtual void DTTSPhi::reconstruct ( ) [inline, virtual]

Load TRACO triggers and run TSPhi algorithm.

Reimplemented from DTCache< T, Coll >.

Definition at line 84 of file DTTSPhi.h.

References loadTSPhi(), and runTSPhi().

Referenced by DTTrig::triggerReco().

{ loadTSPhi(); runTSPhi(); }
void DTTSPhi::runTSPhi ( ) [private]

run DTTSPhi algorithm (DTTSS+DTTSM)

Definition at line 235 of file DTTSPhi.cc.

References DTCache< T, Coll >::_cache, _tsm, _tss, DTTSM::addCand(), DTCache< T, Coll >::begin(), DTGeomSupplier::ChamberId(), DTTracoTrigData::code(), config(), gather_cfg::cout, DTConfigTSPhi::debug(), BitArray< N >::element(), first, getDTTSM(), DTTSCand::isCorr(), DTTSCand::isHtrig(), DTTSCand::isInner(), DTConfig::NSTEPF, DTConfig::NSTEPL, DTConfigTSPhi::NTSMD, DTConfigTSPhi::NTSSTSMD, AlCaHLTBitMon_ParallelJobs::p, DTGeomSupplier::sector(), DTGeomSupplier::station(), DTTSCand::tracoTr(), DTConfigTSPhi::TsmGetCarryFlag(), DTConfigTSPhi::TsmStatus(), and DTConfigTSPhi::TSSinTSMD().

Referenced by reconstruct().

                  {

  DTTSCand* secondPrevBx = 0;    // new DTTSCand;

  bool existSecondPrevBx = false;
  int itsmd = 1;  // initialize it to 1, default value if not in back up mode
  int ntsm[DTConfigTSPhi::NSTEPL+1-DTConfigTSPhi::NSTEPF][DTConfigTSPhi::NTSMD];  
  int i_tsmd;
  
  for(int is=DTConfigTSPhi::NSTEPF;is<DTConfigTSPhi::NSTEPL+1;is++) {
    // loop on DTTSSs
    int ntss = 0;
    i_tsmd = 0;
    ntsm[is-DTConfigTSPhi::NSTEPF][0] = 0; // counter to make sector collector run if at least a tsm 
    ntsm[is-DTConfigTSPhi::NSTEPF][1] = 0;
    std::vector<DTTSS*>::iterator p;
    for(p=_tss[is-DTConfigTSPhi::NSTEPF].begin(); 
        p<_tss[is-DTConfigTSPhi::NSTEPF].end(); p++) {
      if((*p)->nTracoT(1)>0) {
        // run DTTSS algorithm on non-empty DTTSSs
        (*p)->run();
        // load DTTSM with output DTTSS tracks
        if((*p)->nTracks()>0){
          for(int it=1;it<=(*p)->nTracks();it++){
            //--- SM double TSM    get the corresponding tsm data 
            int bkmod = config()->TsmStatus().element(0);
            if (bkmod==0) {    // we are in back-up mode
              int my_itss = (*p)->number();   // metodo di DTTSS che ritorna itss
              int ntsstsmd = config()->TSSinTSMD(station(),sector());
              if(ntsstsmd<2 || ntsstsmd>DTConfigTSPhi::NTSSTSMD) {                 
                std::cout << " DTTSPhi::addTracoT - wrong TSMD: " << ntsstsmd << std::endl;
              }
  
              // Get the appropriate TSMD
              itsmd = (my_itss -1 ) / ntsstsmd + 1;
              if(config()->debug()){
                std::cout << " DTTSPhi::addTracoT: itsmd = (my_itss -1 ) / ntsstsmd + 1  ---> my_itss = " <<
                  my_itss << "  ntsstsmd = " << ntsstsmd << "  itsmd = " << itsmd << std::endl;}
            }
            else if(bkmod==1) {
              itsmd = 1;  // initialize it to 1, default value if not in back up mode
            }
            if(itsmd>2) std::cout << "****** >DTTSPhi::RunTSPhi wrong  itsmd = " << itsmd << std::endl; 
            DTTSM* tsm = getDTTSM(is,itsmd); 
            tsm->addCand((*p)->getTrack(it));
          }
          ntss++;
        } // end loop on output DTTSS tracks
      }
    } // end loop on DTTSSs
    
    
    // at least a DTTSS with signal. Run DTTSM
 
    std::vector<DTTSM*>::iterator p_tsm;
    
    for(p_tsm=_tsm[is-DTConfigTSPhi::NSTEPF].begin(); 
        p_tsm<_tsm[is-DTConfigTSPhi::NSTEPF].end(); p_tsm++) {
      
      // Run TSM sorting if at least a first track 

      i_tsmd = (*p_tsm)->number()-1; // returns itsmd (0 in default, 0 or 1 when bkmode )
      
      if((*p_tsm)->nCand(1)>0) {  
        int bkmod = config()->TsmStatus().element(0);

        (*p_tsm)->run(bkmod);   // bkmod 1 normal, 0 backup
        // Run TSM for current BX in case of 1st Tracks
        // Run TSM for previous BX for second tracks, to check whether there is a pile up
        // Tells whether a second track at previous BX exists
        
        if((*p_tsm)->nTracks()>0){
          // We have a first track. Store it if code is > 0
          
          if((*p_tsm)->getTrack(1)->tracoTr()->code()>0) {
            
            DTTSCand* first = (*p_tsm)->getTrack(1);
            if( config()->TsmGetCarryFlag()==0 ) {  //  get 1st tk at current BX and ignore any 2nd tk at previous BX
              
              _cache.push_back(DTChambPhSegm(ChamberId(),is,(*p_tsm)->getTrack(1)->tracoTr(),1));
              ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at current BX
              if( config()->debug())
                std::cout << "ntsm = " <<  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd] << " is = " << is << " i_tsmd = " << i_tsmd << std::endl; 
              if((*p_tsm)->nTracks()>1)   {  // there is a 2nd tk
                if((*p_tsm)->getTrack(2)->tracoTr()->code()>0) {   // check if its code > 0
                  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;
                  if( config()->debug())
                    std::cout << "ntsm = " <<  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd] << " is = " << is << " i_tsmd = " << i_tsmd << std::endl; 
                  
                  secondPrevBx=(*p_tsm)->getTrack(2) ;   // assign second tk of previous BX
                  
                }
              }
            }
            else if( config()->TsmGetCarryFlag()==1 ) {   // compare with 2nd tk in previous BX and get the tk with better quality
              existSecondPrevBx = ((is-1-DTConfigTSPhi::NSTEPF>=0) &&  ( ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]>1) &&   
                                   (secondPrevBx->tracoTr()->code()>0));                
              if( (!existSecondPrevBx)  || 
                  ! (   (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) ||             
                        (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && !secondPrevBx->isInner())  ||           
                        (!secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) )           ||
                  
                  ( (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) &&
                    (first->isCorr() && first->isHtrig() && first->isInner()) ) ||
                  
                  ( (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && !secondPrevBx->isInner()) &&
                    ( (first->isCorr() && first->isHtrig() && first->isInner()) || 
                      (first->isCorr() && first->isHtrig() && !first->isInner()) ) ) ||
                  
                  ( (!secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) && 
                    !( (!first->isCorr() && first->isHtrig() && !first->isInner())  || 
                       (!first->isCorr() && !first->isHtrig() && first->isInner())  ||
                       (!first->isCorr() && !first->isHtrig() && !first->isInner()) ||
                       (first->isCorr() && !first->isHtrig() && !first->isInner())  ||
                       (first->isCorr() && !first->isHtrig() && first->isInner()) ) )
                  ) {
                // SM sector collector
                ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at current BX. I need to know if there is at least a first track from TSM to run Sect Coll
                
                _cache.push_back(DTChambPhSegm(ChamberId(),is,(*p_tsm)->getTrack(1)->tracoTr(),1));
                //              (*p_tsm)->getTrack(1)->print();
                
                if((*p_tsm)->nTracks()>1)   {  // there is a 2nd tk
                  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;               
                  if((*p_tsm)->getTrack(2)->tracoTr()->code()>0) {   // check if its code > 0
                    secondPrevBx=(*p_tsm)->getTrack(2) ;   // assign second previous BX
                  }
                }
              }
              else   {      // if 2nd tk prev BX is better than first present BX skip the event and get 2nd prev BX 
                ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at previous BX.
                _cache.push_back(DTChambPhSegm(ChamberId(),is-1,secondPrevBx->tracoTr(),2));
                //secondPrevBx->print();
              }
            }
            
            else if( config()->TsmGetCarryFlag()==2 ) {  // neglect first tk if it is a low uncorrelated trigger
              existSecondPrevBx = ((is-1-DTConfigTSPhi::NSTEPF>=0) && (ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd] >1) && (secondPrevBx->tracoTr()->code()>0));
              if( (!existSecondPrevBx) || first->isHtrig() || first->isCorr()) {
                ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at current BX. 
                // SM sector collector: Load DTSectColl with output of DTTSM
                _cache.push_back(DTChambPhSegm(ChamberId(),is,(*p_tsm)->getTrack(1)->tracoTr(),1));
                //              (*p_tsm)->getTrack(1)->print();
                
                if((*p_tsm)->nTracks()>1)   {  // there is a 2nd tk
                  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;
                  if((*p_tsm)->getTrack(2)->tracoTr()->code()>0) {   // check if its code > 0
                    secondPrevBx=(*p_tsm)->getTrack(2) ;   // assign second tk of previous BX
                  }
                }
              }
              else {
                ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at previous BX. 
                _cache.push_back(DTChambPhSegm(ChamberId(),is-1,secondPrevBx->tracoTr(),2));
                //              secondPrevBx->print(); 
              }
            }
          }
        }


      }      
      else if ( ((*p_tsm)->nCand(1) == 0) && (is-1-DTConfigTSPhi::NSTEPF>=0) && ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd] > 0 ) {// it means that the last BX with sort 2 was not the previous one
        existSecondPrevBx = ((is-1-DTConfigTSPhi::NSTEPF>=0) && (ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]>1) && (secondPrevBx->tracoTr()->code()>0));
        if(existSecondPrevBx) {
          _cache.push_back(DTChambPhSegm(ChamberId(),is-1,secondPrevBx->tracoTr(),2));
          
          //      secondPrevBx->print();
        }
      }
    } 
      //---
    
  }   // end loop on step  
  // debugging...
  if(config()->debug()){
    if(_cache.size()>0){
      std::cout << "====================================================" << std::endl;
      std::cout << "                  Phi segments                     " << std::endl;
      std::vector<DTChambPhSegm>::const_iterator p;
      for(p=_cache.begin();p<_cache.end();p++) {
        p->print();
        
      }
      std::cout << "====================================================" << std::endl;
    }
  }
  //  end debugging
  
  
}
const DTChambPhSegm * DTTSPhi::segment ( int  step,
unsigned  n 
)

Return the requested DTTSPhi segment.

Definition at line 510 of file DTTSPhi.cc.

References DTCache< T, Coll >::begin(), DTCache< T, Coll >::end(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by DTSCTrigUnit::phiSegment().

                                     {
  std::vector<DTChambPhSegm>::const_iterator p; //p=0;
  for(p=begin();p<end();p++){
    if(p->step()==step&&((n==1&&p->isFirst())||(n==2&&!p->isFirst())))
      return  &(*p);// p;
  }
  return 0;
}
void DTTSPhi::setConfig ( const DTConfigManager conf)

Set configuration.

Definition at line 127 of file DTTSPhi.cc.

References _config, _tsm, _tss, DTCache< T, Coll >::begin(), DTGeomSupplier::ChamberId(), config(), DTConfigManager::getDTConfigTSPhi(), DTConfig::NSTEPF, DTConfig::NSTEPL, and evf::utils::sid.

Referenced by DTSCTrigUnit::setConfig().

                                              {

  DTChamberId sid = ChamberId();
  _config = conf->getDTConfigTSPhi(sid);

  for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++) {

    // set TSS config
    std::vector<DTTSS*>::iterator ptss;
    for (ptss = _tss[is].begin(); ptss != _tss[is].end(); ptss++){
      (*ptss)->setConfig(config());
    }
    // set TSM config
    std::vector<DTTSM*>::iterator ptsm;
    for (ptsm = _tsm[is].begin(); ptsm != _tsm[is].end(); ptsm++){
      (*ptsm)->setConfig(config());
    }

  }

}

Member Data Documentation

Definition at line 116 of file DTTSPhi.h.

Referenced by config(), and setConfig().

Definition at line 124 of file DTTSPhi.h.

Referenced by addTracoT(), and localClear().

Definition at line 114 of file DTTSPhi.h.

Referenced by loadTSPhi(), localDirection(), and localPosition().

Definition at line 121 of file DTTSPhi.h.

Referenced by DTTSPhi(), getDTTSM(), localClear(), runTSPhi(), setConfig(), and ~DTTSPhi().

Definition at line 119 of file DTTSPhi.h.

Referenced by DTTSPhi(), getDTTSS(), localClear(), runTSPhi(), setConfig(), and ~DTTSPhi().