10#include <ecl/modules/MCMatcherECLClusters/MCMatcherECLClustersModule.h>
13#include <ecl/dataobjects/ECLCalDigit.h>
14#include <ecl/dataobjects/ECLDigit.h>
15#include <ecl/dataobjects/ECLElementNumbers.h>
16#include <ecl/dataobjects/ECLHit.h>
17#include <ecl/dataobjects/ECLShower.h>
18#include <ecl/dataobjects/ECLSimHit.h>
21#include <mdst/dataobjects/ECLCluster.h>
22#include <mdst/dataobjects/MCParticle.h>
36 m_eclDigitArrayName(getECLDigitArrayName()),
37 m_eclCalDigitArrayName(getECLCalDigitArrayName()),
38 m_eclClusterArrayName(getECLClusterArrayName()),
39 m_eclShowerArrayName(getECLShowerArrayName()),
40 m_mcParticleToECLHitRelationArray(m_mcParticles, m_eclHits),
41 m_mcParticleToECLSimHitRelationArray(m_mcParticles, m_eclSimHits)
82 TObject** ocd = cd->GetObjectRef();
83 for (
int i = 0, imax = cd->GetEntries(); i < imax; i++) {
85 double calEnergy = t.getEnergy();
86 if (calEnergy < 0)
continue;
87 Index[t.getCellId() - 1] = i;
95 for (
int i = 0, imax = p2sh.
getEntries(); i < imax; i++) {
97 const std::vector<unsigned int>& simhitindx = re.
getToIndices();
98 std::map<int, double> e;
99 for (
unsigned int j : simhitindx) {
101 int id = h->getCellId() - 1;
102 e[id] += h->getEnergyDep();
106 for (std::pair<int, double> t : e) {
107 int ind = Index[t.first];
121 double shower_mcParWeight = 0;
125 for (
unsigned int iRelation = 0; iRelation < shower_CalDigitRelations.size(); ++iRelation) {
128 const ECLCalDigit* calDigit = shower_CalDigitRelations.object(iRelation);
132 const double calDigit_showerWeight = shower_CalDigitRelations.weight(iRelation);
135 auto it = e.find(
id);
137 const double calDigit_mcParWeight = (*it).second;
138 shower_mcParWeight += (calDigit_mcParWeight * calDigit_showerWeight);
141 if (shower_mcParWeight > 0)
142 shower.addRelationTo(mcs[re.
getFromIndex()], shower_mcParWeight);
149 TObject** oed = ed->GetObjectRef();
150 for (
int i = 0, imax = ed->GetEntries(); i < imax; i++) {
152 if (t.getAmp() <= 0)
continue;
153 Index[t.getCellId() - 1] = i;
159 for (
int i = 0, imax = p2eh.
getEntries(); i < imax; i++) {
161 const std::vector<unsigned int>& eclhitindx = re.
getToIndices();
162 for (
unsigned int j : eclhitindx) {
163 const ECLHit* t = eclhits[j];
164 int id = t->getCellId() - 1;
165 if (t->getBackgroundTag() == 0
178 if (!eclCluster)
continue;
181 for (
unsigned int i = 0; i < mcParticles.
size(); ++i) {
182 const auto mcParticle = mcParticles.
object(i);
183 const auto weight = mcParticles.
weight(i);
Class to store calibrated ECLDigits: ECLCalDigits.
int getCellId() const
Get Cell ID.
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Class to store ECL Showers.
ClassECLSimHit - Geant4 simulated hit for the ECL.
std::string m_eclClusterArrayName
Default name ECLClusters.
StoreArray< ECLShower > m_eclShowers
ECLShowers StoreArray.
std::string m_eclShowerArrayName
Default name ECLShowers.
RelationArray m_mcParticleToECLSimHitRelationArray
MCParticles to ECLSimHits RelationArray.
virtual void initialize() override
Initialize variables, print info, and start CPU clock.
RelationArray m_mcParticleToECLHitRelationArray
MCParticles to ECLHits RelationArray.
virtual void event() override
Actual digitization of all hits in the ECL.
StoreArray< ECLSimHit > m_eclSimHits
ECLSimHits StoreArray.
StoreArray< ECLDigit > m_eclDigits
ECLDigits StoreArray.
StoreArray< ECLCluster > m_eclClusters
ECLClusters StoreArray.
StoreArray< ECLHit > m_eclHits
ECLHits StoreArray.
std::string m_eclCalDigitArrayName
Default name ECLCalDigits.
StoreArray< MCParticle > m_mcParticles
MCParticles StoreArray.
MCMatcherECLClustersModule()
Constructor.
virtual ~MCMatcherECLClustersModule()
Destructor.
std::string m_eclDigitArrayName
Default name ECLDigits.
StoreArray< ECLCalDigit > m_eclCalDigits
ECLCalDigits StoreArray.
A Class to store the Monte Carlo particle information.
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...
Low-level class to create/modify relations between StoreArrays.
int getEntries() const
Get the number of elements.
Class to store a single element of a relation.
index_type getFromIndex() const
Get index we point from.
const std::vector< index_type > & getToIndices() const
Get vector of indices we point to.
Class for type safe access to objects that are referred to in relations.
T * object(int index) const
Get object with index.
size_t size() const
Get number of relations.
float weight(int index) const
Get weight with index.
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).
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
bool isValid() const
Check wether the array was registered.
TClonesArray * getPtr() const
Raw access to the underlying TClonesArray.
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.
#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.