BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcSegGrouperSt Class Reference

#include <MdcSegGrouperSt.h>

Inheritance diagram for MdcSegGrouperSt:

Public Member Functions

 MdcSegGrouperSt (const MdcDetector *gm, int debug)
 ~MdcSegGrouperSt ()
void fillWithSegs (const MdcSegList *inSegs, const MdcTrack *axialTrack)
void plotStereo () const
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)
virtual MdcTrackstorePar (MdcTrack *trk, double parms[2], double chisq, TrkContext &, double trackT0)
 MdcSegGrouperSt (const MdcDetector *gm, int debug)
 ~MdcSegGrouperSt ()
void fillWithSegs (const MdcSegList *inSegs, const MdcTrack *axialTrack)
void plotStereo () const
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)
virtual MdcTrackstorePar (MdcTrack *trk, double parms[2], double chisq, TrkContext &, double trackT0)
 MdcSegGrouperSt (const MdcDetector *gm, int debug)
 ~MdcSegGrouperSt ()
void fillWithSegs (const MdcSegList *inSegs, const MdcTrack *axialTrack)
void plotStereo () const
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)
virtual MdcTrackstorePar (MdcTrack *trk, double parms[2], double chisq, TrkContext &, double trackT0)
Public Member Functions inherited from MdcSegGrouper
virtual ~MdcSegGrouper ()
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)
void setNoInner (bool noInnerFlag)
virtual ~MdcSegGrouper ()
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)
void setNoInner (bool noInnerFlag)
virtual ~MdcSegGrouper ()
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)
void setNoInner (bool noInnerFlag)

Additional Inherited Members

Protected Member Functions inherited from MdcSegGrouper
 MdcSegGrouper (const MdcDetector *gm, int nDeep, int debug)
void resetSegCounters ()
 MdcSegGrouper (const MdcDetector *gm, int nDeep, int debug)
void resetSegCounters ()
 MdcSegGrouper (const MdcDetector *gm, int nDeep, int debug)
void resetSegCounters ()
Protected Attributes inherited from MdcSegGrouper
int nDeep
int nPlyFilled
int * currentSeg
int * firstGood
int * firstBad
bool ** isValid
HepAList< MdcSeg > ** combList
const MdcDetector_gm
HepAList< MdcSeg > * segList
bool * leaveGap
int nNull
int maxNull
int * gapCounter
bool lTestGroup
bool lTestSingle
int _debug
bool _noInner

Detailed Description

Constructor & Destructor Documentation

◆ MdcSegGrouperSt() [1/3]

MdcSegGrouperSt::MdcSegGrouperSt ( const MdcDetector * gm,
int debug )

Definition at line 45 of file MdcSegGrouperSt.cxx.

46 : MdcSegGrouper( gm, gm->nStereoSuper( -1 ) + gm->nStereoSuper( 1 ), debug ) {
47 //------------------------------------------------------------------------
48
49 lTestGroup = true;
50 lTestSingle = false;
51
52 isValid = new bool*[nPly()];
53 for ( int j = 0; j < nPly(); j++ ) { isValid[j] = 0; }
54}
MdcSegGrouper(const MdcDetector *gm, int nDeep, int debug)

Referenced by storePar().

◆ ~MdcSegGrouperSt() [1/3]

MdcSegGrouperSt::~MdcSegGrouperSt ( )
inline

◆ MdcSegGrouperSt() [2/3]

MdcSegGrouperSt::MdcSegGrouperSt ( const MdcDetector * gm,
int debug )

◆ ~MdcSegGrouperSt() [2/3]

MdcSegGrouperSt::~MdcSegGrouperSt ( )
inline

◆ MdcSegGrouperSt() [3/3]

MdcSegGrouperSt::MdcSegGrouperSt ( const MdcDetector * gm,
int debug )

◆ ~MdcSegGrouperSt() [3/3]

MdcSegGrouperSt::~MdcSegGrouperSt ( )
inline

Member Function Documentation

◆ fillWithSegs() [1/3]

void MdcSegGrouperSt::fillWithSegs ( const MdcSegList * inSegs,
const MdcTrack * axialTrack )

