CMS 3D CMS Logo

DTTSPhi Class Reference

Implementation of TS Phi trigger algorithm. More...

#include <L1Trigger/DTTriggerServerPhi/interface/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.

00044                                                          : 
00045   DTGeomSupplier(geom), _tracocard(tracocard){
00046 
00047   // reserve the appropriate amount of space for vectors
00048   int i=0;
00049   for(i=0;i<DTConfigTSPhi::NSTEPL - DTConfigTSPhi::NSTEPF + 1 ;i++) {  // SM add + 1
00050     _tss[i].reserve(DTConfigTSPhi::NTSSTSM);
00051     // DBSM-doubleTSM
00052     _tsm[i].reserve(DTConfigTSPhi::NTSMD);
00053   }
00054 
00055   for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++) {
00056 
00057     // create DTTSSs  
00058     for(int itss=1; itss<=DTConfigTSPhi::NTSSTSM; itss++) {
00059       DTTSS* tss = new DTTSS(itss);
00060       _tss[is].push_back(tss);
00061     }
00062 
00063     // create DTTSMs     SM double TSM  
00064     for(int itsmd=1; itsmd<=DTConfigTSPhi::NTSMD; itsmd++) {
00065       DTTSM* tsm = new DTTSM(itsmd);
00066       _tsm[is].push_back(tsm);
00067     }
00068   }
00069 }

DTTSPhi::~DTTSPhi (  ) 

Destructor.

Definition at line 75 of file DTTSPhi.cc.

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

00075                  {
00076 
00077   std::vector<DTTSS*>::iterator ptss;
00078   std::vector<DTTSM*>::iterator ptsm;
00079   for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++){
00080     // clear TSSs
00081     for (ptss = _tss[is].begin(); ptss != _tss[is].end(); ptss++){
00082       delete (*ptss);
00083     }
00084     _tss[is].clear();
00085     // clear TSMs
00086     for (ptsm = _tsm[is].begin(); ptsm != _tsm[is].end(); ptsm++){
00087       delete (*ptsm);
00088     }
00089     _tsm[is].clear();
00090 
00091   }
00092   
00093   localClear();
00094   
00095   //delete _config;
00096 
00097 }


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(), GenMuonPlsPt100GeV_cfg::cout, debug, element(), lat::endl(), getDTTSS(), DTConfig::NSTEPF, DTConfig::NSTEPL, DTConfig::NTCTSS, DTConfigTSPhi::NTSSTSM, DTTSS::number(), DTTracoTrigData::print(), DTTracoTrigData::pvCode(), and DTTracoTrigData::tracoNumber().

Referenced by loadTSPhi().

00181                                                                       {
00182   if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
00183     std::cout << "DTTSPhi::addTracoT: step out of range: " << step;
00184     std::cout << " trigger not added!" << std::endl;
00185     return;
00186   }
00187   // Check that a preview is present and code is not zero
00188   if(!tracotrig->pvCode() || !tracotrig->code() ) {
00189     std::cout << "DTTSPhi::addTracoT: preview not present in TRACO trigger or its code=0 ";
00190     std::cout << " trigger not added!" << std::endl;
00191     return;
00192   }
00193   
00194   // Get the appropriate TSS
00195   int itss = (tracotrig->tracoNumber() -1 ) / DTConfigTSPhi::NTCTSS + 1;
00196   if(itss<1 || itss>DTConfigTSPhi::NTSSTSM) {
00197     std::cout << "DTTSPhi::addTracoT: wrong TRACO number: ";
00198     std::cout << tracotrig->tracoNumber();
00199     std::cout << " trigger not added!" << std::endl;
00200     return;
00201   }
00202   
00203   // TSM status check (if it is the case, reject TRACO triggers related to broken TSMData)
00204   if( config()->TsmStatus().element(itss)==0){      // TSMD broken
00205     return;
00206   }
00207 
00208   int pos = tracotrig->tracoNumber() - (itss-1)*DTConfigTSPhi::NTCTSS;
00209   DTTSS* tss = getDTTSS(step,itss);
00210   
00211   // Create a new Trigger Server candidate
00212   DTTSCand* cand = new DTTSCand(tss, tracotrig, ifs, pos);
00213   
00214   // Add it to the buffer and to the TSS  
00215   _tctrig[step-DTConfigTSPhi::NSTEPF].push_back(cand);
00216   tss->addDTTSCand(cand);
00217 
00218   // Debugging...
00219   if(config()->debug()){
00220     std::cout << "DTTSPhi::addTracoT at step " << step;
00221     if(ifs==1) {
00222       std::cout << " (first track)";
00223     } else {
00224       std::cout << " (second track)";
00225     }
00226     std::cout << " from TRACO " << tracotrig->tracoNumber();
00227     std::cout << " to TSS " << tss->number() << ", position=" << pos << std::endl;
00228     tracotrig->print();
00229   }
00230   // end debugging
00231 
00232 }

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

Return the configuration class.

Definition at line 66 of file DTTSPhi.h.

References _config.

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

00066 {return _config; }

DTTSM * DTTSPhi::getDTTSM ( int  step,
unsigned  n 
) const [private]

Definition at line 481 of file DTTSPhi.cc.

References _tsm, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DTConfig::NSTEPF, DTConfig::NSTEPL, and DTCache< T, Coll >::size().

Referenced by ignoreSecondTrack(), and runTSPhi().

00481                                             {
00482   if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
00483     std::cout << "DTTSPhi::getDTTSM: step out of range: " << step;
00484     std::cout << " empty pointer returned!" << std::endl;
00485     return 0;
00486   }
00487   if(n<1 || n>_tsm[step-DTConfigTSPhi::NSTEPF].size()){
00488     std::cout << "DTTSPhi::getDTTSM: requested DTTSM not present: " << n;
00489     std::cout << " (at step " << step << ")";
00490     std::cout << " empty pointer returned!" << std::endl;
00491     return 0;
00492   }
00493   std::vector<DTTSM*>::const_iterator p_tsm = _tsm[step-DTConfigTSPhi::NSTEPF].begin()+n-1;
00494   return *p_tsm;
00495 }

DTTSS * DTTSPhi::getDTTSS ( int  step,
unsigned  n 
) const [private]

Definition at line 460 of file DTTSPhi.cc.

References _tss, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DTConfig::NSTEPF, DTConfig::NSTEPL, p, and DTCache< T, Coll >::size().

Referenced by addTracoT(), and ignoreSecondTrack().

00460                                             {
00461   if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
00462     std::cout << "DTTSPhi::getDTTSS: step out of range: " << step;
00463     std::cout << " empty pointer returned!" << std::endl;
00464     return 0;
00465   }
00466   if(n<1 || n>_tss[step-DTConfigTSPhi::NSTEPF].size()){
00467     std::cout << "DTTSPhi::getDTTSS: requested DTTSS not present: " << n;
00468     std::cout << " (at step " << step << ")";
00469     std::cout << " empty pointer returned!" << std::endl;
00470     return 0;
00471   }
00472   
00473   std::vector<DTTSS*>::const_iterator p = _tss[step-DTConfigTSPhi::NSTEPF].begin()+n-1;
00474   return *p;
00475   
00476   
00477 }

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(), GenMuonPlsPt100GeV_cfg::cout, BitArray< N >::element(), lat::endl(), getDTTSM(), getDTTSS(), DTTSM::ignoreSecondTrack(), DTTSS::ignoreSecondTrack(), DTConfig::NSTEPL, DTConfig::NTCTSS, DTConfigTSPhi::NTSSTSM, DTGeomSupplier::sector(), DTGeomSupplier::station(), DTConfigTSPhi::TsmStatus(), and DTConfigTSPhi::TSSinTSMD().

Referenced by loadTSPhi().

00428                                                {
00429   
00430   int itsmd = 1; // initialize it to default
00431   
00432   if(step<DTConfigTSPhi::NSTEPF||step>DTConfigTSPhi::NSTEPL){
00433     std::cout << "DTTSPhi::ignoreSecondTrack: step out of range: " << step;
00434     std::cout << " no flag set!" << std::endl;
00435     return;
00436   }
00437   int itss = (tracon-1 ) / DTConfigTSPhi::NTCTSS + 1;
00438   if(itss<1 || itss>DTConfigTSPhi::NTSSTSM) {
00439     std::cout << "DTTSPhi::ignoreSecondTrack: wrong TRACO number: " << tracon;
00440     std::cout << " no flag set!" << std::endl;
00441     return;
00442   }
00443   DTTSS* tss = getDTTSS(step,itss);
00444   tss->ignoreSecondTrack();
00445   
00446   int bkmod = config()->TsmStatus().element(0);
00447   if (bkmod==0) {  // we are in back-up mode
00448     
00449     int ntsstsmd = config()->TSSinTSMD(station(),sector());
00450     // Get the appropriate TSMD
00451     itsmd = (itss -1 ) / ntsstsmd + 1;
00452     
00453   } 
00454   
00455   DTTSM* tsm = getDTTSM(step,itsmd);
00456   tsm->ignoreSecondTrack();
00457 }

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(), GenMuonPlsPt100GeV_cfg::cout, debug, DTCache< T, Coll >::end(), lat::endl(), ignoreSecondTrack(), localClear(), DTConfig::NSTEPF, p, DTGeomSupplier::sector(), DTGeomSupplier::station(), cmsRelvalreportInput::step, DTConfigTSPhi::usedTraco(), and DTGeomSupplier::wheel().

