NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
EcalFill.cpp
Go to the documentation of this file.
1 #include "EcalKXRec.h"
2 
3 #include "Containers/Ecal.h"
4 
5 namespace NAIA {
6 using namespace Ecal;
7 
9  Energy.resize(Ecal::numEnergyRecos);
10  BDT.resize(Ecal::numBDTTypes);
11 }
12 
13 bool EcalBaseData::Fill(EcalShowerR *showerPtr) {
14  ResizeMembers();
15  TotalHits = AMSEventR::Head()->nEcalHit();
16  ShowerHits = showerPtr->Nhits;
17 
18  Energy[EnergyRecoType::EnergyD] = showerPtr->EnergyD / 1000.0f;
19  Energy[EnergyRecoType::EnergyE] = showerPtr->EnergyE;
20  Energy[EnergyRecoType::EnergyCorrEneE_E] = showerPtr->GetCorrectedEnergy(2, 2);
21  Energy[EnergyRecoType::EnergyCorrEne2017] = showerPtr->ElectronEnergy2017();
22 
23  auto ecalKRec = EcalKXRec::GetHead();
24  EcalKXRec::ProcessAMSEvent(AMSEventR::Head());
25  ecalKRec->GetTotalEnergy(Energy[EnergyRecoType::EcalKEle]);
26 
27  BDT[BDTType::v7std] = showerPtr->GetEcalBDT(AMSEventR::Head(), 7, 0, 1);
28  BDT[BDTType::v7ada] = showerPtr->GetEcalBDT(AMSEventR::Head(), 7, 1, 1);
29  BDT[BDTType::v5std] = showerPtr->GetEcalBDT(AMSEventR::Head(), 5, 0, 1);
30  BDT[BDTType::v5ada] = showerPtr->GetEcalBDT(AMSEventR::Head(), 5, 1, 1);
31 
32  m_pointAndDir.emplace_back(showerPtr->CofG[0], showerPtr->CofG[1], showerPtr->CofG[2]);
33  m_pointAndDir.emplace_back(showerPtr->Dir[0], showerPtr->Dir[1], showerPtr->Dir[2]);
34 
35  return true;
36 }
37 
39 
40 bool EcalPlusData::Fill(EcalShowerR *showerPtr) {
41  ResizeMembers();
42  auto ecalKRec = EcalKXRec::GetHead();
43  ecalKRec->GetHadronFlag(EcalKHadronicFlag);
44  ecalKRec->GetNumberOfShowers(EcalKNShowers);
45  ecalKRec->GetLikelihood(Likelihood[LikelihoodType::Integral], Likelihood[LikelihoodType::LayerCombined]);
46 
47  std::array<float, 18> energy_total_planes{0};
48  std::array<float, 18> energy_max_planes{0};
49 
50  auto event = AMSEventR::Head();
51  for (int ihit = 0; ihit < event->nEcalHit(); ihit++) {
52  energy_total_planes[event->pEcalHit(ihit)->Plane] += event->pEcalHit(ihit)->Edep;
53  energy_max_planes[event->pEcalHit(ihit)->Plane] =
54  std::max(energy_max_planes[event->pEcalHit(ihit)->Plane], event->pEcalHit(ihit)->Edep);
55  }
56 
57  for (int ipl = 0; ipl < 18; ipl++) {
58  if (energy_total_planes[ipl] > 0)
59  MaxEnergyFraction[ipl] = energy_max_planes[ipl] / energy_total_planes[ipl];
60  }
61 
62  return true;
63 }
64 } // namespace NAIA
constexpr unsigned int numLikelihoodTypes
Definition: Utils.h:307
Ecal energy (W. Xu 3D reconstruction)
Definition: Utils.h:293
void ResizeMembers()
Definition: EcalFill.cpp:38
Ecal energy (2017 reconstruction)
Definition: Utils.h:292
constexpr unsigned int numBDTTypes
Definition: Utils.h:316
Ecal container class description.
Ecal energy (standard reconstruction)
Definition: Utils.h:290
Total deposited energy in Ecal.
Definition: Utils.h:289
constexpr unsigned int numEnergyRecos
Definition: Utils.h:285
void ResizeMembers()
Definition: EcalFill.cpp:8
Ecal energy (electron hypothesys, Using different methods to recover anode efficiency, rear leakage, lateral leakage and temperature effects)
Definition: Utils.h:291