Definition at line 65 of file MdcSegGrouperSt.cxx.

65 {
66 //------------------------------------------------------------------------
67 // Prepare for stereo finding
68 // Load segments consistent with input track (already in phi order)
69 // Assuming from origin
70 int nsuper = _gm->nSuper();
71 resetList(); // Clear existing lists
72 if ( 3 == _debug )
73 std::cout << std::endl << "=====MdcSegGrouperSt::fillWithSegs=====" << std::endl;
74
75 const TrkFit* tkFit = track->track().fitResult();
76 if ( tkFit == 0 ) return;
77 TrkExchangePar par = tkFit->helix( 0.0 );
78 double kap = 0.5 * par.omega();
79 double phi0 = par.phi0();
80 double d0 = par.d0();
81 MdcSegWorks segStuff; // holds some calculated values to pass to segInfo
82
83 bool lStraight = false;
84 if ( fabs( kap ) < 1.e-9 ) { lStraight = true; }
85
86 double rCurl = 99999999.;
87 if ( !lStraight ) { rCurl = fabs( d0 + 1. / kap ); }
88
89 // Create an info object to store the info (will be owned by seg)
90 MdcSegInfoSterO* info = new MdcSegInfoSterO;
91
92 // Loop over superlayers
93 for ( int isuper = 0; isuper < nsuper; isuper++ )
94 {
95 const GmsList* inList = inSegs->oneList( isuper );
96
97 if ( inList->count() == 0 ) continue;
98
99 MdcSeg* inSeg = (MdcSeg*)inList->first();
100 // Only load stereo segments
101 if ( inSeg->superlayer()->whichView() == 0 ) continue;
102
103 // Calculate r & phi (approx) of axial track at slayer
104 double radius = inSeg->superlayer()->rEnd();
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;
110 segStuff.phiArg = phiArg;
111 segStuff.phiAx.setRad( phi0 + asin( phiArg ) ); // Approx??!!!!
112 BesAngle delPhi( fabs( inSeg->superlayer()->delPhi() ) );
113 // BesAngle maxPhiA = segStuff.phiAx + delPhi + 0.05; // allow a little slop
114 // BesAngle minPhiA = segStuff.phiAx - delPhi - 0.05;
115 BesAngle maxPhiA = segStuff.phiAx + delPhi + 0.1; // allow a little slop yzhang 2011-06-15
116 BesAngle minPhiA = segStuff.phiAx - delPhi - 0.1; // yzhang TEMP 2011-06-15
117 // yzhang FIXME
118 double maxPhi = maxPhiA;
119 double minPhi = minPhiA;
120 bool phitest = ( maxPhi > minPhi );
121 // phitest = false => the valid range straddles phi = 0, so skip
122 // checking against phimin and phimax
123
124 // Calc some things needed in segInfo::calcStereo
125 segStuff.wirLen2inv = 1. / ( inSeg->superlayer()->zEnd() * inSeg->superlayer()->zEnd() );
126 // Loop over segs in superlayer
127 if ( _debug == 3 )
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() )
132 {
133 // Test if within allowed phi range
134 BesAngle phiSeg( inSeg->phi() );
135
136 if ( _debug == 3 ) { inSeg->plotSeg(); }
137 if ( phitest )
138 {
139 if ( phiSeg < minPhi )
140 {
141 if ( _debug == 3 )
142 {
143 std::cout << " CUT by phi " << phiSeg << "<min " << minPhi << std::endl;
144 } // yzhang debug
145 continue; // not up to candidates
146 }
147 else if ( phiSeg > maxPhi )
148 {
149 if ( _debug == 3 )
150 {
151 std::cout << " CUT by phi " << phiSeg << ">max " << maxPhi << std::endl;
152 } // yzhang debug
153 break; // past candidates
154 }
155 }
156 else
157 { // !phitest
158 if ( phiSeg > maxPhi && phiSeg < minPhi )
159 {
160 if ( _debug == 3 )
161 {
162 std::cout << "!phitest " << phiSeg << " max " << maxPhi << " min " << minPhi
163 << std::endl;
164 } // yzhang debug
165 continue;
166 }
167 }
168
169 if ( _debug == 3 ) std::cout << " **KEEP seg phi=" << phiSeg << std::endl;
170
171 // std::cout<< __FILE__ << " " << __LINE__ << " MdcSegGrouperSt::fillWithSegs call
172 // calcStereo "<<std::endl;
173 int isBad = info->calcStereo( inSeg, track->track(), segStuff );
174
175 if ( isBad )
176 {
177 if ( _debug == 3 ) { std::cout << " CUT by calcStereo isBad!" << std::endl; }
178 continue;
179 }
180 // Test for sensible values of ct and z0
181 if ( g_z0Cut ) { g_z0Cut->fill( info->z0() ); }
182 if ( g_ctCut ) { g_ctCut->fill( info->ct() ); }
183 if ( fabs( info->ct() ) > inSeg->segPar()->ctcut )
184 {
185 if ( _debug == 3 )
186 {
187 std::cout << " CUT by ctcut! " << fabs( info->ct() )
188 << " > cut:" << inSeg->segPar()->ctcut << " " << phiSeg << std::endl;
189 }
190 continue;
191 }
192 if ( fabs( info->z0() ) > inSeg->segPar()->z0cut )
193 {
194 if ( _debug == 3 )
195 {
196 std::cout << " CUT by z0cut! " << fabs( info->z0() ) << " >cut "
197 << inSeg->segPar()->z0cut << " " << phiSeg << std::endl;
198 }
199 continue;
200 }
201 inSeg->setInfo( info );
202 info = new MdcSegInfoSterO;
203 segList[isuper].append( inSeg );
204 // if(_debug==3)std::cout<<" APPEND this stereo seg"<< std::endl;
205
206 } // end loop over new segs
207 } // end loop over superlayers
208 delete info;
209}
AIDA::IHistogram1D * g_z0Cut
AIDA::IHistogram1D * g_ctCut
int calcStereo(MdcSeg *parentSeg, const TrkRecoTrk &track, MdcSegWorks &segStuff)
const GmsList * oneList(int slayIndex) const
void plotSeg() const
Definition MdcSeg.cxx:198
void setInfo(MdcSegInfo *ptr)
Definition MdcSeg.cxx:97
virtual TrkExchangePar helix(double fltL) const =0

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

