24#include "FairRootManager.h"
25#include "FairRunAna.h"
26#include "FairRuntimeDb.h"
31#include "TClonesArray.h"
43using std::setprecision;
45using std::stringstream;
49 : FairTask(
"StsFindTracksEvents")
84 pair<UInt_t, UInt_t> result;
93 nEvents =
fEvents->GetEntriesFast();
94 LOG(debug) << GetName() <<
": reading time slice with " << nEvents <<
" events ";
95 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
98 nHits += result.first;
99 nTracks += result.second;
105 nHits = result.first;
106 nTracks = result.second;
112 logOut << setw(20) << left << GetName() <<
" [";
113 logOut << fixed << setw(8) << setprecision(1) << right << timer.RealTime() * 1000. <<
" ms] ";
114 logOut <<
"TS " <<
fNofTs;
115 if (
fEvents) logOut <<
", events " << nEvents;
116 logOut <<
", hits " << nHits <<
", tracks " << nTracks;
117 LOG(info) << logOut.str();
122 fTime += timer.RealTime();
131 LOG(info) <<
"=====================================";
132 LOG(info) << GetName() <<
": initialising";
135 FairRootManager* ioman = FairRootManager::Instance();
139 fEvents =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"CbmEvent"));
141 LOG(warn) << GetName() <<
": No event array! Will process entire tree.";
145 fStsHits = (TClonesArray*) ioman->GetObject(
"StsHit");
150 fMvdHits = (TClonesArray*) ioman->GetObject(
"MvdHit");
152 LOG(error) << GetName() <<
": Use of MVD hits selected, but no hit branch present! "
153 <<
"Tracking will be done without MVD hits.";
156 LOG(info) << GetName() <<
": including MVD hits in tracking";
160 fTracks =
new TClonesArray(
"CbmStsTrack", 100);
161 ioman->Register(
"StsTrack",
"STS",
fTracks, IsOutputBranchPersistent(
"StsTrack"));
165 LOG(fatal) << GetName() <<
": no track finding engine selected!";
168 LOG(info) << GetName() <<
": Use track finder " <<
fFinder->GetName();
177 LOG(info) << GetName() <<
": successfully initialised.";
178 LOG(info) <<
"=====================================\n";
188 std::cout << std::endl;
189 LOG(info) <<
"=====================================";
190 LOG(info) << GetName() <<
": Run summary";
191 LOG(info) <<
"Time slices : " <<
fNofTs;
192 LOG(info) <<
"Hits / TS : " << fixed << setprecision(2) << Double_t(
fNofHits) / Double_t(
fNofTs);
193 LOG(info) <<
"Tracks / TS : " << fixed << setprecision(2) << Double_t(
fNofTracks) / Double_t(
fNofTs);
195 LOG(info) <<
"Time per TS : " << 1000. *
fTime / Double_t(
fNofTs) <<
" ms ";
197 LOG(info) <<
"Events processed : " <<
fNofEvents;
201 LOG(info) <<
"=====================================";
217 Int_t eventNumber = (
event ?
event->GetNumber() :
fNofEvents);
219 LOG(debug) <<
"+ " << setw(20) << GetName() <<
": Event " << setw(6) << right << eventNumber <<
", real time "
220 << fixed << setprecision(6) <<
fTimer.RealTime() <<
" s, hits: " << nHits <<
", tracks: " << nTracks;
222 return std::make_pair(nHits, nTracks);
ClassImp(CbmConverterManager)
Data class for a reconstructed hit in the STS.
Data class for STS tracks.
Class characterising one event by a collection of links (indices) to data objects,...
Task class for finding STS tracks in an event.
TClonesArray * fTracks
Input array of STS hits.
TClonesArray * fMvdHits
Array of CbmEvent objects.
CbmStsTrackFinder * fFinder
virtual void Exec(Option_t *opt)
TClonesArray * fStsHits
Input array of MVD hits.
TStopwatch fTimer
Output array of CbmStsTracks.
std::pair< UInt_t, UInt_t > ProcessEvent(CbmEvent *event)
Process one event or timeslice.
Int_t fNofEvents
Number of events with success.
Double_t fNofTracks
Number of tracks created.
virtual ~CbmStsFindTracksEvents()
Double_t fTime
Total real time used for good events.
Double_t fNofHits
Number of hits.
CbmStsFindTracksEvents(CbmStsTrackFinder *finder=NULL, Bool_t useMvd=kFALSE)
virtual InitStatus Init()
MC-based track finding in the STS.
void SetMvdHitArray(TClonesArray *hits)
void SetTrackArray(TClonesArray *tracks)
virtual Int_t FindTracks(CbmEvent *event)=0
void FillEloss()
Calculate the median energy loss for the tracks and fill the respective data members.
void SetStsHitArray(TClonesArray *hits)