MdcSegGrouperAx Class Reference

#include <MdcSegGrouperAx.h>

Inheritance diagram for MdcSegGrouperAx:

MdcSegGrouper List of all members.

Public Member Functions

 MdcSegGrouperAx (const MdcDetector *gm, int debug)
 ~MdcSegGrouperAx ()
void fillWithSegs (const MdcSegList *inSegs)
virtual int incompWithSeg (const MdcSeg *refSeg, const MdcSeg *testSeg)
virtual int incompWithGroup (MdcSeg **segGroup, const MdcSeg *testSeg, int iply)
void resetComb (const MdcSeg *seed)
virtual MdcTrackstorePar (MdcTrack *, double parms[2], double chisq, TrkContext &, double trackT0)
int nextGroup (MdcSeg **segGroup, bool printit)
int updateGap ()
void resetGap (int nGap)
int nPly () const
int combineSegs (MdcTrack *&, MdcSeg *seed, TrkContext &, double trackT0, double maxSegChisqO, int combineByFitHits=0)
void transferHits (MdcTrack *track, int nSegs, MdcSeg **segGroup)
void dumpSegList ()
double calcParBySegs (MdcSeg **segGroup, double seedAngle[2], int nToUse, double &qual, int &nSegFit, double param[2])
double calcParByHits (MdcSeg **segGroup, int nToUse, const TrkExchangePar &par, double &qual, int &nSegFit, double param[2], double Bz)

Protected Member Functions

void resetSegCounters ()

Protected Attributes

int nDeep
int nPlyFilled
int * currentSeg
int * firstGood
int * firstBad
bool ** isValid
HepAList< MdcSeg > ** combList
const MdcDetector_gm
HepAList< MdcSeg > * segList
boolleaveGap
int nNull
int maxNull
int * gapCounter
bool lTestGroup
bool lTestSingle
int _debug

Private Member Functions

MdcSegGrouperAxoperator= (const MdcSegGrouperAx &)

Private Attributes

const MdcSeg_seed

Detailed Description

Definition at line 29 of file MdcSegGrouperAx.h.


Constructor & Destructor Documentation

MdcSegGrouperAx::MdcSegGrouperAx ( const MdcDetector gm,
int  debug 
)

Definition at line 60 of file MdcSegGrouperAx.cxx.

References MdcSegGrouper::isValid, ganga-rec::j, MdcSegGrouper::lTestGroup, MdcSegGrouper::lTestSingle, and MdcSegGrouper::nPly().

00060                                                                  : 
00061   MdcSegGrouper(gm, gm->nAxialSuper() - 1, debug) {
00062 //------------------------------------------------------------------------
00063   lTestGroup = false;
00064   lTestSingle = true;
00065 
00066   isValid = new bool * [nPly()];
00067   for (int j = 0; j < nPly(); j++) {
00068     isValid[j] = 0;
00069   } 
00070 }

MdcSegGrouperAx::~MdcSegGrouperAx (  )  [inline]

Definition at line 33 of file MdcSegGrouperAx.h.

00033 { };


Member Function Documentation

double MdcSegGrouper::calcParByHits ( MdcSeg **  segGroup,
int  nToUse,
const TrkExchangePar par,
double &  qual,
int &  nSegFit,
double  param[2],
double  Bz 
) [inherited]

Definition at line 585 of file MdcSegGrouper.cxx.

References MdcSegGrouper::_debug, MdcLine::chisq, MdcLine::fit(), MdcSeg::hit(), MdcSeg::info(), MdcLine::intercept, MdcHit::layernumber(), MdcHitUse::mdcHit(), MdcSeg::nHit(), MdcLine::nPoint, MdcLine::sigma, MdcLine::slope, MdcHit::wirenumber(), MdcLine::x, MdcLine::y, and MdcSegInfoSterO::zPosition().

Referenced by MdcSegGrouper::combineSegs().

00585                                                                                                                                                     {
00586   //************************************************************************
00587   //*** Calc. z and cot(theta) for stereo 
00588   int debug = false;
00589   if (11 == _debug ) debug = true;
00590   if (debug) std::cout<< "-----calculate group param by hit-----"<<std::endl;
00591   MdcLine span(50);
00592   MdcLine spanFit(50);
00593 
00594   int nHit = 0;
00595   if (debug) std::cout<< "nToUse="<<nToUse<<std::endl;
00596   for (int iPly = 0; iPly < nToUse; iPly++) {
00597     if (segGroup[iPly] == 0) continue;   // skipping this slayer
00598     nSegFit++;
00599     MdcSegInfoSterO *segInfo = dynamic_cast<MdcSegInfoSterO*> (segGroup[iPly]->info());
00600 
00601     if(debug) std::cout<< "nHit in segment="<<segGroup[iPly]->nHit()<<std::endl;
00602     for (int ii=0,iHit=0; ii<segGroup[iPly]->nHit(); ii++){
00603 
00604       if(debug)std::cout<< " calcParByHits ("<< segGroup[iPly]->hit(iHit)->mdcHit()->layernumber()<<","<<segGroup[iPly]->hit(iHit)->mdcHit()->wirenumber()<<")";
00605       //if(segGroup[iPly]->hit(iHit)->mdcHit()->layernumber()<4) continue;//yzhang TEMP TEST 2011-08-01 
00606 
00607       int szCode = segInfo->zPosition(*(segGroup[iPly]->hit(iHit)),par,&span,iHit,segGroup[iPly]->bunchTime(),Bz);
00608       if(debug)std::cout<< " szCode "<<szCode;
00609       if(szCode>0&&debug) std::cout<< iHit<<" s "<< span.x[iHit]<< " z "<<span.y[iHit] <<" sigma "<<span.sigma[iHit];
00610       if(debug)std::cout<<std::endl;
00611 
00612       spanFit.x[nHit]=span.x[iHit];
00613       spanFit.y[nHit]=span.y[iHit];
00614       //spanFit.sigma[nHit]=span.sigma[iHit];
00615       spanFit.sigma[nHit]=1.;
00616       if(debug)std::cout<< std::endl;
00617       iHit++;
00618       if(szCode>0) nHit++; 
00619     }
00620   }
00621 
00622   if(debug)std::cout<< __FILE__ << "   " << __LINE__ << " nHit  "<< nHit<<std::endl;
00623   if (nHit>0) spanFit.fit(nHit);
00624   else return -999;
00625 
00626   param[0] = spanFit.intercept;
00627   param[1] = spanFit.slope;
00628   if(debug)std::cout<< "nHit "<<nHit<<" intercept(z0) "<<param[0]<< " slope(ct) " << param[1] <<std::endl;
00629 
00630   qual = 2.*nHit - spanFit.chisq/(spanFit.nPoint - 2);
00631   if(debug)std::cout<< "chisq "<<spanFit.chisq<<" qual "<<qual<<std::endl;
00632 
00633   return spanFit.chisq;
00634 } 

double MdcSegGrouper::calcParBySegs ( MdcSeg **  segGroup,
double  seedAngle[2],
int  nToUse,
double &  qual,
int &  nSegFit,
double  param[2] 
) [inherited]

