 |
Belle II Software
release-05-01-25
|
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);
size_t size() const
Get number of relations.
virtual const char * eclClusterArrayName() const
Default name ECLClusters.
virtual void terminate() override
Stopping of CPU clock.
StoreArray< MCParticle > m_mcParticles
MCParticles StoreArray.
Low-level class to create/modify relations between StoreArrays.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
virtual void beginRun() override
Nothing so far.
Class to store calibrated ECLDigits: ECLCalDigits.
ClassECLSimHit - Geant4 simulated hit for the ECL.
int getCellId() const
Get Cell ID.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
virtual void event() override
Actual digitization of all hits in the ECL.
StoreArray< ECLHit > m_eclHits
ECLHits StoreArray.
virtual const char * eclShowerArrayName() const
Default name ECLShowers.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Class to represent the hit of one cell.
virtual const char * eclDigitArrayName() const
Default name ECLDigits.
StoreArray< ECLShower > m_eclShowers
ECLShowers StoreArray.
Class to store a single element of a relation.
StoreArray< ECLDigit > m_eclDigits
ECLDigits StoreArray.
Class for type safe access to objects that are referred to in relations.
StoreArray< ECLCluster > m_eclClusters
ECLClusters StoreArray.
Abstract base class for different kinds of events.
virtual const char * eclCalDigitArrayName() const
Default name ECLCalDigits.
virtual void initialize() override
Initialize variables, print info, and start CPU clock.
T * object(int index) const
Get object with index.
virtual void endRun() override
Nothing so far.
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
virtual ~MCMatcherECLClustersModule()
Destructor.
TClonesArray * getPtr() const
Raw access to the underlying TClonesArray.
int getEntries() const
Get the number of elements.
float weight(int index) const
Get weight with index.
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
StoreArray< ECLCalDigit > m_eclCalDigits
ECLCalDigits StoreArray.
A Class to store the Monte Carlo particle information.
RelationArray m_mcParticleToECLSimHitRelationArray
MCParticles to ECLSimHits RelationArray.
RelationArray m_mcParticleToECLHitRelationArray
MCParticles to ECLHits RelationArray.
StoreArray< ECLSimHit > m_eclSimHits
ECLSimHits StoreArray.
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
Class to store ECL Showers.