5#ifndef CBMLITCONVERTER_H_
6#define CBMLITCONVERTER_H_
23#include "FairRootManager.h"
24#include "FairTrackParam.h"
25#include "TClonesArray.h"
123 for (Int_t iHit = 0; iHit < track->
GetNofHits(); iHit++) {
129 ltrack->
AddHit(lhits[hitId]);
152 Int_t nofTracks =
tracks->GetEntriesFast();
153 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
157 ltracks.push_back(ltrack);
167 for (Int_t iHit = 0; iHit < litTrack->
GetNofHits(); iHit++) {
171 if (det != systemId)
continue;
172 if (firstHit < 0) firstHit = iHit;
185 if (ndf <= 0) ndf = 1;
191 FairTrackParam parLast, parFirst;
202 TClonesArray* stsTracks, TClonesArray* trdTracks,
203 TClonesArray* muchTracks, TClonesArray* tofTracks)
206 Int_t globalTrackNo = globalTracks->GetEntriesFast();
208 for (Int_t i = 0; i < nofStsTracks; i++) {
216 Int_t trdTrackNo = (trdTracks != NULL) ? trdTracks->GetEntriesFast() : 0;
217 Int_t muchTrackNo = (muchTracks != NULL) ? muchTracks->GetEntriesFast() : 0;
218 Int_t tofTrackNo = (tofTracks != NULL) ? tofTracks->GetEntriesFast() : 0;
220 for (
size_t iTrack = 0; iTrack < litTracks.size(); iTrack++) {
230 LOG(error) <<
"CbmLitConverter::LitTrackVectorToGlobalTrackArray: "
231 "unequal number of hits and fit nodes"
240 FairTrackParam parLast;
244 Bool_t isCreateMuchTrack =
false, isCreateTrdTrack =
false;
245 for (Int_t iHit = 0; iHit < litTrack->
GetNofHits(); iHit++) {
248 if (thisDetId ==
kLITMUCH && muchTracks != NULL) {
249 isCreateMuchTrack =
true;
251 if (thisDetId ==
kLITTRD && trdTracks != NULL) {
252 isCreateTrdTrack =
true;
255 if (isCreateTrdTrack) {
264 if (isCreateMuchTrack) {
275 for (
size_t iTrack = 0; iTrack < litTofTracks.size(); iTrack++) {
299 Int_t nofHits =
event ?
event->GetNofData(hitDataType) :
hits->GetEntriesFast();
300 for (Int_t i = 0; i < nofHits; ++i) {
301 Int_t iHit =
event ?
event->GetIndex(hitDataType, i) : i;
309 litHits.push_back(litHit);
315 Int_t nofHits =
hits->GetEntriesFast();
316 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
323 litHits.push_back(litHit);
330 for (Int_t i = 0; i < nofTracks; ++i) {
343 litTracks.push_back(litTrack);
353 static FairRootManager* ioman = 0;
355 static TClonesArray* stsHits = 0;
356 static TClonesArray* mvdHits = 0;
359 static bool init =
false;
360 static Int_t pdg = 211;
364 ioman = FairRootManager::Instance();
367 primVertex =
static_cast<CbmVertex*
>(ioman->GetObject(
"PrimaryVertex"));
368 stsHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsHit"));
369 mvdHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"MvdHit"));
376 Double_t xVert = primVertex ? primVertex->
GetX() : 0;
377 Double_t yVert = primVertex ? primVertex->
GetY() : 0;
378 Double_t zVert = primVertex ? primVertex->
GetZ() : 0;
388 Double_t
x = paramFirst.
GetX();
389 Double_t
y = paramFirst.
GetY();
390 Double_t z = paramFirst.
GetZ();
393 Double_t deltaTFirst = 0;
395 if (propagator->Propagate(&par, zVert, pdg) ==
kLITERROR)
396 deltaTFirst = -TMath::Sqrt(TMath::Power(
x - xVert, 2) + TMath::Power(
y - yVert, 2) + TMath::Power(z - zVert, 2))
401 if (deltaTFirst > 0) deltaTFirst = -deltaTFirst;
404 firstTime = paramFirst.
GetTime();
409 int nofHits = nofMvdHits + nofStsHits;
410 Double_t deltaTLast = 0;
412 for (
int i = 1; i < nofHits; ++i) {
419 if (i == nofHits - 1)
420 z = paramLast.
GetZ();
424 if (propagator->Propagate(&par, z, pdg) ==
kLITERROR) {
425 deltaTLast = TMath::Sqrt(TMath::Power(paramLast.
GetX() - paramFirst.
GetX(), 2)
426 + TMath::Power(paramLast.
GetY() - paramFirst.
GetY(), 2)
427 + TMath::Power(paramLast.
GetZ() - paramFirst.
GetZ(), 2))
435 filter->Update(&par, &litHit, chi);
441 lastTime = firstTime + deltaTLast;
Define enumerations used in littrack.
Data class for storage of fitted track parameters, transport matrix and chi-square on each detector s...
Base data class for hits.
Base data class for pixel hits.
Base data class for strip hits.
Data class for track parameters.
Base data class for track.
Typedefs for data structures used in littrack.
vector< CbmLitTofTrack * > TofTrackPtrVector
Data class for STS tracks.
static vector< vector< QAHit > > hits
boost::shared_ptr< CbmLitTrackPropagator > TrackPropagatorPtr
boost::shared_ptr< CbmLitTrackUpdate > TrackUpdatePtr
std::vector< CbmTofTrack * > TrackPtrVector
std::vector< CbmTofHit * > HitPtrVector
Helper class to convert unique channel ID back and forth.
Class characterising one event by a collection of links (indices) to data objects,...
void SetParamLast(const FairTrackParam *parLast)
void SetMuchTrackIndex(int32_t iMuch)
void SetTofHitIndex(int32_t iTofHit)
void SetTrdTrackIndex(int32_t iTrd)
void SetStsTrackIndex(int32_t iSts)
double GetTimeError() const
virtual int32_t GetPlaneId() const
static void FairTrackParamToCbmLitTrackParam(const FairTrackParam *par, CbmLitTrackParam *litPar)
static void CbmLitTrackParamToFairTrackParam(const CbmLitTrackParam *litPar, FairTrackParam *par)
static void LitTrackVectorToGlobalTrackArray(CbmEvent *event, const TrackPtrVector &litTracks, const TofTrackPtrVector &litTofTracks, TClonesArray *globalTracks, TClonesArray *stsTracks, TClonesArray *trdTracks, TClonesArray *muchTracks, TClonesArray *tofTracks)
static void MvdHitArrayToHitVector(const TClonesArray *hits, HitPtrVector &litHits)
static void CbmStsTrackToCbmLitTrack(const CbmStsTrack *stsTrack, CbmLitTrack *litTrack)
static void GetStsTrackTimes(const CbmStsTrack *track, Double_t &firstTime, Double_t &lastTime)
static void CbmLitTrackToCbmTrack(const CbmLitTrack *litTrack, CbmTrack *track, LitSystemId systemId)
static void CbmMvdHitToCbmLitPixelHit(const CbmMvdHit *hit, Int_t index, CbmLitPixelHit *litHit)
static void HitArrayToHitVector(CbmEvent *event, ECbmDataType hitDataType, const TClonesArray *hits, HitPtrVector &litHits)
static void CbmTrackArrayToCbmLitTrackArray(const TClonesArray *tracks, const HitPtrVector &lhits, TrackPtrVector <racks)
static void StsTrackArrayToTrackVector(CbmEvent *event, const TClonesArray *tracks, TrackPtrVector &litTracks)
static void CbmPixelHitToCbmLitPixelHit(const CbmPixelHit *hit, Int_t index, CbmLitPixelHit *litHit)
static void CbmTrackToCbmLitTrack(const CbmTrack *track, const HitPtrVector &lhits, CbmLitTrack *ltrack)
const CbmLitTrackParam * GetUpdatedParam() const
litfloat GetChiSqFiltered() const
Base data class for hits.
void SetRefId(Int_t refId)
LitSystemId GetSystem() const
LitHitType GetType() const
void SetDetectorId(LitSystemId sysId, Int_t station)
Base data class for pixel hits.
void SetDxy(litfloat dxy)
litfloat GetDistance() const
const CbmLitTrackParam * GetTrackParam() const
const CbmLitHit * GetHit() const
const CbmLitTrack * GetTrack() const
Data class for track parameters.
static litfloat fSpeedOfLight
Base data class for track.
const vector< CbmLitFitNode > & GetFitNodes() const
void SetRefId(Int_t refId)
string ToString() const
Return string representation of class.
void SetParamLast(const CbmLitTrackParam *par)
Int_t GetPreviousTrackId() const
const CbmLitFitNode * GetFitNode(Int_t index) const
void SetParamFirst(const CbmLitTrackParam *par)
const CbmLitHit * GetHit(Int_t index) const
const CbmLitTrackParam * GetParamLast() const
void SetChi2(litfloat chi2)
void SetPreviousTrackId(Int_t id)
void AddHit(const CbmLitHit *hit)
Add hit to track. No additional memory is allocated for hit.
LitTrackQa GetQuality() const
void SetQuality(LitTrackQa quality)
void SetLastStationId(Int_t lastPlaneId)
virtual int32_t GetStationNr() const
int32_t GetNofMvdHits() const
int32_t GetMvdHitIndex(int32_t iHit) const
int32_t GetStsHitIndex(int32_t iHit) const
int32_t GetNofStsHits() const
void SetTrackIndex(int32_t trackIndex)
void SetTofHitIndex(int32_t tofHitIndex)
void SetTrackParameter(const FairTrackParam *par)
void SetDistance(double distance)
void Set(const FairTrackParam &ftp, double time=0., double timeError=0.)
double GetFirstHitTime() const
double GetLastHitTime() const
double GetFirstHitTimeError() const
int32_t GetPidHypo() const
void AddHit(int32_t index, HitType type)
const FairTrackParam * GetParamLast() const
double GetLastHitTimeError() const
void SetFlag(int32_t flag)
virtual int32_t GetNofHits() const
void SetParamFirst(const FairTrackParam *par)
int32_t GetPreviousTrackId() const
const FairTrackParam * GetParamFirst() const
void SetChiSq(double chiSq)
int32_t GetHitIndex(int32_t iHit) const
HitType GetHitType(int32_t iHit) const
void SetPreviousTrackId(int32_t previousTrackId)
void SetParamLast(const FairTrackParam *par)