CbmRoot
Loading...
Searching...
No Matches
CbmLitConverterParallel.cxx
Go to the documentation of this file.
1/* Copyright (C) 2013-2014 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
12
13#include "CbmMuchTrack.h"
14#include "CbmPixelHit.h"
15#include "CbmTrack.h"
16#include "CbmTrdTrack.h"
17#include "FairTrackParam.h"
18#include "TClonesArray.h"
22
23#include <cassert>
24
25
27
29
32{
33 lpar->X = par->GetX();
34 lpar->Y = par->GetY();
35 lpar->Tx = par->GetTx();
36 lpar->Ty = par->GetTy();
37 lpar->Qp = par->GetQp();
38 lpar->Z = par->GetZ();
39 Double_t cov[15];
40 par->CovMatrix(cov);
41 lpar->C0 = cov[0];
42 lpar->C1 = cov[1];
43 lpar->C2 = cov[2];
44 lpar->C3 = cov[3];
45 lpar->C4 = cov[4];
46 lpar->C5 = cov[5];
47 lpar->C6 = cov[6];
48 lpar->C7 = cov[7];
49 lpar->C8 = cov[8];
50 lpar->C9 = cov[9];
51 lpar->C10 = cov[10];
52 lpar->C11 = cov[11];
53 lpar->C12 = cov[12];
54 lpar->C13 = cov[13];
55 lpar->C14 = cov[14];
56}
57
59 FairTrackParam* par)
60{
61 par->SetX(lpar->X);
62 par->SetY(lpar->Y);
63 par->SetTx(lpar->Tx);
64 par->SetTy(lpar->Ty);
65 par->SetQp(lpar->Qp);
66 par->SetZ(lpar->Z);
67 Double_t cov[15];
68 cov[0] = lpar->C0;
69 cov[1] = lpar->C1;
70 cov[2] = lpar->C2;
71 cov[3] = lpar->C3;
72 cov[4] = lpar->C4;
73 cov[5] = lpar->C5;
74 cov[6] = lpar->C6;
75 cov[7] = lpar->C7;
76 cov[8] = lpar->C8;
77 cov[9] = lpar->C9;
78 cov[10] = lpar->C10;
79 cov[11] = lpar->C11;
80 cov[12] = lpar->C12;
81 cov[13] = lpar->C13;
82 cov[14] = lpar->C14;
83 par->SetCovMatrix(cov);
84}
85
87{
88 assert(hit->GetType() == kTRDHIT || hit->GetType() == kMUCHPIXELHIT || hit->GetType() == kTOFHIT);
89
90 lhit->X = hit->GetX();
91 lhit->Y = hit->GetY();
92 lhit->Z = hit->GetZ();
93 lhit->Dx = hit->GetDx();
94 lhit->Dy = hit->GetDy();
95 lhit->Dxy = hit->GetDxy();
96 lhit->refId = hit->GetRefId();
97
98 if (hit->GetType() == kTRDHIT) {
99 lhit->stationId = hit->GetPlaneId();
100 }
101 else if (hit->GetType() == kMUCHPIXELHIT) {
102 lhit->stationId = (hit->GetPlaneId() - 1) / 2;
103 }
104 else if (hit->GetType() == kTOFHIT) {
105 lhit->stationId = 0;
106 }
107}
108
110 vector<lit::parallel::LitScalPixelHit*>& lhits)
111{
112 Int_t nofHits = hits->GetEntriesFast();
113 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
114 const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(iHit));
117 lhits.push_back(lhit);
118 }
119}
120
122 const vector<lit::parallel::LitScalPixelHit*>& lhits,
124{
125 // Convert hits
126 Int_t nofHits = track->GetNofHits();
127 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
128 // Now we convert only pixel hits
129 if (track->GetHitType(iHit) != kPIXELHIT && track->GetHitType(iHit) != kTRDHIT
130 && track->GetHitType(iHit) != kMUCHPIXELHIT)
131 continue;
132 Int_t hitId = track->GetHitIndex(iHit);
133 ltrack->AddHit(lhits[hitId]);
134 }
135 // Convert first and last track parameter
138 ltrack->SetParamFirst(lpar);
140 ltrack->SetParamFirst(lpar);
141 // Convert other parameters
142 ltrack->SetChiSq(track->GetChiSq());
143 ltrack->SetNDF(track->GetNDF());
144 ltrack->SetPreviousTrackId(track->GetPreviousTrackId());
145 ltrack->SetNofMissingHits(0);
146 ltrack->IsGood(true);
147}
148
150 const vector<lit::parallel::LitScalPixelHit*>& lhits,
151 vector<lit::parallel::LitScalTrack*>& ltracks)
152{
153 Int_t nofTracks = tracks->GetEntriesFast();
154 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
155 const CbmTrack* track = static_cast<const CbmTrack*>(tracks->At(iTrack));
157 CbmTrackToLitScalTrack(track, lhits, ltrack);
158 ltracks.push_back(ltrack);
159 }
160}
161
163{
164 // Convert hits
165 Int_t nofHits = ltrack->GetNofHits();
166 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
167 Int_t hitId = ltrack->GetHit(iHit)->refId;
168 track->AddHit(hitId, kTRDHIT);
169 }
170 // Convert first and last track parameter
171 FairTrackParam par;
173 track->SetParamFirst(&par);
175 track->SetParamLast(&par);
176 // Convert other parameters
177 track->SetChiSq(ltrack->GetChiSq());
178 track->SetNDF(ltrack->GetNDF());
179 track->SetPreviousTrackId(ltrack->GetPreviousTrackId());
180}
181
182void CbmLitConverterParallel::LitScalTrackArrayToCbmTrdTrackArray(const vector<lit::parallel::LitScalTrack*>& ltracks,
183 TClonesArray* tracks)
184{
185 Int_t nofTracks = ltracks.size();
186 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
187 lit::parallel::LitScalTrack* ltrack = ltracks[iTrack];
188 CbmTrdTrack* track = new ((*tracks)[iTrack]) CbmTrdTrack();
189 LitScalTrackToCbmTrack(ltrack, track);
190 }
191}
192
193void CbmLitConverterParallel::LitScalTrackArrayToCbmMuchTrackArray(const vector<lit::parallel::LitScalTrack*>& ltracks,
194 TClonesArray* tracks)
195{
196 Int_t nofTracks = ltracks.size();
197 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
198 lit::parallel::LitScalTrack* ltrack = ltracks[iTrack];
199 CbmMuchTrack* track = new ((*tracks)[iTrack]) CbmMuchTrack();
200 LitScalTrackToCbmTrack(ltrack, track);
201 }
202}
TClonesArray * tracks
@ kTOFHIT
Definition CbmHit.h:31
@ kPIXELHIT
Definition CbmHit.h:23
@ kTRDHIT
Definition CbmHit.h:30
@ kMUCHPIXELHIT
Definition CbmHit.h:28
Class for conversion between CBMROOT data classes and littrack parallel data classes.
static vector< vector< QAHit > > hits
Base class for scalar pixel hits.
Scalar track data class.
Track parameters data class.
HitType GetType() const
Definition CbmHit.h:70
virtual int32_t GetPlaneId() const
Definition CbmHit.h:99
double GetZ() const
Definition CbmHit.h:71
int32_t GetRefId() const
Definition CbmHit.h:73
static void CbmTrackArrayToLitScalTrackArray(const TClonesArray *tracks, const vector< lit::parallel::LitScalPixelHit * > &lhits, vector< lit::parallel::LitScalTrack * > &ltracks)
Convert array of CbmTrack to array of LitScalTrack.
static void LitTrackParamScalToFairTrackParam(const lit::parallel::LitTrackParamScal *lpar, FairTrackParam *par)
Convert LitTrackParamScal to FairTrackParam.
static void CbmTrackToLitScalTrack(const CbmTrack *track, const vector< lit::parallel::LitScalPixelHit * > &lhits, lit::parallel::LitScalTrack *ltrack)
Convert CbmTrack to LitScalTrack.
static void CbmPixelHitToLitScalPixelHit(const CbmPixelHit *hit, lit::parallel::LitScalPixelHit *lhit)
Convert CbmPixelHit to LitScalPixelHit.
static void LitScalTrackArrayToCbmTrdTrackArray(const vector< lit::parallel::LitScalTrack * > &ltracks, TClonesArray *tracks)
Convert array of LitScalTrack to array of CbmTrack.
static void FairTrackParamToLitTrackParamScal(const FairTrackParam *par, lit::parallel::LitTrackParamScal *lpar)
Convert FairTrackParam to LitTrackParamScal.
static void CbmPixelHitArrayToLitScalPixelHitArray(const TClonesArray *hits, vector< lit::parallel::LitScalPixelHit * > &lhits)
Convert CbmPixelHit array to LitScalPixelHit arra.
virtual ~CbmLitConverterParallel()
Destructor.
static void LitScalTrackArrayToCbmMuchTrackArray(const vector< lit::parallel::LitScalTrack * > &ltracks, TClonesArray *tracks)
Convert array of LitScalTrack to array of CbmTrack.
static void LitScalTrackToCbmTrack(const lit::parallel::LitScalTrack *ltrack, CbmTrack *track)
Convert LitScalTrack to CbmTrack.
double GetDy() const
Definition CbmPixelHit.h:76
double GetDx() const
Definition CbmPixelHit.h:75
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
double GetDxy() const
Definition CbmPixelHit.h:77
void AddHit(int32_t index, HitType type)
Definition CbmTrack.cxx:97
const FairTrackParam * GetParamLast() const
Definition CbmTrack.h:69
int32_t GetNDF() const
Definition CbmTrack.h:64
virtual int32_t GetNofHits() const
Definition CbmTrack.h:58
void SetParamFirst(const FairTrackParam *par)
Definition CbmTrack.h:86
int32_t GetPreviousTrackId() const
Definition CbmTrack.h:67
const FairTrackParam * GetParamFirst() const
Definition CbmTrack.h:68
void SetChiSq(double chiSq)
Definition CbmTrack.h:81
int32_t GetHitIndex(int32_t iHit) const
Definition CbmTrack.h:59
HitType GetHitType(int32_t iHit) const
Definition CbmTrack.h:60
void SetPreviousTrackId(int32_t previousTrackId)
Definition CbmTrack.h:85
void SetNDF(int32_t ndf)
Definition CbmTrack.h:82
void SetParamLast(const FairTrackParam *par)
Definition CbmTrack.h:87
double GetChiSq() const
Definition CbmTrack.h:63
Base class for scalar pixel hits.
Scalar track data class.
void SetPreviousTrackId(unsigned short previousTrackId)
Sets previous trackId.
void SetChiSq(fscal chiSq)
Sets chi square.
const LitTrackParamScal & GetParamFirst() const
Returns first parameter of the track.
void SetNofMissingHits(unsigned short nofMissingHits)
Sets number of missing hits.
unsigned short GetPreviousTrackId() const
Return Previous track index.
void SetNDF(unsigned short NDF)
Sets number of degrees of freedom.
fscal GetChiSq() const
Returns chi square of the track.
unsigned short GetNofHits() const
Returns number of hits in track.
const LitTrackParamScal & GetParamLast() const
Returns last parameter of the track.
bool IsGood() const
Returns true if track is good.
const LitScalPixelHit * GetHit(unsigned short index) const
Returns pointer to the hit.
void SetParamFirst(const LitTrackParamScal &param)
Sets first track parameter.
void AddHit(const LitScalPixelHit *hit)
Adds hit to track.
unsigned short GetNDF() const
Returns number of degrees of freedom.