◆ fillWithSegs() [2/3]

void MdcSegGrouperSt::fillWithSegs ( const MdcSegList * inSegs,
const MdcTrack * axialTrack )

◆ fillWithSegs() [3/3]

void MdcSegGrouperSt::fillWithSegs ( const MdcSegList * inSegs,
const MdcTrack * axialTrack )

◆ incompWithGroup() [1/3]

int MdcSegGrouperSt::incompWithGroup ( MdcSeg ** segGroup,
const MdcSeg * testSeg,
int iply )
virtual

Implements MdcSegGrouper.

Definition at line 247 of file MdcSegGrouperSt.cxx.

247 {
248 //-------------------------------------------------------------------------
249 // Test that the latest seg lies more or less in a line with the others
250 // Currently requiring line to point to IP; also require rough
251 // agreement in ct.
252 // iply = depth index of current seg (not yet in group)
253
254 int i;
255 // Find first segment already in group
256 for ( i = iply - 1; i > 0; i-- )
257 {
258 if ( !leaveGap[i] ) break;
259 }
260 const MdcSeg* first = ( *combList[i] )[currentSeg[i]];
261
262 // Test ct
263 MdcSegInfoSterO* firstInfo = (MdcSegInfoSterO*)first->info();
264 MdcSegInfoSterO* newInfo = (MdcSegInfoSterO*)testSeg->info();
265
266 if ( g_delCt ) { g_delCt->fill( firstInfo->ct() - newInfo->ct() ); } // yzhang hist cut
267 if ( fabs( firstInfo->ct() - newInfo->ct() ) > testSeg->segPar()->delCtCut )
268 {
269 if ( _debug == 3 )
270 {
271 cout << "---MdcSegGrouperSt Ct CUT!" << endl; // yzhang debug
272 std::cout << "first:";
273 first->plotSeg();
274 std::cout << std::endl;
275 std::cout << "test:";
276 testSeg->plotSeg();
277 std::cout << std::endl;
278 std::cout << "first.ct " << firstInfo->ct() << " test.ct " << newInfo->ct()
279 << " delta ct " << firstInfo->ct() - newInfo->ct() << " Cut "
280 << testSeg->segPar()->delCtCut << std::endl; // yzhang debug
281
282 std::cout << "--- " << std::endl;
283 }
284 return -1;
285 }
286 else {}
287
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;
292 // project line from IP through 1st seg to new seg
293 double zProj = zFirst / arcFirst * arcNew;
294 if ( g_delZ0 ) { g_delZ0->fill( zProj - zNew ); } // yzhang hist cut
295
296 if ( fabs( zProj - zNew ) > testSeg->segPar()->delZ0Cut )
297 {
298 if ( 3 == _debug )
299 {
300 cout << "MdcSegGrouperSt delZ0Cut not incompWithGroup CUT!" << endl; // yzhang debug
301 testSeg->plotSeg();
302 std::cout << " zProj " << zProj << " zNew " << zNew << " CUT! "
303 << testSeg->segPar()->delZ0Cut << std::endl;
304 }
305 return -1;
306 }
307
308 /*
309 double delZ = newInfo->z0() + newInfo->ct() * arcNew - zFirst;
310 double z0 = zFirst - arcFirst * delZ / (arcNew - arcFirst);
311 if (fabs(z0) > testSeg->segPar()->delZ0Cut)return -1;
312
313 for (i = iply - 1; i > 0; i--) {
314 if (segGroup[i] != 0) break;
315 }
316 const MdcSeg *last = segGroup[i];
317 MdcSegInfoSterO* lastInfo = (MdcSegInfoSterO *) last->info();
318
319 // Test that slope from last segment to new one is roughly = slope from
320 // first seg to last
321 double arcLast = lastInfo->arc();
322 double arcFirst = firstInfo->arc();
323 double arcNew = newInfo->arc();
324
325 double delZold = lastInfo->z0() - firstInfo->z0() +
326 lastInfo->ct() * arcLast - firstInfo->ct() * arcFirst;
327 double delArcold = arcLast - arcFirst;
328 double delZnew = newInfo->z0() - lastInfo->z0() +
329 newInfo->ct() * arcNew - lastInfo->ct() * arcLast;
330 double delArcnew = arcNew - arcLast;
331 double p1 = delZold * delArcnew;
332 double p2 = delZnew * delArcold;
333
334 cout << " test: " << p1 << " " << p2 << endl;
335
336 if (fabs(p2 - p1) > 0.02) return -1;
337
338*/
339 return 0;
340}
AIDA::IHistogram1D * g_delCt
AIDA::IHistogram1D * g_delZ0
Index first(Pair i)

