StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiMaker.cxx
1 // $Id: StiMaker.cxx,v 1.242 2019/06/20 16:04:55 genevb Exp $
5 //
66 #include <Stiostream.h>
67 #include <math.h>
68 #include "TSystem.h"
69 #include "TTree.h"
70 #if ROOT_VERSION_CODE < 331013
71 #include "TCL.h"
72 #else
73 #include "TCernLib.h"
74 #endif
75 #include "TDataSet.h"
76 #include "TDataSetIter.h"
77 #include "StMessMgr.h"
78 #include "StChainOpt.h"
79 #include "SystemOfUnits.h"
80 #include "StMemStat.h"
81 #include "PhysicalConstants.h"
82 #include "StDetectorId.h"
83 #include "StEventTypes.h"
84 #include "Sti/Base/EditableFilter.h"
85 #include "Sti/StiKalmanTrackFinder.h"
86 #include "Sti/StiKalmanTrackFitter.h"
87 #include "Sti/StiTrackContainer.h"
88 #include "Sti/StiDefaultTrackFilter.h"
89 #include "Sti/StiMasterDetectorBuilder.h"
90 #include "Sti/Star/StiStarDetectorGroup.h"
91 #include "StiTpc/StiTpcDetectorGroup.h"
92 #include "StiTpc/StiTpcHitLoader.h"
93 #include "StiSvt/StiSvtDetectorGroup.h"
94 #include "StiSsd/StiSsdDetectorGroup.h"
95 #include "StiSsd/StiSstDetectorGroup.h"
96 #include "StiPxl/StiPxlDetectorGroup.h"
97 #include "Sti/StiKalmanTrackNode.h"
98 #include "Sti/StiKalmanTrack.h"
99 #include "Sti/StiVertexFinder.h"
100 #include "Sti/StiDetectorContainer.h"
101 #include "StiMaker/StiStEventFiller.h"
102 #include "Sti/StiDefaultToolkit.h"
103 #include "StiMaker.h"
104 #include "TFile.h"
105 #include "TCanvas.h"
106 #include "StDetectorDbMaker/StiKalmanTrackFinderParameters.h"
107 #include "StDetectorDbMaker/StiKalmanTrackFitterParameters.h"
108 #include "TString.h"
109 #include "TObjString.h"
110 
111 #include "StDetectorDbMaker/StiHitErrorCalculator.h"
112 // #include "StiRnD/Ist/StiIstDetectorGroup.h"
113 // #include "StiRnD/Ist/StiIstDetectorGroup.h"
114 #include "StiIst/StiIstDetectorGroup.h"
115 
116 #include "StiUtilities/StiDebug.h"
117 #include "StiUtilities/StiPullEvent.h"
118 #include "TDataSet.h"
119 #include "TGeometry.h"
120 #include "Sti/StiTimer.h"
121 #include "StiDetectorVolume.h"
122 #include "StarMagField.h"
123 #if 0
124 #include "StG2TrackVertexMap.h"
125 #endif
126 #include "StTpcDb/StTpcDb.h"
127 #include "StSsdDbMaker/StSsdDbMaker.h"
128 #include "StSsdDbMaker/StSstDbMaker.h"
129 #include "StSvtDbMaker/StSvtDbMaker.h"
134 static const float MIN_VTX_ERR2 = 1e-4*1e-4;
135 enum { kHitTimg,kGloTimg,kVtxTimg,kPriTimg,kFilTimg};
136 
137 void CountHits();
138 
139 //_____________________________________________________________________________
140 StiMaker::StiMaker(const Char_t *name) :
141  StMaker(name),
142  fVolume(0),
143  _initialized(false),
144  _toolkit(0),
145  _hitLoader(0),
146  _seedFinder(0),
147  _tracker(0),
148  _fitter(0),
149  _eventFiller(0),
150  _trackContainer(0),
151  _vertexFinder(0),
152  _loaderTrackFilter(0),
153  _loaderHitFilter(0)
154 
155 {
156  mMaxTimes = 0;
157  memset(mTimg,0,sizeof(mTimg));
158  cout <<"StiMaker::StiMaker() -I- Starting"<<endl;
159  mPullFile=0; mPullEvent=0;mPullTTree=0;
160  memset(mPullHits,0,sizeof(mPullHits));
161  mTotPrimTks[0]=mTotPrimTks[1]=0;
162  if (!StiToolkit::instance()) new StiDefaultToolkit;
163  _toolkit = StiToolkit::instance();
164  SetAttr("useTpc" ,kTRUE);
165  SetAttr("activeTpc" ,kTRUE);
166 
167  SetAttr("useSvt" ,kTRUE);
168  SetAttr("useSsd" ,kTRUE);
169 
170  //SetAttr("usePixel" ,kTRUE);
171  //SetAttr("useSst" ,kTRUE);
172  //SetAttr("useIst" ,kTRUE);
173 
174 //SetAttr("activeSsd" ,kTRUE);
175 //SetAttr("useAux" ,kTRUE); // Auxiliary info added to output for evaluation
176  SetAttr("useEventFiller" ,kTRUE);
177  SetAttr("useTracker" ,kTRUE);
178  SetAttr("useVertexFinder" ,kTRUE);
179  SetAttr("Alignment" ,kFALSE);
180  if (strstr(gSystem->Getenv("STAR"),".DEV"))
181  SetAttr("useAux",kTRUE); // Auxiliary info added to output for evaluation
182 }
183 
184 //_____________________________________________________________________________
185 StiMaker::~StiMaker()
186 {
187  cout <<"StiMaker::~StiMaker() -I- Started/Done"<<endl;
188 }
189 
190 //_____________________________________________________________________________
191 void StiMaker::Clear(const char*)
192 {
193  if (_tracker ) _tracker->clear();
194  if (mPullEvent) mPullEvent->Clear();
195  StMaker::Clear();
196 }
197 
198 //_____________________________________________________________________________
200 {
201  StiDebug::Finish();
202 // Finish Pull
203  if (mPullTTree) {
204  if (Debug()) mPullTTree->Print();
205  if (mPullFile) {
206  TFile *tfile = mPullTTree->GetCurrentFile(); //just in case we switched to a new file
207  tfile->Write();
208  tfile->Close();
209  mPullFile = 0;
210  mPullTTree = 0;
211  }
212  }
213  StiTimer::Print();
214  StiTimer::Clear();
215 
216 static const char *timg[] = {"HitLoa","GlobFnd","VtxFnd","PriFnd","FilFnd",0};
217  if (mTimg[0]) {
218  for (int i=0;timg[i];i++) {
219  Info("Timing","%s(%d) \tCpuTime = %6.2f seconds,\tPerEvent = %g seconds"
220  ,timg[i],mTimg[i]->Counter(),mTimg[i]->CpuTime()
221  ,mTimg[i]->CpuTime()/mTimg[i]->Counter());
222  } }
223  if (_tracker) _tracker->finish();
224 
225  return StMaker::Finish();
226 }
227 
228 //_____________________________________________________________________________
229 Int_t StiMaker::Init()
230 {
231 
232  StiDebug::Init();
233  StiTimer::Init("StiTrackFinder::find() TIMING"
234  ,StiTimer::fgFindTimer,StiTimer::fgFindTally);
235  if (IAttr("Alignment")) SetAttr(".Privilege",kTRUE);
236  _loaderHitFilter = 0; // not using this yet.
237  mTotPrimTks[1] = IAttr("maxTotPrims");
238  if (*SAttr("maxRefiter")) StiKalmanTrack::setMaxRefiter(IAttr("maxRefiter"));
239 
240 
241  if (*SAttr("maxRefiter")) StiKalmanTrack::setMaxRefiter(IAttr("maxRefiter"));
242  if (IAttr("useTiming")) {
243  for (int it=0;it<(int)(sizeof(mTimg)/sizeof(mTimg[0]));it++){
244  mTimg[it]= new TStopwatch(); mTimg[it]->Stop();
245  } }
246 
247  return StMaker::Init();
248 }
249 
250 //_____________________________________________________________________________
251 Int_t StiMaker::InitDetectors()
252 {
254  cout<<"StiMaker::InitDetectors() -I- Adding detector group:Star"<<endl;
255  _toolkit->add(new StiStarDetectorGroup(false));
256  if (IAttr("useTpc") && gStTpcDb)
257  {
258  cout<<"StiMaker::InitDetectors() -I- Adding detector group:TPC"<<endl;
259  _toolkit->add(group = new StiTpcDetectorGroup(IAttr("activeTpc"), IAttr("activeiTpc")));
260  group->setGroupId(kTpcId);
261  StiTpcHitLoader* hitLoader = (StiTpcHitLoader*) group->hitLoader();
262  if (IAttr("activeSvt") || IAttr("activeSsd") || IAttr("skip1row")) {// skip 1 row
263  hitLoader->setMinRow(2);
264  }
265  if (IAttr("EastOff")) {
266  hitLoader->setMinSector(1);
267  hitLoader->setMaxSector(12);
268  }
269  if (IAttr("WestOff")) {
270  hitLoader->setMinSector(13);
271  hitLoader->setMaxSector(24);
272  }
273  cout << "StiMaker::InitDetectors() -I- use hits in sectors["
274  << hitLoader->minSector() << "," << hitLoader->maxSector() << "] and rows["
275  << hitLoader->minRow() << ",*]" << endl;
276  if (IAttr("laserIT")) {
277  StiKalmanTrackNode::SetLaser(1);
278  cout << "StiMaker::InitDetectors() -I- set laser time of flight correction" << endl;
279  }
280  }
281  if (IAttr("useSvt") && gStSvtDbMaker)
282  {
283  cout<<"StiMaker::Init() -I- Adding detector group:SVT"<<endl;
284  _toolkit->add(group = new StiSvtDetectorGroup(IAttr("activeSvt")));
285  group->setGroupId(kSvtId);
286  }
287 
288  // SSD or SST - they share the db and the kSsdId
289  if (IAttr("useSst") && gStSstDbMaker){
290  cout<<"StiMaker::Init() -I- Adding detector group:Sst (ssd)"<<endl;
291  _toolkit->add(group = new StiSstDetectorGroup(IAttr("activeSst")));
292  group->setGroupId(kSstId);
293 
294  } else if ( IAttr("useSsd") && gStSsdDbMaker){
295  cout<<"StiMaker::Init() -I- Adding detector group:Ssd"<<endl;
296  _toolkit->add(group = new StiSsdDetectorGroup(IAttr("activeSsd")));
297  group->setGroupId(kSsdId);
298  }
299 
300 
301  if (IAttr("usePixel"))
302  {
303  cout<<"StiMaker::Init() -I- Adding detector group:PIXEL"<<endl;
304  _toolkit->add(group = new StiPxlDetectorGroup(IAttr("activePixel")));
305  group->setGroupId(kPxlId);
306  }
307  if (IAttr("useIst"))
308  {
309  cout<<"StiMaker::Init() -I- Adding detector group:Ist"<<endl;
310  _toolkit->add(group = new StiIstDetectorGroup(IAttr("activeIst")));
311  group->setGroupId(kIstId);
312  }
313  return kStOk;
314 }
315 
316 //_____________________________________________________________________________
317 Int_t StiMaker::InitRun(int run)
318 {
319  if (!_initialized) {
320  cout <<"StiMaker::InitRun() -I- Initialization Segment Started"<<endl;
321  InitDetectors();
322  // Load Detector related parameters
323  StiMasterDetectorBuilder * masterBuilder = _toolkit->getDetectorBuilder();
324  masterBuilder->build(*this);
325  StiDetectorContainer * detectorContainer = _toolkit->getDetectorContainer();
326  detectorContainer->initialize();//build(masterBuilder);
327  detectorContainer->reset();
328  _seedFinder = _toolkit->getTrackSeedFinder();
329  _seedFinder->initialize();
330  _hitLoader = _toolkit->getHitLoader();
331  _tracker=0;
332  mMaxTimes = IAttr("setMaxTimes");
333 
334  if (IAttr("useTracker")) {
335 
336  _tracker = (StiKalmanTrackFinder *)(_toolkit->getTrackFinder());
337 
338  do {
339 
340  TString seedFinders = SAttr("seedFinders");
341 
342  // Return without changing anything if attribute's value is empty
343  if (seedFinders.Length()) { //found list of ssedfinders
344 
345  TObjArray *sub_strings = seedFinders.Tokenize(" .,");
346 
347  for (int i=0; i <= sub_strings->GetLast(); i++) {
348  int n = 0;
349  TString &sub_string = static_cast<TObjString*>( sub_strings->At(i))->String();
350  if (sub_string[0]=='!') continue; //commented out
351  if ( !sub_string.CompareTo("CA", TString::kIgnoreCase) )
352  {n++;_tracker->addSeedFinder(_toolkit->getTrackSeedFinderCA());}
353  if ( !sub_string.CompareTo("Def", TString::kIgnoreCase) )
354  {n++;_tracker->addSeedFinder(_toolkit->getTrackSeedFinder());}
355  if ( !sub_string.CompareTo("KNN", TString::kIgnoreCase) )
356  {n++;_tracker->addSeedFinder(_toolkit->getTrackSeedFinderKNN());}
357  assert(n);
358  }
359  delete sub_strings; break;
360  }// end seedfinder list
361 
362  if (IAttr("StiCA")) {
363  _tracker->addSeedFinder(_toolkit->getTrackSeedFinderCA());
364  _tracker->addSeedFinder(_toolkit->getTrackSeedFinder());
365  break;
366  }
367  // Default case, Sti seed finder only
368  _tracker->addSeedFinder(_toolkit->getTrackSeedFinder());
369 
370  }while(0);
371 
372  }//end tracker
373 
374  // useTreeSearch flag means
375  // useTreeSearch == tpcFlag *4 + hftFlag
376  // flag == treeSearchOn + 2*treeSearchFull
377  // treeSearchOn==1 means tree search is ON
378  // treeSearchFull==1 means tree search includes case that existing hit
379  // on this level could be omitted
380  // Typical case chain->SetAttr("useTreeSearch",(1+2) +4*(1),"Sti");
381  // means HFT full tree searh, TPC tree search only with existing hits, no hits is not considered
382 
383  if (*SAttr("useTreeSearch")) _tracker->setComb(IAttr("useTreeSearch"));
384  if ( IAttr("useTiming" )) _tracker->setTiming();
385  _fitter = dynamic_cast<StiKalmanTrackFitter *>(_toolkit->getTrackFitter());
386 
387  //if (*SAttr("useMCS")) StiKalmanTrackNode::setMCS(IAttr("useMCS"));
388 
389  _eventFiller=0;
390  if (IAttr("useEventFiller")) {
391  _eventFiller = new StiStEventFiller();
392  _eventFiller->setUseAux(IAttr("useAux"));
393  InitPulls();
394  }
395  _trackContainer = _toolkit->getTrackContainer();
396  _vertexFinder = 0;
397  if (GetTopChain()->GetMakerInheritsFrom("StGenericVertexMaker")) {
398  _vertexFinder = _toolkit->getVertexFinder();
399  }
400  if (_tracker) {
401  _tracker->initialize();
402  _tracker->clear();
403  }
404  _initialized=true;
405  cout <<"StiMaker::InitRun() -I- Initialization Segment Completed"<<endl;
406  }
407 
408  return StMaker::InitRun(run);
409 }
410 
411 //_____________________________________________________________________________
413 {
414  cout <<"StiMaker::Make() -I- Starting on new event"<<endl;
415  Int_t iAns=kStOK,iAnz=0; if (iAns){};
416  if (! _tracker) return kStWarn;
417  StEvent * event = dynamic_cast<StEvent*>( GetInputDS("StEvent") );
418  if (!event) return kStWarn;
419  eventIsFinished = false;
420 
421  _tracker->clear();
422  if (mTimg[kHitTimg]) mTimg[kHitTimg]->Start(0);
423  _hitLoader->loadEvent(event,_loaderTrackFilter,_loaderHitFilter);
424  if (mMaxTimes) _hitLoader->setMaxTimes(mMaxTimes);
425  if (mTimg[kHitTimg]) mTimg[kHitTimg]->Stop();
426 
427  iAnz = MakeGlobalTracks(event);
428  if (iAnz) {MyClear(); return iAnz;}
429  CountHits();
430 
431  if (_vertexFinder) {
432  iAnz = MakePrimaryTracks(event);
433  if (iAnz) {MyClear(); return iAnz;}
434  } else {
435  iAnz = StMaker::Make();
436  }
437  if (mPullTTree) {iAns = FillPulls();}
438  cout<< "StiMaker::Make() -I- Done"<<endl;
439  MyClear();
440  if (iAnz) return iAnz;
441  if (mTotPrimTks[1] && mTotPrimTks[0]>mTotPrimTks[1]) return kStStop;
442  if (IAttr("Alignment") && ! _tracker->getNTracks()) return kStErr;
443  return (!iAns)? kStOK:kStWarn;
444 }
445 
446 //_____________________________________________________________________________
447 Int_t StiMaker::MakeGlobalTracks(StEvent * event) {
448  if (mTimg[kGloTimg]) mTimg[kGloTimg]->Start(0);
449  _tracker->reset(); // get the rest
450  _tracker->findTracks(); // get the rest
451  if (mMaxTimes>1) CleanGlobalTracks();
452  FinishTracks(0);
453  if (mTimg[kGloTimg]) mTimg[kGloTimg]->Stop();
454  if (mTimg[kFilTimg]) mTimg[kFilTimg]->Start(0);
455  if (_eventFiller)
456  _eventFiller->fillEvent(event, _trackContainer);
457  if (mTimg[kFilTimg]) mTimg[kFilTimg]->Stop();
458  return kStOK;
459 }
460 //_____________________________________________________________________________
461 Int_t StiMaker::MakePrimaryTracks(StEvent * event) {
462  if (! _vertexFinder) return kStWarn;
463  if (mTimg[kVtxTimg]) mTimg[kVtxTimg]->Start(0);
464  _vertexFinder->fit(event);
465  const std::vector<StiHit*> *vertexes = _vertexFinder->result();
466  if (mTimg[kVtxTimg]) mTimg[kVtxTimg]->Stop();
467  if (vertexes && vertexes->size()) {
468  //Set minimal errors
469  for (size_t i=0;i<vertexes->size();i++) {
470  StiHit *vtx=(*vertexes)[i];
471  float vtxErr[6];
472  memcpy(vtxErr,vtx->errMtx(),sizeof(vtxErr));
473  if (vtxErr[0]>MIN_VTX_ERR2
474  && vtxErr[2]>MIN_VTX_ERR2
475  && vtxErr[5]>MIN_VTX_ERR2) continue;
476  memset(vtxErr,0,sizeof(vtxErr));
477  vtxErr[0]=MIN_VTX_ERR2;
478  vtxErr[2]=MIN_VTX_ERR2;
479  vtxErr[5]=MIN_VTX_ERR2;
480  vtx->setError(vtxErr);
481  }
482  if (mTimg[kPriTimg]) mTimg[kPriTimg]->Start(0);
483 
484  _tracker->extendTracksToVertices(*vertexes);
485  mTotPrimTks[0]+=_tracker->getNPrims();
486  FinishTracks(1);
487  if (mTimg[kPriTimg]) mTimg[kPriTimg]->Stop();
488 
489  //cout << "StiMaker::Make() -I- Primary Filling"<<endl;
490  if (mTimg[kFilTimg]) mTimg[kFilTimg]->Start(0);
491  if (_eventFiller) {_eventFiller->fillEventPrimaries(); /* fillVxFlags(); */}
492  if (mTimg[kFilTimg]) mTimg[kFilTimg]->Stop();
493  }
494  return kStOK;
495 }
496 //_____________________________________________________________________________
497 void StiMaker::MyClear()
498 {
499 // cout << "StiMaker -I- Perform Yuri's clear... ;-)" << endl;
500 // StMemStat::PrintMem("Before StiFactory clear()");
501  _toolkit->getHitFactory()->clear();
502  _toolkit->getTrackNodeFactory()->clear();
503  _toolkit->getTrackNodeExtFactory()->clear();
504  _toolkit->getTrackNodeInfFactory()->clear();
505  _toolkit->getTrackFactory()->clear();
506 // StMemStat::PrintMem("After StiFactory clear()");
507 }
508 
509 
510 
511 
512 //_____________________________________________________________________________
513 Int_t StiMaker::InitPulls()
514 {
515  if (!IAttr("makePulls")) return 0;
516 
517  const StChainOpt *bfc = GetChainOpt();
518  assert(bfc);
519  TFile *tfile = GetTFile();
520  if (!tfile) {
521  TString ts = bfc->GetFileIn();
522  if ( ts == "" ) {
523  ts = "pullfile";
524  }
525  ts= gSystem->BaseName(ts);
526  int ext = ts.Index(".");
527  if (ext>0) ts.Replace(ext,999,"");
528  ts +=".stipull.root";
529  tfile = mPullFile = new TFile(ts,"RECREATE","TTree Sti Pulls ROOT file");
530  }
531  tfile->cd();
532  mPullTTree = new TTree("StiPulls","TTree Sti pulls");
533  mPullTTree->SetAutoSave(100000000); // autosave when 0.1 Gbyte written
534  mPullEvent = new StiPullEvent;
535  TBranch *branch = mPullTTree->Branch("event", mPullEvent->ClassName(),&mPullEvent, 16000,99);
536  branch->SetAutoDelete(kFALSE);
537  _eventFiller->setPullEvent(mPullEvent);
538  return 0;
539 }
540 //_____________________________________________________________________________
541 Int_t StiMaker::FillPulls()
542 {
543  StEvtHddr *hddr = GetEvtHddr();
544  mPullEvent->mRun = hddr->GetRunNumber();
545  mPullEvent->mEvt = hddr->GetEventNumber();
546  mPullEvent->mDate = hddr->GetDateTime(); //DAQ time (GMT)
547  mPullEvent->mChi2 = 0;
548 
549  memset(mPullEvent->mVtx,0,sizeof(mPullEvent->mVtx));
550  memset(mPullEvent->mEtx,0,sizeof(mPullEvent->mEtx));
551  if (_vertexFinder) {
552  StiHit *vertex = _vertexFinder->getVertex(0);
553  if (vertex) {
554  mPullEvent->mVtx[0] = vertex->x_g();
555  mPullEvent->mVtx[1] = vertex->y_g();
556  mPullEvent->mVtx[2] = vertex->z_g();
557  TCL::ucopy(vertex->errMtx(),mPullEvent->mEtx,6);
558  }
559  }
560  mPullEvent->Finish();
561  mPullTTree->Fill();
562  for (int i=0; i<3; i++) {mPullHits[i]+=mPullEvent->mNHits[i];}
563  if (! IAttr(".Privilege")) return kStOK;
564 
565  int k;for (k=2; k>=0; k--) {if (mPullHits[k]) break;}
566  if (k<0) return kStOK;
567  k = mPullHits[k]<<(k*3);
568  if (k>1000000) return kStSTOP;
569  return kStOK;
570 }
571 //_____________________________________________________________________________
572 TDataSet *StiMaker::FindDataSet (const char* logInput,const StMaker *uppMk,
573  const StMaker *dowMk) const
574 {
575  TDataSet *ds = StMaker::FindDataSet(logInput,uppMk,dowMk);
576 
577  if (ds || strcmp(logInput,"STIGEOM")) return ds;
578 
579 // if (!fVolume && _toolkit) ((StiMaker *)this)->fVolume = new StiDetectorVolume(*_toolkit->getDetectorBuilder(), kActive);
580  if (!fVolume && _toolkit) ((StiMaker *)this)->fVolume = new StiDetectorVolume(*_toolkit, TString(), 0);
581 
582  if (fVolume) {
583  if (gGeometry) {
584  TList *listOfVolume = gGeometry->GetListOfNodes();
585 
586  // Remove hall from the list of ROOT nodes to make it free of ROOT control
587  listOfVolume->Remove(fVolume);
588  listOfVolume->Remove(fVolume);
589  }
590  // Add "hall" into ".const" area of this maker
591  ((StiMaker *)this)->AddConst(fVolume);
592  if (Debug()) fVolume->ls(3);
593  }
594  return fVolume;
595 }
596 //________________________________________________________________________________
597 static Bool_t TrackCompareStatus(const StiTrack *a, const StiTrack *b)
598 {
599  int nA = a->getFitPointCount();
600  int nB = b->getFitPointCount();
601  if (nA!=nB) return (nA > nB);
602  return (a->getChi2()<b->getChi2());
603 //return (a->getChi2Max()<b->getChi2Max());
604 }
605 //_____________________________________________________________________________
606 int StiMaker::CleanGlobalTracks()
607 {
608  for (int iTk=0; iTk< (int)_trackContainer->size(); iTk++)
609  {
610  auto* kTrack = static_cast<StiKalmanTrack*>((*_trackContainer)[iTk]);
611  kTrack->reserveHits(0);
612  }
613  sort(_trackContainer->begin(), _trackContainer->end(),TrackCompareStatus );
614 
615  for (int iTk=0; iTk<(int) _trackContainer->size(); iTk++)
616  {
617  auto* kTrack = (StiKalmanTrack*)((*_trackContainer)[iTk]);
618  StiKalmanTrackNode *node = 0;
619  int nHits=0,nNits=0;
620  do {//one time loop
621 
622  StiKalmanTrackNode *dcaNode=0;
623  for (auto nodeIt =kTrack->begin();nodeIt!=kTrack->end();nodeIt++)
624  {
625  node = &(*nodeIt);
626  if (node->isDca()) {dcaNode = node; continue;}
627  StiHit *hit = node->getHit(); if (!hit) continue;
628  if (!node->isValid()) {node->setHit(0); continue;}
629  if (node->getChi2()>1e2) {node->setHit(0); continue;}
630  if (hit->timesUsed()) {nNits++; node->setHit(0);}
631  else { nHits++;}
632  }
633 
634  if (!nNits) continue;
635  if (nHits<5) { kTrack->setFlag(-1); continue; }
636  if (dcaNode) kTrack->removeNode(dcaNode);
637 
638  // Refit track with removed hits
639  int ans = kTrack->refit();
640  if (ans || kTrack->getFitPointCount()<5)
641  { kTrack->setFlag(-1); continue; }
642 
643  // Make new Dca node
644  StiHit dcaHit; dcaHit.makeDca();
645  StiTrackNode *extenDca = kTrack->extendToVertex(&dcaHit);
646  if (extenDca) kTrack->add(extenDca,kOutsideIn);
647  } while(0);
648 
649 // Now mark hits as used
650  kTrack->reserveHits();
651  }
652 // Compact track container
653  int jTk=0;
654  for (int iTk=0; iTk< (int)_trackContainer->size(); iTk++)
655  {
656  auto* kTrack = ((*_trackContainer)[iTk]);
657  if (kTrack->getFlag()<0) continue;
658  if (jTk!=iTk)(*_trackContainer)[jTk]=kTrack;
659  jTk++;
660  }
661  _trackContainer->resize(jTk);
662 
663  for (int iTk=0; iTk<(int) _trackContainer->size(); iTk++)
664  {
665  auto* kTrack = (StiKalmanTrack*)((*_trackContainer)[iTk]);
666  StiKalmanTrackNode *node = 0;
667  int nHit = 0,nNode = 0;
668  for (auto nodeIt =kTrack->begin();nodeIt!=kTrack->end();nodeIt++)
669  {
670  node = &(*nodeIt);
671  nNode++;
672  StiHit *hit = node->getHit(); if (!hit) continue;
673  nHit++;
674  assert(hit->timesUsed());
675  }
676  assert(nHit || !nNode);
677  }
678  return _trackContainer->size();
679 }
680 //_____________________________________________________________________________
681 void StiMaker::FinishTracks (int gloPri)
682 {
683 // Added new method FonishTracks(int gloPri) 0=global 1=primary tracks
684 // In this method:
685 // 1. loop over nodes
686 // 2. Move node to the center volume along x or r local
687 
688 // static const char * tkNames[2] = {"globalTracks","primaryTracks"};
689 // static const char * noNames[2] = {"globalNodes" ,"primaryNodes" };
690 // static const char * inNames[2] = {"globalInside","primaryInside"};
691 // static const char * hiNames[2] = {"globaHits" ,"primaryHits" };
692 // static const char * elNames[2] = {"globaELoss" ,"primaryELoss" };
693 
694 
695  StiTrackContainer* tkV = StiToolkit::instance()->getTrackContainer();
696  if (!tkV) return;
697 
698  int nTk=0,nNodes=0,nInside=0,nHits=0;
699 
700  for (int itk=0; itk<(int)tkV->size(); itk++)
701  {
702  StiKalmanTrack *track = (StiKalmanTrack*)(*tkV)[itk];
703  if (gloPri && !track->isPrimary()) continue;
704  nTk++;
705  StiKTNIterator tNode = track->begin();
706  StiKTNIterator eNode = track->end();
707  nNodes=0;nInside=0;nHits=0;
708  for (;tNode!=eNode;++tNode)
709  {
710  StiKalmanTrackNode *node = &(*tNode);
711  if(!node->isValid()) continue;
712  if (node->isDca() ) continue;
713  StiHit *hit = node->getHit();
714  if (hit && !hit->detector()) continue; //primary vertex
715  nNodes++;
716  if ( hit && node->getChi2()<100) nHits++;
717  node->nudge();
718  if (1 /*node->inside()*/) {
719  nInside++;
720 // StiDebug::Count(elNames[gloPri],node->getELoss()[0].mELoss);
721  }
722  }
723  int qa,idt = track->idTruth(&qa);if(idt){};
724 // StiDebug::Count(noNames[gloPri],nNodes );
725 // StiDebug::Count(inNames[gloPri],nInside);
726 // StiDebug::Count(hiNames[gloPri],nHits );
727  }
728 // StiDebug::Count(tkNames[gloPri],nTk );
729 }
730 
731 
732 // $Id: StiMaker.cxx,v 1.242 2019/06/20 16:04:55 genevb Exp $
733 // $Log: StiMaker.cxx,v $
734 // Revision 1.242 2019/06/20 16:04:55 genevb
735 // Update from B4SL18h branch
736 //
737 // Revision 1.241.4.1 2019/02/27 21:32:53 genevb
738 // Avoid unnecessary re-initializations in InitRun()
739 //
740 // Revision 1.241 2018/07/06 22:13:05 smirnovd
741 // [Cosmetic] Changes in white space
742 //
743 // Revision 1.240 2018/06/29 21:46:33 smirnovd
744 // Revert iTPC-related changes committed on 2018-06-20 through 2018-06-28
745 //
746 // Revert "NoDead option added"
747 // Revert "Fill mag field more carefully"
748 // Revert "Assert commented out"
749 // Revert "Merging with TPC group code"
750 // Revert "Remove too strong assert"
751 // Revert "Restore removed by mistake line"
752 // Revert "Remove not used anymore file"
753 // Revert "iTPCheckIn"
754 //
755 // Revision 1.238 2018/04/19 15:48:28 smirnovd
756 // [Cosmetic] Remove unused include statements
757 //
758 // Revision 1.237 2018/04/12 18:43:59 smirnovd
759 // Add new option to deactivate iTpc hits
760 //
761 // Revision 1.236 2018/04/10 11:32:10 smirnovd
762 // Minor corrections across multiple files
763 //
764 // - Remove ClassImp macro
765 // - Change white space
766 // - Correct windows newlines to unix
767 // - Remove unused debugging
768 // - Correct StTpcRTSHitMaker header guard
769 // - Remove unused preprocessor directives in StiCA
770 // - Minor changes in status and debug print out
771 // - Remove using std namespace from StiKalmanTrackFinder
772 // - Remove includes for unused headers
773 //
774 // Revision 1.235 2018/01/03 21:24:21 smirnovd
775 // Remove unused std::string
776 //
777 // Revision 1.234 2017/12/19 20:14:12 jwebb
778 // If no input file, provide default name
779 //
780 // Revision 1.233 2017/01/26 21:17:48 perev
781 // In method CleanGlobalTracks
782 // 1. for track with reused hits old Dca node removed(not only marked)
783 // 2. After Refit, new Dca node created
784 //
785 // In method FinishTracks some histo created (if debug>2)
786 //
787 // Revision 1.232 2016/11/07 20:51:43 perev
788 // CleanGlobalTracks() added. This method provides cleanen reused hits in the style of CA.
789 // Thic call is triggered by nMaxTimes attribute, which allows reuse hits nMaxTimes times.
790 //
791 // Revision 1.231 2016/06/30 18:49:41 perev
792 // 1. include StiCADefaultToolkit.h removed. No such file anymore
793 // 2. local function CountHits() added for print only
794 // 3. added seed finders SeedFinderKNN,SeedFinderCA
795 // 4. Flag StiCA means CA seed finder and after standard Sti one
796 //
797 // Revision 1.227.4.6 2016/06/29 20:10:11 perev
798 // CleanGlobalTracks added
799 //
800 // Revision 1.227.4.5 2016/06/03 17:00:49 smirnovd
801 // Sti and StiCA refactoring
802 //
803 // Revision 1.227.4.4 2016/06/03 16:07:15 smirnovd
804 // Sync with MAIN branch as of 2016-05-31
805 //
806 // Revision 1.229 2016/03/28 00:15:53 perev
807 // Add max number of tracks assigned to one hit
808 //
809 // Revision 1.228 2016/02/25 23:05:31 genevb
810 // kSsdId => kSstId
811 //
812 // Revision 1.227 2015/07/07 23:31:52 perev
813 // Clean mess of reset and clear methods
814 //
815 // Revision 1.226 2015/02/27 03:51:06 perev
816 // remove not used BTof
817 //
818 // Revision 1.225 2015/01/29 19:04:43 perev
819 // Comments about treeSearch On/Off added
820 //
821 // Revision 1.224 2015/01/29 17:08:47 perev
822 // Remove redundant inputFile parameter
823 //
824 // Revision 1.223 2015/01/15 19:04:41 perev
825 // Debug--
826 //
827 // Revision 1.222 2014/12/16 17:21:14 perev
828 // temporary supress inside()
829 //
830 // Revision 1.221 2014/12/16 01:14:40 perev
831 // Added new method fonishTracks(int gloPri) 0=global 1=primary tracks
832 // In this method:
833 // 1. loop over nodes
834 // 2. Move node to the center volume along x or r local
835 // 3. If StiDebug::mgGlobal >1 create a set of technical histogramms
836 //
837 // Revision 1.220 2014/10/30 15:03:55 jeromel
838 // Reverted to Oct 2nd
839 //
840 // Revision 1.217 2014/09/10 15:52:12 perev
841 // Fix typo, StiSsdDetectorGroup ==> StiSsdDetectorGroup
842 //
843 // Revision 1.216 2014/08/22 15:56:30 perev
844 // Remove never used input file in StiXXXDetectorGroup
845 //
846 // Revision 1.215 2014/08/08 17:07:50 jeromel
847 // oops - previous commits included Jonathan's changes (recalled the previous commit by mistake)
848 //
849 // Revision 1.214 2014/08/08 17:06:19 jeromel
850 // No change - moved history at the bootom as getting very long
851 //
852 // Revision 1.213 2014/08/08 16:41:23 jeromel
853 // No change - moved history at the bootom as getting very long
854 //
855 // Revision 1.212 2014/04/24 18:15:02 perev
856 // Remove RnD as old approach
857 //
858 // Revision 1.211 2014/04/22 21:43:13 jeromel
859 // Grompf! Inverted ssd <-> sst now corrected (thx DS)
860 //
861 // Revision 1.210 2014/04/10 23:39:23 jeromel
862 // Backstep: remove default useXX as clash with older data (we need to reshape the options)
863 //
864 // Revision 1.209 2014/04/10 15:48:28 jeromel
865 // Oops
866 //
867 // Revision 1.208 2014/04/10 15:28:55 jeromel
868 // Merged my previous differences commited by Victor with Dmitri's (Victor OK)
869 //
870 // Revision 1.207 2014/04/09 23:52:20 perev
871 // Ssd+Sst+Pxl
872 //
873 // Revision 1.206 2013/04/10 22:14:20 fisyak
874 // Roll back to version 04/04/2013
875 //
876 // Revision 1.204 2012/06/13 20:21:09 fisyak
877 // Check that vertex fitter exist before getting vertex postion
878 //
879 // Revision 1.203 2012/06/11 15:33:41 fisyak
880 // std namespace
881 //
882 // Revision 1.202 2012/05/07 14:56:14 fisyak
883 // Add StKFVertexMaker
884 //
885 // Revision 1.201 2012/02/25 01:48:55 perev
886 // Limit on permutation installed
887 //
888 // Revision 1.200 2011/10/17 12:16:10 fisyak
889 // Comment out request DoAlignment for Track Finder
890 //
891 // Revision 1.199 2011/10/17 00:14:34 fisyak
892 // Move handles for IdTruth to StEvent
893 //
894 // Revision 1.198 2011/04/05 22:49:16 fisyak
895 // Add safety marging
896 //
897 // Revision 1.197 2011/04/05 22:26:30 fisyak
898 // Remove alloc/free
899 //
900 // Revision 1.196 2011/04/04 19:13:41 fisyak
901 // Move intialization of detectors in InitRun
902 //
903 // Revision 1.195 2011/04/04 15:18:52 fisyak
904 // Add check that the corresponding Db maker has been instantiated before adding the detector
905 //
906 // Revision 1.194 2011/03/31 22:11:24 fisyak
907 // Propagate IdTruth to StEvent
908 //
909 // Revision 1.193 2010/09/01 21:25:03 fisyak
910 // Add comment
911 //
912 // Revision 1.192 2010/01/27 21:43:49 perev
913 // Add _nPrimTracks for case of fiterr
914 //
915 // Revision 1.191 2009/10/18 22:47:29 perev
916 // assert instead of skip
917 //
918 // Revision 1.190 2009/03/16 13:50:14 fisyak
919 // Move out all Sti Chairs into StDetectorDb
920 //
921 // Revision 1.189 2009/01/26 22:00:47 fisyak
922 // rename TMemStat => StMemStat
923 //
924 // Revision 1.188 2008/06/11 22:04:38 fisyak
925 // Add dead material
926 //
927 // Revision 1.187 2008/04/08 14:22:15 fisyak
928 // remove redundant includes
929 //
930 // Revision 1.186 2008/04/03 20:04:05 fisyak
931 // Straighten out DB access via chairs
932 //
933 // Revision 1.185 2008/03/25 18:03:11 perev
934 // remove field field from everythere
935 //
936 // Revision 1.184 2008/03/20 02:01:36 perev
937 // setMinPrecHits(..) obsolete
938 //
939 // Revision 1.183 2008/02/07 18:26:17 perev
940 // Remove setMCS() call
941 //
942 // Revision 1.182 2008/02/07 02:27:40 perev
943 // Add minPrecHits
944 //
945 // Revision 1.181 2007/10/17 15:32:34 fisyak
946 // rename Hft => Pxl
947 //
948 // Revision 1.180 2007/09/22 03:29:16 perev
949 // Timer + Pulls without vertex
950 //
951 // Revision 1.179 2007/09/10 00:32:30 perev
952 // Attribute useTreeSearch added
953 //
954 // Revision 1.178 2007/04/30 19:53:47 fisyak
955 // add time of flight corrrection for Laser
956 //
957 // Revision 1.177 2007/04/28 17:56:19 perev
958 // Redundant StChain.h removed
959 //
960 // Revision 1.176 2007/04/26 04:23:54 perev
961 // Remove StBFChain dependency
962 //
963 // Revision 1.175 2007/04/17 05:11:45 perev
964 // GetTFile()==>StMaker. Jerome request
965 //
966 // Revision 1.174 2007/03/21 17:51:17 fisyak
967 // add option for EastOff and WestOff, FindDataSet for Sti Geometry
968 //
969 // Revision 1.173 2006/12/18 01:29:00 perev
970 // +noTreeSearch flag & pulls
971 //
972 // Revision 1.172 2006/10/16 20:30:42 fisyak
973 // Clean dependencies from Sti useless classes
974 //
975 // Revision 1.171 2006/10/15 05:10:10 fisyak
976 // Add Hpd
977 //
978 // Revision 1.170 2006/10/09 15:51:28 fisyak
979 // Remove Ftpc
980 //
981 // Revision 1.169 2006/08/01 03:51:00 perev
982 // Return from Make() for too many hits
983 //
984 // Revision 1.168 2006/06/16 21:27:52 perev
985 // Minimal errors of vertex 1 micron
986 //
987 // Revision 1.167 2006/05/31 03:59:04 fisyak
988 // Add Victor's dca track parameters, clean up
989 //
990 // Revision 1.166 2006/04/14 22:51:26 perev
991 // Option useFakeVertex added
992 //
993 // Revision 1.161 2006/02/14 18:53:58 perev
994 // Sub makerFunctionality added.
995 //
996 // Revision 1.160 2006/02/08 20:56:39 fisyak
997 // use kHftId and kIstId for StiDetector groups instead of hadr coded numbers 9999 and 9998
998 //
999 // Revision 1.159 2006/01/19 20:21:52 perev
1000 // Ist added
1001 //
1002 // Revision 1.158 2005/12/31 01:34:02 perev
1003 // Degug histos added
1004 //
1005 // Revision 1.157 2005/12/07 23:55:02 perev
1006 // control is changed using StMaker::SetAttr
1007 //
1008 // Revision 1.156 2005/11/22 23:15:27 fisyak
1009 // Clean up parameters setting
1010 //
1011 // Revision 1.155 2005/10/26 21:54:10 fisyak
1012 // Remove dead classes, gid rid off dependencies from StMcEvent and StiGui
1013 //
1014 // Revision 1.154 2005/10/06 20:38:46 fisyak
1015 // Clean up
1016 //
1017 // Revision 1.153 2005/09/28 21:46:36 fisyak
1018 // Persistent StMcEvent
1019 //
1020 // Revision 1.152 2005/08/09 15:23:18 perev
1021 // Add new factory for Node extention
1022 //
1023 // Revision 1.151 2005/08/04 04:03:19 perev
1024 // Cleanup
1025 //
1026 // Revision 1.150 2005/07/21 01:20:12 perev
1027 // clearmem is default now
1028 //
1029 // Revision 1.149 2005/07/20 17:33:25 perev
1030 // MultiVertex
1031 //
1032 // Revision 1.148 2005/02/25 17:41:01 perev
1033 // Time count added
1034 //
1035 // Revision 1.147 2005/01/25 17:23:48 pruneau
1036 // removed references to html package
1037 //
1038 // Revision 1.146 2005/01/21 03:13:37 pruneau
1039 // turned off StiHistograms
1040 //
1041 // Revision 1.145 2005/01/17 03:56:47 pruneau
1042 // change track container to vector
1043 //
1044 // Revision 1.144 2005/01/17 01:32:13 perev
1045 // parameters protected
1046 //
1047 // Revision 1.143 2004/08/04 21:06:17 pruneau
1048 // Added an "if" statement predicated on m_Mode to clear the memory used by the
1049 // factories at the end of StiMaker::Make().
1050 //
1051 // Revision 1.142 2004/04/15 00:43:22 pruneau
1052 // Added Ssd to the list of possible detectors...
1053 //
1054 // Revision 1.141 2004/03/26 15:30:06 andrewar
1055 // bug in field reset
1056 //
1057 // Revision 1.140 2004/03/26 14:52:43 calderon
1058 // Print out the magnetic field read from StEvent::eventSummary()
1059 //
1060 // Revision 1.139 2004/03/25 22:42:44 andrewar
1061 // temp mag field fix; cache filed value and reset if it goes to zero. This
1062 // protects against corrupt event headers...
1063 //
1064 // Revision 1.138 2004/02/24 01:59:46 jeromel
1065 // Commented out include of disappeared .h
1066 //
1067 // Revision 1.137 2004/02/21 18:28:31 pruneau
1068 // Updates to comply to changes in interfaces
1069 //
1070 // Revision 1.136 2004/02/19 22:18:07 pruneau
1071 // Modified call to StMcEventMaker structure
1072 //
1073 // Revision 1.135 2004/02/13 17:36:24 andrewar
1074 // Changed name of StMcEventMaker to StMcEvent... this allows me to run
1075 // simulation. It doesn't seem like this follows the Maker name scheme, though...
1076 //
1077 // Revision 1.134 2004/02/03 18:10:10 pruneau
1078 // Changed name of StMcEventMaker to McEvent in GetMaker call
1079 //
1080 // Revision 1.133 2004/01/30 21:47:23 pruneau
1081 // Changed organization so detector geometris are loaded and build in InitRun
1082 // rather than Make.
1083 // Added accesses to db
1084 //
1085 // Revision 1.132 2003/10/28 16:01:15 andrewar
1086 // Passing tracking parameter file to detector Builders.
1087 //
1088 // Revision 1.131 2003/09/02 17:59:59 perev
1089 // gcc 3.2 updates + WarnOff
1090 //
1091 // Revision 1.130 2003/08/05 18:20:33 andrewar
1092 // Changed default parameters to apply eta filters.
1093 //
1094 // Revision 1.129 2003/07/30 20:12:31 pruneau
1095 // Added new histo group
1096 //
1097 // Revision 1.128 2003/06/10 18:47:28 andrewar
1098 // Changed StiResiduaCalc calls to conform to modified class.
1099 //
1100 // Revision 1.127 2003/05/07 03:06:34 pruneau
1101 // *** empty log message ***
1102 //
1103 // Revision 1.126 2003/05/06 16:48:10 mmiller
1104 // Incorporated StiPixel. usePixel==false by default.
1105 //
1106 // Revision 1.125 2003/05/06 15:36:36 mmiller
1107 // Committing changes to turn on multiple regions (StiPlacement::StiRegion -> kMidRapidity, kForwardRapidity, etc).
1108 // Also added a point to StiToolkit for StiMaker. This allows for the req. GetDataSet calls in the FTPC code.
1109 // Not so elegant...
1110 //
1111 // Revision 1.124 2003/04/30 15:39:33 pruneau
1112 // Integrating StiResidual in main stream Sti
1113 //
1114 // Revision 1.123 2003/04/29 18:48:50 pruneau
1115 // *** empty log message ***
1116 //
1117 // Revision 1.122 2003/04/13 02:16:13 pruneau
1118 // *** empty log message ***
1119 //
1120 // Revision 1.121 2003/04/11 18:56:14 pruneau
1121 // Pulling the B field from StEventSummary
1122 //
1123 // Revision 1.120 2003/04/11 16:51:57 pruneau
1124 // various fixes
1125 //
1126 // Revision 1.119 2003/04/10 14:53:06 pruneau
1127 // removing obsolete files and classes
1128 //
1129 // Revision 1.118 2003/04/10 12:10:09 pruneau
1130 // Changed StiMaker and Default Toolkit to accomodate the new Event Display
1131 //
1132 // Revision 1.117 2003/03/31 17:19:27 pruneau
1133 // various
1134 //
1135 // Revision 1.116 2003/03/17 17:44:49 pruneau
1136 // *** empty log message ***
1137 //
1138 // Revision 1.115 2003/03/13 18:59:42 pruneau
1139 // various updates
1140 //
1141 // Revision 1.114 2003/03/13 16:30:59 andrewar
1142 // Added plotting package
1143 //
1144 // Revision 1.113 2003/03/13 15:15:51 pruneau
1145 // various
1146 //
1147 // Revision 1.112 2003/03/12 17:58:04 pruneau
1148 // fixing stuff
1149 //
1150 // Revision 1.111 2003/02/25 14:21:06 pruneau
1151 // *** empty log message ***
1152 //
1153 // Revision 1.110 2003/01/24 06:12:28 pruneau
1154 // removing centralized io
1155 //
1156 // Revision 1.109 2003/01/22 20:06:26 andrewar
1157 // Changed includes to point to new libraries (StiTpc, StiSvt, etc)
1158 //
1159 // Revision 1.108 2002/12/19 19:29:42 pruneau
1160 // *** empty log message ***
1161 //
1162 // Revision 1.106 2002/10/04 01:54:48 pruneau
1163 // DefaultToolkit now uses the StiHitLoader scheme rahter than the StiHitFiller.
1164 //
1165 // Revision 1.105 2002/09/27 19:19:01 mmiller
1166 // Changed program flow to once again allow for track by track gui.
1167 //
1168 // Revision 1.104 2002/09/10 18:42:40 pruneau
1169 // Fixed bug in the call sequence of the association maker
1170 // introduced in the previous release.
1171 //
1172 // Revision 1.103 2002/09/05 21:27:10 pruneau
1173 // Fixed problem with StiRootSimpleTrackFilter::makeNewObject
1174 //
1175 // Revision 1.102 2002/09/05 05:47:30 pruneau
1176 // Adding Editable Parameters and dynamic StiOptionFrame
1177 //
1178 // Revision 1.101 2002/08/28 17:14:18 pruneau
1179 // Simplified the interface of StiKalmanTrackFinder and the calls
1180 // required in StiMaker.
1181 //
1182 // Revision 1.100 2002/08/23 18:16:50 pruneau
1183 // Added StiSimpleTrackFilter to StiMaker to enable simple and
1184 // fast track finding diagnostics.
1185 //
1186 // Revision 1.99 2002/08/19 19:32:59 pruneau
1187 // eliminated cout when unnecessary, made helix member of the EventFiller
1188 //
1189 // Revision 1.98 2002/06/26 23:05:31 pruneau
1190 // changed macro
1191 //
1192 // Revision 1.97 2002/06/18 18:08:34 pruneau
1193 // some cout statements removed/added
1194 //
1195 // Revision 1.96 2002/06/04 19:45:31 pruneau
1196 // including changes for inside out tracking
1197 //
1198 
1199 //_____________________________________________________________________________
1200 void CountHits()
1201 {
1202  int nTimesUsed=0;
1203  StiTrackContainer* tkV = StiToolkit::instance()->getTrackContainer();
1204  if (!tkV) return;
1205  for (int itk=0; itk<(int)tkV->size(); itk++)
1206  {
1207  StiKalmanTrack *track = (StiKalmanTrack*)(*tkV)[itk];
1208  StiKalmanTrackNode *node;
1209  StiKTNIterator it = track->begin();
1210  for (;(node=it());it++){
1211  const StiHit *hit = node->getHit();
1212  if (!hit) continue;
1213  if (!hit->detector()) continue;
1214  assert(node->getChi2()<1000.);
1215  nTimesUsed++;
1216  } }
1217 }
virtual void initialize()
Initialize the finder.
virtual void initialize()
Initialize the finder.
void setError(const StMatrixF &)
Definition: StiHit.cxx:67
virtual void findTracks()
Find all tracks of the currently loaded event.
Definition of toolkit.
Definition of Kalman Track.
void makeDca()
Make fake hit for dca calculation.
Definition: StiHit.cxx:279
virtual double getChi2() const =0
Get chi2 of this track.
virtual int fit(StEvent *)=0
Find the vertex(es) associated with the given event.
Abstract definition of a Track.
Definition: StiTrack.h:59
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
virtual Int_t Make()
Definition: StiMaker.cxx:412
Definition: StiHit.h:51
virtual void reset()
Reset the tracker.
void reserveHits(int yes=1)
int getNTracks() const
get number of tracks
const StiDetector * detector() const
Definition: StiHit.h:96
void setComb(int comb=7)
Set the vertex finder used by this tracker.
Float_t x_g() const
Return the global x, y, z values.
Definition: StiHit.h:73
virtual void finish() const
Finish the tracker.
virtual Int_t Make()
Definition: StMaker.cxx:898
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
void setTiming()
Set timing of tracking.
Definition of Kalman Track.
virtual Int_t Finish()
Definition: StiMaker.cxx:199
UInt_t timesUsed() const
Return the number of times this hit was assigned to a track.
Definition: StiHit.h:108
Default Implementation of the StiToolkit Abstract interface.
Definition: Stypes.h:42
Definition: Stypes.h:40
Definition: Stypes.h:51
int isPrimary() const
const StiKTNBidirectionalIterator & end() const
void reset()
This performs a full internal reset of interator structure.
virtual void build(StMaker &source)
void fillEvent(StEvent *e, StiTrackContainer *t)
virtual void clear()=0
Clear/delete all objects owned by this factory.
virtual Int_t Finish()
Definition: StMaker.cxx:776
Definition: Stypes.h:50
virtual void clear()
Clear the tracker.
Definition: Stypes.h:44
StiKTNBidirectionalIterator begin() const
Definition: Stypes.h:41