17#include "MdcGeom/BesAngle.h"
18#include "MdcData/MdcHit.h"
19#include "CLHEP/Alist/AList.h"
20#include "MdcGeom/MdcDetector.h"
21#include "MdcGeom/MdcSuperLayer.h"
22#include "MdcTrkRecon/MdcSeg.h"
23#include "MdcTrkRecon/MdcSegGrouperSt.h"
24#include "MdcTrkRecon/MdcSegList.h"
25#include "MdcTrkRecon/MdcSegInfoSterO.h"
26#include "MdcTrkRecon/MdcSegWorks.h"
27#include "MdcTrkRecon/MdcSegUsage.h"
28#include "MdcTrkRecon/MdcTrack.h"
29#include "MdcTrkRecon/GmsList.h"
30#include "TrkBase/TrkExchangePar.h"
31#include "TrkBase/TrkRecoTrk.h"
32#include "TrkBase/TrkFit.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++) {
59void MdcSegGrouperSt::resetList() {
63 for (
int i = 0; i < nsuper; i++) {
77 if(3==
_debug) std::cout<<std::endl<<
"=====MdcSegGrouperSt::fillWithSegs====="<<std::endl;
80 if (tkFit == 0)
return;
82 double kap = 0.5 * par.
omega();
83 double phi0 = par.
phi0();
87 bool lStraight =
false;
88 if (fabs(kap) < 1.e-9) { lStraight =
true; }
90 double rCurl = 99999999.;
92 rCurl = fabs(d0 + 1./kap);
99 for (
int isuper = 0; isuper < nsuper; isuper++) {
102 if (inList->
count() == 0)
continue;
110 if (radius >= rCurl)
break;
111 double phiArg = kap * radius;
112 if (lStraight) phiArg = d0 / radius;
113 if (phiArg < -1.0) phiArg = -1.0;
114 else if (phiArg > 1.0) phiArg = 1.0;
123 double maxPhi = maxPhiA;
124 double minPhi = minPhiA;
125 bool phitest = (maxPhi > minPhi);
133 if(
_debug==3) std::cout<<std::endl<<
"Pick segment by phi from " <<minPhi<<
" to "<<maxPhi<<
" phiAx="<<segStuff.
phiAx<<
" delPhi="<<delPhi<<std::endl;
134 for ( ; inSeg != 0; inSeg = (
MdcSeg *) inSeg->
next()) {
140 if (phiSeg < minPhi){
141 if (
_debug ==3){std::cout <<
" CUT by phi "<<phiSeg
142 <<
"<min "<<minPhi << std::endl;}
145 else if(phiSeg > maxPhi) {
146 if (
_debug ==3){std::cout <<
" CUT by phi "<<phiSeg
147 <<
">max "<<maxPhi<< std::endl;}
151 if (phiSeg > maxPhi && phiSeg < minPhi) {
152 if (
_debug ==3){std::cout <<
"!phitest "<<phiSeg
153 <<
" max "<<maxPhi<<
" min "<<minPhi << std::endl;}
158 if(
_debug == 3) std::cout<<
" **KEEP seg phi="<<phiSeg<< std::endl;
164 if (
_debug ==3){std::cout <<
" CUT by calcStereo isBad!"<<std::endl;}
171 if (
_debug ==3){std::cout <<
" CUT by ctcut! "
172 <<fabs(info->
ct())<<
" > cut:"<< inSeg->
segPar()->
ctcut<<
" "<<phiSeg<<std::endl; }
176 if (
_debug ==3){std::cout <<
" CUT by z0cut! "
177 <<fabs(info->
z0())<<
" >cut "<< inSeg->
segPar()->
z0cut<<
" "<<phiSeg<<std::endl; }
207 for (isuper = 0; isuper < nsuper; isuper++) {
208 if (
segList[isuper].length() == 0)
continue;
213 for (
int j = 0 ; j < (int)
segList[isuper].length(); j++) {
238 for (i = iply - 1; i > 0; i--) {
248 if (fabs( firstInfo->
ct() - newInfo->
ct() ) >
251 cout <<
"---MdcSegGrouperSt Ct CUT!" << endl;
252 std::cout<<
"first:"; first->plotSeg(); std::cout<<std::endl;
253 std::cout<<
"test:"; testSeg->
plotSeg();std::cout<<std::endl;
254 std::cout <<
"first.ct "<< firstInfo->
ct()
255 <<
" test.ct "<<newInfo->
ct()
256 <<
" delta ct "<<firstInfo->
ct() - newInfo->
ct()
259 std::cout<<
"--- "<< std::endl;
265 double arcFirst = firstInfo->
arc();
266 double arcNew = newInfo->
arc();
267 double zFirst = firstInfo->
z0() + firstInfo->
ct() * arcFirst;
268 double zNew = newInfo->
z0() + newInfo->
ct() * arcNew;
270 double zProj = zFirst / arcFirst * arcNew;
275 cout <<
"MdcSegGrouperSt delZ0Cut not incompWithGroup CUT!" << endl;
277 std::cout<<
" zProj "<< zProj <<
" zNew "<< zNew<<
" CUT! "
324 for (i = 0; i <
nDeep; i++) {
339 thisSlay = thisSlay->
next()) {
342 if (thisSlay->whichView() == 0)
continue;
368 if(3==
_debug) 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
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
const MdcSuperLayer * firstSlay(void) 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)
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)
const MdcSuperLayer * next(void) const
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