17#include "MdcTrkRecon/MdcSegGrouperSt.h"
18#include "CLHEP/Alist/AList.h"
19#include "MdcData/MdcHit.h"
20#include "MdcGeom/BesAngle.h"
21#include "MdcGeom/MdcDetector.h"
22#include "MdcGeom/MdcSuperLayer.h"
23#include "MdcTrkRecon/GmsList.h"
24#include "MdcTrkRecon/MdcSeg.h"
25#include "MdcTrkRecon/MdcSegInfoSterO.h"
26#include "MdcTrkRecon/MdcSegList.h"
27#include "MdcTrkRecon/MdcSegUsage.h"
28#include "MdcTrkRecon/MdcSegWorks.h"
29#include "MdcTrkRecon/MdcTrack.h"
30#include "TrkBase/TrkExchangePar.h"
31#include "TrkBase/TrkFit.h"
32#include "TrkBase/TrkRecoTrk.h"
33#include "TrkFitter/TrkHelixMaker.h"
36#include "AIDA/IHistogram1D.h"
37extern AIDA::IHistogram1D*
g_z0Cut;
38extern AIDA::IHistogram1D*
g_ctCut;
39extern AIDA::IHistogram1D*
g_delCt;
40extern AIDA::IHistogram1D*
g_delZ0;
46 :
MdcSegGrouper( gm, gm->nStereoSuper( -1 ) + gm->nStereoSuper( 1 ), debug ) {
53 for (
int j = 0; j <
nPly(); j++ ) {
isValid[j] = 0; }
57void MdcSegGrouperSt::resetList() {
61 for (
int i = 0; i < nsuper; i++ ) {
segList[i].removeAll(); }
70 int nsuper =
_gm->nSuper();
73 std::cout << std::endl <<
"=====MdcSegGrouperSt::fillWithSegs=====" << std::endl;
76 if ( tkFit == 0 )
return;
78 double kap = 0.5 * par.
omega();
79 double phi0 = par.
phi0();
83 bool lStraight =
false;
84 if ( fabs( kap ) < 1.e-9 ) { lStraight =
true; }
86 double rCurl = 99999999.;
87 if ( !lStraight ) { rCurl = fabs( d0 + 1. / kap ); }
93 for (
int isuper = 0; isuper < nsuper; isuper++ )
97 if ( inList->
count() == 0 )
continue;
105 if ( radius >= rCurl )
break;
106 double phiArg = kap * radius;
107 if ( lStraight ) phiArg = d0 / radius;
108 if ( phiArg < -1.0 ) phiArg = -1.0;
109 else if ( phiArg > 1.0 ) phiArg = 1.0;
118 double maxPhi = maxPhiA;
119 double minPhi = minPhiA;
120 bool phitest = ( maxPhi > minPhi );
128 std::cout << std::endl
129 <<
"Pick segment by phi from " << minPhi <<
" to " << maxPhi
130 <<
" phiAx=" << segStuff.
phiAx <<
" delPhi=" << delPhi << std::endl;
131 for ( ; inSeg != 0; inSeg = (
MdcSeg*)inSeg->
next() )
139 if ( phiSeg < minPhi )
143 std::cout <<
" CUT by phi " << phiSeg <<
"<min " << minPhi << std::endl;
147 else if ( phiSeg > maxPhi )
151 std::cout <<
" CUT by phi " << phiSeg <<
">max " << maxPhi << std::endl;
158 if ( phiSeg > maxPhi && phiSeg < minPhi )
162 std::cout <<
"!phitest " << phiSeg <<
" max " << maxPhi <<
" min " << minPhi
169 if (
_debug == 3 ) std::cout <<
" **KEEP seg phi=" << phiSeg << std::endl;
177 if (
_debug == 3 ) { std::cout <<
" CUT by calcStereo isBad!" << std::endl; }
187 std::cout <<
" CUT by ctcut! " << fabs( info->
ct() )
188 <<
" > cut:" << inSeg->
segPar()->
ctcut <<
" " << phiSeg << std::endl;
196 std::cout <<
" CUT by z0cut! " << fabs( info->
z0() ) <<
" >cut "
197 << inSeg->
segPar()->
z0cut <<
" " << phiSeg << std::endl;
203 segList[isuper].append( inSeg );
214 int nsuper =
_gm->nSuper();
228 for ( isuper = 0; isuper < nsuper; isuper++ )
230 if (
segList[isuper].length() == 0 )
continue;
235 for (
int j = 0; j < (int)
segList[isuper].length(); j++ )
236 {
segList[isuper][j]->plotSeg(); }
256 for ( i = iply - 1; i > 0; i-- )
271 cout <<
"---MdcSegGrouperSt Ct CUT!" << endl;
272 std::cout <<
"first:";
274 std::cout << std::endl;
275 std::cout <<
"test:";
277 std::cout << std::endl;
278 std::cout <<
"first.ct " << firstInfo->
ct() <<
" test.ct " << newInfo->
ct()
279 <<
" delta ct " << firstInfo->
ct() - newInfo->
ct() <<
" Cut "
282 std::cout <<
"--- " << std::endl;
288 double arcFirst = firstInfo->
arc();
289 double arcNew = newInfo->
arc();
290 double zFirst = firstInfo->
z0() + firstInfo->
ct() * arcFirst;
291 double zNew = newInfo->
z0() + newInfo->
ct() * arcNew;
293 double zProj = zFirst / arcFirst * arcNew;
300 cout <<
"MdcSegGrouperSt delZ0Cut not incompWithGroup CUT!" << endl;
302 std::cout <<
" zProj " << zProj <<
" zNew " << zNew <<
" CUT! "
350 for ( i = 0; i <
nDeep; i++ )
365 thisSlay = thisSlay->next() )
369 if ( thisSlay->whichView() == 0 )
continue;
396 std::cout <<
"-----storePar z0 " << parms[0] <<
" ct " << parms[1] << std::endl;
AIDA::IHistogram1D * g_delCt
AIDA::IHistogram1D * g_delZ0
AIDA::IHistogram1D * g_z0Cut
AIDA::IHistogram1D * g_ctCut
void setRad(const double)
GmsListLink * next() const
GmsListLink * first() const
unsigned int count() const
void fillWithSegs(const MdcSegList *inSegs, const MdcTrack *axialTrack)
virtual int incompWithSeg(const MdcSeg *refSeg, const MdcSeg *testSeg)
virtual int incompWithGroup(MdcSeg **segGroup, const MdcSeg *testSeg, int iply)
void resetComb(const MdcSeg *seed=0)
MdcSegGrouperSt(const MdcDetector *gm, int debug)
virtual MdcTrack * storePar(MdcTrack *trk, double parms[2], double chisq, TrkContext &, double trackT0)
MdcSegGrouper(const MdcDetector *gm, int nDeep, int debug)
HepAList< MdcSeg > * segList
HepAList< MdcSeg > ** combList
int calcStereo(MdcSeg *parentSeg, const TrkRecoTrk &track, MdcSegWorks &segStuff)
const GmsList * oneList(int slayIndex) const
const MdcSuperLayer * superlayer() const
static MdcSegParams * segPar()
MdcSegInfo * info() const
void setInfo(MdcSegInfo *ptr)
int whichView(void) const
double delPhi(void) const
virtual TrkExchangePar helix(double fltL) const =0
void addZValues(TrkRecoTrk &theTrack, double z0, double tanDip, double chi2)
const TrkFit * fitResult() const