4 #include "TClonesArray.h"
6 #include "FairRootManager.h"
15 assert(!in_branches_.empty() && !out_branch_.empty() && out_config_
17 auto* ioman = FairRootManager::Instance();
18 cbm_mc_tracks_ = (TClonesArray*) ioman->GetObject(in_branches_[0].c_str());
20 AnalysisTree::BranchConfig SimTracksBranch(out_branch_,
21 AnalysisTree::DetType::kParticle);
22 SimTracksBranch.AddField<
int>(
"mother_id");
23 out_config_->AddBranchConfig(std::move(SimTracksBranch));
24 sim_tracks_ =
new AnalysisTree::Particles(out_config_->GetLastId());
26 out_branch_.c_str(),
"AnalysisTree::Particles", &
sim_tracks_);
33 std::cout <<
"ReadMcTracks" << std::endl;
37 const int imother_id =
38 out_config_->GetBranchConfig(
sim_tracks_->GetId()).GetFieldId(
"mother_id");
41 for (
int iMcTrack = 0; iMcTrack < nMcTracks; ++iMcTrack) {
43 if (mctrack->GetStartZ() > 200.)
48 Track->Init(out_config_->GetBranchConfig(
sim_tracks_->GetId()));
52 Track->SetMomentum(mctrack->GetPx(), mctrack->GetPy(), mctrack->GetPz());
53 Track->SetMass(
float(mctrack->GetMass()));
54 Track->SetPid(
int(mctrack->GetPdgCode()));
56 if (mctrack->GetMotherId()
58 Track->SetField(
int(-1), imother_id);
62 Track->SetField(
int(-999), imother_id);
64 Track->SetField(
int(p->second), imother_id);