Definition at line 475 of file MdcSegGrouper.cxx.

References MdcSegGrouper::_debug, MdcSegInfo::errmat(), ers::error, genRecEmupikp::i, MdcSeg::info(), MdcSegInfo::inverr(), ganga-rec::j, mdcTwoInv(), mdcTwoVec(), mdcWrapAng(), MdcSeg::nHit(), MdcSegInfo::par(), and MdcSegInfo::parIsAngle().

Referenced by MdcSegGrouper::combineSegs().

00476                                                              {
00477   //************************************************************************
00478   if (11 == _debug) std::cout<< "-----calculate group param by segment param-----"<<std::endl;
00479   double wgtmat[3], wgtinv[3];
00480   double wgtpar[2];
00481   double temvec[2], diff[2];
00482   // Calculate track & chisq for this group 
00483   int nhit = 0;
00484   wgtmat[0] = wgtmat[1] = wgtmat[2] = wgtpar[0] = wgtpar[1] = 0.0;
00485 
00486   int iPly;
00487   for (iPly = 0; iPly < nToUse; iPly++) {
00488     if (11 == _debug) {
00489       //if (!lSeed) //if (segGroup[iPly] == 0) cout << "ply empty: " << iPly << "\n";
00490     }
00491     if (segGroup[iPly] == 0) continue;   // skipping this slayer
00492     nSegFit++;
00493     MdcSegInfo *segInfo = segGroup[iPly]->info();
00494     // Accumulate sums
00495     for (int i = 0; i < 3; i++) wgtmat[i] += (segInfo->inverr())[i];
00496     for (int k = 0; k < 2; k++) {
00497       param[k] = segInfo->par(k);
00498       //zhangy add
00499       if (segInfo->parIsAngle(k)) {
00500         param[k] = mdcWrapAng(seedAngle[k], param[k]);
00501       }
00502     }
00503     // Multiply by weight matrix.
00504     mdcTwoVec( segInfo->inverr(), param, temvec );
00505     wgtpar[0] += temvec[0];
00506     wgtpar[1] += temvec[1];
00507     if(11 == _debug) {
00508       std::cout<<0<<": param "<<param[0]<<" inverr "<< segInfo->inverr()[0]<<" par*W "<<temvec[0]<<std::endl;
00509       std::cout<<1<<": param "<<param[1]<<" "<<1/param[1]<<" inverr "<< segInfo->inverr()[1]<<" par*W "<<temvec[1]<<std::endl;
00510       std::cout<< "   " <<std::endl;
00511     }
00512     nhit += segGroup[iPly]->nHit();
00513   }
00514 
00515   // And the fitted parameters are . . . 
00516   int error = mdcTwoInv(wgtmat,wgtinv);
00517   if (error && (11 == _debug)) {
00518     cout << "ErrMsg(warning) " 
00519       <<  "failed matrix inversion in MdcTrackList::combineSegs" << endl;
00520     //continue;
00521     return -999.;
00522   }
00523   mdcTwoVec( wgtinv, wgtpar, param );
00524   if(11 == _debug) {
00525     std::cout<< " param of wgtinv * wgtpar" << std::endl;
00526     std::cout<<0<<": param "<<param[0]<< std::endl;
00527     std::cout<<1<<": param "<<param[1]<<" "<<1/param[1]<< std::endl;
00528     std::cout<< "   " <<std::endl;
00529   }
00530 
00531   //param[0]= 5.312286;
00532   //param[1]= -0.006;
00533   //std::cout<< "set param   " <<param[0]<< "   "<<param[1]<<std::endl;
00534   if(11 == _debug)cout<<endl<<"-- Calculate track & chisq for this group "<<endl;
00535 
00536   // Calc. chisq. = sum( (Vi - V0) * W * (Vi - V0) ) 
00537   // W = weight, Vi = measurement, V0 = fitted param. 
00538   double chisq = 0.0;
00539   for (iPly = 0; iPly < nToUse; iPly++) {
00540     if (segGroup[iPly] == 0) continue;   // skipping this slayer
00541     MdcSegInfo *segInfo = segGroup[iPly]->info();
00542     for (int j = 0; j < 2; j++) {
00543       double temPar;
00544       if (segInfo->parIsAngle(j)) {
00545         temPar = mdcWrapAng(seedAngle[j], segInfo->par(j));
00546       } else {
00547         temPar = segInfo->par(j);
00548       }
00549       if(11 == _debug) {
00550         std::cout<<" segPar"<<j<<" "<<temPar<<  std::endl;
00551       }
00552       diff[j] = temPar - param[j];
00553     }
00554 
00555     if(11 == _debug) {
00556       std::cout<<"inverr " <<segInfo->inverr()[0]<<" "
00557         <<segInfo->inverr()[1] <<" "<<segInfo->inverr()[2] <<  std::endl;
00558       std::cout<<"errmat " <<segInfo->errmat()[0]<< " "
00559         <<segInfo->errmat()[1] << " "<<segInfo->errmat()[2] <<  std::endl;
00560       std::cout<<"diff " <<diff[0]<<" "<<diff[1]<<" temvec "<<temvec[0]<<" "<<temvec[1]<< std::endl;
00561       std::cout<<  std::endl;
00562     }
00563     mdcTwoVec( segInfo->inverr(), diff, temvec);
00564 
00565     chisq += diff[0] * temvec[0] + diff[1] * temvec[1];
00566 
00567     if(11 == _debug){
00568       std::cout<<iPly<<" chi2Add:"<<diff[0] * temvec[0] + diff[1] * temvec[1]<<" diff0 "<< diff[0]<< " vec0 "<<temvec[0]<<" diff1 "<< diff[1]<< " vec1 "<<temvec[1] << std::endl;
00569     }
00570   }
00571 
00572   double chiDof = chisq/(2.*nSegFit - 2.);
00573   if (11 == _debug) {
00574     cout << "segment:"<<endl<<" chiDof "<<chiDof<<" chisq "<< chisq << " nhit " << nhit << " phi0/z0 " << 
00575       param[0] << " cpa/cot " << param[1] << " qual "<<(2. * nhit - chiDof) <<endl;
00576   }
00577 
00578   qual = 2. * nhit - chiDof;
00579 
00580   //if(is3d) std::cout<< __FILE__ << "   " << " z0 "<<param[0] << " ct "<<param[0] <<std::endl;//zhange TEMP test 2011-05-06 
00581   return chisq;
00582 }

int MdcSegGrouper::combineSegs ( MdcTrack *&  ,
MdcSeg seed,
TrkContext ,
double  trackT0,
double  maxSegChisqO,
int  combineByFitHits = 0 
) [inherited]

Definition at line 270 of file MdcSegGrouper.cxx.

References MdcSegGrouper::_debug, TrkRecoTrk::bField(), BField::bFieldZ(), MdcSegGrouper::calcParByHits(), MdcSegGrouper::calcParBySegs(), TrkRecoTrk::fitResult(), g_maxSegChisqAx, g_maxSegChisqSt, TrkFit::helix(), genRecEmupikp::i, MdcSeg::info(), iprint, MdcSegGrouper::nextGroup(), MdcSegGrouper::nPly(), MdcSegInfo::par(), MdcSegInfo::parIsAngle(), MdcSeg::plotSegAll(), MdcSegGrouper::resetComb(), MdcSegGrouper::storePar(), MdcTrack::track(), and MdcSegGrouper::transferHits().

