10#include <ecl/modules/eclTRGInformation/ECLTRGInformationModule.h>
13#include <ecl/dataobjects/ECLCalDigit.h>
14#include <ecl/dataobjects/ECLElementNumbers.h>
17#include <analysis/dataobjects/ECLTRGInformation.h>
18#include <analysis/dataobjects/ECLTriggerCell.h>
19#include <framework/logging/Logger.h>
20#include <framework/gearbox/Unit.h>
21#include <mdst/dataobjects/ECLCluster.h>
22#include <trg/ecl/dataobjects/TRGECLUnpackerEvtStore.h>
23#include <trg/ecl/dataobjects/TRGECLUnpackerStore.h>
24#include <trg/ecl/TrgEclMapping.h>
84 EventTiming = trgEvt.getEvtTime();
85 RevoGDL = trgEvt.getL1Revo();
86 RevoFAM = trgEvt.getEvtRevo();
94 const auto aTC =
m_eclTCs.appendNew();
96 const unsigned idx = trg.getTCId();
99 aTC->setFADC(trg.getTCEnergy());
100 aTC->setTiming(trg.getTCTime());
101 aTC->setEvtTiming(EventTiming);
102 aTC->setRevoGDL(RevoGDL);
103 aTC->setRevoFAM(RevoFAM);
106 aTC->setHitWin(trg.getHitWin());
109 float energySum = 0.;
122 aTC->setECLCalDigitEnergy(energySum);
127 for (
int i = 0; i <
m_eclTCs.getEntries(); i++) {
130 B2ERROR(
m_eclTCs[i]->getTCId() <<
" not possible");
144 auto relationsCalDigits = cluster.getRelationsTo<
ECLCalDigit>();
145 for (
unsigned int idx = 0; idx < relationsCalDigits.size(); ++idx) {
146 const auto cal = relationsCalDigits.object(idx);
147 const auto weight = relationsCalDigits.weight(idx);
150 for (
unsigned int idxTC = 0; idxTC < relationsTCs.size(); ++idxTC) {
151 const auto tc = relationsTCs.object(idxTC);
153 const unsigned tcid = tc->
getTCId();
154 TCMap[tcid] += weight * cal->getEnergy();
159 for (
const auto& mapentry : TCMap) {
161 cluster.addRelationTo(
m_eclTCs[pos], mapentry.second);
166 float sumEnergyTCECLCalDigitInECLCluster = 0.0;
167 float sumEnergyECLCalDigitInECLCluster = 0.0;
175 float eventtiming = std::numeric_limits<float>::quiet_NaN();
180 const int tcid = trg.getTCId();
183 if (trg.getTCEnergy() > maxtc) {
184 maxtc = trg.getTCEnergy();
194 if (trg.getTCEnergy() > 0 and std::isnan(eventtiming)) {
195 eventtiming = EventTiming;
198 B2DEBUG(29,
"TC Id: (1.." <<
ECLTRGInformation::c_nTCs <<
") " << trg.getTCId() <<
" FADC=" << trg.getTCEnergy() <<
", t=" <<
199 trg.getTCTime() <<
", tevent=" << eventtiming);
204 float energyInTC = 0.;
205 float energyInTCInECLCluster = 0.;
206 float highestEnergy = -1.;
207 float time = std::numeric_limits<float>::quiet_NaN();
219 for (
unsigned int irel = 0; irel < rel.size(); ++irel) {
221 const auto cluster = rel.object(irel);
225 const auto weight = rel.weight(irel);
231 energyInTCInECLCluster += weight *
m_eclCalDigits[pos]->getEnergy();
251 if (
m_eclTRGInformation->getEnergyTC(idx)) sumEnergyTCECLCalDigitInECLCluster += energyInTCInECLCluster;
252 sumEnergyECLCalDigitInECLCluster += energyInTCInECLCluster;
261 if (energyInTC > 0) B2DEBUG(29,
"ECLCalDigits TC Id: (1.." <<
ECLTRGInformation::c_nTCs <<
") " << idx <<
" E=" << energyInTC <<
267 m_eclTRGInformation->setSumEnergyTCECLCalDigitInECLCluster(sumEnergyTCECLCalDigitInECLCluster);
268 m_eclTRGInformation->setSumEnergyECLCalDigitInECLCluster(sumEnergyECLCalDigitInECLCluster);
275 m_eclTCs[pos]->setIsHighestFADC(
true);
Class to store calibrated ECLDigits: ECLCalDigits.
@ c_nPhotons
CR is split into n photons (N1)
unsigned int getTCId() const
Get m_TCId.
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...
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
std::vector< int > getXtalIdFromTCId(int)
get [Xtal ID] from [TC ID] (Output as a vector)
int getTCPhiIdFromTCId(int)
get [TC Phi ID] from [TC ID]
static const double MeV
[megaelectronvolt]
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.
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.