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