29 auto* ioman = FairRootManager::Instance();
35 AnalysisTree::BranchConfig trd_branch(
out_branch_, AnalysisTree::DetType::kTrack);
36 trd_branch.AddFields<
float>({
"energy_loss_0",
"energy_loss_1",
"energy_loss_2",
"energy_loss_3"},
37 "keV(?), Energy loss per TRD station");
38 trd_branch.AddFields<
float>({
"pid_like_e",
"pid_like_pi",
"pid_like_k",
"pid_like_p"},
39 "Probability to be a given particle specie");
40 trd_branch.AddField<
float>(
"chi2_ov_ndf",
"chi2 divided by NDF of the track fit");
41 trd_branch.AddFields<
float>({
"pT_out",
"p_out"},
"Momentum at last point (?)");
42 trd_branch.AddField<
int>(
"n_hits",
"Number of hits");
44 i_e_loss_i_ = trd_branch.GetFieldId(
"energy_loss_0");
47 i_pT_out_ = trd_branch.GetFieldId(
"pT_out");
48 i_n_hits_ = trd_branch.GetFieldId(
"n_hits");
50 auto* man = AnalysisTree::TaskManager::GetInstance();
61 auto* out_config_ = AnalysisTree::TaskManager::GetInstance()->GetConfig();
62 const auto& branch = out_config_->GetBranchConfig(
out_branch_);
65 if (it ==
indexes_map_->end()) {
throw std::runtime_error(
match_to_ +
" is not found to match with TRD tracks"); }
66 auto rec_tracks_map = it->second;
70 LOG(warn) <<
"No global tracks!";
76 for (Int_t igt = 0; igt < n_tracks; igt++) {
82 if (itrd < 0)
continue;
85 if (trd_track ==
nullptr) {
86 LOG(warn) <<
"No TRD track!";
90 TVector3 mom, mom_last;
92 trd_track->GetParamLast()->Momentum(mom_last);
94 track.SetMomentum3(mom);
96 track.SetField(
float(trd_track->GetPidLikeEL()),
i_pid_like_);
97 track.SetField(
float(trd_track->GetPidLikePI()),
i_pid_like_ + 1);
98 track.SetField(
float(trd_track->GetPidLikeKA()),
i_pid_like_ + 2);
99 track.SetField(
float(trd_track->GetPidLikePR()),
i_pid_like_ + 3);
101 track.SetField(
float(trd_track->GetNDF() > 0. ? trd_track->GetChiSq() / trd_track->GetNDF() : -999.),
104 track.SetField(
float(mom_last.Pt()),
i_pT_out_);
105 track.SetField(
float(mom_last.Mag()),
i_pT_out_ + 1);
107 for (
int i = 0; i < 4; ++i) {
111 int trd_hits = trd_track->GetNofHits();
112 for (Int_t ihit = 0; ihit < trd_track->GetNofHits(); ihit++) {
113 Int_t idx = trd_track->GetHitIndex(ihit);
116 if (hit->GetELoss() > 0) {
117 track.SetField(
float(hit->GetELoss() * 1e6),
i_e_loss_i_ + hit->GetPlaneId());
127 if (rec_tracks_map.empty()) {
continue; }
128 const Int_t stsTrackIndex = global_track->GetStsTrackIndex();
129 if (rec_tracks_map.find(stsTrackIndex) != rec_tracks_map.end()) {
130 vtx_tracks_2_trd_->AddMatch(rec_tracks_map.find(stsTrackIndex)->second, track.GetId());