Commit 7dae081f authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Add simple particle collector

parent c5493a1e
......@@ -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
......
......@@ -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 =
......
// 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment