10#include <ecl/modules/eclSplitterN2/ECLSplitterN2Module.h>
13#include <ecl/utility/Position.h>
14#include <ecl/dataobjects/ECLCalDigit.h>
15#include <ecl/dataobjects/ECLConnectedRegion.h>
16#include <ecl/dataobjects/ECLLocalMaximum.h>
17#include <ecl/dataobjects/ECLShower.h>
20#include <framework/logging/Logger.h>
40 m_eclConnectedRegions(eclConnectedRegionArrayName()),
41 m_eclLocalMaximums(eclLocalMaximumArrayName()),
42 m_eclShowers(eclShowerArrayName())
45 setDescription(
"ECLSplitterN2Module: Baseline reconstruction splitter code for the neutral hadron hypothesis.");
89 B2DEBUG(175,
"ECLCRSplitterN2Module::event()");
93 unsigned int iShower = 1;
98 aECLShower->addRelationTo(&aCR);
103 aECLShower->addRelationTo(&aLM);
107 double highestEnergy = 0.0;
108 double highestEnergyTime = 0.;
109 double highestEnergyTimeResolution = 0.;
110 double weightSum = 0.0;
111 double energySum = 0.0;
112 unsigned int highestEnergyID = 0;
113 std::vector< ECLCalDigit > digits;
114 std::vector< double > weights;
118 for (
unsigned int iRel = 0; iRel < relatedDigitsPairs.size(); iRel++) {
119 const auto aECLCalDigit = relatedDigitsPairs.object(iRel);
120 const auto weight = relatedDigitsPairs.weight(iRel);
123 aECLShower->addRelationTo(aECLCalDigit, weight);
126 const double energyDigit = aECLCalDigit->getEnergy();
127 if (energyDigit > highestEnergy) {
128 highestEnergy = energyDigit * weight;
129 highestEnergyID = aECLCalDigit->getCellId();
130 highestEnergyTime = aECLCalDigit->getTime();
131 highestEnergyTimeResolution = aECLCalDigit->getTimeResolution();
134 digits.push_back(*aECLCalDigit);
135 weights.push_back(weight);
138 energySum += energyDigit * weight;
142 const ROOT::Math::XYZVector& showerposition = Belle2::ECL::computePositionLiLo(digits, weights,
m_liloParameters);
143 aECLShower->setTheta(showerposition.Theta());
144 aECLShower->setPhi(showerposition.Phi());
145 aECLShower->setR(showerposition.R());
147 aECLShower->setEnergy(energySum);
148 aECLShower->setEnergyRaw(energySum);
149 aECLShower->setEnergyHighestCrystal(highestEnergy);
150 aECLShower->setCentralCellId(highestEnergyID);
151 aECLShower->setTime(highestEnergyTime);
152 aECLShower->setDeltaTime99(highestEnergyTimeResolution);
153 aECLShower->setNumberOfCrystals(weightSum);
155 aECLShower->setShowerId(iShower);
157 aECLShower->setConnectedRegionId(aCR.getCRId());
159 B2DEBUG(175,
"N2 shower " << iShower);
160 B2DEBUG(175,
" theta = " << aECLShower->getTheta());
161 B2DEBUG(175,
" phi = " << aECLShower->getPhi());
162 B2DEBUG(175,
" R = " << aECLShower->getR());
163 B2DEBUG(175,
" energy = " << aECLShower->getEnergy());
164 B2DEBUG(175,
" time = " << aECLShower->getTime());
165 B2DEBUG(175,
" time resolution = " << aECLShower->getDeltaTime99());
Class to store calibrated ECLDigits: ECLCalDigits.
Class to store local maxima (LM)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
virtual const char * eclShowerArrayName() const
Default name ECLShowers.
double m_liloParameterB
lin-log parameter B
StoreArray< ECLShower > m_eclShowers
Store array: ECLShower.
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
ECLSplitterN2Module()
Constructor.
std::string m_positionMethod
Position calculation: lilo or linear.
virtual void initialize() override
Initialize.
StoreArray< ECLLocalMaximum > m_eclLocalMaximums
Store array: ECLLocalMaximum.
virtual void event() override
Event.
virtual const char * eclLocalMaximumArrayName() const
Default name ECLLocalMaximums.
virtual void endRun() override
End run.
virtual void terminate() override
Terminate.
~ECLSplitterN2Module()
Destructor.
virtual void beginRun() override
Begin run.
std::vector< double > m_liloParameters
lin-log parameters A, B, and C
virtual const char * eclConnectedRegionArrayName() const
Default name ECLConnectedRegions.
virtual const char * eclCalDigitArrayName() const
Default name ECLCalDigits.
double m_liloParameterA
lin-log parameter A
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.
double m_liloParameterC
lin-log parameter C
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.