Referenced by reconstruct().

00150                    {
00151 
00152   // clear DTTSSs and DTTSM 
00153   localClear();
00154   
00155   if(config()->debug()){
00156     std::cout << "DTTSPhi::loadDTTSPhi called for wheel=" << wheel() ;
00157     std::cout <<                                ", station=" << station();
00158     std::cout <<                                ", sector="  << sector() << std::endl;
00159   }
00160   
00161   // loop on all TRACO triggers
00162   std::vector<DTTracoTrigData>::const_iterator p;
00163   std::vector<DTTracoTrigData>::const_iterator pend=_tracocard->end();
00164   for(p=_tracocard->begin();p!=pend;p++){
00165 
00166     if(config()->usedTraco(p->tracoNumber()) /*|| config()->usedTraco(p->tracoNumber())==1*/ ) {
00167       int step = p->step();
00168       int fs = (p->isFirst()) ? 1 : 2 ;
00169             
00170       // if first track is found inhibit second track processing in previous BX
00171       if( fs==1 && step>DTConfigTSPhi::NSTEPF)
00172         ignoreSecondTrack(step-1,p->tracoNumber());
00173       
00174       // load trigger
00175       addTracoT( step, &(*p), fs );   
00176     }
00177   }
00178 }

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().

00105                     {
00106   for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++) {
00107     // clear buffer
00108     std::vector<DTTSCand*>::iterator p1;
00109     for(p1 = _tctrig[is].begin(); p1 != _tctrig[is].end(); p1++) {
00110       delete (*p1);
00111     }
00112     _tctrig[is].clear();
00113     
00114     std::vector<DTTSS*>::iterator ptss;
00115     for(ptss = _tss[is].begin(); ptss != _tss[is].end(); ptss++) {
00116       (*ptss)->clear();
00117     }
00118     // clear all DTTSM
00119     std::vector<DTTSM*>::iterator ptsm;
00120     for(ptsm = _tsm[is].begin(); ptsm != _tsm[is].end(); ptsm++) {
00121       (*ptsm)->clear();
00122     }
00123   }
00124 }

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, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DTTracoCard::localDirection(), and DTChambPhSegm::tracoTrig().

00532                                                    {
00533   DTChambPhSegm* trig = dynamic_cast<DTChambPhSegm*>(const_cast<DTTrigData*>(tr));
00534   //  const DTChambPhSegm* trig = dynamic_cast<const DTChambPhSegm*>(tr);
00535   if(!trig) {
00536     std::cout << "DTTSPhi::LocalDirection called with wrong argument!" << std::endl;
00537     return LocalVector(0,0,0);
00538   }
00539     return _tracocard->localDirection(trig->tracoTrig());
00540 }

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, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DTTracoCard::localPosition(), and DTChambPhSegm::tracoTrig().

00520                                                  {
00521   //@@ patch for Sun 4.2 compiler
00522   //sm DTChambPhSegm* trig = dynamic_cast<DTChambPhSegm*>(const_cast<DTTrigData*>(tr));
00523     const DTChambPhSegm* trig = dynamic_cast<const DTChambPhSegm*>(tr);
00524   if(!trig) {
00525     std::cout << "DTTSPhi::LocalPosition called with wrong argument!" << std::endl;
00526     return LocalPoint(0,0,0);
00527   }
00528      return _tracocard->localPosition(trig->tracoTrig());
00529 }

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, and p.

Referenced by DTSCTrigUnit::nPhiSegm().

00500                        {
00501   int n=0;
00502   std::vector<DTChambPhSegm>::const_iterator p; //p=0;
00503   for(p=begin(); p<end(); p++) {
00504     if(p->step()==step)n++;
00505   }
00506   return n;
00507 }

