Go to the documentation of this file. 1 #ifndef CBMLITCONVERTER_H_
2 #define CBMLITCONVERTER_H_
28 #include "FairTrackParam.h"
34 #include "TClonesArray.h"
36 #include "FairRootManager.h"
114 &cbmParamFirst, ¶mFirst);
119 &cbmParamLast, ¶mLast);
132 for (Int_t iHit = 0; iHit < track->
GetNofHits(); iHit++) {
139 ltrack->
AddHit(lhits[hitId]);
153 &cbmParamFirst, ¶mFirst);
158 &cbmParamLast, ¶mLast);
166 Int_t nofTracks =
tracks->GetEntriesFast();
167 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
171 ltracks.push_back(ltrack);
182 for (Int_t iHit = 0; iHit < litTrack->
GetNofHits(); iHit++) {
186 if (det != systemId)
continue;
187 if (firstHit < 0) firstHit = iHit;
199 if (ndf <= 0) ndf = 1;
205 FairTrackParam parLast, parFirst;
218 TClonesArray* globalTracks,
219 TClonesArray* stsTracks,
220 TClonesArray* trdTracks,
221 TClonesArray* muchTracks,
222 TClonesArray* tofTracks) {
224 Int_t globalTrackNo = globalTracks->GetEntriesFast();
226 : stsTracks->GetEntriesFast();
227 for (Int_t
i = 0;
i < nofStsTracks;
i++) {
236 Int_t trdTrackNo = (trdTracks != NULL) ? trdTracks->GetEntriesFast() : 0;
237 Int_t muchTrackNo = (muchTracks != NULL) ? muchTracks->GetEntriesFast() : 0;
238 Int_t tofTrackNo = (tofTracks != NULL) ? tofTracks->GetEntriesFast() : 0;
240 for (
size_t iTrack = 0; iTrack < litTracks.size(); iTrack++) {
245 if (
static_cast<size_t>(litTrack->
GetNofHits())
247 LOG(ERROR) <<
"CbmLitConverter::LitTrackVectorToGlobalTrackArray: "
248 "unequal number of hits and fit nodes"
258 FairTrackParam parLast;
263 Bool_t isCreateMuchTrack =
false, isCreateTrdTrack =
false;
264 for (Int_t iHit = 0; iHit < litTrack->
GetNofHits(); iHit++) {
267 if (thisDetId ==
kLITMUCH && muchTracks != NULL) {
268 isCreateMuchTrack =
true;
270 if (thisDetId ==
kLITTRD && trdTracks != NULL) {
271 isCreateTrdTrack =
true;
274 if (isCreateTrdTrack) {
283 if (isCreateMuchTrack) {
294 for (
size_t iTrack = 0; iTrack < litTofTracks.size(); iTrack++) {
317 const TClonesArray*
hits,
320 event ?
event->GetNofData(hitDataType) :
hits->GetEntriesFast();
321 for (Int_t
i = 0;
i < nofHits; ++
i) {
322 Int_t iHit =
event ?
event->GetIndex(hitDataType,
i) :
i;
324 if (NULL == hit) {
continue; }
328 litHits.push_back(litHit);
334 Int_t nofHits =
hits->GetEntriesFast();
335 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
337 if (NULL == hit) {
continue; }
340 litHits.push_back(litHit);
345 const TClonesArray*
tracks,
348 :
tracks->GetEntriesFast();
349 for (Int_t
i = 0;
i < nofTracks; ++
i) {
352 if (track == NULL) {
continue; }
358 litTracks.push_back(litTrack);
364 Double_t& lastTime) {
365 static FairRootManager* ioman = 0;
367 static TClonesArray* stsHits = 0;
368 static TClonesArray* mvdHits = 0;
371 static bool init =
false;
372 static Int_t pdg = 211;
376 ioman = FairRootManager::Instance();
379 primVertex =
static_cast<CbmVertex*
>(ioman->GetObject(
"PrimaryVertex"));
380 stsHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsHit"));
381 mvdHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"MvdHit"));
388 Double_t xVert = primVertex ? primVertex->
GetX() : 0;
389 Double_t yVert = primVertex ? primVertex->
GetY() : 0;
390 Double_t zVert = primVertex ? primVertex->
GetZ() : 0;
397 &cbmParamFirst, ¶mFirst);
402 &cbmParamLast, ¶mLast);
404 Double_t
x = paramFirst.
GetX();
405 Double_t
y = paramFirst.
GetY();
406 Double_t z = paramFirst.
GetZ();
409 Double_t deltaTFirst = 0;
411 if (propagator->Propagate(&par, zVert, pdg) ==
kLITERROR)
413 -TMath::Sqrt(TMath::Power(
x - xVert, 2) + TMath::Power(
y - yVert, 2)
414 + TMath::Power(z - zVert, 2))
419 if (deltaTFirst > 0) deltaTFirst = -deltaTFirst;
422 firstTime = paramFirst.
GetTime();
427 int nofHits = nofMvdHits + nofStsHits;
428 Double_t deltaTLast = 0;
430 for (
int i = 1;
i < nofHits; ++
i) {
437 kMVDHIT == hitType ? mvdHits->At(hitInd) : stsHits->At(hitInd));
439 if (
i == nofHits - 1)
440 z = paramLast.
GetZ();
444 if (propagator->Propagate(&par, z, pdg) ==
kLITERROR) {
446 TMath::Sqrt(TMath::Power(paramLast.
GetX() - paramFirst.
GetX(), 2)
447 + TMath::Power(paramLast.
GetY() - paramFirst.
GetY(), 2)
448 + TMath::Power(paramLast.
GetZ() - paramFirst.
GetZ(), 2))
456 filter->Update(&par, &litHit, chi);
462 lastTime = firstTime + deltaTLast;
Data class for track parameters.
Double_t GetChiSq() const
const FairTrackParam * GetParamLast() const
const CbmLitFitNode * GetFitNode(Int_t index) const
Base data class for strip hits.
Helper class to convert unique channel ID back and forth.
vector< CbmLitTofTrack * > TofTrackPtrVector
virtual Int_t GetNofHits() const
const CbmLitTrackParam * GetUpdatedParam() const
boost::shared_ptr< CbmLitTrackPropagator > TrackPropagatorPtr
void SetParamLast(const FairTrackParam *parLast)
void SetTrdTrackIndex(Int_t iTrd)
Data class for track parameters.
static void CbmTrackToCbmLitTrack(const CbmTrack *track, const HitPtrVector &lhits, CbmLitTrack *ltrack)
boost::shared_ptr< CbmLitTrackUpdate > TrackUpdatePtr
virtual Int_t GetStationNr() const
void SetTrackIndex(Int_t trackIndex)
void SetParamFirst(const CbmLitTrackParam *par)
Data class for storage of fitted track parameters, transport matrix and chi-square on each detector s...
void SetPreviousTrackId(Int_t previousTrackId)
void SetPreviousTrackId(Int_t id)
const CbmLitHit * GetHit() const
Base data class for pixel hits.
static void HitArrayToHitVector(CbmEvent *event, ECbmDataType hitDataType, const TClonesArray *hits, HitPtrVector &litHits)
void SetParamLast(const FairTrackParam *par)
litfloat GetDistance() const
void SetDetectorId(LitSystemId sysId, Int_t station)
void Set(const FairTrackParam &ftp, Double_t time=0., Double_t timeError=0.)
void SetParamLast(const CbmLitTrackParam *par)
Double_t GetTimeError() const
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)
virtual Int_t GetPlaneId() const
Define enumerations used in littrack.
Int_t GetNofMvdHits() const
void SetLastStationId(Int_t lastPlaneId)
const vector< CbmLitFitNode > & GetFitNodes() const
void SetTrackParameter(const FairTrackParam *par)
Data class for STS tracks.
void SetStsTrackIndex(Int_t iSts)
void SetRefId(Int_t refId)
Int_t GetPreviousTrackId() const
std::vector< CbmTofTrack * > TrackPtrVector
const CbmLitTrack * GetTrack() const
Base data class for hits.
static void MvdHitArrayToHitVector(const TClonesArray *hits, HitPtrVector &litHits)
Int_t GetHitIndex(Int_t iHit) const
Base data class for track.
Base data class for pixel hits.
void SetChiSq(Double_t chiSq)
Int_t GetPreviousTrackId() const
HitType GetHitType(Int_t iHit) const
string ToString() const
Return string representation of class.
static void CbmStsTrackToCbmLitTrack(const CbmStsTrack *stsTrack, CbmLitTrack *litTrack)
const FairTrackParam * GetParamFirst() const
const CbmLitTrackParam * GetParamLast() const
void SetRefId(Int_t refId)
const CbmLitTrackParam * GetTrackParam() const
void SetTofHitIndex(Int_t tofHitIndex)
void SetQuality(LitTrackQa quality)
void SetDistance(Double_t distance)
Typedefs for data structures used in littrack.
litfloat GetChiSqFiltered() const
void SetDxy(litfloat dxy)
static void StsTrackArrayToTrackVector(CbmEvent *event, const TClonesArray *tracks, TrackPtrVector &litTracks)
Base data class for track.
void SetMuchTrackIndex(Int_t iMuch)
void SetParamFirst(const FairTrackParam *par)
static vector< vector< QAHit > > hits
Class characterising one event by a collection of links (indices) to data objects,...
Int_t GetMvdHitIndex(Int_t iHit) const
void SetTofHitIndex(Int_t iTofHit)
Int_t GetStsHitIndex(Int_t iHit) const
LitSystemId GetSystem() const
static void CbmMvdHitToCbmLitPixelHit(const CbmMvdHit *hit, Int_t index, CbmLitPixelHit *litHit)
LitTrackQa GetQuality() const
Double_t GetTimeError() const
const CbmLitHit * GetHit(Int_t index) const
void AddHit(Int_t index, HitType type)
static void CbmPixelHitToCbmLitPixelHit(const CbmPixelHit *hit, Int_t index, CbmLitPixelHit *litHit)
LitHitType GetType() const
void AddHit(const CbmLitHit *hit)
Add hit to track. No additional memory is allocated for hit.
Base data class for hits.
void SetChi2(litfloat chi2)
static void FairTrackParamToCbmLitTrackParam(const FairTrackParam *par, CbmLitTrackParam *litPar)
static void GetStsTrackTimes(const CbmStsTrack *track, Double_t &firstTime, Double_t &lastTime)
Provides information on attaching a TofHit to a GlobalTrack.
static litfloat fSpeedOfLight
std::vector< CbmTofHit * > HitPtrVector
static void CbmLitTrackToCbmTrack(const CbmLitTrack *litTrack, CbmTrack *track, LitSystemId systemId)
Int_t GetNofStsHits() const
static void CbmTrackArrayToCbmLitTrackArray(const TClonesArray *tracks, const HitPtrVector &lhits, TrackPtrVector <racks)