◆ incompWithGroup() [2/3]

virtual int MdcSegGrouperSt::incompWithGroup ( MdcSeg ** segGroup,
const MdcSeg * testSeg,
int iply )
virtual

Implements MdcSegGrouper.

◆ incompWithGroup() [3/3]

virtual int MdcSegGrouperSt::incompWithGroup ( MdcSeg ** segGroup,
const MdcSeg * testSeg,
int iply )
virtual

Implements MdcSegGrouper.

◆ incompWithSeg() [1/3]

int MdcSegGrouperSt::incompWithSeg ( const MdcSeg * refSeg,
const MdcSeg * testSeg )
virtual

Implements MdcSegGrouper.

Definition at line 240 of file MdcSegGrouperSt.cxx.

240 {
241 //-------------------------------------------------------------------------
242
243 return 0;
244}

◆ incompWithSeg() [2/3]

virtual int MdcSegGrouperSt::incompWithSeg ( const MdcSeg * refSeg,
const MdcSeg * testSeg )
virtual

Implements MdcSegGrouper.

◆ incompWithSeg() [3/3]

virtual int MdcSegGrouperSt::incompWithSeg ( const MdcSeg * refSeg,
const MdcSeg * testSeg )
virtual

Implements MdcSegGrouper.

◆ plotStereo() [1/3]

void MdcSegGrouperSt::plotStereo ( ) const

