NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
TrdK.cpp
Go to the documentation of this file.
1 #include "fmt/format.h"
2 
3 #include "Containers/TrdK.h"
4 
5 namespace NAIA {
6 const std::string TrdKBase::BranchName = "TrdKBaseData";
7 const std::string TrdKBaseStandalone::BranchName = "TrdKBaseStandaloneData";
8 
9 using namespace TrdK;
10 
11 void TrdKBaseData::Dump() const {
12  fmt::print("{:=^120} \n", " TrdKBaseData ");
13  fmt::print("{:^15} {:^15} {:^15}\n", "AlignStatus", "CalibStatus", "ChargeStatus");
14  fmt::print("{:^15} {:^15} {:^15}\n", AlignStatus, CalibStatus, ChargeStatus);
15 
16  if (!(AlignStatus || CalibStatus || ChargeStatus))
17  return;
18 
19  if (NHits.size() > 0) {
20  fmt::print(" {:<25} {:>15} {:>15}\n", "Type", "NHits", "Amps");
21  for (auto qualType : TrdK::qualTypes) {
22  fmt::print(" - {:<23} {:>15} {:>15}\n", TrdK::qualNames[qualType], NHits[qualType], Amps[qualType]);
23  }
24  }
25 
26  fmt::print("{:-^120}\n", "");
27 
28  if (Charge.size() > 0) {
29  fmt::print(" {:^25}", " ");
30  for (auto chargeType : TrdK::recoTypes)
31  fmt::print(" {:>15}", TrdK::recoNames[chargeType]);
32  fmt::print("\n");
33 
34  fmt::print(" {:<25}", "Charge");
35  for (auto chargeType : TrdK::recoTypes)
36  fmt::print(" {:>15f}", Charge[chargeType]);
37  fmt::print("\n");
38  }
39 
40  fmt::print("{:-^120}\n", "");
41 
42  if (Likelihood.size() > 0) {
43  fmt::print(" {:^25}", " ");
44  for (auto likeType : TrdK::likelihoodTypes)
45  fmt::print(" {:>15}", TrdK::likelihoodNames[likeType]);
46  fmt::print("\n");
47 
48  fmt::print(" {:<25}", "Likelihood");
49  for (size_t likeType = 0; likeType < Likelihood.size(); likeType++)
50  fmt::print(" {:>15f}", Likelihood[likeType]);
51  fmt::print("\n");
52  }
53 
54  if (LikelihoodRatio.size() > 0) {
55  fmt::print(" {:^25}", " ");
56  for (auto likeType : TrdK::likelihoodRTypes)
57  fmt::print(" {:>15}", TrdK::likelihoodRNames[likeType]);
58  fmt::print("\n");
59 
60  fmt::print(" {:<25}", "Likelihood ratio");
61  for (auto likeType : TrdK::likelihoodRTypes)
62  fmt::print(" {:>15f}", LikelihoodRatio[likeType]);
63  fmt::print("\n");
64  }
65 
66  fmt::print("{:-^120}\n", "");
67 
68  if (Edep.size() > 0) {
69  fmt::print("{:-^120}\n", "");
70  fmt::print("{:<32} {:>15} {:>15}\n", " ", "Edep", "Pathlength");
71  for (auto layerIter : Edep) {
72  fmt::print(" - {:<28} = {:> 15.4f} {:> 15.4f}\n", fmt::format("Layer {}", layerIter.first),
73  Edep.at(layerIter.first), Pathlength.at(layerIter.first));
74  }
75  }
76  fmt::print("{:-^120}\n", "");
77 }
78 
80  AlignStatus = false;
81  CalibStatus = false;
82  ChargeStatus = false;
83 
84  NHits.clear();
85  Amps.clear();
86  Charge.clear();
87  Likelihood.clear();
88  LikelihoodRatio.clear();
89  Edep.clear();
90  Pathlength.clear();
91 
92  Cleanliness = IPChi2 = 0;
93  DirectionalStoermerCutoff = {0, 0};
94 
95  m_pointAndDir.clear();
96 }
97 
98 TVector3 TrdKBaseData::InterpolateAtZ(float z) const {
99  // not elegant, but who cares
100  float dxdz = m_pointAndDir.at(1)[0] / m_pointAndDir.at(1)[2];
101  float dydz = m_pointAndDir.at(1)[1] / m_pointAndDir.at(1)[2];
102 
103  TVector3 result{m_pointAndDir.at(0)};
104  result[0] += dxdz * (z - result[2]);
105  result[1] += dydz * (z - result[2]);
106  result[2] = z;
107 
108  return result;
109 }
110 } // namespace NAIA
static const std::array< std::string, numQualTypes > qualNames
Definition: Utils.h:278
void Clear()
Clear container content.
Definition: TrdK.cpp:79
static const std::array< std::string, numChargeTypes > recoNames
Definition: Utils.h:239
static const std::array< std::string, numLikelihoodTypes > likelihoodNames
Definition: Utils.h:250
constexpr std::array< QualType, numQualTypes > qualTypes
Definition: Utils.h:276
constexpr std::array< LikelihoodRType, numLikelihoodRTypes > likelihoodRTypes
Definition: Utils.h:262
void Dump() const
Dump on screen container content.
Definition: TrdK.cpp:11
static const std::array< std::string, numLikelihoodRTypes > likelihoodRNames
Definition: Utils.h:265
TrdK container class description.
TVector3 InterpolateAtZ(float z) const
Get Trd track interpolation at given height.
Definition: TrdK.cpp:98
static const std::string BranchName
Definition: TrdK.h:182
constexpr std::array< LikelihoodType, numLikelihoodTypes > likelihoodTypes
Definition: Utils.h:247
static const std::string BranchName
Definition: TrdK.h:168
constexpr std::array< ChargeType, numChargeTypes > recoTypes
Definition: Utils.h:237