Referenced by MdcTrackListCsmc::createFromSegs(), and MdcTrackList::createFromSegs().

00271                                                                                {
00272   //************************************************************************/
00273   // forms track from list of segs; does 2-param fit (either r-phi from origin
00274   //  or s-z) and picks best combination.
00275   if (3 == _debug) std::cout<<std::endl<<  "=====MdcSegGrouper::combineSegs=====" <<std::endl;
00276   bool lSeed = (seed != 0); // no seed for stereo group
00277 
00278   int success = 0;
00279   double qual;
00280   double qualBest = -1000.;
00281   int nSegFit = 0;
00282   int nSegBest = 0;
00283   //int nHitBest = 0;
00284   double param[2];
00285   double paramBest[2];
00286   double chiBest = 9999.;
00287   int nToUse = nPly();
00288   if (lSeed) nToUse++;   // seed isn't included in the segs list
00289   MdcSeg **segGroup;
00290   MdcSeg **segGroupBest;
00291   segGroup = new MdcSeg * [nToUse];
00292   segGroupBest = new MdcSeg * [nToUse];
00293   //  static int counter = 0;
00294   //  counter++;
00295   //  cout << counter << endl;
00296 
00297   //bool is3d = (seed==NULL);//zhange TEMP test 2011-05-06 
00298 
00299   // Loop over all combinations of segs consistent with seed (including gaps)
00300   if ((3 == _debug)&&lSeed) {
00301     std::cout<<"seed segment: ";
00302     seed->plotSegAll();
00303     std::cout<< std::endl;
00304   }
00305   resetComb(seed); 
00306 
00307   // Save seed params (if angles) for later use as reference angle in 
00308   //    mdcWrapAng (don't really have to test whether it's an angle, but I do)
00309   double seedAngle[2] = {0.,0.};
00310   if (lSeed) {
00311     if (seed->info()->parIsAngle(0)) seedAngle[0] = seed->info()->par(0);
00312     if (seed->info()->parIsAngle(1)) seedAngle[1] = seed->info()->par(1);
00313   }
00314 
00315   int iprint = ( 3 == _debug);
00316   int nInGroup = 0;
00317   while ( (nInGroup = nextGroup(segGroup, iprint)) != 0) {
00318 
00319     if (lSeed) {
00320       segGroup[nToUse-1] = seed;
00321       nInGroup++;
00322     }
00323     if (nInGroup < 0) continue;
00324     if (nInGroup < 2) break;
00325     if (nInGroup < nSegBest) break;
00326 
00327     if (3 == _debug || 11 == _debug) {
00328       cout << endl <<"-----found a segment group by nextGroup()----- nInGroup "<<nInGroup<<" nToUse "<<nToUse<<endl;
00329       for(int ii=0; ii<nToUse; ii++){ if(segGroup[ii]) {segGroup[ii]->plotSegAll(); cout<<endl;} }
00330       //cout << endl <<"--calc. parameters of this segment group"<<endl;
00331     }
00332 
00333     double chisq =-999.;
00334     nSegFit=0;
00335 
00336     if(lSeed){
00337       //2d
00338       chisq = calcParBySegs(segGroup, seedAngle, nToUse, qual, nSegFit, param);
00339     }else{
00340       if (combineByFitHits == 0){
00341         chisq = calcParBySegs(segGroup, seedAngle, nToUse, qual, nSegFit, param);
00342       }else{
00343         //3d 
00344         const TrkFit* tkFit = trk->track().fitResult();
00345         double Bz = trk->track().bField().bFieldZ();//??
00346         TrkExchangePar par = tkFit->helix(0.0);
00347         //par.print(std::cout);
00348         if (tkFit != 0) chisq = calcParByHits(segGroup, nToUse, par, qual,nSegFit, param, Bz);
00349         //std::cout<< __FILE__ << "   " << __LINE__ << " calcParByHits"<<std::endl;
00350         if(chisq<=0){
00351           //std::cout<< "calcParByHits failed! calc. by seg" <<std::endl;
00352           chisq = calcParBySegs(segGroup, seedAngle, nToUse, qual, nSegFit, param);
00353         }
00354       }
00355     }
00356 
00357 
00358     if (chisq < 0.) continue;//yzhang add
00359     double chiDof = chisq/(2.*nSegFit - 2.);
00360 
00361     if (g_maxSegChisqAx && lSeed ) { g_maxSegChisqAx->fill(chiDof); } //yzhang hist cut
00362     if (g_maxSegChisqSt && !lSeed) { g_maxSegChisqSt->fill(chiDof); } //yzhang hist cut
00363 
00364     //std::cout<<  " chisq  " << chisq<< " chi2dof "<<chiDof<<std::endl;
00365 
00366     if (3 == _debug || 11 == _debug) {
00367       std::cout<< endl<<"chisq "<<chisq<<" nSegFit " << nSegFit<< " chiDof "<<chiDof<<std::endl;
00368       if(chiDof > maxSegChisqO) {
00369         cout << "***** DROP this group by chiDof "<<chiDof<<" > maxSegChisqO:"<<maxSegChisqO<<endl;
00370       }else{
00371         cout << "***** KEEP this group by chiDof "<<chiDof<<" <= maxSegChisqO:"<<maxSegChisqO<<endl;
00372       }
00373     }
00374     // Chisq test
00375     if (chiDof > maxSegChisqO) continue;
00376 
00377     success = 1;
00378     if (qual > qualBest) {
00379       qualBest = qual;
00380       nSegBest = nSegFit;
00381       //nHitBest = nhit;
00382       paramBest[0] = param[0];
00383       paramBest[1] = param[1];
00384       chiBest = chisq;
00385       for (int i = 0; i < nToUse; i++) {
00386         segGroupBest[i] = segGroup[i];
00387       }
00388       if (3 == _debug && 11 == _debug) std::cout<<"Keep as best group. param: phi0/z0 "
00389         <<paramBest[0]<< " cpa/ct "<<paramBest[1]<<  std::endl;
00390     }// end test on qual
00391   }
00392 
00393   if (success == 1) {
00394     if(3 == _debug || 11 == _debug) {
00395       std::cout<< endl<<"-----Parameter best group-----    "<<std::endl;
00396       std::cout<< "paramBest "<<paramBest[0]<<" "<<paramBest[1]<< " chiBest " << chiBest<< std::endl;
00397     }
00398     // Store the results in a track, possibly creating it in the process
00399     trk = storePar(trk, paramBest, chiBest, context, t0);
00400     transferHits(trk, nToUse, segGroupBest);     // Store hits with track
00401   }
00402   delete [] segGroupBest;
00403   delete [] segGroup;
00404   return success;
00405 } 

void MdcSegGrouper::dumpSegList (  )  [inherited]

Definition at line 464 of file MdcSegGrouper.cxx.