Definition at line 212 of file MdcSegGrouperSt.cxx.

212 {
213 //-------------------------------------------------------------------------
214 int nsuper = _gm->nSuper();
215 int isuper;
216 /*
217 for (isuper = 0; isuper < nsuper; isuper++) {
218 if (segList[isuper].length() == 0) continue;
219
220 MdcSeg *inSeg = (MdcSeg *) segList[isuper].first();
221 // Only draw stereo segments
222 if (inSeg->superlayer()->whichView() == 0) continue;
223 for (int j = 0 ; j < (int) segList[isuper].length(); j++) {
224 segList[isuper][j]->plotSeg(0,orange);
225 }
226 }
227 */
228 for ( isuper = 0; isuper < nsuper; isuper++ )
229 {
230 if ( segList[isuper].length() == 0 ) continue;
231
232 MdcSeg* inSeg = (MdcSeg*)segList[isuper].first();
233 // Only draw stereo segments
234 // if (inSeg->superlayer()->whichView() == 0) continue;
235 for ( int j = 0; j < (int)segList[isuper].length(); j++ )
236 { segList[isuper][j]->plotSeg(); }
237 }
238}

◆ plotStereo() [2/3]

void MdcSegGrouperSt::plotStereo ( ) const

◆ plotStereo() [3/3]

void MdcSegGrouperSt::plotStereo ( ) const

◆ resetComb() [1/3]

void MdcSegGrouperSt::resetComb ( const MdcSeg * seed = 0)
virtual

Implements MdcSegGrouper.

Definition at line 343 of file MdcSegGrouperSt.cxx.

343 {
344 //**************************************************************************
345
346 // Delete existing list of valid/invalid segs
347 if ( isValid != 0 )
348 {
349 int i;
350 for ( i = 0; i < nDeep; i++ )
351 {
352 delete[] isValid[i];
353 isValid[i] = 0;
354 }
355 }
356
357 // Grab the seglist for each slayer
358 int islay = 0;
359 int iply = 0;
360 nPlyFilled = 0;
361 nNull = 0;
362
363 // Set up all sorts of stuff for fast grouping of segs in nextGroup()
364 for ( const MdcSuperLayer* thisSlay = _gm->firstSlay(); thisSlay != 0;
365 thisSlay = thisSlay->next() )
366 {
367 // bool noGoodYet = true;
368 islay++;
369 if ( thisSlay->whichView() == 0 ) continue;
370 firstGood[iply] = 0;
371 firstBad[iply] = segList[islay - 1].length();
372 if ( firstGood[iply] > firstBad[iply] ) firstGood[iply] = firstBad[iply];
373 if ( firstGood[iply] == firstBad[iply] )
374 {
375 // If there are no valid segs for this ply, skip it
376 continue;
377 }
378 // Associate correct seglist with this ply
379 combList[iply] = &segList[islay - 1];
380 leaveGap[iply] = false;
381 iply++;
382 }
383
384 nPlyFilled = iply;
386 maxNull = nPlyFilled - 2;
387}

◆ resetComb() [2/3]

void MdcSegGrouperSt::resetComb ( const MdcSeg * seed = 0)
virtual

Implements MdcSegGrouper.

◆ resetComb() [3/3]

void MdcSegGrouperSt::resetComb ( const MdcSeg * seed = 0)
virtual

Implements MdcSegGrouper.

◆ storePar() [1/3]

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

Implements MdcSegGrouper.

Definition at line 390 of file MdcSegGrouperSt.cxx.

391 {
392 //---------------------------------------------------------------------
393 assert( trk != 0 );
394 TrkHelixMaker maker;
395 if ( 3 == _debug )
396 std::cout << "-----storePar z0 " << parms[0] << " ct " << parms[1] << std::endl;
397 maker.addZValues( trk->track(), parms[0], parms[1], chisq );
398 return trk;
399}
void addZValues(TrkRecoTrk &theTrack, double z0, double tanDip, double chi2)

◆ storePar() [2/3]

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

Implements MdcSegGrouper.

◆ storePar() [3/3]

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

Implements MdcSegGrouper.


The documentation for this class was generated from the following files: