diff --git a/JugReco/CMakeLists.txt b/JugReco/CMakeLists.txt index 535dad72175eff3bba25e11fc32680c2e57cab2d..cfcead312921c1b5791401c018d9327c05fb58ed 100644 --- a/JugReco/CMakeLists.txt +++ b/JugReco/CMakeLists.txt @@ -23,6 +23,7 @@ gaudi_add_module(JugRecoPlugins src/components/EcalTungstenSamplingCluster.cpp src/components/EnergyPositionClusterMerger.cpp src/components/ClusterRecoCoG.cpp + src/components/ParticleCollector.cpp src/components/ParticlesWithTruthPID.cpp src/components/PhotoMultiplierReco.cpp src/components/PhotoRingClusters.cpp diff --git a/JugReco/src/components/DummyFarForwardParticles.cpp b/JugReco/src/components/DummyFarForwardParticles.cpp index 2f80727ab5c8bd50ad5a0d606804c272e39d4d5d..ec7f7cd1c98092e344100683647943738a65ded3 100644 --- a/JugReco/src/components/DummyFarForwardParticles.cpp +++ b/JugReco/src/components/DummyFarForwardParticles.cpp @@ -32,7 +32,7 @@ public: // theta from 0.2mrad -> 5mrad Gaudi::Property<double> m_thetaMinRP{this, "thetaMinRP", 0.2e-3}; Gaudi::Property<double> m_thetaMaxRP{this, "thetaMaxRP", 5e-3}; - Gaudi::Property<double> m_pMinRP{this, "thetaMaxRP", 60}; + Gaudi::Property<double> m_pMinRP{this, "pMinRP", 60}; // B0 Gaudi::Property<double> m_thetaMinB0{this, "thetaMinB0", 6.0e-3}; Gaudi::Property<double> m_thetaMaxB0{this, "thetaMaxB0", 20.0e-3}; @@ -44,8 +44,8 @@ public: Gaudi::Property<double> m_thetaMaxFullOMD{this, "thetaMaxFullOMD", 2e-3}; Gaudi::Property<double> m_thetaMinPartialOMD{this, "thetaMinPartialOMD", 2.0e-3}; Gaudi::Property<double> m_thetaMaxPartialOMD{this, "thetaMaxPartialOMD", 5.0e-3}; - Gaudi::Property<double> m_pMinOMD{this, "thetaMaxRP", 25.}; - Gaudi::Property<double> m_pMaxOMD{this, "thetaMaxRP", 60.}; + Gaudi::Property<double> m_pMinOMD{this, "pMinOMD", 25.}; + Gaudi::Property<double> m_pMaxOMD{this, "pMaxOMD", 60.}; Rndm::Numbers m_gaussDist; @@ -185,7 +185,7 @@ private: if (part.pdgID() != 2212) { continue; } - if (part.ps().theta() < m_thetaMinRP || part.ps().theta() > m_thetaMaxRP) { + if (part.ps().theta() < m_thetaMinRP || part.ps().theta() > m_thetaMaxRP || part.ps().mag() < m_pMinRP) { continue; } rc.push_back(smearMomentum(part)); @@ -211,6 +211,11 @@ private: if (part.pdgID() != 2212) { continue; } + // momentum cut + if (part.ps().mag() < m_pMinOMD || part.ps().mag() > m_pMaxOMD) { + continue; + } + // angle cut const double phi = (part.ps().phi() < M_PI) ? part.ps().phi() : part.ps().phi() - 2 * M_PI; const bool in_small_angle = (part.ps().theta() > m_thetaMinFullOMD && part.ps().theta() < m_thetaMaxFullOMD); const bool in_large_angle = diff --git a/JugReco/src/components/ParticleCollector.cpp b/JugReco/src/components/ParticleCollector.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d082b0e352ac184230f6c32dbb59700e40bc827c --- /dev/null +++ b/JugReco/src/components/ParticleCollector.cpp @@ -0,0 +1,74 @@ +// Gaudi +#include "Gaudi/Property.h" +#include "GaudiAlg/GaudiAlgorithm.h" +#include "GaudiAlg/GaudiTool.h" +#include "GaudiAlg/Transformer.h" + +#include "JugBase/DataHandle.h" + +// Event Model related classes +#include "eicd/ReconstructedParticleCollection.h" + +namespace Jug::Reco { + +/** Collect the tracking hits into a single collection. + * + * \param inputParticles [in] vector of collection names + * \param outputParticles [out] all particles into one collection. + * + * \ingroup reco + */ +class ParticleCollector2 : public GaudiAlgorithm { +public: + Gaudi::Property<std::vector<std::string>> m_inputParticles{this, "inputParticles", {}, "Particles to be aggregated"}; + DataHandle<eic::ReconstructedParticleCollection> m_outputParticles{"outputParticles", Gaudi::DataHandle::Writer, + this}; + + std::vector<DataHandle<eic::ReconstructedParticleCollection>*> m_particleCollections; + +public: + ParticleCollector2(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { + // declareProperty("inputParticles", m_inputParticles, "vector of collection names"); + declareProperty("outputParticles", m_outputParticles, "output particles combined into single collection"); + } + ~ParticleCollector2() { + for (auto col : m_particleCollections) { + if (col) { + delete col; + } + } + } + + StatusCode initialize() override { + if (GaudiAlgorithm::initialize().isFailure()) { + return StatusCode::FAILURE; + } + for (auto colname : m_inputParticles) { + debug() << "initializing collection: " << colname << endmsg; + m_particleCollections.push_back( + new DataHandle<eic::ReconstructedParticleCollection>{colname, Gaudi::DataHandle::Reader, this}); + } + return StatusCode::SUCCESS; + } + + StatusCode execute() override { + auto output = m_outputParticles.createAndPut(); + if (msgLevel(MSG::DEBUG)) { + debug() << "execute collector" << endmsg; + } + for (const auto& hits : m_particleCollections) { + const auto& parts = *(hits->get()); + if (msgLevel(MSG::DEBUG)) { + debug() << "col n particles: " << parts.size() << endmsg; + } + for (const auto& part : parts) { + output->push_back(part.clone()); + } + } + + return StatusCode::SUCCESS; + } +}; +DECLARE_COMPONENT(ParticleCollector2) + +} // namespace Jug::Reco