11 #include <ecl/modules/MCMatcherECLClusters/MCMatcherECLClustersModule.h>
14 #include <mdst/dataobjects/ECLCluster.h>
15 #include <mdst/dataobjects/MCParticle.h>
18 #include <ecl/dataobjects/ECLHit.h>
19 #include <ecl/dataobjects/ECLCalDigit.h>
20 #include <ecl/dataobjects/ECLDigit.h>
21 #include <ecl/dataobjects/ECLShower.h>
22 #include <ecl/dataobjects/ECLSimHit.h>
36 m_eclCalDigits(eclCalDigitArrayName()),
37 m_eclDigits(eclDigitArrayName()),
38 m_eclClusters(eclClusterArrayName()),
39 m_eclShowers(eclShowerArrayName()),
40 m_mcParticleToECLHitRelationArray(m_mcParticles, m_eclHits),
41 m_mcParticleToECLSimHitRelationArray(m_mcParticles, m_eclSimHits)
44 setDescription(
"MCMatcherECLClustersModule");
45 setPropertyFlags(c_ParallelProcessingCertified);
77 short int Index[8736];
78 std::fill_n(Index, 8736, -1);
80 TObject** ocd = cd->GetObjectRef();
81 for (
int i = 0, imax = cd->GetEntries(); i < imax; i++) {
83 double calEnergy = t.getEnergy();
84 if (calEnergy < 0)
continue;
85 Index[t.getCellId() - 1] = i;
93 for (
int i = 0, imax = p2sh.
getEntries(); i < imax; i++) {
95 const std::vector<unsigned int>& simhitindx = re.getToIndices();
96 std::map<int, double> e;
97 for (
unsigned int j : simhitindx) {
99 int id = h->getCellId() - 1;
100 e[id] += h->getEnergyDep();
104 for (
const std::pair<int, double>& t : e) {
105 int ind = Index[t.first];
119 double shower_mcParWeight = 0;
123 for (
unsigned int iRelation = 0; iRelation < shower_CalDigitRelations.size(); ++iRelation) {
126 const ECLCalDigit* calDigit = shower_CalDigitRelations.object(iRelation);
130 const double calDigit_showerWeight = shower_CalDigitRelations.weight(iRelation);
133 auto it = e.find(
id);
135 const double calDigit_mcParWeight = (*it).second;
136 shower_mcParWeight += (calDigit_mcParWeight * calDigit_showerWeight);
139 if (shower_mcParWeight > 0)
140 shower.addRelationTo(mcs[re.getFromIndex()], shower_mcParWeight);
145 std::fill_n(Index, 8736, -1);
147 TObject** oed = ed->GetObjectRef();
148 for (
int i = 0, imax = ed->GetEntries(); i < imax; i++) {
150 if (t.getAmp() <= 0)
continue;
151 Index[t.getCellId() - 1] = i;
157 for (
int i = 0, imax = p2eh.
getEntries(); i < imax; i++) {
159 const std::vector<unsigned int>& eclhitindx = re.getToIndices();
160 for (
unsigned int j : eclhitindx) {
161 const ECLHit* t = eclhits[j];
162 int id = t->getCellId() - 1;
163 if (t->getBackgroundTag() == 0
176 if (!eclCluster)
continue;
179 for (
unsigned int i = 0; i < mcParticles.
size(); ++i) {
180 const auto mcParticle = mcParticles.
object(i);
181 const auto weight = mcParticles.
weight(i);