7#include "CbmL1StsTrackFinder.h"
9#include "CbmStsTrack.h"
10#include "CbmStsTrackFinderIdeal.h"
14#include "FairRootManager.h"
15#include "FairRunAna.h"
16#include "FairRuntimeDb.h"
19#include "TClonesArray.h"
46 finderName(
"CbmStsTrackFinderIdeal")
51 const TString& sFinderName,
52 Bool_t useMvd,
const char* name)
69 finderName(sFinderName)
76 if ( fFinder)
delete fFinder;
82 if (!IsActive())
return;
87 Int_t nTracks = fFinder->
DoFind();
88 for (Int_t iTrack=0; iTrack<fTracks->GetEntriesFast(); iTrack++) {
95 cout <<
"+ " << setw(15) << left << fName <<
": " << setprecision(4)
96 << setw(8) << fixed << right << fTimer.RealTime()
97 <<
" s, tracks found " << nTracks << endl;
100 fTime += fTimer.RealTime();
101 fNTracks += Double_t(nTracks);
106void CbmStsFindTracks::SetParContainers() {
109 FairRunAna*
run = FairRunAna::Instance();
110 if ( !
run ) Fatal(
"SetParContainers",
"No analysis run");
112 FairRuntimeDb* db =
run->GetRuntimeDb();
113 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
116 fGeoPar = (
CbmGeoStsPar*) db->getContainer(
"CbmGeoStsPar");
119 fDigiPar = (
CbmStsDigiPar*) db->getContainer(
"CbmStsDigiPar");
123void CbmStsFindTracks::InitFinder()
125 if(finderName ==
"CbmStsTrackFinderIdeal")
127 else if(finderName ==
"CbmL1StsTrackFinder")
130 LOG(error) <<
"Cannot initialize finder. Invalid finder name: " << finderName;
133void CbmStsFindTracks::BuildDigitisationScheme()
135 if ( fDigiScheme->
Init(fGeoPar, fDigiPar) ) {
136 if (fVerbose == 1 || fVerbose == 2) fDigiScheme->
Print(kFALSE);
137 else if (fVerbose > 2) fDigiScheme->
Print(kTRUE);
139 <<
"STS digitisation scheme succesfully initialised" << endl;
141 <<
", Sectors: " << fDigiScheme->
GetNSectors() <<
", Channels: "
147InitStatus CbmStsFindTracks::Init()
150 cout <<
"---------------------------------------------" << endl;
151 cout <<
"-I- Initialising " << GetName() <<
" ...." << endl;
156 FairRootManager* ioman = FairRootManager::Instance();
157 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
158 fStsHits = (TClonesArray*) ioman->GetObject(
"StsHit");
160 cout <<
"-E- "<< GetName() <<
"::Init: No StsHit array!" << endl;
164 fMvdHits = (TClonesArray*) ioman->GetObject(
"MvdHit");
166 cout <<
"-W- " << GetName() <<
"::Init: No MVD hits available!"
168 cout <<
" Running track finding without MVD hits" << endl;
173 fTracks =
new TClonesArray(
"CbmStsTrack",100);
174 ioman->Register(
"StsTrack",
"STS", fTracks, kTRUE);
176 BuildDigitisationScheme();
180 cout <<
"-E- " << GetName() <<
"::Init: No track finder selected!"
184 cout <<
"-I- Track finder engine " << fFinder->GetName()
185 <<
" selected" << endl;
198 cout <<
"-I- " << GetName() <<
" intialised " << endl;
199 cout <<
"---------------------------------------------" << endl;
206 if (!IsActive())
return;
208 resultTree->Branch(
"StsTrack", &fTracks);
214void CbmStsFindTracks::Finish() {
220 cout <<
"============================================================"
222 cout <<
"===== " << GetName() <<
": Run summary " << endl;
223 cout <<
"===== " << endl;
224 cout <<
"===== Good events : " << setw(6) << fNEvents << endl;
225 cout <<
"===== Failed events : " << setw(6) << fNEventsFailed << endl;
226 cout <<
"===== Average time : " << setprecision(4) << setw(8) << right
227 << fTime / Double_t(fNEvents) <<
" s" << endl;
228 cout <<
"===== " << endl;
229 cout <<
"===== Found tracks per event : " << fixed << setprecision(0)
230 << fNTracks / Double_t(fNEvents) << endl;
231 cout <<
"============================================================"
234 printf(
"Work time of CbmStsFindTracks: %4.2f sec.\n", fTime);
BmnSsdDigitizeParameters * fDigiPar
Digitisation parameters.
void Print(Bool_t kLong=kFALSE)
virtual void OnlineWrite(const std::unique_ptr< TTree > &resultTree)
Write task resul to tree.
virtual void Exec(Option_t *opt)
virtual ~CbmStsFindTracks()
void SetMvdHitArray(TClonesArray *hits)
void SetTrackArray(TClonesArray *tracks)
void SetField(FairField *field)
void SetVerbose(Int_t verbose)
void SetStsHitArray(TClonesArray *hits)
void SetDigiScheme(CbmStsDigiScheme *scheme)