Commit 3ecf1202 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Eicd update

parent dfb1f48a
......@@ -5,7 +5,7 @@ cmake_policy(SET CMP0074 NEW)
project(Juggler VERSION 4.3.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
# Export compile commands as json for run-clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
......
......@@ -39,7 +39,7 @@ private:
};
template <class T>
DataWrapper<T>::~DataWrapper<T>() {
DataWrapper<T>::~DataWrapper() {
if (m_data != nullptr) delete m_data;
}
......
#ifndef JUGBASE_UNIQUE_ID
#define JUGBASE_UNIQUE_ID
// Get a unique integer identifier based on a string
// Deals with possible overflow issues
//
// Both in function and mixin form (latter is useful for algorithms)
#include <cstdint>
#include <functional>
#include <limits>
#include <string>
#include <GaudiKernel/MsgStream.h>
namespace Jug {
template <class Integer> Integer uniqueID(const std::string& s) {
std::hash<std::string> hash_alg;
const auto fullID = hash_alg(s);
const Integer max = std::numeric_limits<Integer>::max();
return static_cast<Integer>(fullID & max);
}
template <class Integer = int32_t> class AlgorithmIDMixin {
public:
AlgorithmIDMixin(const std::string& name, MsgStream& out) : m_id{uniqueID<Integer>(name)} {
// suppress output during Gaudi plugin construction
if (name != "DefaultName") {
out << "Unique ID associated with '" << name << "': " << m_id << endmsg;
}
}
AlgorithmIDMixin() = delete;
AlgorithmIDMixin(const AlgorithmIDMixin&) = delete;
AlgorithmIDMixin& operator=(const AlgorithmIDMixin&) = delete;
Integer algorithmID() const { return m_id; }
private:
const Integer m_id;
};
} // namespace Jug
#endif
......@@ -7,7 +7,6 @@
#include <cmath>
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "edm4hep/MCParticleCollection.h"
......@@ -15,7 +14,7 @@
namespace Jug::Base {
class MC2DummyParticle : public GaudiAlgorithm, AlgorithmIDMixin<int32_t> {
class MC2DummyParticle : public GaudiAlgorithm {
public:
DataHandle<edm4hep::MCParticleCollection> m_inputParticles{"MCParticles", Gaudi::DataHandle::Reader, this};
DataHandle<eic::ReconstructedParticleCollection> m_outputParticles{"DummyReconstructedParticles",
......@@ -23,11 +22,8 @@ namespace Jug::Base {
Rndm::Numbers m_gaussDist;
Gaudi::Property<double> m_smearing{this, "smearing", 0.01 /* 1 percent*/};
const int32_t kMonteCarloSource{uniqueID<int32_t>("MCParticles")};
MC2DummyParticle(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputCollection", m_inputParticles, "MCParticles");
declareProperty("outputCollection", m_outputParticles, "DummyReconstructedParticles");
......@@ -50,7 +46,6 @@ namespace Jug::Base {
const edm4hep::MCParticleCollection* parts = m_inputParticles.get();
// output collection
auto& out_parts = *(m_outputParticles.createAndPut());
int ID = 0;
for (const auto& p : *parts) {
if (p.getGeneratorStatus() > 1) {
if (msgLevel(MSG::DEBUG)) {
......@@ -78,7 +73,6 @@ namespace Jug::Base {
const auto p_theta = std::atan2(std::hypot(px, py), pz);
auto rec_part = out_parts.create();
rec_part.ID({ID++, algorithmID()});
rec_part.p({px, py, pz});
rec_part.v({vx, vy, vz});
rec_part.time(p.getTime());
......@@ -86,7 +80,8 @@ namespace Jug::Base {
rec_part.status(p.getGeneratorStatus());
rec_part.charge(p.getCharge());
rec_part.weight(1.);
rec_part.direction({p_theta, p_phi});
rec_part.theta(p_theta);
rec_part.phi(p_phi);
rec_part.momentum(momentum);
rec_part.energy(energy);
rec_part.mass(p.getMass());
......
......@@ -14,7 +14,6 @@
#include "GaudiKernel/RndmGenerators.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
#include "JugBase/IParticleSvc.h"
// Event Model related classes
......@@ -32,7 +31,7 @@ namespace Jug::Digi {
* \ingroup digi
* \ingroup calorimetry
*/
class CalorimeterBirksCorr : public GaudiAlgorithm, AlgorithmIDMixin<> {
class CalorimeterBirksCorr : public GaudiAlgorithm {
public:
// digitization settings
......@@ -50,7 +49,6 @@ namespace Jug::Digi {
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
CalorimeterBirksCorr(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin{name, info()}
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......
......@@ -22,7 +22,6 @@
#include "JugBase/IGeoSvc.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
#include "fmt/format.h"
#include "fmt/ranges.h"
......@@ -42,7 +41,7 @@ namespace Jug::Digi {
* \ingroup digi
* \ingroup calorimetry
*/
class CalorimeterHitDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
class CalorimeterHitDigi : public GaudiAlgorithm {
public:
// additional smearing resolutions
Gaudi::Property<std::vector<double>> u_eRes{this, "energyResolutions", {}}; // a/sqrt(E/GeV) + b + c/(E/GeV)
......@@ -84,7 +83,6 @@ namespace Jug::Digi {
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
CalorimeterHitDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin{name, info()}
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -168,7 +166,6 @@ namespace Jug::Digi {
const auto simhits = m_inputHitCollection.get();
// Create output collections
auto rawhits = m_outputHitCollection.createAndPut();
int nhits = 0;
for (const auto& ahit : *simhits) {
// Note: juggler internal unit of energy is GeV
const double eDep = ahit.getEnergy();
......@@ -189,8 +186,7 @@ namespace Jug::Digi {
const long long tdc = std::llround((time + m_normDist() * tRes) * stepTDC);
eic::RawCalorimeterHit rawhit(
{nhits++, algorithmID()},
(long long)ahit.getCellID(),
ahit.getCellID(),
(adc > m_capADC.value() ? m_capADC.value() : adc),
tdc
);
......@@ -244,7 +240,6 @@ namespace Jug::Digi {
long long tdc = std::llround((time + m_normDist() * tRes) * stepTDC);
eic::RawCalorimeterHit rawhit(
{nhits++, algorithmID()},
id,
(adc > m_capADC.value() ? m_capADC.value() : adc),
tdc
......
......@@ -18,7 +18,6 @@
#include "GaudiKernel/PhysicalConstants.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "eicd/RawPMTHitCollection.h"
......@@ -34,7 +33,7 @@ namespace Jug::Digi {
*
* \ingroup digi
*/
class PhotoMultiplierDigi : public GaudiAlgorithm, AlgorithmIDMixin<>
class PhotoMultiplierDigi : public GaudiAlgorithm
{
public:
DataHandle<edm4hep::SimTrackerHitCollection>
......@@ -54,7 +53,6 @@ public:
// constructor
PhotoMultiplierDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection,"");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -87,7 +85,7 @@ public:
auto &raw = *m_outputHitCollection.createAndPut();
struct HitData { int npe; double signal; double time; };
std::unordered_map<long long, std::vector<HitData>> hit_groups;
std::unordered_map<uint64_t, std::vector<HitData>> hit_groups;
// collect the photon hit in the same cell
// calculate signal
for(const auto& ahit : sim) {
......@@ -96,7 +94,7 @@ public:
continue;
}
// cell id, time, signal amplitude
long long id = ahit.getCellID();
uint64_t id = ahit.getCellID();
double time = ahit.getMCParticle().getTime();
double amp = m_speMean + m_rngNorm()*m_speError;
......@@ -121,11 +119,10 @@ public:
}
// build hit
int ID = 0;
for (auto &it : hit_groups) {
for (auto &data : it.second) {
eic::RawPMTHit hit{
{ID++, algorithmID()},
0 /* Old ID TBDeleted */,
it.first,
static_cast<uint32_t>(data.signal),
static_cast<uint32_t>(data.time/(m_timeStep/ns))};
......
......@@ -8,7 +8,6 @@
#include "Gaudi/Property.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
// edm4hep's tracker hit is the input collectiopn
......@@ -23,7 +22,7 @@ namespace Jug::Digi {
*
* \ingroup digi
*/
class SiliconTrackerDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
class SiliconTrackerDigi : public GaudiAlgorithm {
public:
Gaudi::Property<double> m_timeResolution{this, "timeResolution", 10}; // todo : add units
Gaudi::Property<double> m_threshold{this, "threshold", 0. * Gaudi::Units::keV};
......@@ -37,7 +36,6 @@ namespace Jug::Digi {
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
SiliconTrackerDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -61,7 +59,6 @@ namespace Jug::Digi {
auto rawhits = m_outputHitCollection.createAndPut();
// eic::RawTrackerHitCollection* rawHitCollection = new eic::RawTrackerHitCollection();
std::map<long long, int> cell_hit_map;
int ID = 0;
for (const auto& ahit : *simhits) {
if (msgLevel(MSG::DEBUG)) {
debug() << "--------------------" << ahit.getCellID() << endmsg;
......@@ -82,8 +79,8 @@ namespace Jug::Digi {
}
if (cell_hit_map.count(ahit.getCellID()) == 0) {
cell_hit_map[ahit.getCellID()] = rawhits->size();
eic::RawTrackerHit rawhit({ID++, algorithmID()},
(int64_t)ahit.getCellID(),
eic::RawTrackerHit rawhit(0 /* deleteme */,
ahit.getCellID(),
ahit.getMCParticle().getTime() * 1e6 + m_gaussDist() * 1e3, // ns->fs
std::llround(ahit.getEDep() * 1e6));
rawhits->push_back(rawhit);
......
......@@ -8,7 +8,6 @@
#include "Gaudi/Property.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
// edm4hep's tracker hit is the input collectiopn
......@@ -23,7 +22,7 @@ namespace Jug::Digi {
*
* \ingroup digi
*/
class UFSDTrackerDigi : public GaudiAlgorithm, AlgorithmIDMixin<> {
class UFSDTrackerDigi : public GaudiAlgorithm {
public:
Gaudi::Property<double> m_timeResolution{this, "timeResolution", 10.};
Gaudi::Property<double> m_threshold{this, "threshold", 0. * Gaudi::Units::keV};
......@@ -37,7 +36,6 @@ namespace Jug::Digi {
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
UFSDTrackerDigi(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc)
, AlgorithmIDMixin(name, info())
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
......@@ -61,7 +59,6 @@ namespace Jug::Digi {
auto rawhits = m_outputHitCollection.createAndPut();
// eic::RawTrackerHitCollection* rawHitCollection = new eic::RawTrackerHitCollection();
std::map<long long, int> cell_hit_map;
int ID = 0;
for (const auto& ahit : *simhits) {
if (msgLevel(MSG::DEBUG)) {
debug() << "--------------------" << ahit.getCellID() << endmsg;
......@@ -83,8 +80,8 @@ namespace Jug::Digi {
// std::cout << ahit << "\n";
if (cell_hit_map.count(ahit.getCellID()) == 0) {
cell_hit_map[ahit.getCellID()] = rawhits->size();
eic::RawTrackerHit rawhit({ID++, algorithmID()},
(int64_t)ahit.getCellID(),
eic::RawTrackerHit rawhit(0 /* TBDeleted */,
ahit.getCellID(),
ahit.getMCParticle().getTime() * 1e6 + m_gaussDist() * 1e3, // ns->fs
std::llround(ahit.getEDep() * 1e6));
rawhits->push_back(rawhit);
......
// TODO needs full rework to run off mc-cluster relations instead
#if 0
#include <limits>
#include <numbers>
......@@ -10,11 +12,9 @@
#include "GaudiKernel/PhysicalConstants.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "eicd/ClusterCollection.h"
#include "eicd/MergedClusterRelationsCollection.h"
using namespace Gaudi::Units;
......@@ -25,20 +25,17 @@ namespace Jug::Fast {
*
* \ingroup fast
*/
class ClusterMerger : public GaudiAlgorithm, public AlgorithmIDMixin<> {
class ClusterMerger : public GaudiAlgorithm {
public:
// Input
DataHandle<eic::ClusterCollection> m_inputClusters{"InputClusters", Gaudi::DataHandle::Reader, this};
// Output
DataHandle<eic::ClusterCollection> m_outputClusters{"OutputClusters", Gaudi::DataHandle::Writer, this};
DataHandle<eic::MergedClusterRelationsCollection> m_relations{"OutputClusterRelations", Gaudi::DataHandle::Writer,
this}; // namespace Jug::Reco
public:
ClusterMerger(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputClusters", m_inputClusters, "Input cluster collection");
declareProperty("outputClusters", m_outputClusters, "Cluster collection with good energy precision");
declareProperty("outputRelations", m_relations, "Cluster collection with good position precision");
}
StatusCode initialize() override { return StatusCode::SUCCESS; }
......@@ -51,7 +48,6 @@ public:
const auto& split = *(m_inputClusters.get());
// output
auto& merged = *(m_outputClusters.createAndPut());
auto& relations = *(m_relations.createAndPut());
if (!split.size()) {
if (msgLevel(MSG::DEBUG)) {
......@@ -70,8 +66,6 @@ public:
if (msgLevel(MSG::DEBUG)) {
debug() << "Step 1/1: Merging clusters where needed" << endmsg;
}
// index for newly created matched clusters
int32_t idx = 0;
for (const auto& [mcID, clusters] : clusterMap) {
if (msgLevel(MSG::DEBUG)) {
debug() << " --> Processing " << clusters.size() << " clusters for mcID " << mcID << endmsg;
......@@ -79,54 +73,39 @@ public:
if (clusters.size() == 1) {
const auto& clus = clusters[0];
if (msgLevel(MSG::DEBUG)) {
debug() << " --> Only a single cluster " << clus.ID() << ", energy: " << clus.energy()
debug() << " --> Only a single cluster, energy: " << clus.energy()
<< " for this particle, copying" << endmsg;
}
merged.push_back(clus.clone());
auto rel = relations.create();
rel.clusterID(clus.ID());
rel.size(1);
rel.parent()[0] = clus.ID();
} else {
auto new_clus = merged.create();
new_clus.ID({idx++, algorithmID()});
auto rel = relations.create();
rel.clusterID(new_clus.ID());
rel.size(clusters.size());
// calculate aggregate info
float energy = 0;
float energyError = 0;
float time = 0;
int nhits = 0;
eic::VectorXYZ position;
float radius = 0;
float skewness = 0;
size_t cnt = 0;
for (const auto& clus : clusters) {
if (msgLevel(MSG::DEBUG)) {
debug() << " --> Adding cluster " << clus.ID() << ", energy: " << clus.energy() << endmsg;
debug() << " --> Adding cluster with energy: " << clus.energy() << endmsg;
}
energy += clus.energy();
energyError += clus.energyError() * clus.energyError();
time += clus.time() * clus.energy();
nhits += clus.nhits();
position = position.add(clus.position().scale(energy));
radius += clus.radius() * clus.radius(); // @TODO does this make sense?
skewness += 0; // @TODO
if (cnt < 4) {
rel.parent()[cnt] = clus.ID();
new_clus.addclusters(clus);
for (const auto& hit : clus.hits()) {
new_clus.addhits(hit);
}
++cnt;
}
new_clus.energy(energy);
new_clus.energyError(sqrt(energyError));
new_clus.time(time / energy);
new_clus.nhits(nhits);
new_clus.position(position.scale(1/energy));
new_clus.radius(sqrt(radius));
new_clus.skewness(skewness);
if (msgLevel(MSG::DEBUG)) {
debug() << " --> Merged cluster " << new_clus.ID() << ", energy: " << new_clus.energy() << endmsg;
debug() << " --> Merged cluster with energy: " << new_clus.energy() << endmsg;
}
}
}
......@@ -141,7 +120,7 @@ public:
std::map<eic::Index, std::vector<eic::ConstCluster>> matched = {};
for (const auto& cluster : clusters) {
if (msgLevel(MSG::VERBOSE)) {
verbose() << " --> Found cluster: " << cluster.ID() << " with mcID " << cluster.mcID() << " and energy "
verbose() << " --> Found cluster with mcID " << cluster.mcID() << " and energy "
<< cluster.energy() << endmsg;
}
if (!cluster.mcID()) {
......@@ -161,3 +140,4 @@ public:
DECLARE_COMPONENT(ClusterMerger)
} // namespace Jug::Fast
#endif
......@@ -8,7 +8,6 @@
#include "JugBase/IParticleSvc.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
#include <CLHEP/Vector/LorentzVector.h>
......@@ -18,7 +17,7 @@
namespace Jug::Fast {
class InclusiveKinematicsTruth : public GaudiAlgorithm, AlgorithmIDMixin<int32_t> {
class InclusiveKinematicsTruth : public GaudiAlgorithm {
public:
DataHandle<edm4hep::MCParticleCollection> m_inputParticleCollection{"MCParticles", Gaudi::DataHandle::Reader,
this};
......@@ -30,7 +29,7 @@ public:
double m_neutron;
InclusiveKinematicsTruth(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputMCParticles", m_inputParticleCollection, "MCParticles");
declareProperty("outputData", m_outputInclusiveKinematicsCollection, "InclusiveKinematicsTruth");
}
......
......@@ -7,7 +7,6 @@
#include <cmath>
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "edm4hep/MCParticleCollection.h"
......@@ -15,7 +14,7 @@
namespace Jug::Fast {
class MC2SmearedParticle : public GaudiAlgorithm, AlgorithmIDMixin<int32_t> {
class MC2SmearedParticle : public GaudiAlgorithm {
public:
DataHandle<edm4hep::MCParticleCollection> m_inputMCParticles{"MCParticles", Gaudi::DataHandle::Reader, this};
DataHandle<eic::ReconstructedParticleCollection> m_outputParticles{"SmearedReconstructedParticles",
......@@ -23,10 +22,8 @@ public:
Rndm::Numbers m_gaussDist;
Gaudi::Property<double> m_smearing{this, "smearing", 0.01 /* 1 percent*/};
const int32_t kMonteCarloSource{uniqueID<int32_t>("MCParticles")};
MC2SmearedParticle(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputParticles", m_inputMCParticles, "MCParticles");
declareProperty("outputParticles", m_outputParticles, "SmearedReconstructedParticles");
}
......@@ -46,7 +43,6 @@ public:
auto parts = m_inputMCParticles.get();
// output collection
auto& out_parts = *(m_outputParticles.createAndPut());
int ID = 0;
for (const auto& p : *parts) {
if (p.getGeneratorStatus() > 1) {
if (msgLevel(MSG::DEBUG)) {
......@@ -74,7 +70,6 @@ public:
const auto vz = p.getVertex().z;
auto rec_part = out_parts.create();
rec_part.ID({ID++, algorithmID()});
rec_part.p({px, py, pz});
rec_part.v({vx, vy, vz});
rec_part.time(p.getTime());
......@@ -82,7 +77,8 @@ public:
rec_part.status(p.getGeneratorStatus());
rec_part.charge(p.getCharge());
rec_part.weight(1.);
rec_part.direction({theta, phi});
rec_part.theta(theta);
rec_part.phi(phi);
rec_part.momentum(momentum);
rec_part.energy(energy);
rec_part.mass(p.getMass());
......
// TODO needs full rework to run off list of mc-cluster relations instead
#if 0
// Takes a list of particles (presumed to be from tracking), and all available clusters.
// 1. Match clusters to their tracks using the mcID field
// 2. For unmatched clusters create neutrals and add to the particle list
......@@ -14,36 +16,31 @@
#include "GaudiKernel/RndmGenerators.h"
#include "JugBase/DataHandle.h"
#include "JugBase/UniqueID.h"
// Event Model related classes
#include "edm4hep/MCParticleCollection.h"
#include "eicd/ClusterCollection.h"
#include "eicd/ReconstructedParticleCollection.h"
#include "eicd/TrackParametersCollection.h"
#include "eicd/VectorPolar.h"
#include "eicd/vector_utils.h"
namespace Jug::Fast {
class MatchClusters : public GaudiAlgorithm, AlgorithmIDMixin<> {
class MatchClusters : public GaudiAlgorithm {
public:
// input data
DataHandle<edm4hep::MCParticleCollection> m_inputMCParticles{"MCParticles", Gaudi::DataHandle::Reader, this};
DataHandle<eic::ReconstructedParticleCollection> m_inputParticles{"ReconstructedChargedParticles",
Gaudi::DataHandle::Reader, this};
Gaudi::Property<std::vector<std::string>> m_inputEcalClusters{
this, "inputEcalClusters", {}, "Ecal clusters to be aggregated"};
Gaudi::Property<std::vector<std::string>> m_inputHcalClusters{
this, "inputHcalClusters", {}, "Hcal clusters to be aggregated"};
std::vector<DataHandle<eic::ClusterCollection>*> m_inputEcalClusterCollections;
std::vector<DataHandle<eic::ClusterCollection>*> m_inputHcalClusterCollections;
Gaudi::Property<std::vector<std::string>> m_inputClusters{this, "inputClusters", {}, "Clusters to be aggregated"};
std::vector<DataHandle<eic::ClusterCollection>*> m_inputClusterCollections;
// output data
DataHandle<eic::ReconstructedParticleCollection> m_outputParticles{"ReconstructedParticles",
Gaudi::DataHandle::Writer, this};
MatchClusters(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc), AlgorithmIDMixin(name, info()) {
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputMCParticles", m_inputMCParticles, "MCParticles");
declareProperty("inputParticles", m_inputParticles, "ReconstructedChargedParticles");
declareProperty("outputParticles", m_outputParticles, "ReconstructedParticles");
......@@ -53,8 +50,7 @@ public:
if (GaudiAlgorithm::initialize().isFailure()) {
return StatusCode::FAILURE;
}
m_inputEcalClusterCollections = getClusterCollections(m_inputEcalClusters);
m_inputHcalClusterCollections = getClusterCollections(m_inputHcalClusters);
m_inputClusterCollections = getClusterCollections(m_inputClusters);
return StatusCode::SUCCESS;
}
StatusCode execute() override {
......@@ -70,8 +66,7 @@ public:
debug() << "Step 0/2: Getting indexed list of clusters..." << endmsg;
}
// get an indexed map of all clusters
auto ecalClusterMap = indexedClusters(m_inputEcalClusterCollections);
auto hcalClusterMap = indexedClusters(m_inputHcalClusterCollections);
auto clusterMap = indexedClusters(m_inputClusterCollections);
// loop over all tracks and link matched clusters where applicable
// (removing matched clusters from the cluster maps)
......@@ -91,31 +86,22 @@ public:
}
continue;
}
if (ecalClusterMap.count(part.mcID())) {