BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcTrackListBase.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: MdcTrackListBase.cxx,v 1.68 2017/08/11 02:24:14 zhangy Exp $
4//
5// Environment:
6// Software developed for the BaBar Detector at the SLAC B-Factory.
7//
8// Author(s):
9// Steve Schaffner
10// Zhang Yao(zhangyao@ihep.ac.cn) Migrate to BESIII
11//
12//--------------------------------------------------------------------------
13#include "MdcTrkRecon/MdcTrackListBase.h"
14#include "AIDA/IHistogram1D.h"
15#include "AIDA/IHistogram2D.h"
16#include "CLHEP/Geometry/Point3D.h"
17#include "CLHEP/Geometry/Vector3D.h"
18#include "CLHEP/Matrix/SymMatrix.h"
19#include "CLHEP/Vector/ThreeVector.h"
20#include "Identifier/Identifier.h"
21#include "Identifier/MdcID.h"
22#include "MdcData/MdcHit.h"
23#include "MdcData/MdcHitOnTrack.h"
24#include "MdcData/MdcRecoHitOnTrack.h"
25#include "MdcGeom/BesAngle.h"
26#include "MdcGeom/Constants.h"
27#include "MdcGeom/MdcDetector.h"
28#include "MdcRawEvent/MdcDigi.h"
29#include "MdcRecoUtil/Pdt.h"
30#include "MdcTrkRecon/MdcMap.h"
31#include "MdcTrkRecon/MdcTrack.h"
32#include "TrkBase/TrkDifTraj.h"
33#include "TrkBase/TrkErrCode.h"
34#include "TrkBase/TrkExchangePar.h"
35#include "TrkBase/TrkFit.h"
36#include "TrkBase/TrkFitStatus.h"
37#include "TrkBase/TrkHitList.h"
38#include "TrkBase/TrkRecoTrk.h"
39#include "TrkBase/TrkRep.h"
40#include "TrkFitter/TrkContextEv.h"
41#include <iostream>
42#include <math.h>
43#include <vector>
44//
45#ifndef ENABLE_BACKWARDS_COMPATIBILITY
46// backwards compatibility will be enabled ONLY in CLHEP 1.9
47typedef HepGeom::Point3D<double> HepPoint3D;
48#endif
49
50#ifndef ENABLE_BACKWARDS_COMPATIBILITY
51// backwards compatibility will be enabled ONLY in CLHEP 1.9
52typedef HepGeom::Vector3D<double> HepVector3D;
53#endif
54
55double MdcTrackListBase::m_d0Cut = -999.;
56double MdcTrackListBase::m_z0Cut = -999.;
57double MdcTrackListBase::m_ptCut = -999.;
58
59#include "GaudiKernel/NTuple.h"
60
61//*************************************************************************
63 //*************************************************************************
64 tkParam = tkPar;
65 m_noInner = false;
66 return;
67}
68
69//------------------------------------------------------------------------
71//------------------------------------------------------------------------
72
73// ***********************************************************************
75 // ***********************************************************************
76 int trackId = 0;
77 for ( int itrack = 0; itrack < nTrack(); itrack++ )
78 {
79 MdcTrack* track = ( *this )[itrack];
80 // tkStat: 0,PatRec 1,MdcxReco 2,Tsf 3,CurlFinder
81 int tkStat = 0;
82 track->storeTrack( trackId, trackList, hitList, tkStat );
83 ++trackId;
84 }
85 HepAListDeleteAll( *this ); // Discard the husks
86 removeAll();
87 return;
88}
89
90//*************************************************************************
92 //*************************************************************************
93 std::cout << "nTrack " << nTrack() << std::endl; // yzhang debug
94 for ( int itrack = 0; itrack < nTrack(); itrack++ )
95 {
96 MdcTrack* atrack = ( *this )[itrack];
97 if ( atrack == NULL ) continue;
98 atrack->track().printAll( cout );
99 }
100}
101
102//*************************************************************************
104 //*************************************************************************
105 // Look at all hits used in two or more tracks. Assign hits to the track
106 // that gives the lower residual. If, however, many hits are shared by
107 // a pair of tracks, assign them all to one or the other.
108 // Refit any tracks that have had hits dropped.
109 // The implementation is very clumsy, since the arrays were originally
110 // indexed by id # => there is an unneeded layer of indexing.
111
112 // return # of tracks deleted
113
114 if ( 8 == tkParam.lPrint )
115 { std::cout << "=======Print before arbitrateHits=======" << std::endl; }
116
117 int nDeleted = 0;
118 std::vector<MdcTrack*> trksToKill;
119 trksToKill.reserve( 4 );
120
121 MdcMap<long, long> idMap;
122
123 // usedInTrackNum records how many shared hits track has with each other track
124 int* usedInTrackNum = new int[nTrack()];
125 // to navigate from track id # to track pointer:
126 MdcTrack** trkXRef = new MdcTrack*[nTrack()];
127 // refitTrack flags track id #s of tracks to be refit
128 int* refitTrack = new int[nTrack()];
129 for ( int i = 0; i < nTrack(); i++ ) { refitTrack[i] = 0; }
130
131 // Fill xref table
132 int itrack;
133 for ( itrack = 0; itrack < nTrack(); itrack++ )
134 {
135 MdcTrack* atrack = ( *this )[itrack];
136 if ( atrack == 0 ) continue; // I don't think it can be, but . . .
137 idMap.put( atrack->track().id(), itrack );
138 trkXRef[itrack] = atrack;
139 }
140 // Loop through the tracks
141 for ( itrack = 0; itrack < nTrack(); itrack++ )
142 {
143
144 if ( 8 == tkParam.lPrint ) std::cout << "arbitrate track No." << itrack << std::endl;
145 MdcTrack* atrack = ( *this )[itrack];
146 if ( atrack == 0 ) continue;
147 TrkRecoTrk& aRecoTrk = atrack->track();
148 int lRefit = 0;
149 int trackOld = -1;
150 const TrkFit* tkFit = aRecoTrk.fitResult();
151 assert( tkFit != 0 );
152 TrkHitList* hitList = aRecoTrk.hits();
153 assert( hitList != 0 );
154 restart:
155 for ( int ii = 0; ii < nTrack(); ii++ ) usedInTrackNum[ii] = 0;
156
157 // Loop through hits on track, counting # used in other tracks
158 int nPrev = 0;
159 int nHitDeleted = 0;
160 int maxGapLength = 0; // yzhang 2011-07-29 # of max continuous no hits layer for a track,
161 // Gap defined as missing layer >=2
162 int nGapGE2 = 0; // yzhang 2011-07-29 # of no hits gap for a track
163 int nGapGE3 = 0; // yzhang 2011-07-29 # of no hits gap for a track
164 int nHitInLayer[43]; // yzhang 2010-09-20 for bad tracking testing
165 int nDeleteInLayer[43]; // yzhang 2010-09-20
166 for ( int i = 0; i < 43; i++ )
167 {
168 nHitInLayer[i] = 0;
169 nDeleteInLayer[i] = 0;
170 }
171 if ( 8 == tkParam.lPrint ) std::cout << "--arbitrate--" << std::endl;
172 for ( TrkHitList::hot_iterator ihit( hitList->begin() ); ihit != hitList->end(); ++ihit )
173 {
174 int nUsed = ihit->hit()->nUsedHits();
175 if ( 8 == tkParam.lPrint )
176 {
177 std::cout << "nUsed=" << nUsed << ":";
178 ihit->hit()->printAll( std::cout );
179 }
180 if ( 8 == tkParam.lPrint )
181 {
182 double deltaChi = -999;
183 ihit->getFitStuff( deltaChi );
184 std::cout << "deltaChi=" << deltaChi << std::endl;
185 }
186 int layer = ihit->layerNumber();
187 nHitInLayer[layer]++;
188
189 if ( !ihit->isActive() )
190 {
191 //-----------------------------------
192 // yzhang delete not ACT hit 2010-05-14
193 //-----------------------------------
194 if ( tkParam.lRemoveInActive )
195 { // 2010-05-16
196 nDeleteInLayer[layer]++;
197 if ( 8 == tkParam.lPrint ) { std::cout << "=remove above inactive " << std::endl; }
198 TrkFundHit* hit = const_cast<TrkFundHit*>( ihit->hit() );
199 hitList->removeHit( hit );
200 if ( ihit == hitList->end() ) break;
201 --ihit; // be careful of the iterator, yzhang
202 }
203 continue; // active hits only yzhang 2009-11-03 delete
204 }
205 if ( nUsed > 1 )
206 {
207 bool wasUsed = false;
208 std::pair<TrkFundHit::hot_iterator, TrkFundHit::hot_iterator> q =
209 ihit->hit()->getUsedHits();
210 for ( TrkFundHit::hot_iterator i = q.first; i != q.second; ++i )
211 {
212 if ( !i->isActive() ) continue; // yzhang 2009-11-03 delete
213 TrkRecoTrk* recoTrk = i->parentTrack();
214 // zhangjin
215 int wasDel = 0;
216 for ( int idel = 0; idel < trksToKill.size(); idel++ )
217 {
218 if ( recoTrk == &( trksToKill[idel]->track() ) ) wasDel = 1;
219 }
220 if ( wasDel == 1 ) continue;
221 // zhangjin
222 int id = recoTrk->id();
223 if ( id == aRecoTrk.id() ) continue; // skip same track
224 long index = 0;
225 bool findKey = idMap.get( id, index );
226 // if( findKey == false ) continue; //zhangjin 2017/6/27
227 assert( index >= 0 );
228 usedInTrackNum[index]++;
229 if ( 8 == tkParam.lPrint )
230 {
231 std::cout << " track " << itrack << "&" << index << " shared hits "
232 << usedInTrackNum[index] << ":";
233 ihit->printAll( std::cout );
234 }
235 wasUsed = true;
236 }
237 if ( wasUsed ) nPrev++;
238 } // end nUsed > 1
239 } // end loop over hits
240
241 int testGap = 0;
242 // std::cout<< __FILE__ << " " << itrack<< " "<<std::endl;
243 for ( int i = 0; i < 43; i++ )
244 {
245 // std::cout<< __FILE__ << " " << i<< " nHitInLayer "<<nHitInLayer[i]<<"
246 // nDeleteInLayer "<<nDeleteInLayer[i]<<std::endl;
247 if ( 8 == tkParam.lPrint )
248 {
249 std::cout << i << " nHitInLayer " << nHitInLayer[i] << " nDeleteInLayer "
250 << nDeleteInLayer[i] << std::endl;
251 }
252 // 1.only hit in layer deleted; 2.no hits in layer; 3.got hits in layer;
253 if ( nHitInLayer[i] > 0 && ( nHitInLayer[i] - nDeleteInLayer[i] ) == 0 )
254 {
255 // only hit in layer i has been deleted
256 nHitDeleted++;
257 if ( 8 == tkParam.lPrint )
258 { cout << "rec hits have been deleted in this layer" << std::endl; }
259 testGap++;
260 // std::cout<< __FILE__ << " " << __LINE__ << " testGap3 "<<testGap<<std::endl;
261 }
262 else if ( nHitInLayer[i] == 0 )
263 {
264 // no hits in this layer i
265 testGap++;
266 // std::cout<< __FILE__ << " " << __LINE__ << " testGap3 "<<testGap<<std::endl;
267 }
268 else
269 {
270 // std::cout<< __FILE__ << " " << __LINE__ << " testGap3 "<<testGap<<std::endl;
271 // got hit in layer i
272 if ( testGap >= 2 )
273 {
274 nGapGE2++;
275 if ( testGap >= 3 ) { nGapGE3++; }
276 if ( testGap > maxGapLength ) maxGapLength = testGap;
277 // std::cout<< __FILE__ << " " << __LINE__ << " maxGapLength
278 // "<<maxGapLength<<std::endl;
279 }
280 testGap = 0;
281 } // end for layer 43
282 }
283
284 bool toBeDeleted = false;
285
286 if ( tkParam.lPrint > 1 )
287 std::cout << "arbitrateHits tkNo:" << itrack << " nGapGE2= " << nGapGE2
288 << " nGapGE3= " << nGapGE3 << " maxGapLength= " << maxGapLength << std::endl;
289 // yzhang add nHitDeleted cut 2010-09-13
290 // remove track if # not Active
291 if ( nHitDeleted >= tkParam.nHitDeleted )
292 {
293 if ( tkParam.lPrint > 1 )
294 {
295 cout << "arbitrateHits: nHitDeleted " << nHitDeleted << " >= " << tkParam.nHitDeleted
296 << " Killing tkNo " << itrack << endl;
297 }
298 toBeDeleted = true;
299 }
300
301 // yzhang add nGap cut 2011-07-29
302 // remove track with gaps and big gap
303 if ( nGapGE2 >= tkParam.nGapGE2 )
304 {
305 if ( tkParam.lPrint > 1 )
306 {
307 cout << "arbitrateHits: nGapGE2 " << nGapGE2 << " >= " << tkParam.nGapGE2
308 << " Killing tkNo " << itrack << endl;
309 }
310 toBeDeleted = true;
311 }
312 if ( nGapGE3 >= tkParam.nGapGE3 )
313 {
314 if ( tkParam.lPrint > 1 )
315 {
316 cout << "arbitrateHits: nGapGE3 " << nGapGE3 << " >= " << tkParam.nGapGE3
317 << " Killing tkNo " << itrack << endl;
318 }
319 toBeDeleted = true;
320 }
321 if ( maxGapLength >= tkParam.maxGapLength )
322 {
323 if ( tkParam.lPrint > 1 )
324 {
325 cout << "arbitrateHits: maxGapLength " << maxGapLength
326 << " >= " << tkParam.maxGapLength << " Killing tkNo " << itrack << endl;
327 }
328 toBeDeleted = true;
329 }
330
331 if ( toBeDeleted )
332 {
333 nDeleted++;
334 delete &( atrack->track() ); // Delete the RecoTrk inside atrack
335 atrack->setTrack( 0 );
336 trksToKill.push_back( atrack );
337 continue;
338 }
339
340 //*******
341 // How many hits are shared with a single track?
342 int nMost = 0;
343 int trackMost = 0;
344 for ( int ii = 0; ii < nTrack(); ii++ )
345 {
346 if ( 8 == tkParam.lPrint )
347 {
348 std::cout << "tk:" << itrack << "&" << ii << " shared " << usedInTrackNum[ii]
349 << " hits " << std::endl;
350 }
351 if ( usedInTrackNum[ii] > nMost )
352 {
353 nMost = usedInTrackNum[ii];
354 trackMost = ii; // index of track w/ most hits in common w/ current trk
355 }
356 }
357
358 // A little precaution against infinite loops:
359 if ( trackMost == trackOld )
360 {
361 std::cout << "ErrMsg(error) MdcTrackListBase:"
362 << "Something ghastly happened in MdcTrackListBase::arbitrateHits"
363 << std::endl;
364 return 0;
365 }
366 trackOld = trackMost;
367
368 //******
369 // Decide whether to handle hits individually or in group
370 double groupDiff = 0.0; // relative quality of grouped hits for the two
371 // tracks; > 0. => current track worse
372 int nFound = 0; // # of grouped hits located so far
373 TrkHitOnTrk** theseHits = 0; // grouped hits as seen in current track
374 TrkHitOnTrk** thoseHits = 0; // grouped hits as seen in the other track
375 int lGroupHits = 0;
376
377 if ( nMost >= tkParam.nOverlap )
378 {
379 if ( 8 == tkParam.lPrint )
380 {
381 std::cout << "track " << trackMost << " shared " << nMost << " hits > Cut nOverlap "
382 << tkParam.nOverlap << ", group hits!" << std::endl;
383 }
384 lGroupHits = 1;
385 theseHits = new TrkHitOnTrk*[nMost];
386 thoseHits = new TrkHitOnTrk*[nMost];
387 }
388
389 //*********
390 // Go back through hits on this track, looking up the overlap of each
391 // if grouping hits, only deal with hits shared with trackMost on this pass
392 // otherwise, deal with all shared hits as encountered
393 if ( 8 == tkParam.lPrint )
394 std::cout << "Go back through hits, looking up overlap hits" << std::endl;
395 if ( nMost > 0 )
396 {
397 if ( 8 == tkParam.lPrint ) std::cout << " nHits= " << hitList->nHit() << std::endl;
398 for ( TrkHitList::hot_iterator ihit( hitList->begin() ); ihit != hitList->end(); ++ihit )
399 {
400 int nUsed = ihit->hit()->nUsedHits();
401
402 if ( 8 == tkParam.lPrint )
403 {
404 std::cout << "--hit go back, nUsed=" << nUsed << ":";
405 ihit->hit()->printAll( std::cout );
406 }
407
408 // only shared hits
409 if ( nUsed < 2 ) { continue; }
410
411 // active hits only
412 if ( !ihit->isActive() )
413 {
414 if ( 8 == tkParam.lPrint ) { std::cout << "act=0 continue" << std::endl; }
415 continue;
416 }
417
418 //*** look at all overlaps for this hit
419 std::pair<TrkFundHit::hot_iterator, TrkFundHit::hot_iterator> q =
420 ihit->hit()->getUsedHits();
421 while ( q.first != q.second )
422 { // nUsed > 0
423 int dropThisHit = 0;
424 TrkHitOnTrk* otherHot = const_cast<TrkHitOnTrk*>( ( --q.second ).get() );
425 TrkRecoTrk* otherTrack = otherHot->parentTrack();
426
427 if ( !otherHot->isActive() ) continue;
428
429 // Again, skip "overlap" of track with itself
430 if ( &aRecoTrk == otherTrack ) continue;
431 int otherId = otherTrack->id();
432 long otherIndex = -1;
433 idMap.get( otherId, otherIndex );
434 assert( otherIndex >= 0 );
435
436 // if grouping hits, only look at hits shared with trackMost
437 if ( lGroupHits && otherIndex != trackMost ) continue;
438
439 if ( lGroupHits )
440 {
441 if ( 8 == tkParam.lPrint ) { std::cout << "group hits " << std::endl; }
442 // Calculate contribution of group to each chisq/dof
443 // groupDiff += fabs(ihit->resid(0)) -
444 // fabs(otherHot->resid(0));
445 // Hack to handle tracks with 5 active hits:
446 int aDof = tkFit->nActive() - 5;
447 assert( otherTrack->fitResult() != 0 );
448 int otherDof = otherTrack->fitResult()->nActive() - 5;
449 if ( aDof <= 0 ) { groupDiff = 999; }
450 else if ( otherDof <= 0 ) { groupDiff = -999; }
451 else
452 {
453 groupDiff +=
454 ihit->resid( 0 ) * ihit->resid( 0 ) * ihit->weight() / aDof -
455 otherHot->resid( 0 ) * otherHot->resid( 0 ) * otherHot->weight() / otherDof;
456 }
457 theseHits[nFound] = const_cast<TrkHitOnTrk*>( ihit.get() );
458 thoseHits[nFound] = otherHot;
459 nFound++;
460 dropThisHit = 1;
461 }
462 else
463 { // handle hits individually
464
465 if ( 8 == tkParam.lPrint )
466 { std::cout << "handle hits individually" << std::endl; }
467 nFound++;
468 if ( fabs( ihit->resid( 0 ) ) > fabs( otherHot->resid( 0 ) ) )
469 {
470 // turn off (inactivate) hit on this track
471 lRefit = 1;
472 // ihit->hit()->setUnusedHit(ihit.get());
473 // Should I be setting inactive, or deleting the hit???????
474 const_cast<TrkHitOnTrk*>( ihit.get() )->setActivity( 0 );
475 dropThisHit = 1;
476 if ( 8 == tkParam.lPrint )
477 {
478 std::cout << "dorp hit ";
479 const_cast<TrkHitOnTrk*>( ihit.get() )->print( std::cout );
480 }
481 break; // found other hit, so quit loop
482 }
483 else
484 {
485 // inactivate hit on other track
486 refitTrack[otherIndex] = 1;
487 // otherHot->hit()->setUnusedHit(otherHot);
488 otherHot->setActivity( 0 );
489 if ( 8 == tkParam.lPrint )
490 {
491 std::cout << "inactive hit on other track";
492 const_cast<TrkHitOnTrk*>( ihit.get() )->print( std::cout );
493 }
494 break; // found other hit, so quit loop
495 }
496 } // end grouped/individual treatment
497
498 if ( dropThisHit == 1 ) break; // don't look for other matches since
499 // this hit is now turned off
500 } // end loop over nUsed
501
502 // Quit if we've found all of the shared hits on this track
503 if ( lGroupHits && nFound == nMost || nFound == nPrev )
504 {
505 if ( 8 == tkParam.lPrint )
506 {
507 std::cout << "we've found all of the shared hits on this track,Quit" << std::endl;
508 }
509 break;
510 }
511
512 } // end loop over hits
513
514 // Decide which track grouped hits belong with and inactivate accordingly
515 if ( lGroupHits )
516 {
517 if ( 8 == tkParam.lPrint )
518 {
519 cout << "nGroup: " << nMost << " groupDiff: " << groupDiff << endl;
520 cout << "Track: " << aRecoTrk.id() << " nHit: " << hitList->nHit()
521 << " nActive: " << tkFit->nActive()
522 << " chisq/dof: " << tkFit->chisq() / ( tkFit->nActive() - 5 ) << endl;
523 TrkRecoTrk& othTrack = trkXRef[trackMost]->track();
524 cout << "Track: " << othTrack.id() << " nHit: " << othTrack.hits()->nHit()
525 << " nActive: " << othTrack.fitResult()->nActive() << " chisq/dof: "
526 << othTrack.fitResult()->chisq() / ( othTrack.fitResult()->nActive() - 5 )
527 << endl;
528 }
529
530 if ( groupDiff > 0.0 )
531 {
532 // inactivate hits on this track
533 lRefit = 1;
534 for ( int ii = 0; ii < nMost; ii++ )
535 {
536 TrkHitOnTrk* alink = theseHits[ii];
537 TrkFundHit* hit = const_cast<TrkFundHit*>( alink->hit() );
538 hitList->removeHit( hit ); // yzhang 2011-02-12
539 // alink->setActivity(0);
540 }
541 if ( 8 == tkParam.lPrint )
542 std::cout << "inactive hits on this track, No." << aRecoTrk.id() << std::endl;
543 }
544 else
545 {
546 // inactivate hits on other track
547 refitTrack[trackMost] = 1;
548 for ( int ii = 0; ii < nMost; ii++ )
549 {
550 TrkHitOnTrk* alink = thoseHits[ii];
551 TrkFundHit* hit = const_cast<TrkFundHit*>( alink->hit() );
552 TrkRecoTrk& othTrack = trkXRef[trackMost]->track(); // zhangjin
553 othTrack.hits()->removeHit( hit ); // zhangjin
554 // hitList->removeHit(hit);//yzhang 2011-02-12
555 // alink->setActivity(0);
556 }
557 if ( 8 == tkParam.lPrint ) std::cout << "inactive hits on other track " << std::endl;
558 }
559 delete[] theseHits;
560 delete[] thoseHits;
561
562 } // end if lGroupHits
563
564 } // end if nMost > 0
565
566 //*********
567 // Refit this track, if any hits have been dropped
568 TrkErrCode fitResult;
569 long index = -1;
570 idMap.get( aRecoTrk.id(), index );
571 assert( index >= 0 );
572
573 if ( lRefit || refitTrack[index] == 1 )
574 {
575 if ( 8 == tkParam.lPrint )
576 { std::cout << "after group ,refit track" << aRecoTrk.id() << std::endl; }
577 fitResult = hitList->fit();
578 aRecoTrk.status()->addHistory(
580 "Arbitrated" ),
581 "MdcTrkRecon" );
582 if ( fitResult.failure() && ( 8 == tkParam.lPrint ) ) { fitResult.print( std::cerr ); }
583
584 double chisqperDOF;
585 bool badFit = true;
586 if ( fitResult.success() )
587 {
588 badFit = false;
589 int nDOF = tkFit->nActive() - 5;
590 if ( nDOF > 5 ) { chisqperDOF = tkFit->chisq() / nDOF; }
591 else { chisqperDOF = tkFit->chisq(); }
592
593 if ( chisqperDOF > tkParam.maxChisq ) badFit = true;
594 if ( tkFit->nActive() < tkParam.minHits ) badFit = true;
595 double tem2 = (float)hitList->nHit() - tkFit->nActive();
596 if ( tkParam.lUseQualCuts )
597 {
598 if ( tem2 >= tkParam.maxNmissTrack ) badFit = true;
599 if ( tem2 / float( hitList->nHit() ) > tkParam.maxNmissNorm ) { badFit = true; }
600 }
601 if ( 8 == tkParam.lPrint )
602 std::cout << "fit quality:"
603 << " chisqperDof " << chisqperDOF << "?>" << tkParam.maxChisq
604 << " nActive " << tkFit->nActive() << "?<" << tkParam.minHits << " nHit "
605 << hitList->nHit() << " nhit-act " << tem2 << "?>= nMiss "
606 << tkParam.maxNmissTrack << " hit-act/nhit "
607 << tem2 / float( hitList->nHit() ) << "?> MissNorm "
608 << tkParam.maxNmissNorm << std::endl;
609 }
610 if ( 8 == tkParam.lPrint )
611 {
612 cout << "Refitting track " << aRecoTrk.id() << " success = " << fitResult.success()
613 << "\n";
614 }
615 // If the track no longer passes cuts, delete it
616 if ( fitResult.failure() || badFit )
617 {
618 nDeleted++;
619 // Don't change the track list while we're iterating through it!
620 // remove(atrack);
621 // int id = aRecoTrk.id();
622 if ( 8 == tkParam.lPrint )
623 {
624 cout << "fitResult.failure? " << fitResult.failure() << " badFit? " << badFit
625 << " Killing tkNo " << itrack << endl;
626 }
627 // delete &(atrack->track()); // Delete the RecoTrk inside atrack
628 // atrack->setTrack(0);
629 trksToKill.push_back( atrack );
630 continue;
631 }
632 } // end if lRefit
633
634 if ( lGroupHits ) goto restart;
635
636 } // end loop over tracks
637 if ( 8 == tkParam.lPrint ) std::cout << "end of loop over tracks" << std::endl;
638
639 // Remove dead track husks
640 for ( int itk = 0; itk < (int)trksToKill.size(); itk++ )
641 {
642 delete &( trksToKill[itk]->track() ); // zhangjin
643 trksToKill[itk]->setTrack( 0 ); // zhangjin
644 remove( trksToKill[itk] );
645 if ( 8 == tkParam.lPrint ) std::cout << "remode dead track No." << itk << std::endl;
646 }
647 if ( 8 == tkParam.lPrint ) std::cout << "---end of arbitrateHits" << std::endl;
648
649 delete[] usedInTrackNum;
650 delete[] refitTrack;
651 delete[] trkXRef;
652 return nDeleted;
653}
654
655//**************************************************************************
657 //**************************************************************************
658 tkParam = tkPar;
659}
660
661//--------------------------------------------------------------------
663 //--------------------------------------------------------------------
664 if ( atrack != 0 )
665 {
667 delete atrack;
668 }
669}
670
671//**************************************************************************
672void MdcTrackListBase::transferTrack() {
673 //**************************************************************************
674}
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition KKsem.h:33
bool get(const K &theKey, V &theAnswer) const
void put(const K &, const V &)
void newParams(const MdcTrackParams &tkPar)
MdcTrackListBase(const MdcTrackParams &tkPar)
void store(RecMdcTrackCol *, RecMdcHitCol *)
void remove(MdcTrack *atrack)
void storeTrack(int trackId, RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat)
Definition MdcTrack.cxx:145
virtual double chisq() const =0
void print(std::ostream &ostr) const
virtual void addHistory(const TrkErrCode &status, const char *modulename)
virtual int nActive() const =0
TrkErrCode fit()
bool removeHit(const TrkFundHit *theHit)
void setActivity(bool turnOn)
double resid(bool exclude=false) const
double weight() const
TrkRecoTrk * parentTrack() const
virtual void print(std::ostream &) const
const TrkId & id() const
const TrkFit * fitResult() const
virtual void printAll(std::ostream &) const
const TrkFitStatus * status() const