References genRecEmupikp::i, and MdcSegGrouper::segList.

Referenced by MdcTrackList::createFromSegs().

00464                                {
00465   //************************************************************************
00466   for(int islayer=0; islayer<11; islayer++){
00467     for(int i=0; i<segList[islayer].length(); i++){
00468       segList[islayer][i]->plotSegAll();
00469       std::cout<< std::endl;
00470     }
00471   }
00472 }

void MdcSegGrouperAx::fillWithSegs ( const MdcSegList inSegs  ) 

Definition at line 73 of file MdcSegGrouperAx.cxx.

References MdcSegGrouper::_debug, MdcSegGrouper::_gm, MdcSegInfoAxialO::calcFromOrigin(), GmsList::first(), GmsListLink::next(), MdcDetector::nSuper(), MdcSegList::oneList(), MdcSegInfoAxialO::phi0(), phi0, MdcSegGrouper::segList, MdcSeg::setInfo(), MdcSeg::superlayer(), and MdcSuperLayer::whichView().

Referenced by MdcTrackList::createFromSegs().

00073                                                             {
00074 //------------------------------------------------------------------------
00075   if(3==_debug) std::cout<<std::endl<< "=====MdcSegGrouperAx::fillWithSegs====="<<std::endl;
00076   // Prepare for axial finding
00077   // Store the segments (pointers, actually), sorting by phi0 
00078   for (int isuper = 0; isuper < _gm->nSuper(); isuper++) {
00079     const GmsList *inList = inSegs->oneList(isuper);
00080     if (inList->count() == 0) continue;
00081     MdcSeg *inSeg = (MdcSeg *) inList->first();
00082     // Only load axial segments
00083     if (inSeg->superlayer()->whichView() != 0) continue;
00084    
00085     while (inSeg != 0) {
00086       // Create an info object within the seg to store info
00087       MdcSegInfoAxialO *info = new MdcSegInfoAxialO;
00088       inSeg->setInfo(info);
00089       info->calcFromOrigin(inSeg);  // calc. origin-dependent info
00090 
00091       // Loop over the segs already stored, looking for the right place 
00092       //   to stick the new one
00093       int isInserted = 0;
00094       for (int iseg = 0; iseg < (int) segList[isuper].length(); iseg++) {
00095         MdcSeg *aSeg = segList[isuper][iseg];
00096         if ( ((MdcSegInfoAxialO *)aSeg->info())->phi0() < info->phi0()) {
00097           continue;  }
00098         segList[isuper].insert(inSeg, iseg);
00099         isInserted = 1;
00100         break;
00101       }  // end of loop over existing segs
00102       if (isInserted == 0) segList[isuper].append(inSeg);
00103       inSeg = (MdcSeg *) inSeg->next();
00104     }  // end loop over new segs
00105 //   cout<<"segList["<<isuper<<"].length"<< segList[isuper].length()<<endl;//yzhang debug
00106   }  //  end loop over superlayers
00107 
00109 /*  for(int isuper = 0; isuper < _gm->nSuper(); isuper++) {
00110     std::cout<<"-------super layer "<<isuper<<std::endl;
00111       for (int iseg = 0; iseg < (int) segList[isuper].length(); iseg++) {
00112         MdcSeg *aSeg = segList[isuper][iseg];
00113         std::cout << "    seg phi "<<iseg<< " "<<((MdcSegInfoAxialO*)aSeg->info())->phi0()<<std::endl;
00114       }  // end of loop over existing segs
00115   }
00116 
00117 */
00118 
00119 }

int MdcSegGrouperAx::incompWithGroup ( MdcSeg **  segGroup,
const MdcSeg testSeg,
int  iply 
) [virtual]

Implements MdcSegGrouper.

Definition at line 242 of file MdcSegGrouperAx.cxx.

00243               {
00244   //-------------------------------------------------------------------------
00245 
00246   return 0;
00247 }

int MdcSegGrouperAx::incompWithSeg ( const MdcSeg refSeg,
const MdcSeg testSeg 
) [virtual]

Implements MdcSegGrouper.

Definition at line 122 of file MdcSegGrouperAx.cxx.

References MdcSegGrouper::_debug, MdcSegInfoAxialO::curv(), g_combAxdCurv, g_combAxdPhi0, g_combAxMc, g_combAxMcAmbigSeed, g_combAxMcAmbigTest, g_combAxMcPt, g_combAxMcTheta, g_combAxQualitySeed, g_combAxQualityTest, g_tupleCombAx, MdcSeg::info(), MdcTrkReconCut_combAxCurvCut, MdcTrkReconCut_combAxPhi0Cut, mdcWrapAng(), MdcSeg::nHit(), MdcSegInfoAxialO::phi0(), MdcSeg::plotSegAll(), MdcSeg::quality(), MdcSegInfoAxialO::sigCurv(), MdcSegInfoAxialO::sigPhi0(), MdcSuperLayer::slayNum(), MdcSeg::superlayer(), MdcSeg::testCombSeg(), MdcSeg::testCombSegAmbig(), MdcSeg::testCombSegPt(), and MdcSeg::testCombSegTheta().

Referenced by resetComb().

00123                                                           {
00124 //-------------------------------------------------------------------------
00125 
00126   // Returns 0 if valid, -1 if invalid, +1 if invalid and no more valid 
00127   //   ones possible in this slayer (assumes they're ordered)
00128   if (testSeg == 0) return 0;
00129   if(3 == _debug) {
00130     //std::cout<< "test seg:"; 
00131     testSeg->plotSegAll(); 
00132   }
00133   // Test phi0 match
00134   MdcSegInfoAxialO *refInfo = (MdcSegInfoAxialO *) refSeg->info();
00135   MdcSegInfoAxialO *testInfo = (MdcSegInfoAxialO *) testSeg->info();
00136 
00137 
00138   double sigPhi0 = (refInfo->sigPhi0() > testInfo->sigPhi0() ? 
00139       refInfo->sigPhi0() : testInfo->sigPhi0());
00140   double refPhi0 = refInfo->phi0();
00141   double testPhi0 =  testInfo->phi0();
00142   double corrPhi0 = mdcWrapAng(refPhi0, testPhi0);
00143 
00144   double sigCurv = (refInfo->sigCurv() > testInfo->sigCurv() ? 
00145       refInfo->sigCurv() : testInfo->sigCurv());
00146   double refCurv = refInfo->curv();
00147   double testCurv = testInfo->curv();
00148   //double nSigmaPhi0 = MdcTrkReconCut_combAxPhi0;//4. for default
00149   //double nSigmaCurv = MdcTrkReconCut_combAxCurv;//4. for default
00150   double phi0Cut = MdcTrkReconCut_combAxPhi0Cut;
00151   double curvCut = MdcTrkReconCut_combAxCurvCut;
00152   //std::cout << "test phi0 "<<corrPhi0<<" ref "<<refPhi0<<" sig "<< nSigmaPhi0 * sigPhi0 << std::endl;
00153   //std::cout << "test Curv "<<testCurv<<" ref "<<refCurv<<" sig "<< nSigmaCurv * sigCurv << std::endl;
00154 
00155   if (g_tupleCombAx) {
00156     g_combAxdPhi0 = refPhi0 - corrPhi0; 
00157     g_combAxdCurv = refCurv - testCurv; 
00158     g_combAxQualitySeed = refSeg->quality()+refSeg->nHit()*10+refSeg->superlayer()->slayNum()*1000;
00159     g_combAxQualityTest = testSeg->quality()+testSeg->nHit()*10+testSeg->superlayer()->slayNum()*1000;
00160     g_combAxMcAmbigSeed = refSeg->testCombSegAmbig();
00161     g_combAxMcAmbigTest = testSeg->testCombSegAmbig();
00162     g_combAxMc = refSeg->testCombSeg(testSeg);
00163     g_combAxMcPt = refSeg->testCombSegPt();
00164     g_combAxMcTheta = refSeg->testCombSegTheta();
00165     //g_combAxSigPhi0 = sigPhi0;
00166     //g_combAxSigCurv = sigCurv;
00167     //g_combAxSlSeed = refSeg->superlayer()->slayNum();
00168     //g_combAxSlTest = testSeg->superlayer()->slayNum();
00169     //g_combAxPatSeed = refSeg->segPattern();
00170     //g_combAxPatTest = testSeg->segPattern();
00171     //g_combAxNhitSeed = refSeg->nHit();
00172     //g_combAxNhitTest = testSeg->nHit();
00173     //test if the combined segments in the same track
00174     // return -1:seed false
00175     // return value = n hits on the seed track/ n hits of test seg
00176     //g_combAxMcPhi = refSeg->testCombSegPhi();
00177     //std::cout<< "mc seg   "<< refSeg->testCombSeg(testSeg) << std::endl;//yzhang debug
00178     g_tupleCombAx->write();  
00179   }
00180 
00181   //yzhang add 2009-10-16
00182   //if (refPhi0 - corrPhi0 > nSigmaPhi0 * sigPhi0)
00183   //if(3 == _debug){
00184   //  std::cout << " phi0 ref"<<refPhi0
00185   //    <<" corr "<<corrPhi0
00186   //    << " diff "<<fabs(corrPhi0-refPhi0)
00187   //    <<" >? "<<phi0Cut<<std::endl;
00188   //  std::cout <<  " curv ref"<<refCurv
00189   //    <<" test "<<testCurv<< " diff "<<refCurv-testCurv
00190   //    <<" >? "<<curvCut<< std::endl;
00191   //}
00192   if(refSeg->testCombSegPt()>0.4 && fabs(corrPhi0 - refPhi0)>0.4 &&(refSeg->testCombSeg(testSeg)>0.5)){
00193     if(3==_debug){
00194       std::cout<< endl<<" test " << std::endl;
00195       std::cout<<"seed seg: "; refSeg->plotSegAll(); std::cout<< std::endl;
00196       std::cout<<"test seg: "; testSeg->plotSegAll(); std::cout<< std::endl;
00197       std::cout<< " dPhi0 abnormal "<<corrPhi0 - refPhi0<<std::endl;
00198     }
00199   }else{
00200     if(3== _debug){
00201       std::cout<< endl<<" test " << std::endl;
00202       std::cout<<"seed seg: "; refSeg->plotSegAll(); std::cout<< std::endl;
00203       std::cout<<"test seg: "; testSeg->plotSegAll(); std::cout<< std::endl;
00204       std::cout<< " dPhi0 ok " <<setprecision(3)<< corrPhi0 - refPhi0<<std::endl; 
00205     }
00206   }
00207 
00208   //std::cout<< __FILE__ << "   " << __LINE__ << " dphi0=  "<<fabs(corrPhi0 - refPhi0)<<" mc "<<refSeg->testCombSeg(testSeg)<<std::endl;
00209 
00210   cout<<setiosflags(ios::fixed);
00211   //FIXME 2011-05-31 yzhang cut vs pt
00212   if (fabs(corrPhi0 - refPhi0) > phi0Cut) { 
00213     if(3 == _debug) std::cout <<  " SKIP by dPhi0 "
00214       <<fabs(corrPhi0-refPhi0)<<">"<<phi0Cut<<std::endl; 
00215     //yzhang delete 
00216     //if (testPhi0 > refPhi0) return  1;  
00217     //else 
00218     return -1; // => testPhi0>2pi & refPhi0<2pi
00219   }else{
00220     if(3 == _debug)std::cout<< " dphi " <<setprecision(3)<< fabs(corrPhi0 - refPhi0); 
00221   }
00222 
00223   // Test curvature match
00224   // use larger error of the two
00225   //if (fabs(refCurv - testCurv) > nSigmaCurv * sigCurv) 
00226   if (fabs(refCurv - testCurv) > curvCut){
00227     if(3 == _debug) std::cout <<  " SKIP by dCurv"
00228       <<fabs(refCurv-testCurv)<<">"<<curvCut<<std::endl; 
00229     return -2;
00230   }else{
00231     if(3 == _debug)std::cout<< " dCurv " <<setprecision(3)<< fabs(refCurv - testCurv);
00232   }
00233   if(3 == _debug) std::cout <<  " KEEP "<<std::endl; 
00234 
00235   cout<<setprecision(6);
00236   cout<<setiosflags(ios::scientific);
00237   //std::cout<< "ok!   " << std::endl;//yzhang debug
00238   return 0;
00239 }

int MdcSegGrouper::nextGroup ( MdcSeg **  segGroup,
bool  printit 
) [inherited]

Definition at line 83 of file MdcSegGrouper.cxx.

References MdcSegGrouper::combList, MdcSegInfoSterO::ct(), MdcSegGrouper::currentSeg, MdcSegGrouper::firstBad, MdcSegGrouper::firstGood, MdcSegGrouper::incompWithGroup(), MdcSegGrouper::isValid, MdcSegGrouper::leaveGap, MdcSegGrouper::lTestGroup, MdcSegGrouper::lTestSingle, MdcSegGrouper::maxNull, MdcSegGrouper::nDeep, MdcSegGrouper::nNull, MdcSegGrouper::nPlyFilled, MdcSegGrouper::resetGap(), MdcSegGrouper::resetSegCounters(), and MdcSegGrouper::updateGap().

Referenced by MdcSegGrouper::combineSegs().

00083                                                               {
00084   //------------------------------------------------------------------------
00085 
00086   // Loop over the superlayers, moving to next valid seg for each if necessary
00087   // First, loop over the slayers w/o good segs, filling segGroup w/ 0
00088   int iply;
00089   for (iply = nPlyFilled; iply < nDeep; iply++) {
00090     segGroup[iply] = 0;
00091   }
00092 
00093 restart:
00094   if (printit) cout <<endl<< "MdcSegGrouper::nextGroup starting group finder, nply = " << nPlyFilled << endl;
00095   int nFound = 0;
00096   bool incrementNext = true;
00097   //int nSegUsed;//yzhang 2010-05-21 
00098   for (iply = 0; iply < nPlyFilled; iply++) {
00099     segGroup[iply] = 0;
00100     if (!incrementNext && currentSeg[iply] >= firstGood[iply]) {
00101       if(printit) std::cout<< " reach end of list, break." << iply<< std::endl;
00102       break;
00103     }
00104     //if (nSegUsed > segPar.nSegUsedNextGroup) break;
00105     if (leaveGap[iply]) {
00106       if(printit) std::cout<< "  leaveGap  " <<std::endl;
00107       // This ply is currently a gap; move on.
00108       if (iply == nPlyFilled - 1 && incrementNext) {
00109         // we've exhausted this gap group; start another
00110         iply = -1;
00111         resetSegCounters();
00112         int lDone = updateGap();
00113         if (lDone) {
00114           // all gap groups for nNull exhausted; increment nNull
00115           nNull++;
00116           if (nNull > maxNull) return 0;  // All done 
00117           resetGap(nNull);
00118           updateGap();
00119         } // end if lDone
00120       }  //end if exhausted gap group
00121       continue;
00122     }
00123     incrementNext = false;
00124 
00125     // Loop through the segs in this ply until valid one found
00126     while (1) {
00127       currentSeg[iply]++;
00128       if (currentSeg[iply] == firstBad[iply]) {   // reached end of segs
00129         incrementNext = true;
00130         currentSeg[iply] = firstGood[iply];
00131         if(printit) { std::cout<< "reach end of segs  "<<std::endl; }
00132         if (iply == nPlyFilled - 1) {  
00133           // we've exhausted this gap group; start another
00134           iply = -1;
00135           resetSegCounters();
00136           int lDone = updateGap();
00137           if (lDone) {
00138             // all gap groups for nNull exhausted; increment nNull
00139             nNull++;
00140             if (nNull > maxNull) {
00141               if(printit) { std::cout<<endl<< " All done!  "<<std::endl; }
00142               return 0;  // All done
00143             }
00144             resetGap(nNull);
00145             updateGap();
00146           } // end if lDone
00147         }  //end if exhausted gap group
00148         break;
00149       }  // end reached end of segs
00150 
00151       if(printit){
00152         std::cout<< "ply " << iply<< " seg "<<currentSeg[iply]<<": ";
00153         (*combList[iply])[currentSeg[iply]]->plotSeg();
00154         if((*combList[iply])[currentSeg[iply]]->superlayer()->whichView()!= 0){
00155           MdcSegInfoSterO* info = (MdcSegInfoSterO *) (*combList[iply])[currentSeg[iply]]->info();
00156           std::cout<< " ct " << info->ct();
00157         }
00158       }
00159 
00160       //yzhang 09-09-28 delete
00161       if( (*combList[iply])[currentSeg[iply]]->segUsed()) {
00162         if(printit) {
00163           std::cout<< std::endl<<" Used??";
00164           (*combList[iply])[currentSeg[iply]]->plotSeg();
00165         }
00166         if(printit) { std::cout<< " segUsed! SKIP "<<std::endl; }
00167         continue;  //yzhang 2010-05-21 add
00168         //nSegUsed++;
00169       }
00170 
00171       // Test this seg for validity
00172       if (lTestSingle) {
00173         assert(isValid != 0);
00174         assert(isValid[iply] != 0);
00175         int invalid = (isValid[iply][currentSeg[iply]] == false);
00176         if(printit) {
00177           if(invalid){ std::cout<<" invalid "<< std::endl;
00178           }else{ std::cout<<" KEEP 1 "<< std::endl; }
00179         }
00180         if (invalid) continue;
00181       }else{
00182         if(printit) std::cout<<" KEEP 2 "<< std::endl; 
00183       }
00184 
00185       // Whew.  We successfully incremented.  
00186       break;
00187 
00188     }  // end seg loop
00189   } // end ply loop
00190 
00191   // Fill segGroup with appropriate segs
00192   for (iply = 0; iply < nPlyFilled; iply++) {
00193     if (leaveGap[iply]) {
00194       segGroup[iply] = 0;
00195     } else {
00196       segGroup[iply] = (*combList[iply])[currentSeg[iply]];     
00197       if (lTestGroup && nFound > 1) {
00198         int lBad = incompWithGroup(segGroup, segGroup[iply], iply);
00199         if(printit){
00200           if(lBad) std::cout<<" incompWithGroup Bad! restart" << std::endl;
00201           //else std::cout<<" incompWithGroup Bad! restart" << std::endl;
00202         }
00203         if (lBad) goto restart;
00204       }
00205       nFound++;
00206     }
00207   }
00208 
00209   if (printit) std::cout<< "nextGoup() found " << nFound << " segment(s)"<<std::endl;
00210   return nFound;
00211 }

int MdcSegGrouper::nPly (  )  const [inline, inherited]

Definition at line 54 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::combineSegs(), MdcSegGrouperAx(), MdcSegGrouperCsmc::MdcSegGrouperCsmc(), and MdcSegGrouperSt::MdcSegGrouperSt().

00054 {return nDeep;}

MdcSegGrouperAx& MdcSegGrouperAx::operator= ( const MdcSegGrouperAx  )  [private]

void MdcSegGrouperAx::resetComb ( const MdcSeg seed  )  [virtual]

Implements MdcSegGrouper.

Definition at line 250 of file MdcSegGrouperAx.cxx.

References MdcSegGrouper::_debug, MdcSegGrouper::_gm, _seed, MdcSegGrouper::combList, MdcSegGrouper::firstBad, MdcSegGrouper::firstGood, MdcDetector::firstSlay(), genRecEmupikp::i, incompWithSeg(), MdcSegGrouper::isValid, ganga-rec::j, MdcSegGrouper::leaveGap, MdcSegGrouper::maxNull, MdcSegGrouper::nDeep, MdcSuperLayer::next(), MdcSegGrouper::nNull, MdcSegGrouper::nPlyFilled, MdcSegGrouper::resetSegCounters(), MdcSegGrouper::segList, and MdcSeg::superlayer().

