Commit c39ee7e5 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

- JugBase/JugBase/DataHandle.h

- CMakeLists.txt
- JugReco/SourceLinks.h
- JugReco/src/components/ParticlesFromTrackFit.cpp
- JugReco/src/components/TrackFindingAlgorithm.cpp
- JugReco/src/components/TrackParamTruthInit.cpp
parent 4ff68c49
......@@ -8,7 +8,7 @@
#include "GaudiKernel/Algorithm.h"
#include <GaudiKernel/DataObjectHandle.h>
#include <GaudiKernel/GaudiException.h>
#include <GaudiKernel/Property.h>
#include <Gaudi/Property.h>
#include <GaudiKernel/ServiceLocatorHelper.h>
#include "TTree.h"
......
......@@ -33,6 +33,7 @@ gaudi_add_module(JugRecoPlugins
src/components/TrackFindingAlgorithm.cpp
src/components/TestACTSLogger.cpp
src/components/TrackParamTruthInit.cpp
src/components/ParticlesFromTrackFit.cpp
LINK_LIBRARIES GaudiAlgLib GaudiKernel JugBase ROOT NPDet::DD4podIO EICD::eicd DDRec Acts)
target_compile_options(JugRecoPlugins PRIVATE -Wno-suggest-override)
......
......@@ -72,7 +72,8 @@ class SourceLink {
friend constexpr bool operator==(const SourceLink& lhs,
const SourceLink& rhs) {
return lhs.geometryId() == rhs.geometryId();//lhs.m_truthHit == rhs.m_truthHit;
return lhs.geometryId() == rhs.geometryId();
//lhs.m_truthHit == rhs.m_truthHit;
}
};
......
#include <algorithm>
// Gaudi
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiKernel/RndmGenerators.h"
#include "GaudiKernel/Property.h"
#include "DDRec/CellIDPositionConverter.h"
#include "DDRec/SurfaceManager.h"
#include "DDRec/Surface.h"
#include "JugBase/DataHandle.h"
#include "JugBase/IGeoSvc.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
#include "eicd/ParticleCollection.h"
#include "eicd/TrackerHitCollection.h"
#include "JugReco/SourceLinks.h"
#include "JugReco/Track.hpp"
namespace Jug {
namespace Reco {
/** Ultra-fast silicon detector digitization.
*
*/
class ParticlesFromTrackFit : public GaudiAlgorithm {
public:
//DataHandle<eic::RawTrackerHitCollection> m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this};
DataHandle<TrajectoryContainer> m_inputTrajectories{"inputTrajectories", Gaudi::DataHandle::Reader, this};
DataHandle<eic::ParticleCollection> m_outputParticles{"outputParticles", Gaudi::DataHandle::Writer, this};
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
ParticlesFromTrackFit(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputTrajectories", m_inputTrajectories,"");
declareProperty("outputParticles", m_outputParticles, "");
}
StatusCode initialize() override {
if (GaudiAlgorithm::initialize().isFailure())
return StatusCode::FAILURE;
return StatusCode::SUCCESS;
}
StatusCode execute() override {
// input collection
const TrajectoryContainer* trajectories = m_inputTrajectories.get();
// create output collections
auto rec_parts = m_outputParticles.createAndPut();
for(const auto& traj : *trajectories) {
//traj.trajectory().first
auto tsize = traj.trajectory().first.size();
debug() << "# fitted parameters : " << tsize << endmsg;
if(tsize == 0 ) continue;
traj.trajectory().second.visitBackwards(tsize-1, [&](auto&& trackstate) {
debug() << trackstate.hasPredicted() << endmsg;
debug() << trackstate.predicted() << endmsg;
auto params = trackstate.predicted() ;//<< endmsg;
debug() << 1.0/params[Acts::eQOP] << " GeV" << endmsg;
eic::Particle p( {params[Acts::ePHI],params[Acts::eTHETA],1.0/params[Acts::eQOP],0.105}, {0.0,0.0,0.0,params[Acts::eT]},
(long long)13*params[Acts::eQOP]/std::abs(params[Acts::eQOP]), 0);
debug() << p << endmsg;
rec_parts->push_back(p);
});
//auto pos = m_geoSvc->cellIDPositionConverter()->position(ahit.cellID());
//auto dim = m_geoSvc->cellIDPositionConverter()->cellDimensions(ahit.cellID());
//debug() << " dim size : " << std::size(dim) << endmsg;
//for(const auto& s : dim ) {
// debug() << "a size : " << s << endmsg;
//}
////std::array<double,3> posarr; pos.GetCoordinates(posarr);
////std::array<double,3> dimarr; dim.GetCoordinates(posarr);
////eic::TrackerHit hit;
//eic::TrackerHit hit((long long)ahit.cellID(), (long long)ahit.cellID(), (long long)ahit.time(),
// (float)ahit.charge() / 10000.0, (float)0.0, {{pos.x(), pos.y(),pos.z()}},{{dim[0],dim[1],0.0}});
//rec_hits->push_back(hit);
}
return StatusCode::SUCCESS;
}
};
DECLARE_COMPONENT(ParticlesFromTrackFit)
} // namespace Examples
} // namespace Gaudi
......@@ -52,7 +52,6 @@
#include <random>
#include <stdexcept>
namespace Jug::Reco {
using namespace Acts::UnitLiterals;
......@@ -69,8 +68,7 @@ namespace Jug::Reco {
public:
DataHandle<SourceLinkContainer> m_inputSourceLinks{"inputSourceLinks", Gaudi::DataHandle::Reader, this};
DataHandle<TrackParametersContainer> m_inputInitialTrackParameters{"inputInitialTrackParameters",
Gaudi::DataHandle::Reader, this};
DataHandle<TrackParametersContainer> m_inputInitialTrackParameters{"inputInitialTrackParameters", Gaudi::DataHandle::Reader, this};
DataHandle<TrajectoryContainer> m_outputTrajectories{"outputTrajectories", Gaudi::DataHandle::Writer, this};
TrackFinderFunction m_trackFinderFunc;
SmartIF<IGeoSvc> m_geoSvc;
......@@ -95,22 +93,8 @@ namespace Jug::Reco {
static TrackFinderFunction makeTrackFinderFunction(std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
BFieldVariant magneticField);
// struct Config {
// /// Input source links collection.
// std::string inputSourceLinks;
//
// /// Input initial track parameter estimates for for each proto track.
// std::string inputInitialTrackParameters;
//
// /// Output find trajectories collection.
// std::string outputTrajectories;
//
// /// Type erased track finder function.
/// Type erased track finder function.
TrackFinderFunction findTracks;
//
// /// CKF source link selector config
// Acts::CKFSourceLinkSelector::Config sourcelinkSelectorCfg;
//};
StatusCode initialize() override {
if (GaudiAlgorithm::initialize().isFailure())
......@@ -149,7 +133,7 @@ namespace Jug::Reco {
//// Construct a perigee surface as the target surface
auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3D{0., 0., 0.});
ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("TrackFindingAlgorithm Logger", Acts::Logging::VERBOSE));
ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("TrackFindingAlgorithm Logger", Acts::Logging::INFO));
// Perform the track finding for each starting parameter
// @TODO: use seeds from track seeding algorithm as starting parameter
......@@ -172,8 +156,9 @@ namespace Jug::Reco {
// Get the track finding output object
const auto& trackFindingOutput = result.value();
// Create a SimMultiTrajectory
trajectories->emplace_back(std::move(trackFindingOutput.fittedStates), std::move(trackFindingOutput.trackTips),
std::move(trackFindingOutput.fittedParameters));
trajectories->emplace_back(std::move(trackFindingOutput.fittedStates),
std::move(trackFindingOutput.trackTips),
std::move(trackFindingOutput.fittedParameters));
} else {
ACTS_WARNING("Track finding failed for truth seed " << iseed << " with error" << result.error());
// Track finding failed, but still create an empty SimMultiTrajectory
......
......@@ -57,15 +57,17 @@ namespace Jug::Reco {
// build some track cov matrix
Acts::BoundSymMatrix cov = Acts::BoundSymMatrix::Zero();
cov(Acts::eLOC_0, Acts::eLOC_0) = 0.1 * mm;
cov(Acts::eLOC_1, Acts::eLOC_1) = 0.1 * mm;
cov(Acts::eLOC_0, Acts::eLOC_0) = 0.1 * mm*0.1 * mm;
cov(Acts::eLOC_1, Acts::eLOC_1) = 0.1 * mm*0.1 * mm;
cov(Acts::ePHI, Acts::ePHI) = M_PI / 180.0;
cov(Acts::eTHETA, Acts::eTHETA) = M_PI / 180.0;
cov(Acts::eQOP, Acts::eQOP) = 1.0 / (0.1 * GeV);
cov(Acts::eQOP, Acts::eQOP) = 1.0 / (0.2 * GeV* 0.2 * GeV);
cov(Acts::eT, Acts::eT) = Acts::UnitConstants::ns;
init_trk_params->emplace_back(std::make_optional(std::move(cov)), Acts::Vector3D(part.vsx()*mm, part.vsy()*mm, part.vsz()*mm),
Acts::Vector3D(part.psx()*GeV, part.psy()*GeV, part.psz()*GeV), 1, part.time()*Acts::UnitConstants::ns);
init_trk_params->emplace_back(std::make_optional(std::move(cov)),
Acts::Vector3D(part.vsx() * mm, part.vsy() * mm, part.vsz() * mm),
Acts::Vector3D(part.psx() * GeV, part.psy() * GeV, part.psz() * GeV),
((part.pdgID() > 0) ? 1 : -1), part.time() * Acts::UnitConstants::ns);
//part .charge()
debug() << "Invoke track finding seeded by truth particle " << part << endmsg;
......
Supports Markdown
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