CbmRoot
Loading...
Searching...
No Matches
CbmRichTrackExtrapolationMirrorIdeal.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) << "CbmRichTrackExtrapolationMirrorIdeal::Init(): FairRootManager is nullptr.";
40
41 fMcTracks = (TClonesArray*) manager->GetObject("MCTrack");
42 if (fMcTracks == nullptr) LOG(fatal) << "CbmRichTrackExtrapolationMirrorIdeal::Init(): No MCTrack array.";
43
44 fRichMirrorPoints = (TClonesArray*) manager->GetObject("RichMirrorPoint");
45 if (fRichMirrorPoints == nullptr)
46 LOG(fatal) << "CbmRichTrackExtrapolationMirrorIdeal::Init(): No RichMirrorPoint array.";
47
48 fStsTracks = (TClonesArray*) manager->GetObject("StsTrack");
49 if (fStsTracks == nullptr) LOG(fatal) << "CbmRichTrackExtrapolationMirrorIdeal::Init(): No StsTrack array.";
50
51 fStsTrackMatches = (TClonesArray*) manager->GetObject("StsTrackMatch");
52 if (fStsTrackMatches == nullptr)
53 LOG(fatal) << "CbmRichTrackExtrapolationMirrorIdeal::Init(): No StsTrackMatch array.";
54}
55
57 TClonesArray* extrapolatedTrackParams, double /*z*/)
58{
59
60 if (event != nullptr) {
61 LOG(fatal) << "CbmRichTrackExtrapolationMirrorIdeal::DoExtrapolation(): CbmEvent is not nullptr. "
62 "This class does not support time-based mode. Please switch to event-by-event mode.";
63 }
64
65 if (extrapolatedTrackParams == nullptr) {
66 LOG(error) << "CbmRichTrackExtrapolationMirrorIdeal::DoExtrapolation(): extrapolatedTrackParams missing!";
67 return;
68 }
69
70 if (globalTracks == nullptr) {
71 LOG(error) << "CbmRichTrackExtrapolationMirrorIdeal::DoExtrapolation(): globalTracks missing!";
72 return;
73 }
74
75 Double_t charge = 1.;
76 TMatrixFSym covMat(5);
77 for (Int_t i = 0; i < 5; i++)
78 for (Int_t j = 0; j <= i; j++)
79 covMat(i, j) = 0;
80 covMat(0, 0) = covMat(1, 1) = covMat(2, 2) = covMat(3, 3) = covMat(4, 4) = 1.e-4;
81
82 TVector3 pos, mom;
83 Int_t nofGlobalTracks = globalTracks->GetEntriesFast();
84 for (Int_t iT = 0; iT < nofGlobalTracks; iT++) {
85 CbmGlobalTrack* gTrack = static_cast<CbmGlobalTrack*>(globalTracks->At(iT));
86 new ((*extrapolatedTrackParams)[iT]) FairTrackParam(0., 0., 0., 0., 0., 0., covMat);
87
88 Int_t stsInd = gTrack->GetStsTrackIndex();
89 if (stsInd < 0) continue;
90 CbmStsTrack* stsTrack = static_cast<CbmStsTrack*>(fStsTracks->At(stsInd));
91 if (stsTrack == nullptr) continue;
92 CbmTrackMatchNew* stsTrackMatch = static_cast<CbmTrackMatchNew*>(fStsTrackMatches->At(stsInd));
93 if (stsTrackMatch == nullptr) continue;
94 Int_t stsMcInd = stsTrackMatch->GetMatchedLink().GetIndex();
95 for (Int_t iM = 0; iM < fRichMirrorPoints->GetEntriesFast(); iM++) {
96 CbmRichPoint* pMirror = static_cast<CbmRichPoint*>(fRichMirrorPoints->At(iM));
97 if (pMirror->GetTrackID() == stsMcInd) {
98 pMirror->Momentum(mom);
99 pMirror->Position(pos);
100 Double_t tx = mom.Px() / mom.Pz();
101 Double_t ty = mom.Py() / mom.Pz();
102 Double_t qp = charge / mom.Mag();
103 FairTrackParam richtrack(pos.X(), pos.Y(), pos.Z(), tx, ty, qp, covMat);
104 *(FairTrackParam*) (extrapolatedTrackParams->At(iT)) = richtrack;
105 }
106 }
107 }
108}
This is the implementation of the TrackExtrapolation from MC points - operating on points in the RICH...
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 Init()
Inherited from CbmRichTrackExtrapolationBase.
virtual void DoExtrapolation(CbmEvent *event, TClonesArray *globalTracks, TClonesArray *extrapolatedTrackParams, double z)
Inherited from CbmRichTrackExtrapolationBase.