Commit 96b84a7f authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

modified: ../../CMakeLists.txt

	modified:   CalorimeterIslandCluster.cpp
	new file:   EMCalReconstruction.cpp
parent 3a0eb874
......@@ -40,6 +40,7 @@ gaudi_add_module(JugRecoPlugins
src/components/PhotoMultiplierReco.cpp
src/components/PhotoRingClusters.cpp
src/components/FuzzyKClusters.cpp
src/components/EMCalReconstruction.cpp
LINK_LIBRARIES GaudiAlgLib GaudiKernel JugBase ROOT NPDet::DD4podIO EICD::eicd DDRec Acts)
target_compile_options(JugRecoPlugins PRIVATE -Wno-suggest-override)
......
......@@ -33,9 +33,9 @@
using namespace Gaudi::Units;
namespace Jug::Reco {
class CalorimeterIslandCluster : public GaudiAlgorithm
{
public:
class CalorimeterIslandCluster : public GaudiAlgorithm {
public:
Gaudi::Property<double> m_groupRange{this, "groupRange", 1.8};
Gaudi::Property<double> m_minClusterCenterEdep{this, "minClusterCenterEdep", 50.0*MeV};
DataHandle<eic::CalorimeterHitCollection>
......@@ -83,13 +83,13 @@ public:
// create a new group, and group all the neighboring hits
dfs_group(groups.back(), i, hits, visits);
}
// info() << "we have " << groups.size() << " groups of hits" << endmsg;
debug() << "we have " << groups.size() << " groups of hits" << endmsg;
for (auto &group : groups) {
auto maxima = find_local_maxima(group);
split_group(group, maxima, clusters, split_hits);
// info() << "hits in a group: " << group.hits_size() << ", "
// << "local maxima: " << maxima.hits_size() << endmsg;
debug() << "hits in a group: " << group.size() << ", "
<< "local maxima: " << maxima.hits_size() << endmsg;
}
return StatusCode::SUCCESS;
......@@ -217,7 +217,7 @@ private:
}
return;
}
};
};
DECLARE_COMPONENT(CalorimeterIslandCluster)
......
#include <algorithm>
#include "Gaudi/Property.h"
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiKernel/RndmGenerators.h"
#include "GaudiKernel/PhysicalConstants.h"
#include "DDRec/CellIDPositionConverter.h"
#include "DDRec/SurfaceManager.h"
#include "DDRec/Surface.h"
// FCCSW
#include "JugBase/DataHandle.h"
#include "JugBase/IGeoSvc.h"
// Event Model related classes
#include "eicd/CalorimeterHitCollection.h"
#include "eicd/RawCalorimeterHitCollection.h"
using namespace Gaudi::Units;
namespace Jug::Reco {
class EMCalReconstruction : public GaudiAlgorithm {
public:
using RawHits = eic::RawCalorimeterHitCollection;
using RecHits = eic::CalorimeterHitCollection;
DataHandle<RawHits> m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this};
DataHandle<RecHits> m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this};
Gaudi::Property<double> m_minModuleEdep{this, "minModuleEdep", 5.0*MeV};
/// Pointer to the geometry service
SmartIF<IGeoSvc> m_geoSvc;
EMCalReconstruction(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
{
declareProperty("inputHitCollection", m_inputHitCollection, "");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
StatusCode initialize() override
{
if (GaudiAlgorithm::initialize().isFailure()) {
return StatusCode::FAILURE;
}
m_geoSvc = service("GeoSvc");
if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
<< "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
StatusCode execute() override
{
// input collections
const auto& rawhits = *m_inputHitCollection.get();
// Create output collections
auto& hits = *m_outputHitCollection.createAndPut();
// energy time reconstruction
for (auto& rh : rawhits) {
float energy = rh.amplitude()/1e6; //GeV
if (energy >= m_minModuleEdep) {
float time = rh.timeStamp()/1e6; //ns
auto id = rh.cellID();
// global positions
auto gpos = m_geoSvc->cellIDPositionConverter()->position(id);
// local positions
auto pos = m_geoSvc->cellIDPositionConverter()->findContext(id)->volumePlacement().position();
// cell dimension
auto dim = m_geoSvc->cellIDPositionConverter()->cellDimensions(id);
hits.push_back(eic::CalorimeterHit{
id, energy, time, {gpos.x(), gpos.y(), gpos.z()}, {pos.x(), pos.y(), pos.z()}, {dim[0], dim[1], 0.0}, 0});
}
}
return StatusCode::SUCCESS;
}
};
DECLARE_COMPONENT(EMCalReconstruction)
} // 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