00250                                                   {
00251   //-------------------------------------------------------------------------
00252 
00253   // Delete existing list of valid/invalid segs
00254   if (isValid != 0) {
00255     int i;
00256     for (i = 0; i < nDeep; i++) {
00257       delete [] isValid[i];
00258       isValid[i] = 0;
00259     }
00260   }
00261 
00262   _seed = seed;
00263   //Grab the seglist for each non-seed slayer
00264   int islay = 0;
00265   int iply = 0;
00266   nPlyFilled = 0;
00267   nNull = 0;
00268   const MdcSuperLayer *seedSlay = 0;
00269   if (seed != 0) seedSlay = seed->superlayer();
00270 
00271 
00272   // Set up all sorts of stuff for fast grouping of segs in nextGroup()
00273   for (const MdcSuperLayer *thisSlay = _gm->firstSlay(); thisSlay != 0;
00274       thisSlay = thisSlay->next()) {
00275     bool noGoodYet = true;
00276     islay++;
00277 
00278     if (thisSlay == seedSlay) continue;
00279     if (thisSlay->whichView() != 0) continue;//Axial slayer
00280     firstGood[iply] = 0;
00281 
00282     // Loop over the segs, marking start & end of valid region for this seed
00283     firstBad[iply] = 0;
00284     if (segList[islay-1].length() != 0) {
00285       isValid[iply] = new bool[segList[islay-1].length()];
00286     }
00287 
00288     if(3 == _debug && segList[islay-1].length()>0) {
00289       std::cout<<std::endl<< "--match axial seg by phi in slayer "
00290         <<thisSlay->slayNum()<<"--"<<std::endl;
00291       //std::cout<< "reference seg: "; seed->plotSeg();
00292       //std::cout<< std::endl;
00293     }
00294 
00295     for (int i = 0; i < (int) segList[islay-1].length(); i++) {
00296       MdcSeg *aSeg = segList[islay-1][i];
00297       int invalid = incompWithSeg(seed, aSeg);
00298       isValid[iply][i] = true;
00299       if (invalid < 0) {
00300         firstBad[iply] = i;
00301         isValid[iply][i] = false;
00302         if (noGoodYet) firstGood[iply] = i+1;
00303       } else if (invalid > 0) {
00304         // No more valid segs in this slayer
00305         firstBad[iply] = i;
00306         for (int j = i; j < (int) segList[islay-1].length(); j++) 
00307           isValid[iply][j] = false;
00308         break;
00309       } else {
00310         firstBad[iply] = i+1;
00311         noGoodYet = false;
00312       }
00313     }
00314 
00315     //if(3 == _debug) std::cout<<iply<<" islay "<<islay<<" firstGood "<<firstGood[iply]<<" "<<firstBad[iply]<< std::endl;
00316     if (firstGood[iply] > firstBad[iply]) firstGood[iply] = firstBad[iply];
00317     if (firstGood[iply] == firstBad[iply]) {
00318       // If there are no valid segs for this ply, drop it
00319       delete [] isValid[iply];
00320       isValid[iply] = 0;
00321       continue;
00322     }
00323     // Associate correct seglist with this ply
00324     combList[iply] = &segList[islay-1];
00325     leaveGap[iply] = false;
00326     iply++;
00327   }
00328   nPlyFilled = iply;
00329   resetSegCounters();
00330   maxNull = nPlyFilled - 2;
00331   maxNull++;
00332 }

void MdcSegGrouper::resetGap ( int  nGap  )  [inherited]

Definition at line 214 of file MdcSegGrouper.cxx.

References MdcSegGrouper::gapCounter, genRecEmupikp::i, and MdcSegGrouper::nPlyFilled.

Referenced by MdcSegGrouper::nextGroup().

00214                                      {
00215   //**************************************************************************
00216 
00217   for (int i = 0; i < nPlyFilled; i++) {
00218     gapCounter[i] = nGap - 1 - i;
00219   }
00220   gapCounter[0]--; // so 1st increment will put 1st counter in right place
00221 
00222   return;
00223 }

void MdcSegGrouper::resetSegCounters (  )  [protected, inherited]

Definition at line 262 of file MdcSegGrouper.cxx.

References MdcSegGrouper::currentSeg, MdcSegGrouper::firstGood, genRecEmupikp::i, and MdcSegGrouper::nPlyFilled.

Referenced by MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), and resetComb().

00262                                      {
00263   //-------------------------------------------------------------------------
00264   for (int i = 0; i < nPlyFilled; i++) {
00265     currentSeg[i] = firstGood[i] - 1;
00266   }
00267 }

MdcTrack * MdcSegGrouperAx::storePar ( MdcTrack ,
double  parms[2],
double  chisq,
TrkContext ,
double  trackT0 
) [virtual]

Implements MdcSegGrouper.

Definition at line 334 of file MdcSegGrouperAx.cxx.

References MdcSegGrouper::_gm, MdcDetector::nSuper(), and BesAngle::rad().

00336                {
00337   //---------------------------------------------------------------------
00338   // cout << "storePar in MdcSegGrouperAx" <<endl;//yzhang debug
00339   assert(trk == 0);
00340   BesAngle foundPhi0(parms[0]);
00341   // factor of two to convert to BaBar def of curvature (omega)
00342   //std::cout<< "stored par   " << parms[0]<< "   "<<parms[1]
00343     //<<" store: "<<foundPhi0.rad()<<" "<<2.*parms[1]<<std::endl;
00344   TrkExchangePar par(0.0, foundPhi0.rad(), 2.*parms[1], 0.0, 0.0);
00345   return new MdcTrack(_gm->nSuper(), par, chisq, context, t0);
00346 }

void MdcSegGrouper::transferHits ( MdcTrack track,
int  nSegs,
MdcSeg **  segGroup 
) [inherited]

Definition at line 408 of file MdcSegGrouper.cxx.

References MdcSegGrouper::_debug, TrkHitList::appendHit(), MdcTrack::firstLayer(), MdcTrack::hasCurled(), TrkRecoTrk::hits(), genRecEmupikp::i, MdcTrack::lastLayer(), MdcSeg::nHit(), MdcSeg::plotSegAll(), MdcLayer::rMid(), MdcTrack::setFirstLayer(), MdcTrack::setLastLayer(), MdcSeg::setUsed(), and MdcTrack::track().

Referenced by MdcSegGrouper::combineSegs().

00408                                                                             {
00409   //************************************************************************/
00410   //Move hits from segments to track hitlist
00411   // Also note first and last layers in list
00412   // Only handles Mdc segments
00413   double smallRad = 1000.;
00414   if (trk->firstLayer() != 0) smallRad = trk->firstLayer()->rMid();
00415   double bigRad = 0.;
00416   if (trk->lastLayer() != 0) bigRad = trk->lastLayer()->rMid();
00417 
00418   //yzhang 2011-05-04 
00419   //bool maintainAmbiguity = (trk->track().status()->is2d() == 0) ? false: true;
00420   //bool maintainAmbiguity = false;
00421   //std::cout<< __FILE__ << "   " << __LINE__ << " maintainAmbiguity "<<maintainAmbiguity<<std::endl;
00422 
00423   if(3 == _debug) std::cout<< endl<<"-----transferHits for this segGroup-----  " <<std::endl;
00424   for (int i = 0; i < nSegs; i++) {
00425     if (segGroup[i] == 0) continue;   // skipping this slayer
00426     if(3 == _debug) {
00427       cout << i << "  "; segGroup[i]->plotSegAll(); cout<< endl;
00428     }
00429     segGroup[i]->setUsed();  // mark seg as used
00430     for (int ihit = 0; ihit < segGroup[i]->nHit(); ihit++) {
00431       MdcHitUse *aHit = segGroup[i]->hit(ihit);
00432       const MdcLayer *layer = aHit->mdcHit()->layer();
00433       double radius = layer->rMid();
00434       if (radius < smallRad) {
00435         smallRad = radius;
00436         trk->setFirstLayer(layer);
00437       }
00438 
00439       // Assume that segs aren't added to backside of curler
00440       if (radius > bigRad && !trk->hasCurled()) {
00441         bigRad = radius;
00442         trk->setLastLayer(layer);
00443       }
00444       // Provide very crude starting guess of flightlength
00445       double flt = radius;
00446       flt += 0.000001 * (aHit->mdcHit()->x() +aHit->mdcHit()->y());
00447 
00448       aHit->setFltLen(flt);
00449 
00450       TrkHitList* theHits = trk->track().hits();
00451 
00452       if (theHits == 0) return;
00453 
00454       //theHits->appendHit(*aHit, maintainAmbiguity);
00455       theHits->appendHit(*aHit);
00456       //zhangy
00457 
00458       //std::cout<<"in MdcSegGrouper  append ok"<<std::endl;//yzhang debug
00459     }   
00460   }  // end loop over slayers
00461 } 

