CbmRoot
Loading...
Searching...
No Matches
CbmRichTrackExtrapolationIdeal.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Claudia Hoehne [committer], Andrey Lebedev, Semen Lebedev */
4
13
14#include "CbmEvent.h"
15#include "CbmGlobalTrack.h"
16#include "CbmMCTrack.h"
17#include "CbmRichPoint.h"
18#include "CbmStsTrack.h"
19#include "CbmTrackMatchNew.h"
20#include "FairRootManager.h"
21#include "FairTrackParam.h"
22#include "TClonesArray.h"
23#include "TMatrixFSym.h"
24
25#include <Logger.h>
26
27#include <iostream>
28
29using std::cout;
30using std::endl;
31
33
35
37{
38 FairRootManager* manager = FairRootManager::Instance();
39 if (manager == nullptr) LOG(fatal) << "CbmRichTrackExtrapolationIdeal::Init(): FairRootManager is nullptr.";
40
41 fRefPlanePoints = (TClonesArray*) manager->GetObject("RefPlanePoint");
42 if (fRefPlanePoints == nullptr) LOG(fatal) << "CbmRichTrackExtrapolationIdeal::Init(): No RefPlanePoint array.";
43
44 fStsTracks = (TClonesArray*) manager->GetObject("StsTrack");
45 if (fStsTracks == nullptr) LOG(fatal) << "CbmRichTrackExtrapolationIdeal::Init(): No StsTrack array.";
46
47 fStsTrackMatches = (TClonesArray*) manager->GetObject("StsTrackMatch");
48 if (fStsTrackMatches == nullptr) LOG(fatal) << "CbmRichTrackExtrapolationIdeal::Init(): No StsTrackMatch array.";
49}
50
51void CbmRichTrackExtrapolationIdeal::DoExtrapolation(CbmEvent* event, TClonesArray* globalTracks,
52 TClonesArray* extrapolatedTrackParams, double /*z*/)
53{
54
55 if (event != nullptr) {
56 LOG(fatal) << "CbmRichTrackExtrapolationIdeal::DoExtrapolation(): CbmEvent is not nullptr. "
57 "This class does not support time-based mode. Please switch to event-by-event mode.";
58 }
59
60 if (extrapolatedTrackParams == nullptr) {
61 LOG(error) << "CbmRichTrackExtrapolationIdeal::DoExtrapolation(): extrapolatedTrackParams missing!";
62 return;
63 }
64
65 if (globalTracks == nullptr) {
66 LOG(error) << "CbmRichTrackExtrapolationIdeal::DoExtrapolation(): globalTracks missing!";
67 return;
68 }
69
70 Double_t charge = 1.;
71 TMatrixFSym covMat(5);
72 for (Int_t i = 0; i < 5; i++)
73 for (Int_t j = 0; j <= i; j++)
74 covMat(i, j) = 0;
75 covMat(0, 0) = covMat(1, 1) = covMat(2, 2) = covMat(3, 3) = covMat(4, 4) = 1.e-4;
76
77 TVector3 pos, mom;
78 Int_t nofGlobalTracks = globalTracks->GetEntriesFast();
79 for (Int_t iT = 0; iT < nofGlobalTracks; iT++) {
80 CbmGlobalTrack* gTrack = static_cast<CbmGlobalTrack*>(globalTracks->At(iT));
81 new ((*extrapolatedTrackParams)[iT]) FairTrackParam(0., 0., 0., 0., 0., 0., covMat);
82
83 Int_t stsInd = gTrack->GetStsTrackIndex();
84 if (stsInd < 0) continue;
85 CbmStsTrack* stsTrack = static_cast<CbmStsTrack*>(fStsTracks->At(stsInd));
86 if (stsTrack == nullptr) continue;
87 CbmTrackMatchNew* stsTrackMatch = static_cast<CbmTrackMatchNew*>(fStsTrackMatches->At(stsInd));
88 if (stsTrackMatch == nullptr) continue;
89 Int_t stsMcInd = stsTrackMatch->GetMatchedLink().GetIndex();
90
91 for (Int_t iR = 0; iR < fRefPlanePoints->GetEntriesFast(); iR++) {
92 CbmRichPoint* refPlanePoint = static_cast<CbmRichPoint*>(fRefPlanePoints->At(iR));
93 if (refPlanePoint->GetTrackID() == stsMcInd) {
94 refPlanePoint->Momentum(mom);
95 refPlanePoint->Position(pos);
96 Double_t tx = mom.Px() / mom.Pz();
97 Double_t ty = mom.Py() / mom.Pz();
98 Double_t qp = charge / mom.Mag();
99 FairTrackParam richtrack(pos.X(), pos.Y(), pos.Z(), tx, ty, qp, covMat);
100 *(FairTrackParam*) (extrapolatedTrackParams->At(iT)) = richtrack;
101 }
102 }
103 }
104}
This is the implementation of the TrackExtrapolation from MC points. It reads the STS track array,...
Data class for STS tracks.
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
int32_t GetStsTrackIndex() const
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
virtual void DoExtrapolation(CbmEvent *event, TClonesArray *globalTracks, TClonesArray *extrapolatedTrackParams, double z)
Inherited from CbmRichTrackExtrapolationBase.
virtual void Init()
Inherited from CbmRichTrackExtrapolationBase.