NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
MCTruth.cpp
Go to the documentation of this file.
1 #include "fmt/format.h"
2 #include <bitset>
3 
4 #include "Containers/MCTruth.h"
5 
6 namespace NAIA {
7 const std::string MCTruthBase::BranchName = "MCTruthBaseData";
8 const std::string MCTruthPlus::BranchName = "MCTruthPlusData";
9 
11 
12 void MCTruthBaseData::Dump() const {
13  fmt::print("{:=^120} \n", " MCTruthBaseData ");
14 
15  fmt::print("{:<32}\n", "Primary particle");
16  fmt::print(" - {:<20} {:>15} {:>15} {:>15} {:>15} {:>20}\n", "", "Z", "A", "PDG", "Gen. Momentum",
17  "Gen. Position");
18  fmt::print(" - {:<20} {:>15} {:>15} {:>15} {:>15.3f} ({:4.2f},{:4.2f},{:4.2f})\n", "", Primary.Z, Primary.A,
20  Primary.Position[0][2]);
21  fmt::print("{:-^120}\n", "");
22 }
23 
24 void MCTruthPlusData::Dump() const {
25  fmt::print("{:=^120} \n", " MCTruthPlus ");
26 
27  fmt::print("{:<32}\n", "Secondary particles");
28  fmt::print(" - {:<20} {:>15} {:>15} {:>15} {:>15} {:>15} {:>20}\n", "", "Z", "A", "PDG", "ID (parent)",
29  "Gen. Momentum", "Gen. Position");
30  for (const auto &sec : Secondaries) {
31  fmt::print(" {:<20} {:>15} {:>15} {:>15} {:>15} {:>15.3f} ({:4.2f},{:4.2f},{:4.2f})\n", "", sec.Z, sec.A,
32  sec.PDGCode, fmt::format("{} ({})", sec.partID, sec.parentID), sec.GetGenMomentum(), sec.Position[0][0],
33  sec.Position[0][1], sec.Position[0][2]);
34  }
35  fmt::print("{:-^120}\n", "");
36 }
37 
39  Secondaries.clear();
40  TrackMCHits.clear();
41 }
42 } // namespace NAIA
int Z
particle charge
Definition: MCTruth.h:33
std::vector< TVector3 > Position
particle position at different z-heights. See MCTruth::MCHeights for a description of the possible he...
Definition: MCTruth.h:37
void Dump() const
Dump on screen container content.
Definition: MCTruth.cpp:12
int A
particle mass number
Definition: MCTruth.h:34
static const std::string BranchName
Definition: MCTruth.h:167
void Clear()
Clear container content.
Definition: MCTruth.cpp:38
MCParticle Primary
primary particle
Definition: MCTruth.h:91
double GetGenMomentum() const
Get the particle generation momentum.
Definition: MCTruth.h:49
void Clear()
Clear container content.
Definition: MCTruth.cpp:10
void Dump() const
Dump on screen container content.
Definition: MCTruth.cpp:24
std::vector< MCParticle > Secondaries
list of particles created by interaction of the primary particle
Definition: MCTruth.h:134
MCTruth container class description.
Simple struct to describe a MC particle.
Definition: MCTruth.h:31
LayerVariable< TrMCHit > TrackMCHits
A collection of the closest MCHit to the TrTrack cluster on each layer.
Definition: MCTruth.h:135
static const std::string BranchName
Definition: MCTruth.h:152
int PDGCode
particle PDG code
Definition: MCTruth.h:32