virtual void DTTSPhi::reconstruct ( void   )  [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().

00084 { 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(), GenMuonPlsPt100GeV_cfg::cout, DTConfigTSPhi::debug(), BitArray< N >::element(), lat::endl(), first, getDTTSM(), DTTSCand::isCorr(), DTTSCand::isHtrig(), DTTSCand::isInner(), it, DTConfig::NSTEPF, DTConfig::NSTEPL, DTConfigTSPhi::NTSMD, DTConfigTSPhi::NTSSTSMD, p, DTGeomSupplier::sector(), DTGeomSupplier::station(), DTTSCand::tracoTr(), DTConfigTSPhi::TsmGetCarryFlag(), DTConfigTSPhi::TsmStatus(), and DTConfigTSPhi::TSSinTSMD().

Referenced by reconstruct().

00235                   {
00236 
00237   DTTSCand* secondPrevBx = 0;    // new DTTSCand;
00238 
00239   bool existSecondPrevBx = false;
00240   int itsmd = 1;  // initialize it to 1, default value if not in back up mode
00241   int ntsm[DTConfigTSPhi::NSTEPL+1-DTConfigTSPhi::NSTEPF][DTConfigTSPhi::NTSMD];  
00242   int i_tsmd;
00243   
00244   for(int is=DTConfigTSPhi::NSTEPF;is<DTConfigTSPhi::NSTEPL+1;is++) {
00245     // loop on DTTSSs
00246     int ntss = 0;
00247     i_tsmd = 0;
00248     ntsm[is-DTConfigTSPhi::NSTEPF][0] = 0; // counter to make sector collector run if at least a tsm 
00249     ntsm[is-DTConfigTSPhi::NSTEPF][1] = 0;
00250     std::vector<DTTSS*>::iterator p;
00251     for(p=_tss[is-DTConfigTSPhi::NSTEPF].begin(); 
00252         p<_tss[is-DTConfigTSPhi::NSTEPF].end(); p++) {
00253       if((*p)->nTracoT(1)>0) {
00254         // run DTTSS algorithm on non-empty DTTSSs
00255         (*p)->run();
00256         // load DTTSM with output DTTSS tracks
00257         if((*p)->nTracks()>0){
00258           for(int it=1;it<=(*p)->nTracks();it++){
00259             //--- SM double TSM    get the corresponding tsm data 
00260             int bkmod = config()->TsmStatus().element(0);
00261             if (bkmod==0) {    // we are in back-up mode
00262               int my_itss = (*p)->number();   // metodo di DTTSS che ritorna itss
00263               int ntsstsmd = config()->TSSinTSMD(station(),sector());
00264               if(ntsstsmd<2 || ntsstsmd>DTConfigTSPhi::NTSSTSMD) {                 
00265                 std::cout << " DTTSPhi::addTracoT - wrong TSMD: " << ntsstsmd << std::endl;
00266               }
00267   
00268               // Get the appropriate TSMD
00269               itsmd = (my_itss -1 ) / ntsstsmd + 1;
00270               if(config()->debug()){
00271                 std::cout << " DTTSPhi::addTracoT: itsmd = (my_itss -1 ) / ntsstsmd + 1  ---> my_itss = " <<
00272                   my_itss << "  ntsstsmd = " << ntsstsmd << "  itsmd = " << itsmd << std::endl;}
00273             }
00274             else if(bkmod==1) {
00275               itsmd = 1;  // initialize it to 1, default value if not in back up mode
00276             }
00277             if(itsmd>2) std::cout << "****** >DTTSPhi::RunTSPhi wrong  itsmd = " << itsmd << std::endl; 
00278             DTTSM* tsm = getDTTSM(is,itsmd); 
00279             tsm->addCand((*p)->getTrack(it));
00280           }
00281           ntss++;
00282         } // end loop on output DTTSS tracks
00283       }
00284     } // end loop on DTTSSs
00285     
00286     
00287     // at least a DTTSS with signal. Run DTTSM
00288  
00289     std::vector<DTTSM*>::iterator p_tsm;
00290     
00291     for(p_tsm=_tsm[is-DTConfigTSPhi::NSTEPF].begin(); 
00292         p_tsm<_tsm[is-DTConfigTSPhi::NSTEPF].end(); p_tsm++) {
00293       
00294       // Run TSM sorting if at least a first track 
00295 
00296       i_tsmd = (*p_tsm)->number()-1; // returns itsmd (0 in default, 0 or 1 when bkmode )
00297       
00298       if((*p_tsm)->nCand(1)>0) {  
00299         int bkmod = config()->TsmStatus().element(0);
00300 
00301         (*p_tsm)->run(bkmod);   // bkmod 1 normal, 0 backup
00302         // Run TSM for current BX in case of 1st Tracks
00303         // Run TSM for previous BX for second tracks, to check whether there is a pile up
00304         // Tells whether a second track at previous BX exists
00305         
00306         if((*p_tsm)->nTracks()>0){
00307           // We have a first track. Store it if code is > 0
00308           
00309           if((*p_tsm)->getTrack(1)->tracoTr()->code()>0) {
00310             
00311             DTTSCand* first = (*p_tsm)->getTrack(1);
00312             if( config()->TsmGetCarryFlag()==0 ) {  //  get 1st tk at current BX and ignore any 2nd tk at previous BX
00313               
00314               _cache.push_back(DTChambPhSegm(ChamberId(),is,(*p_tsm)->getTrack(1)->tracoTr(),1));
00315               ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at current BX
00316               if( config()->debug())
00317                 std::cout << "ntsm = " <<  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd] << " is = " << is << " i_tsmd = " << i_tsmd << std::endl; 
00318               if((*p_tsm)->nTracks()>1)   {  // there is a 2nd tk
00319                 if((*p_tsm)->getTrack(2)->tracoTr()->code()>0) {   // check if its code > 0
00320                   ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;
00321                   if( config()->debug())
00322                     std::cout << "ntsm = " <<  ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd] << " is = " << is << " i_tsmd = " << i_tsmd << std::endl; 
00323                   
00324                   secondPrevBx=(*p_tsm)->getTrack(2) ;   // assign second tk of previous BX
00325                   
00326                 }
00327               }
00328             }
00329             else if( config()->TsmGetCarryFlag()==1 ) {   // compare with 2nd tk in previous BX and get the tk with better quality
00330               existSecondPrevBx = ((is-1-DTConfigTSPhi::NSTEPF>=0) &&  ( ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]>1) &&   
00331                                    (secondPrevBx->tracoTr()->code()>0));                
00332               if( (!existSecondPrevBx)  || 
00333                   ! (   (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) ||             
00334                         (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && !secondPrevBx->isInner())  ||           
00335                         (!secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) )           ||
00336                   
00337                   ( (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) &&
00338                     (first->isCorr() && first->isHtrig() && first->isInner()) ) ||
00339                   
00340                   ( (secondPrevBx->isCorr() && secondPrevBx->isHtrig() && !secondPrevBx->isInner()) &&
00341                     ( (first->isCorr() && first->isHtrig() && first->isInner()) || 
00342                       (first->isCorr() && first->isHtrig() && !first->isInner()) ) ) ||
00343                   
00344                   ( (!secondPrevBx->isCorr() && secondPrevBx->isHtrig() && secondPrevBx->isInner()) && 
00345                     !( (!first->isCorr() && first->isHtrig() && !first->isInner())  || 
00346                        (!first->isCorr() && !first->isHtrig() && first->isInner())  ||
00347                        (!first->isCorr() && !first->isHtrig() && !first->isInner()) ||
00348                        (first->isCorr() && !first->isHtrig() && !first->isInner())  ||
00349                        (first->isCorr() && !first->isHtrig() && first->isInner()) ) )
00350                   ) {
00351                 // SM sector collector
00352                 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
00353                 
00354                 _cache.push_back(DTChambPhSegm(ChamberId(),is,(*p_tsm)->getTrack(1)->tracoTr(),1));
00355                 //              (*p_tsm)->getTrack(1)->print();
00356                 
00357                 if((*p_tsm)->nTracks()>1)   {  // there is a 2nd tk
00358                   ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;               
00359                   if((*p_tsm)->getTrack(2)->tracoTr()->code()>0) {   // check if its code > 0
00360                     secondPrevBx=(*p_tsm)->getTrack(2) ;   // assign second previous BX
00361                   }
00362                 }
00363               }
00364               else   {      // if 2nd tk prev BX is better than first present BX skip the event and get 2nd prev BX 
00365                 ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at previous BX.
00366                 _cache.push_back(DTChambPhSegm(ChamberId(),is-1,secondPrevBx->tracoTr(),2));
00367                 //secondPrevBx->print();
00368               }
00369             }
00370             
00371             else if( config()->TsmGetCarryFlag()==2 ) {  // neglect first tk if it is a low uncorrelated trigger
00372               existSecondPrevBx = ((is-1-DTConfigTSPhi::NSTEPF>=0) && (ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd] >1) && (secondPrevBx->tracoTr()->code()>0));
00373               if( (!existSecondPrevBx) || first->isHtrig() || first->isCorr()) {
00374                 ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at current BX. 
00375                 // SM sector collector: Load DTSectColl with output of DTTSM
00376                 _cache.push_back(DTChambPhSegm(ChamberId(),is,(*p_tsm)->getTrack(1)->tracoTr(),1));
00377                 //              (*p_tsm)->getTrack(1)->print();
00378                 
00379                 if((*p_tsm)->nTracks()>1)   {  // there is a 2nd tk
00380                   ntsm[is-DTConfigTSPhi::NSTEPF][i_tsmd]++;
00381                   if((*p_tsm)->getTrack(2)->tracoTr()->code()>0) {   // check if its code > 0
00382                     secondPrevBx=(*p_tsm)->getTrack(2) ;   // assign second tk of previous BX
00383                   }
00384                 }
00385               }
00386               else {
00387                 ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]++;  // SM increment ntsm at previous BX. 
00388                 _cache.push_back(DTChambPhSegm(ChamberId(),is-1,secondPrevBx->tracoTr(),2));
00389                 //              secondPrevBx->print(); 
00390               }
00391             }
00392           }
00393         }
00394 
00395 
00396       }      
00397       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
00398         existSecondPrevBx = ((is-1-DTConfigTSPhi::NSTEPF>=0) && (ntsm[is-1-DTConfigTSPhi::NSTEPF][i_tsmd]>1) && (secondPrevBx->tracoTr()->code()>0));
00399         if(existSecondPrevBx) {
00400           _cache.push_back(DTChambPhSegm(ChamberId(),is-1,secondPrevBx->tracoTr(),2));
00401           
00402           //      secondPrevBx->print();
00403         }
00404       }
00405     } 
00406       //---
00407     
00408   }   // end loop on step  
00409   // debugging...
00410   if(config()->debug()){
00411     if(_cache.size()>0){
00412       std::cout << "====================================================" << std::endl;
00413       std::cout << "                  Phi segments                     " << std::endl;
00414       std::vector<DTChambPhSegm>::const_iterator p;
00415       for(p=_cache.begin();p<_cache.end();p++) {
00416         p->print();
00417         
00418       }
00419       std::cout << "====================================================" << std::endl;
00420     }
00421   }
00422   //  end debugging
00423   
00424   
00425 }

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 p.