int MdcSegGrouper::updateGap (  )  [inherited]

Definition at line 226 of file MdcSegGrouper.cxx.

References MdcSegGrouper::gapCounter, genRecEmupikp::i, ganga-rec::j, MdcSegGrouper::leaveGap, MdcSegGrouper::nNull, and MdcSegGrouper::nPlyFilled.

Referenced by MdcSegGrouper::nextGroup().

00226                              {
00227   //**************************************************************************
00228   if (nNull == 0) return 1;
00229 
00230   for (int i = 0; i < nPlyFilled; i++) {
00231     leaveGap[i] = false;
00232   }
00233   for (int igap = 0; igap < nNull; igap++) {
00234     gapCounter[igap]++;
00235     if (gapCounter[igap] == nPlyFilled - igap) {
00236       // End of loop for this counter; look at the other counters to 
00237       //  decide where this one should be reset to.
00238       int inext = igap + 1;
00239       while (1) {
00240         if (inext >= nNull) return 1; // done with all combos
00241         if (gapCounter[inext] + inext + 1 < nPlyFilled) {
00242           // This is the right spot to reset to
00243           gapCounter[igap] = gapCounter[inext] + inext + 1 - igap;
00244           break;
00245         }
00246         inext++;
00247       } 
00248     }
00249     else {
00250       // We successfully incremented.  Quit looping and return.
00251       break;
00252     }
00253   }  // end loop over igap
00254 
00255   for (int j = 0; j < nNull; j++) {
00256     leaveGap[gapCounter[j]] = true;
00257   }
00258   return 0;
00259 
00260 }


Member Data Documentation

int MdcSegGrouper::_debug [protected, inherited]

Definition at line 96 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::calcParByHits(), MdcSegGrouper::calcParBySegs(), MdcSegGrouper::combineSegs(), MdcSegGrouperSt::fillWithSegs(), fillWithSegs(), MdcSegGrouperSt::incompWithGroup(), incompWithSeg(), MdcSegGrouper::MdcSegGrouper(), resetComb(), MdcSegGrouperSt::storePar(), and MdcSegGrouper::transferHits().

const MdcDetector* MdcSegGrouper::_gm [protected, inherited]

Definition at line 78 of file MdcSegGrouper.h.

Referenced by MdcSegGrouperSt::fillWithSegs(), MdcSegGrouperCsmc::fillWithSegs(), fillWithSegs(), MdcSegGrouper::MdcSegGrouper(), MdcSegGrouperSt::plotStereo(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), MdcSegGrouperSt::resetList(), MdcSegGrouperCsmc::storePar(), and storePar().

const MdcSeg* MdcSegGrouperAx::_seed [private]

Definition at line 46 of file MdcSegGrouperAx.h.

Referenced by resetComb().

HepAList<MdcSeg>** MdcSegGrouper::combList [protected, inherited]

Definition at line 77 of file MdcSegGrouper.h.

Referenced by MdcSegGrouperSt::incompWithGroup(), MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), and MdcSegGrouper::~MdcSegGrouper().

int* MdcSegGrouper::currentSeg [protected, inherited]

Definition at line 70 of file MdcSegGrouper.h.

Referenced by MdcSegGrouperSt::incompWithGroup(), MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::nextGroup(), MdcSegGrouper::resetSegCounters(), and MdcSegGrouper::~MdcSegGrouper().

int* MdcSegGrouper::firstBad [protected, inherited]

Definition at line 72 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), and MdcSegGrouper::~MdcSegGrouper().

int* MdcSegGrouper::firstGood [protected, inherited]

Definition at line 71 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), MdcSegGrouper::resetSegCounters(), and MdcSegGrouper::~MdcSegGrouper().

int* MdcSegGrouper::gapCounter [protected, inherited]

Definition at line 91 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::resetGap(), MdcSegGrouper::updateGap(), and MdcSegGrouper::~MdcSegGrouper().

bool** MdcSegGrouper::isValid [protected, inherited]

Definition at line 73 of file MdcSegGrouper.h.

Referenced by MdcSegGrouperAx(), MdcSegGrouperCsmc::MdcSegGrouperCsmc(), MdcSegGrouperSt::MdcSegGrouperSt(), MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), and MdcSegGrouper::~MdcSegGrouper().

bool* MdcSegGrouper::leaveGap [protected, inherited]

Definition at line 88 of file MdcSegGrouper.h.

Referenced by MdcSegGrouperSt::incompWithGroup(), MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), MdcSegGrouper::updateGap(), and MdcSegGrouper::~MdcSegGrouper().

bool MdcSegGrouper::lTestGroup [protected, inherited]

Definition at line 93 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::MdcSegGrouper(), MdcSegGrouperAx(), MdcSegGrouperCsmc::MdcSegGrouperCsmc(), MdcSegGrouperSt::MdcSegGrouperSt(), and MdcSegGrouper::nextGroup().

bool MdcSegGrouper::lTestSingle [protected, inherited]

Definition at line 94 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::MdcSegGrouper(), MdcSegGrouperAx(), MdcSegGrouperCsmc::MdcSegGrouperCsmc(), MdcSegGrouperSt::MdcSegGrouperSt(), and MdcSegGrouper::nextGroup().

int MdcSegGrouper::maxNull [protected, inherited]

Definition at line 90 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), and resetComb().

int MdcSegGrouper::nDeep [protected, inherited]

Definition at line 68 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::MdcSegGrouper(), MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), and MdcSegGrouper::~MdcSegGrouper().

int MdcSegGrouper::nNull [protected, inherited]

Definition at line 89 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), and MdcSegGrouper::updateGap().

int MdcSegGrouper::nPlyFilled [protected, inherited]

Definition at line 69 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::nextGroup(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), MdcSegGrouper::resetGap(), MdcSegGrouper::resetSegCounters(), and MdcSegGrouper::updateGap().

HepAList<MdcSeg>* MdcSegGrouper::segList [protected, inherited]

Definition at line 79 of file MdcSegGrouper.h.

Referenced by MdcSegGrouper::dumpSegList(), MdcSegGrouperSt::fillWithSegs(), MdcSegGrouperCsmc::fillWithSegs(), fillWithSegs(), MdcSegGrouper::MdcSegGrouper(), MdcSegGrouperSt::plotStereo(), MdcSegGrouperSt::resetComb(), MdcSegGrouperCsmc::resetComb(), resetComb(), MdcSegGrouperSt::resetList(), and MdcSegGrouper::~MdcSegGrouper().


Generated on Tue Nov 29 23:20:17 2016 for BOSS_7.0.2 by  doxygen 1.4.7