NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Ecal.cpp
Go to the documentation of this file.
1 #include "fmt/format.h"
2 
3 #include "Containers/Ecal.h"
4 
5 namespace NAIA {
6 const std::string EcalBase::BranchName = "EcalBaseData";
7 const std::string EcalPlus::BranchName = "EcalPlusData";
8 
10  TotalHits = ShowerHits = 0;
11 
12  BDT.clear();
13  Energy.clear();
14 
15  m_pointAndDir.clear();
16 };
17 
19  EcalKNShowers = 0;
21  Likelihood.clear();
22  MaxEnergyFraction.clear();
23 };
24 
25 void EcalBaseData::Dump() const {
26  fmt::print("{:=^120} \n", " EcalBaseData ");
27  fmt::print("{:^15} {:^15}\n", "TotalHits", "ShowerHits");
28  fmt::print("{:^15} {:^15}\n", TotalHits, ShowerHits);
29 
30  if (Energy.size() > 0) {
31  fmt::print(" {:^15}", " ");
32  for (auto recoType : Ecal::recoTypes)
33  fmt::print(" {:>20}", Ecal::recoNames[recoType]);
34  fmt::print("\n");
35 
36  fmt::print(" {:<15}", "Energy");
37  for (auto recoType : Ecal::recoTypes)
38  fmt::print(" {:>20f}", Energy[recoType]);
39  fmt::print("\n");
40  }
41 
42  if (BDT.size() > 0) {
43  fmt::print(" {:^15}", " ");
44  for (auto bdtType : Ecal::BDTTypes)
45  fmt::print(" {:>20}", Ecal::BDTNames[bdtType]);
46  fmt::print("\n");
47 
48  fmt::print(" {:<15}", "BDT");
49  for (auto bdtType : Ecal::BDTTypes)
50  fmt::print(" {:>20f}", BDT[bdtType]);
51  fmt::print("\n");
52  }
53 
54  if (m_pointAndDir.size() > 0) {
55  fmt::print("\n COG: ({:5.2f}, {:5.2f}, {:5.2f}) Direction: ({:5.2f}, {:5.2f}, {:5.2f})\n", GetCOG().x(),
56  GetCOG().y(), GetCOG().z(), GetDirection().x(), GetDirection().y(), GetDirection().z());
57  }
58 
59  fmt::print("{:-^120}\n", "");
60 }
61 
62 void EcalPlusData::Dump() const {
63  fmt::print("{:=^120} \n", " EcalPlusData ");
64  fmt::print("{:^15} {:^15}\n", "EcalKNShowers", "EcalKHadronicFlag");
65  fmt::print("{:^15} {:^15}\n", EcalKNShowers, EcalKHadronicFlag);
66 
67  if (Likelihood.size() > 0) {
68  fmt::print(" Likelihood: ({:5.2f}, {:5.2f})\n", Likelihood[Ecal::LikelihoodType::Integral],
70  }
71 
72  if (MaxEnergyFraction.size() > 0) {
73  fmt::print(" {:<15}", "MaxEnergyFraction:");
74  for (unsigned int iLayer = 0; iLayer < 18; iLayer++) {
75  if (ContainsKeys(MaxEnergyFraction, iLayer))
76  fmt::print(" {:>5.2f}", MaxEnergyFraction.at(iLayer));
77  }
78  fmt::print("\n");
79  }
80 
81  fmt::print("{:-^120}\n", "");
82 }
83 
84 } // namespace NAIA
int EcalKHadronicFlag
Hadronic interaction flag (W. Xu reconstruction)
Definition: Ecal.h:121
const TVector3 & GetCOG() const
Get the shower COG coordinates.
Definition: Ecal.h:90
short ShowerHits
Total number of Ecal hits in the shower.
Definition: Ecal.h:47
void Clear()
Clear container content.
Definition: Ecal.cpp:18
std::vector< TVector3 > m_pointAndDir
Definition: Ecal.h:103
void Dump() const
Dump on screen container content.
Definition: Ecal.cpp:25
EcalBDTVariable< float > BDT
Ecal BDT estimator for e/p separation. See Ecal::BDTType for a list of available types.
Definition: Ecal.h:54
void Clear()
Clear container content.
Definition: Ecal.cpp:9
short TotalHits
Total number of Ecal hits.
Definition: Ecal.h:46
constexpr std::array< EnergyRecoType, numEnergyRecos > recoTypes
Definition: Utils.h:298
LayerVariable< float > MaxEnergyFraction
Energy fraction in the cell with the highest edep, for each Ecal layer.
Definition: Ecal.h:125
void Dump() const
Dump on screen container content.
Definition: Ecal.cpp:62
int EcalKNShowers
Number of reconstructed showers (W. Xu reconstruction)
Definition: Ecal.h:120
static const std::string BranchName
Definition: Ecal.h:166
static const std::array< std::string, numBDTTypes > BDTNames
Definition: Utils.h:322
EcalLikelihoodVariable< float > Likelihood
Likelihood variable for e/p separation (W. Xu reconstruction). See Ecal::LikelihoodType for a list of...
Definition: Ecal.h:123
static const std::array< std::string, numEnergyRecos > recoNames
Definition: Utils.h:302
static const std::string BranchName
Definition: Ecal.h:181
Ecal container class description.
EcalEnergyVariable< float > Energy
Reconstructed shower energy. See Ecal::EnergyRecoType for a list of available energy reconstructions...
Definition: Ecal.h:51
const TVector3 & GetDirection() const
Get the shower Direction.
Definition: Ecal.h:97
std::enable_if< std::is_convertible< Key, size_t >::value, bool >::type ContainsKeys(const std::array< T, N > &container, Key key)
Definition: Utils.hpp:53
constexpr std::array< BDTType, numBDTTypes > BDTTypes
Definition: Utils.h:320