StsTrack: hide confusing method of the base CbmTrack class
Hide confusing methods of the base CbmTrack in CbmStsTrack
There are two conflicting interfaces to treat Mvd hits in the Sts tracks.
The first is the interface in CbmTrack. Here one can store hits from different detectors in the same array fHitIndex. The detector systems are stored in parallel in the fHitType array.
/** Array contains the hit indices of the hits attached to the track **/
std::vector<int32_t> fHitIndex;
/** Array contains the hit types of the hits attached to the track **/
std::vector<HitType> fHitType;
These are the methods to add and get the hit indices:
/** Add a hit to the list, using index and HitType
* @param index Index of the hit in the array
* @param type Type of the hit to be added
**/
void AddHit(int32_t index, HitType type);
/** Accessors **/
virtual int32_t GetNofHits() const { return fHitIndex.size(); }
int32_t GetHitIndex(int32_t iHit) const { return fHitIndex[iHit]; }
HitType GetHitType(int32_t iHit) const { return fHitType[iHit]; }
The GetNofHits() is supposed to return the total number of hits for all det. systems. In case of the StsTrack this is nSts + nMvd;
But despite the fact that CbmStsTrack inherits from CbmTrack, it has its own way of storing the Mvd hits. While the Sts hits are stored in CbmTrack::fHitIndex, the MVD hits are stored in a separate array:
/** Array with indices of the MVD hits attached to the track **/
std::vector<int32_t> fMvdHitIndex;
The CbmTrack::GetNofHits() method is overwritten and returns now not the number of hits in the CbmTrack::fHitIndex, but the total number of hits in CbmTrack::fHitIndex and CbmStsTrack::fMvdHitIndex :
/** Total number of hits
** @return Sum of numbers of STS and MVD hits
**/
virtual int32_t GetNofHits() const { return (GetNofStsHits() + GetNofMvdHits()); }
The new behavior of the CbmStsTrack::GetNofHits() leads to confusion. For example, this loop will crash:
for( int ih=0; ih < stsTrack.GetNofHits(); ih++){
stsTrack.GetHitIndex(ih); // out of range when ih >= GetNofStsHits() for an Mvd hit
}
Instead, one should do two loops:
for( int ih=0; ih < stsTrack.GetNofStsHits(); ih++){
stsTrack.GetStsHitIndex(ih);
}
for( int ih=0; ih < stsTrack.GetNofMvdHits(); ih++){
stsTrack.GetMvdHitIndex(ih);
}
Also, the generic CbmTrack::AddHit(int32_t index, HitType type) is now conflicting with the particular method CbmStsTrack::AddMvdHit(). A call of CbmStsTrack::AddHit(i, kMVDHIT); makes GetNofStsHits(), GetNofMvdHits() and GetStsHitIndex() methods invalid.
In this MR I suppressed the CbmTrack interface in the CbmStsTrack. By doing this I fixed several bugs mostly in an unused code.