Referenced by DTSCTrigUnit::phiSegment().

00510                                      {
00511   std::vector<DTChambPhSegm>::const_iterator p; //p=0;
00512   for(p=begin();p<end();p++){
00513     if(p->step()==step&&((n==1&&p->isFirst())||(n==2&&!p->isFirst())))
00514       return  &(*p);// p;
00515   }
00516   return 0;
00517 }

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, and DTConfig::NSTEPL.

Referenced by DTSCTrigUnit::setConfig().

00127                                               {
00128 
00129   DTChamberId sid = ChamberId();
00130   _config = conf->getDTConfigTSPhi(sid);
00131 
00132   for(int is=0;is<DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1;is++) {
00133 
00134     // set TSS config
00135     std::vector<DTTSS*>::iterator ptss;
00136     for (ptss = _tss[is].begin(); ptss != _tss[is].end(); ptss++){
00137       (*ptss)->setConfig(config());
00138     }
00139     // set TSM config
00140     std::vector<DTTSM*>::iterator ptsm;
00141     for (ptsm = _tsm[is].begin(); ptsm != _tsm[is].end(); ptsm++){
00142       (*ptsm)->setConfig(config());
00143     }
00144 
00145   }
00146 
00147 }


Member Data Documentation

DTConfigTSPhi* DTTSPhi::_config [private]

Definition at line 116 of file DTTSPhi.h.

Referenced by config(), and setConfig().

std::vector<DTTSCand*> DTTSPhi::_tctrig[DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1] [private]

Definition at line 124 of file DTTSPhi.h.

Referenced by addTracoT(), and localClear().

DTTracoCard* DTTSPhi::_tracocard [private]

Definition at line 114 of file DTTSPhi.h.

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

std::vector<DTTSM*> DTTSPhi::_tsm[DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1] [private]

Definition at line 121 of file DTTSPhi.h.

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

std::vector<DTTSS*> DTTSPhi::_tss[DTConfigTSPhi::NSTEPL-DTConfigTSPhi::NSTEPF+1] [private]

Definition at line 119 of file DTTSPhi.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:10 2009 for CMSSW by  doxygen 1.5.4