diff --git a/core/data/CMakeLists.txt b/core/data/CMakeLists.txt index 58d59d289ab9eda6a34509f36b7e645d4e78d4ce..f5497b388d3f1ad8d23df1d81d904b5f31ed38f4 100644 --- a/core/data/CMakeLists.txt +++ b/core/data/CMakeLists.txt @@ -88,6 +88,7 @@ set(SRCS tof/CbmTofDetectorId_v21a.cxx tof/CbmTofAddress.cxx tof/CbmTofDigi.cxx + tof/CbmTofTrack.cxx tof/CbmTofTracklet.cxx tof/CbmTofTrackletParam.cxx @@ -101,7 +102,6 @@ set(SRCS global/CbmTzdDigi.cxx global/CbmGlobalTrack.cxx global/CbmVertex.cxx - global/CbmTofTrack.cxx global/CbmTrackParam.cxx raw/AccDataSis18.cxx diff --git a/core/data/CbmDataLinkDef.h b/core/data/CbmDataLinkDef.h index 3669806a486db425dd887982e029e569c85e5514..d16afef6d038d466d14731e556574e501a98fdcb 100644 --- a/core/data/CbmDataLinkDef.h +++ b/core/data/CbmDataLinkDef.h @@ -80,6 +80,7 @@ #pragma link C++ class CbmTofPoint + ; #pragma link C++ class CbmTofDigi + ; #pragma link C++ class CbmTofAddress + ; +#pragma link C++ class CbmTofTrack + ; #pragma link C++ class CbmTofTracklet + ; #pragma link C++ class CbmTofTrackletParam + ; @@ -92,7 +93,6 @@ // --- data/global #pragma link C++ class CbmGlobalTrack + ; -#pragma link C++ class CbmTofTrack + ; #pragma link C++ class CbmTzdDigi + ; #pragma link C++ class CbmVertex + ; #pragma link C++ class std::vector < CbmDigiEvent>; diff --git a/core/data/global/CbmGlobalTrack.cxx b/core/data/global/CbmGlobalTrack.cxx index edd13de3f66e2beea91f9a519c1c9629a496a7ea..b1a6548345801d74a619857737a9d5db596cd47f 100644 --- a/core/data/global/CbmGlobalTrack.cxx +++ b/core/data/global/CbmGlobalTrack.cxx @@ -14,23 +14,7 @@ #include <TObject.h> // for TObject // ----- Default constructor ------------------------------------------- -CbmGlobalTrack::CbmGlobalTrack() - : TObject() - , fStsTrack(-1) - , fTrdTrack(-1) - , fMuchTrack(-1) - , fRichRing(-1) - , fTofHit(-1) - , fParamFirst() - , fParamLast() - , fParamPrimaryVertex() - , fPidHypo(0) - , fChi2(0.) - , fNDF(0) - , fFlag(0) - , fLength(0.) -{ -} +CbmGlobalTrack::CbmGlobalTrack() {} // ------------------------------------------------------------------------- @@ -43,7 +27,7 @@ CbmGlobalTrack::~CbmGlobalTrack() {} void CbmGlobalTrack::Print(Option_t*) const { LOG(info) << "StsTrack " << fStsTrack << ", TrdTrack " << fTrdTrack << ", MuchTrack " << fMuchTrack << ", RichRing " - << fRichRing << ", TofHit " << fTofHit; + << fRichRing << ", TofHit " << fTofHit << ", TofTrack " << fTofTrack; // LOG(info) << "Parameters at first plane: "; // fParamFirst.Print(); // LOG(info) << "Parameters at last plane: "; diff --git a/core/data/global/CbmGlobalTrack.h b/core/data/global/CbmGlobalTrack.h index 483fad916ca6f9afeddd00dd98d2f9787e76098f..2e730c8d2fceff160c78f083d5f46906d44c0aac 100644 --- a/core/data/global/CbmGlobalTrack.h +++ b/core/data/global/CbmGlobalTrack.h @@ -46,6 +46,7 @@ public: int32_t GetMuchTrackIndex() const { return fMuchTrack; } int32_t GetRichRingIndex() const { return fRichRing; } int32_t GetTofHitIndex() const { return fTofHit; } + int32_t GetTofTrackIndex() const { return fTofTrack; } const FairTrackParam* GetParamFirst() const { return &fParamFirst; } const FairTrackParam* GetParamLast() const { return &fParamLast; } const CbmTrackParam* GetParamVertex() const { return &fParamPrimaryVertex; } @@ -62,6 +63,7 @@ public: void SetMuchTrackIndex(int32_t iMuch) { fMuchTrack = iMuch; } void SetRichRingIndex(int32_t iRing) { fRichRing = iRing; } void SetTofHitIndex(int32_t iTofHit) { fTofHit = iTofHit; } + void SetTofTrackIndex(int32_t iTofTrack) { fTofTrack = iTofTrack; } void SetParamFirst(const FairTrackParam* parFirst) { fParamFirst = *parFirst; } void SetParamLast(const FairTrackParam* parLast) { fParamLast = *parLast; } void SetParamPrimaryVertex(const FairTrackParam* parPV) { fParamPrimaryVertex.Set(*parPV); } @@ -78,11 +80,12 @@ public: private: /** Indices of local StsTrack, TrdTrack, MuchTrack, RichRing and TofHit **/ - int32_t fStsTrack; - int32_t fTrdTrack; - int32_t fMuchTrack; - int32_t fRichRing; - int32_t fTofHit; + int32_t fStsTrack = -1; + int32_t fTrdTrack = -1; + int32_t fMuchTrack = -1; + int32_t fRichRing = -1; + int32_t fTofHit = -1; + int32_t fTofTrack = -1; /** Global track parameters at first and last plane **/ FairTrackParam fParamFirst; @@ -90,20 +93,19 @@ private: CbmTrackParam fParamPrimaryVertex; /** PID hypothesis used for global track fit **/ - int32_t fPidHypo; + int32_t fPidHypo = 0; /** Chi2 of global track fit **/ - Double32_t fChi2; + double fChi2 = 0.; /** NDF of global track fit **/ - int32_t fNDF; + int32_t fNDF = 0; /** Quality flag **/ - int32_t fFlag; + int32_t fFlag = 0; /** Track length **/ - Double32_t fLength; - + double fLength = 0.; ClassDef(CbmGlobalTrack, 3); }; diff --git a/core/data/global/CbmTofTrack.cxx b/core/data/global/CbmTofTrack.cxx deleted file mode 100644 index c50d9e868a3fdacc864cb2e7bec5abc41e9dc1f6..0000000000000000000000000000000000000000 --- a/core/data/global/CbmTofTrack.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2013-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Volker Friese [committer], Andrey Lebedev, Florian Uhlig */ - -/** @file CbmTofTrack.cxx - ** @author Volker Friese <v.friese@gsi.de> - ** @date 17.10.2013 - ** - ** Empty implementation, everything is inline. - **/ -#include "CbmTofTrack.h" - -#include <TObject.h> // for TObject - -CbmTofTrack::CbmTofTrack() - : TObject() - , fGlbTrack(-1) - , fTofHit(-1) - , fTrackLength(0.) - , fTrackPar() - , fPidHypo(-1) - , fMass(-1.) - , fDistance(0.) -{ -} - -CbmTofTrack::~CbmTofTrack() {} - -ClassImp(CbmTofTrack) diff --git a/core/data/much/CbmMuchTrack.h b/core/data/much/CbmMuchTrack.h index e52942610c0a328722fb17cea104ad3f0e91eada..ea9aeb976e1eb37c2a3014383cc48ddbdd094f4c 100644 --- a/core/data/much/CbmMuchTrack.h +++ b/core/data/much/CbmMuchTrack.h @@ -25,6 +25,12 @@ public: /** Destructor **/ virtual ~CbmMuchTrack(); + + /** Associate a MuchPixelHit to the track + ** @param hitIndex Index of the Much hit in TClonesArray + **/ + void AddMuchHit(int32_t hitIndex) { AddHit(hitIndex, kMUCHPIXELHIT); } + ClassDef(CbmMuchTrack, 3); }; diff --git a/core/data/tof/CbmTofTrack.cxx b/core/data/tof/CbmTofTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bf7d3b601c4d93824f9d9069b7b6203febb60d7c --- /dev/null +++ b/core/data/tof/CbmTofTrack.cxx @@ -0,0 +1,45 @@ +/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Volker Friese, Denis Bertini [committer], Andrey Lebedev, Florian Uhlig */ + +/** + ** \file CbmTofTrack.h + ** \author V.Friese <v.friese@gsi.de> + ** \since 26.01.05 + ** \date 07.09.15 + ** Updated 28/11/2021 by V.Akishina <v.akishina@gsi.de> + **/ +#include "CbmTofTrack.h" + +#include <FairTrackParam.h> // for FairTrackParam + +#include <sstream> // for operator<<, basic_ostream, stringstream + +using std::stringstream; + + +// ----- Constructor --------------------------------------------------- +CbmTofTrack::CbmTofTrack() : CbmTrack() {} +// ------------------------------------------------------------------------- + + +// ----- Destructor ---------------------------------------------------- +CbmTofTrack::~CbmTofTrack() {} +// ------------------------------------------------------------------------- + + +// ----- Debug --------------------------------------------------------- +std::string CbmTofTrack::ToString() const +{ + stringstream ss; + ss << "CbmTofTrack: time " << fTime << " ns | hits STS " << GetNofTofHits() << " | q/p " << GetParamFirst()->GetQp() + << " | chisq " << GetChiSq() << " | NDF " << GetNDF() << " | STS hits "; + for (int32_t iHit = 0; iHit < GetNofTofHits(); iHit++) { + ss << GetTofHitIndex(iHit) << " "; + } + return ss.str(); +} +// ------------------------------------------------------------------------- + + +ClassImp(CbmTofTrack) diff --git a/core/data/global/CbmTofTrack.h b/core/data/tof/CbmTofTrack.h similarity index 60% rename from core/data/global/CbmTofTrack.h rename to core/data/tof/CbmTofTrack.h index ddb46be52f20bf0485fc6a6dc4babed395b0d2b9..e43fb055bd084943b97fa7ce91c9035ba1e91748 100644 --- a/core/data/global/CbmTofTrack.h +++ b/core/data/tof/CbmTofTrack.h @@ -5,56 +5,45 @@ /** @file CbmTofTrack.h ** @author Volker Friese <v.friese@gsi.de> ** @date 17.10.2013 + ** Updated 28/11/2021 by V.Akishina <v.akishina@gsi.de> **/ + #ifndef CBMTOFTRACK_H #define CBMTOFTRACK_H 1 -#include <FairTrackParam.h> // for FairTrackParam +#include "CbmHit.h" // for kTOFHIT +#include "CbmTrack.h" // for CbmTrack #include <Rtypes.h> // for ClassDef #include <RtypesCore.h> // for Double32_t -#include <TObject.h> // for TObject +#include <cassert> // for assert #include <cstdint> +#include <string> // for string +#include <vector> // for vector -#include <cmath> - -/** @class CbmTofTrack - ** @brief Provides information on attaching a TofHit to a GlobalTrack +/** @class CbmTofTrack.h + ** @brief Data class with information on a TOF local track ** @author V.Friese <v.friese@gsi.de> + ** + ** The TOF track is a collection of TOF hits, together + ** with the track parameters obtained by the track fit. **/ -class CbmTofTrack : public TObject { - +class CbmTofTrack : public CbmTrack { public: - /** Constructor **/ + /** Default constructor **/ CbmTofTrack(); - /** Constructor with parameters - ** @param trackIndex Array index of global track - ** @param hitIndex Array index of TOF hit - ** @param trackLength Track length from primary vertex to TOF - ** @param trackPar Parameters of track at TOF - ** @param pidHypo PID hypothesis for track extrapolation - **/ - - CbmTofTrack(int32_t trackIndex, int32_t hitIndex, double trackLength, float mass, const FairTrackParam& trackPar, - int32_t pidHypo) - : TObject() - , fGlbTrack(trackIndex) - , fTofHit(hitIndex) - , fTrackLength(trackLength) - , fTrackPar(trackPar) - , fPidHypo(pidHypo) - , fMass(mass) - , fDistance(0.) - { - } + /** Destructor **/ + virtual ~CbmTofTrack(); + /** Associate a TofHit to the track + ** @param hitIndex Index of the TOF hit in TClonesArray + **/ + void AddTofHit(int32_t hitIndex) { AddHit(hitIndex, kTOFHIT); } - /** Destructor **/ - virtual ~CbmTofTrack(); /** PID hypothesis for track extrapolation to TOF **/ int32_t GetPidHypo() const { return fPidHypo; } @@ -63,7 +52,7 @@ public: float GetMass() const { return fMass; } /** Index of TOF hit **/ - int32_t GetTofHitIndex() const { return fTofHit; } + int32_t GetTofHitIndex() const { return GetHitIndex(0); } /** Error of track x coordinate at TOF **/ double GetTrackDx() const { return sqrt(fTrackPar.GetCovariance(1, 1)); } @@ -93,13 +82,18 @@ public: void SetTrackIndex(int32_t trackIndex) { fGlbTrack = trackIndex; } /** Set TOF hit index **/ - void SetTofHitIndex(int32_t tofHitIndex) { fTofHit = tofHitIndex; } + void SetTofHitIndex(int32_t tofHitIndex) + { + fHitIndex.clear(); + fHitType.clear(); + AddTofHit(tofHitIndex); + } /** Set track parameter **/ void SetTrackParameter(const FairTrackParam* par) { fTrackPar = *par; } /** Set track length **/ - void SetTrackLength(Double32_t trackLength) { fTrackLength = trackLength; } + void SetTrackLength(double trackLength) { fTrackLength = trackLength; } /** Set PID hypothesis for track extrapolation to TOF **/ void SetPidHypo(int32_t pid) { fPidHypo = pid; } @@ -110,17 +104,38 @@ public: /** Set normalized distance from hit to track **/ void SetDistance(double distance) { fDistance = distance; } + + /** Number of TOF hits + ** @return Number of TOF hits associated to the track + **/ + int32_t GetNofTofHits() const { return CbmTrack::GetNofHits(); } + + + /** Index of a TOF hit + ** @value Array index of the ith TOF hit of the track + ** + ** Throws std::vector exception if out of bounds. + **/ + int32_t GetTofHitIndex(int32_t iHit) const + { + assert(iHit < GetNofTofHits()); + return GetHitIndex(iHit); + } + + /** Debug output **/ + virtual std::string ToString() const; + + private: int32_t fGlbTrack; ///< Index of global track - int32_t fTofHit; ///< Index of TofHit - Double32_t fTrackLength; ///< Track length from primary vertex to TOF [cm] + double fTrackLength; ///< Track length from primary vertex to TOF [cm] FairTrackParam fTrackPar; ///< Track parameters at z of TofHit int32_t fPidHypo; ///< PID hypothesis used for track extrapolation float fMass; ///< Mass from Tof - Double32_t fDistance; ///< Normalized distance from hit to track + double fDistance = 0.; ///< Normalized distance from hit to track - ClassDef(CbmTofTrack, 1); + ClassDef(CbmTofTrack, 3); }; -#endif /* CBMTOFTRACK_H */ +#endif diff --git a/core/data/trd/CbmTrdTrack.h b/core/data/trd/CbmTrdTrack.h index ee3d98ba5a4b15915557e20096f658cce7ef24c0..53dfbb0f03fc9d7c11e3c982006a5f3af9d96af0 100644 --- a/core/data/trd/CbmTrdTrack.h +++ b/core/data/trd/CbmTrdTrack.h @@ -20,7 +20,7 @@ #include "CbmTrack.h" // for CbmTrack -#include <Rtypes.h> // for ClassDef +#include <Rtypes.h> // for ClassDef class CbmTrdTrack : public CbmTrack { public: @@ -30,6 +30,12 @@ public: /** Destructor **/ virtual ~CbmTrdTrack(); + + /** Associate a TrdHit to the track + ** @param hitIndex Index of the TRD hit in TClonesArray + **/ + void AddTrdHit(int32_t hitIndex) { AddHit(hitIndex, kTRDHIT); } + /** Accessors **/ double GetPidWkn() const { return fPidWkn; } double GetPidANN() const { return fPidANN; } diff --git a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx index 7cf698bb46643fb75e71cbbadca1ac1dbb3760a0..7d514b1d04bf8f955f4db657d5dcc3a3852957a7 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx +++ b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx @@ -95,7 +95,8 @@ Int_t CbmL1GlobalTrackFinder::CopyL1Tracks(CbmEvent* event) CbmKFMath::CopyTC2TrackParam(&lpar, T.TLast, T.CLast); t->SetParamFirst(&fpar); t->SetParamLast(&lpar); - // t->SetChiSq(T.chi2); + t->SetChi2(T.chi2); + // t->SetLength(T.length); t->SetNDF(T.NDF); t->SetPidHypo(T.T[4] >= 0 ? 211 : -211); // t->SetTime(T.Tpv[6]); @@ -115,6 +116,7 @@ Int_t CbmL1GlobalTrackFinder::CopyL1Tracks(CbmEvent* event) t->SetStsTrackIndex(stsTrackIndex); if (event) event->AddData(ECbmDataType::kStsTrack, stsTrackIndex); CbmL1TrackToCbmStsTrack(T, track, h.Det); + track->AddStsHit(h.ExtIndex); stsTrackIndex++; } if (h.Det == 2 && hasMuchHits == false) { @@ -124,6 +126,7 @@ Int_t CbmL1GlobalTrackFinder::CopyL1Tracks(CbmEvent* event) t->SetMuchTrackIndex(muchTrackIndex); if (event) event->AddData(ECbmDataType::kMuchTrack, muchTrackIndex); CbmL1TrackToCbmMuchTrack(T, track, h.Det); + track->AddMuchHit(h.ExtIndex); muchTrackIndex++; } if (h.Det == 3 && hasTrdHits == false) { @@ -132,17 +135,19 @@ Int_t CbmL1GlobalTrackFinder::CopyL1Tracks(CbmEvent* event) t->SetTrdTrackIndex(trdTrackIndex); if (event) event->AddData(ECbmDataType::kTrdTrack, trdTrackIndex); CbmL1TrackToCbmTrdTrack(T, track, h.Det); + track->AddTrdHit(h.ExtIndex); trdTrackIndex++; } if (h.Det == 4 && hasTofHits == false) { hasTofHits = true; CbmTofTrack* track = new ((*fTofTracks)[tofTrackIndex]) CbmTofTrack(); - // t->SetTofHitIndex(tofTrackIndex); + t->SetTofTrackIndex(tofTrackIndex); if (event) event->AddData(ECbmDataType::kTofTrack, tofTrackIndex); CbmL1TrackToCbmTofTrack(T, track, h.Det); tofTrackIndex++; + track->AddTofHit(h.ExtIndex); if (event) event->AddData(ECbmDataType::kTofHit, h.ExtIndex); } diff --git a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h index 018bc02563923400c6a5c8d73a89468451e54f49..02e7a5f02a5ff84a858cc4ae44dcd596783db7c2 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h +++ b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.h @@ -25,7 +25,7 @@ #include "CbmL1.h" #include "CbmMuchTrack.h" #include "CbmStsTrackFinder.h" -#include "CbmTofTrack.h" +//#include "CbmTofTrack.h" #include "CbmTrack.h" #include "CbmTrdTrack.h" @@ -33,6 +33,7 @@ class TClonesArray; class CbmEvent; class CbmTrack; class CbmGlobalTrack; +class CbmTofTrack; class CbmL1GlobalTrackFinder : public CbmStsTrackFinder {