Go to the documentation of this file.
28 #include "FairRootManager.h"
30 #include "TClonesArray.h"
36 : FairTask(
"CbmLitFindGlobalTracks")
43 , fMuchPixelHits(NULL)
58 , fLitOutputTofTracks()
67 fTrackingType(
"branch")
68 , fMergerType(
"nearest_hit")
69 , fFitterType(
"lit_kalman")
81 std::cout << std::endl;
82 LOG(info) <<
"=========================================";
83 LOG(info) << GetName() <<
": Initializing ";
95 LOG(info) <<
"=========================================";
96 std::cout << std::endl;
107 Int_t nEvents =
fEvents->GetEntriesFast();
108 LOG(debug) << GetName() <<
": reading time slice with " << nEvents
111 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
119 std::cout <<
"CbmLitFindGlobalTracks::Exec event: " <<
event->GetNumber()
130 std::cout <<
"CbmLitFindGlobalTracks::Exec event: " <<
fEventNo++
140 FairRootManager* ioman = FairRootManager::Instance();
145 fMvdHits =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"MvdHit"));
147 LOG(warn) << GetName() <<
": No MvdHit branch!";
150 LOG(info) << GetName() <<
": Found MvdHit branch";
154 fStsHits =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"StsHit"));
156 LOG(FATAL) << GetName() <<
": No StsHit branch!";
159 LOG(INFO) << GetName() <<
": Found StsHit branch";
162 fStsTracks =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"StsTrack"));
164 LOG(FATAL) << GetName() <<
": No StsTrack branch!";
167 LOG(INFO) << GetName() <<
": Found StsTrack branch";
172 dynamic_cast<TClonesArray*
>(ioman->GetObject(
"MuchPixelHit"));
174 LOG(WARNING) << GetName() <<
"No MuchPixelHit branch!";
178 LOG(INFO) << GetName() <<
": Found MuchPixelHit branch";
184 fTrdHits =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"TrdHit"));
186 LOG(WARNING) << GetName() <<
": No TrdHit branch!";
189 LOG(INFO) << GetName() <<
": Found TrdHit branch";
194 fTofHits =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"TofHit"));
196 LOG(WARNING) << GetName() <<
": No TofHit branch!";
199 LOG(INFO) << GetName() <<
": Found TofHit branch";
203 fEvents =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"Event"));
205 LOG(INFO) << GetName() <<
": Found Event branch";
207 LOG(INFO) << GetName() <<
": No Event branch; run in time-based mode";
215 LOG(WARNING) << GetName() <<
": No PrimaryVertex branch!";
217 LOG(INFO) << GetName() <<
": Found PrimaryVertex branch";
221 FairRootManager* ioman = FairRootManager::Instance();
226 fMuchTracks =
new TClonesArray(
"CbmMuchTrack", 100);
228 "MuchTrack",
"Much",
fMuchTracks, IsOutputBranchPersistent(
"MuchTrack"));
229 LOG(INFO) << GetName() <<
": Register MuchTrack branch";
234 fTrdTracks =
new TClonesArray(
"CbmTrdTrack", 100);
236 "TrdTrack",
"Trd",
fTrdTracks, IsOutputBranchPersistent(
"TrdTrack"));
237 LOG(INFO) << GetName() <<
": Register TrdTrack branch";
242 fTofTracks =
new TClonesArray(
"CbmTofTrack", 100);
244 "TofTrack",
"Tof",
fTofTracks, IsOutputBranchPersistent(
"TofTrack"));
245 LOG(INFO) << GetName() <<
": Register TofTrack branch";
250 ioman->Register(
"GlobalTrack",
253 IsOutputBranchPersistent(
"GlobalTrack"));
254 LOG(INFO) << GetName() <<
": Register GlobalTrack branch";
261 std::string st(
"e_");
265 TObject::Fatal(
"CbmLitFindGlobalTracks",
"Tracking type not found");
270 std::string st(
"mu_");
274 TObject::Fatal(
"CbmLitFindGlobalTracks",
"Tracking type not found");
282 TObject::Fatal(
"CbmLitFindGlobalTracks",
"Merger type not found");
289 TObject::Fatal(
"CbmLitFindGlobalTracks",
"Fitter type not found");
297 std::cout <<
"-I- CbmLitFindGlobalTracks: Number of STS tracks: "
319 std::cout <<
"-I- CbmLitFindGlobalTracks: Number of hits: " <<
fLitHits.size()
325 std::cout <<
"-I- CbmLitFindGlobalTracks: Number of TOF hits: "
352 for (Int_t
i = 0;
i < nofTofTracks; ++
i) {
357 if (globalTrack == NULL) {
continue; }
359 std::vector<Double_t> X, Y, Z;
360 if (primVertex == NULL) {
365 X.push_back(primVertex->
GetX());
366 Y.push_back(primVertex->
GetY());
367 Z.push_back(primVertex->
GetZ());
380 for (Int_t ih = 0; ih < nofStsHits; ih++) {
382 X.push_back(hit->
GetX());
383 Y.push_back(hit->
GetY());
384 Z.push_back(hit->
GetZ());
392 for (Int_t ih = 0; ih < nofMuchHits; ih++) {
397 X.push_back(hit->
GetX());
398 Y.push_back(hit->
GetY());
399 Z.push_back(hit->
GetZ());
408 for (Int_t ih = 0; ih < nofTrdHits; ih++) {
411 X.push_back(hit->
GetX());
412 Y.push_back(hit->
GetY());
413 Z.push_back(hit->
GetZ());
420 X.push_back(hit->
GetX());
421 Y.push_back(hit->
GetY());
422 Z.push_back(hit->
GetZ());
426 Double_t length = 0.;
427 for (Int_t j = 0; j < X.size() - 1; ++j) {
428 Double_t dX = X[j] - X[j + 1];
429 Double_t dY = Y[j] - Y[j + 1];
430 Double_t dZ = Z[j] - Z[j + 1];
431 length +=
std::sqrt(dX * dX + dY * dY + dZ * dZ);
486 if (0 == primVertex)
return;
491 for (Int_t i0 = 0; i0 < nofGlobalTracks; ++i0) {
497 FairTrackParam vtxTrackParam;
498 float chiSqPrimary = 0.f;
500 stsTrack, primVertex, &vtxTrackParam, chiSqPrimary);
576 Int_t stationCut = nofStations - 3;
592 std::cout <<
"Stopwatch: " << std::endl;
void CalculateLength(CbmEvent *event)
virtual ~CbmLitFindGlobalTracks()
Destructor.
TrackPropagatorPtr fPropagator
void InitTrackReconstruction()
Create and initialize track finder and track merger objects.
Base data class for strip hits.
Int_t GetMuchTrackIndex() const
HitToTrackMergerPtr fMerger
virtual InitStatus Init()
Inherited from FairTask.
virtual Int_t GetNofHits() const
friend F32vec4 sqrt(const F32vec4 &a)
TClonesArray * fMuchPixelHits
Tracking geometry constructor.
@ kMvd
Micro-Vertex Detector.
Int_t GetNofMuchStations()
Return number of stations in MUCH.
Base data class for pixel hits.
CbmLitFindGlobalTracks()
Constructor.
void ClearArrays()
Clear arrays and frees the memory.
TClonesArray * fStsTracks
static void HitArrayToHitVector(CbmEvent *event, ECbmDataType hitDataType, const TClonesArray *hits, HitPtrVector &litHits)
@ kTof
Time-of-flight Detector.
void SetDetectorId(LitSystemId sysId, Int_t station)
TrackPropagatorPtr fPropagator
TClonesArray * fTofTracks
static void LitTrackVectorToGlobalTrackArray(CbmEvent *event, const TrackPtrVector &litTracks, const TofTrackPtrVector &litTofTracks, TClonesArray *globalTracks, TClonesArray *stsTracks, TClonesArray *trdTracks, TClonesArray *muchTracks, TClonesArray *tofTracks)
void ConvertOutputData(CbmEvent *event)
Convert output data LIT data classes to CBMROOT data classes.
TClonesArray * fTofTracks
virtual void SetParContainers()
Inherited from FairTask.
TClonesArray * fTrdTracks
data class for a reconstructed 3-d hit in the STS
TStopwatch fTrackingWatch
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
CBM task for global track reconstruction.
Data class for STS tracks.
Int_t GetStsTrackIndex() const
void SetLength(Double_t length)
Base data class for hits.
void RunTrackReconstruction()
Run the track reconstruction.
Int_t GetNofMuchTrdStations()
Return number of stations in MUCH + TRD.
void CalculatePrimaryVertexParameters(CbmEvent *event)
Int_t GetHitIndex(Int_t iHit) const
Int_t GetTrdTrackIndex() const
bool GetDet(ECbmModuleId detId) const
Return detector presence in setup.
void RegisterOutputBranches()
Register output data branches (tracks) to the tree.
TofTrackPtrVector fLitOutputTofTracks
virtual void Finish()
Inherited from FairTask.
Base data class for track.
void SetParamPrimaryVertex(const FairTrackParam *parPV)
virtual void Exec(Option_t *opt)
Inherited from FairTask.
Int_t GetTrackIndex() const
TrackPtrVector fLitStsTracks
HitType GetHitType(Int_t iHit) const
Int_t GetTofHitIndex() const
void PrintStopwatchStatistics()
Print output stopwatch statistics for track-finder and hit-to-track merger.
void ConvertInputData(CbmEvent *event)
Convert input data from CBMROOT data classes to LIT data classes.
@ kTrd
Transition Radiation Detector.
void SetQuality(LitTrackQa quality)
static void ExtrapolateTrackToPV(const CbmStsTrack *track, CbmVertex *pv, FairTrackParam *paramAtPV, float &chiPrim)
TClonesArray * fGlobalTracks
ClassImp(CbmLitFindGlobalTracks)
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
static void StsTrackArrayToTrackVector(CbmEvent *event, const TClonesArray *tracks, TrackPtrVector &litTracks)
Base data class for track.
Class characterising one event by a collection of links (indices) to data objects,...
@ kMuch
Muon detection system.
void ReadInputBranches()
Accesses input data branches (hits, tracks, events) from the tree.
Int_t GetTofHitIndex() const
LitSystemId GetSystem() const
bool GetElectronSetup() const
Return true if electron setup is detected.
TClonesArray * fMuchTracks
void SetTrackLength(Double32_t trackLength)
LitTrackQa GetQuality() const
string ToString() const
Return string representation of class.
@ kSts
Silicon Tracking System.
static CbmLitTrackingGeometryConstructor * Instance()
Return pointer to singleton object.
const CbmLitHit * GetHit(Int_t index) const
void SetDet(ECbmModuleId detId, bool isDet)
Set detector presence manually.
Base data class for hits.
Provides information on attaching a TofHit to a GlobalTrack.
Data class for a reconstructed hit in the STS.
void SelectTracksForTofMerging()
Select tracks for further merging with TOF.
void DetermineSetup()
Determines detector presence using TGeoManager.
Int_t GetNofStsHits() const
TrackPtrVector fLitOutputTracks