20#include "FairRootManager.h"
21#include "TClonesArray.h"
25 , fDigiScheme(nullptr)
30 , fStsClusters(nullptr)
41 auto mid = vec.size() / 2;
42 std::nth_element(vec.begin(), vec.begin() + mid, vec.end());
43 auto median = vec[mid];
44 if (!(vec.size() & 1)) {
45 auto max_it = std::max_element(vec.begin(), vec.begin() + mid);
46 median = (*max_it + median) / 2.0;
54 FairRootManager* ioman = FairRootManager::Instance();
57 fStsClusters = (TClonesArray*) ioman->GetObject(
"StsCluster");
63 std::vector<double> dEdxAllveto;
66 for (
int iHit = 0; iHit < cbmStsTrack->
GetNofStsHits(); ++iHit) {
67 bool frontVeto = kFALSE, backVeto = kFALSE;
70 double x,
y, z, xNext, yNext, zNext;
77 xNext = stsHitNext->
GetX();
78 yNext = stsHitNext->
GetY();
79 zNext = stsHitNext->
GetZ();
80 dr =
sqrt((xNext -
x) * (xNext -
x) + (yNext -
y) * (yNext -
y) + (zNext - z) * (zNext - z))
87 if (!frontCluster || !backCluster) {
88 LOG(info) <<
"CbmStsTrackFinder::CalculateEloss: no front or back cluster";
93 for (
int iDigi = 0; iDigi < frontCluster->
GetNofDigis(); ++iDigi) {
97 for (
int iDigi = 0; iDigi < backCluster->
GetNofDigis(); ++iDigi) {
102 if (!frontVeto) dEdxAllveto.push_back((frontCluster->
GetCharge()) / dr);
103 if (!backVeto) dEdxAllveto.push_back((backCluster->
GetCharge()) / dr);
107 if (dEdxAllveto.size() != 0) dEdXSTS =
VecMedian(dEdxAllveto);
113 Int_t nStsTracks =
fTracks->GetEntriesFast();
114 for (Int_t stsTrackIndex = 0; stsTrackIndex < nStsTracks; stsTrackIndex++) {
ClassImp(CbmConverterManager)
Data class for STS clusters.
Data class for a reconstructed hit in the STS.
Data class for STS tracks.
friend fvec sqrt(const fvec &a)
int32_t GetDigi(int32_t index) const
Get digi at position index.
int32_t GetNofDigis() const
Number of digis in cluster.
const Digi * Get(Int_t index) const
Get a digi object.
static CbmDigiManager * Instance()
Static instance.
Data class for STS clusters.
double GetCharge() const
Get cluster charge @value Total cluster charge [e].
Data class for a single-channel message in the STS.
data class for a reconstructed 3-d hit in the STS
int32_t GetFrontClusterId() const
int32_t GetBackClusterId() const
double CalculateEloss(CbmStsTrack *cbmStsTrack)
double VecMedian(std::vector< double > &vec)
static constexpr int MaxAdcVal()
void FillEloss()
Calculate the median energy loss for the tracks and fill the respective data members.
TClonesArray * fStsClusters
int32_t GetStsHitIndex(int32_t iHit) const
void SetELoss(float ELoss)
static constexpr float ELossOverflow()
int32_t GetNofStsHits() const