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

Added MCCopier to copy mcparticles input collection to output.

- I guess this is a bug in PodioInput/PodioOutput.
-  new file:   tests/options/col_copier.py
- Added class template InputCopier
- Split up CI for docker build into "build" and "push" stages.
parent d256321b
......@@ -8,6 +8,7 @@ default:
stages:
# - build
- docker_build
- docker_push
- run
#compile:
......@@ -46,8 +47,19 @@ docker_image:
# - ci_dev
script:
- cd containers/docker
- ls -lrth && pwd
- make release-latest
- make build-nc
docker_image_push:
image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
stage: docker_push
tags:
- silicon
# only:
# - master
# - ci_dev
script:
- cd containers/docker
- make push
docker_tag:
image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
......
......@@ -31,7 +31,8 @@ target_link_libraries(JugBase
target_compile_options(JugBase PRIVATE -Wno-suggest-override)
gaudi_add_module(JugBasePlugins
src/components/*.cpp src/components/ReadTestConsumer.cxx
src/components/*.cpp
src/components/ReadTestConsumer.cxx
LINK_LIBRARIES GaudiAlgLib GaudiKernel JugBase ROOT NPDet::DD4podIO ActsCore ActsPluginDD4hep)
target_compile_options(JugBasePlugins PRIVATE -Wno-suggest-override)
......
#include <algorithm>
#include "GaudiAlg/Transformer.h"
#include "GaudiAlg/Producer.h"
#include "GaudiAlg/GaudiTool.h"
#include "Gaudi/Algorithm.h"
// FCCSW
#include "JugBase/DataHandle.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
#include "dd4pod/Geant4ParticleCollection.h"
#include "dd4pod/CalorimeterHitCollection.h"
#include "dd4pod/TrackerHitCollection.h"
#include "dd4pod/PhotoMultiplierHitCollection.h"
namespace Jug {
namespace Base {
/** Need to fix a bug.
*
* Details found here:
* https://github.com/AIDASoft/podio/issues/103
*/
template<typename T_IN, typename T_OUT>
class InputCopier : public GaudiAlgorithm {
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
InputCopier(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
{
declareProperty("inputCollection", m_inputHitCollection, "mcparticles");
declareProperty("outputCollection", m_outputHitCollection, "genparticles");
}
StatusCode initialize() override
{
if (GaudiAlgorithm::initialize().isFailure())
return StatusCode::FAILURE;
return StatusCode::SUCCESS;
}
StatusCode execute() override
{
// input collection
const T_IN* simhits = m_inputHitCollection.get();
// output collection
auto out_parts = m_outputHitCollection.createAndPut();
for (const auto& ahit : *simhits) {
out_parts->push_back(ahit.clone());
}
return StatusCode::SUCCESS;
}
DataHandle<T_IN> m_inputHitCollection{"mcparticles", Gaudi::DataHandle::Reader, this};
DataHandle<T_OUT> m_outputHitCollection{"genparticles", Gaudi::DataHandle::Writer, this};
};
using CalorimeterColCopier = InputCopier<dd4pod::CalorimeterHitCollection, dd4pod::CalorimeterHitCollection>;
DECLARE_COMPONENT(CalorimeterColCopier)
using TrackerColCopier = InputCopier<dd4pod::TrackerHitCollection, dd4pod::TrackerHitCollection>;
DECLARE_COMPONENT(TrackerColCopier)
using MCCopier = InputCopier<dd4pod::Geant4ParticleCollection, dd4pod::Geant4ParticleCollection>;
DECLARE_COMPONENT(MCCopier)
using PMTColCopier = InputCopier<dd4pod::PhotoMultiplierHitCollection, dd4pod::PhotoMultiplierHitCollection>;
DECLARE_COMPONENT(PMTColCopier)
//class MCCopier : public GaudiAlgorithm {
//public:
// // ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
// MCCopier(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc)
// {
// declareProperty("inputCollection", m_inputHitCollection, "mcparticles");
// declareProperty("outputCollection", m_outputHitCollection, "genparticles");
// }
// StatusCode initialize() override
// {
// if (GaudiAlgorithm::initialize().isFailure())
// return StatusCode::FAILURE;
// // f_counter = m_starting_value.value();
// return StatusCode::SUCCESS;
// }
// StatusCode execute() override
// {
// // input collection
// const dd4pod::Geant4ParticleCollection* simhits = m_inputHitCollection.get();
// // Create output collections
// auto out_parts = m_outputHitCollection.createAndPut();
// // std::copy(std::begin(*simhits),std::end(*simhits),std::begin(*out_parts));
// for (const auto& ahit : *simhits) {
// // std::cout << ahit << "\n";
// // eic::RawCalorimeterHit rawhit((long long)ahit.cellID(),
// // (long long)ahit.energyDeposit() * 100, 0);
// // dd4pod::Geant4Particle bpart = ahit;// dd4pod::Geant4ParticleCollection():
// out_parts->push_back(ahit.clone());
// }
// return StatusCode::SUCCESS;
// }
// DataHandle<dd4pod::Geant4ParticleCollection> m_inputHitCollection{"mcparticles", Gaudi::DataHandle::Reader, this};
// DataHandle<dd4pod::Geant4ParticleCollection> m_outputHitCollection{"genparticles", Gaudi::DataHandle::Writer,
// this};
//};
//DECLARE_COMPONENT(MCCopier)
} // namespace Examples
} // namespace Gaudi
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput
podioevent = EICDataSvc("EventDataSvc", inputs=["derp.root"], OutputLevel=DEBUG)
from Configurables import Jug__Base__MCCopier as MCCopier
from Configurables import PodioInput, ReadTestConsumer
podioinput = PodioInput("PodioReader", collections=["mcparticles"], OutputLevel=DEBUG)
checker = ReadTestConsumer()
copier = MCCopier("copier", inputCollection="mcparticles", outputCollection="mcparticles",OutputLevel=DEBUG)
out = PodioOutput("out", filename="test.root")
out.outputCommands = ["keep *"]
ApplicationMgr(
TopAlg = [podioinput, checker,copier,
out
],
EvtSel = 'NONE',
EvtMax = 5,
ExtSvc = [podioevent],
OutputLevel=DEBUG
)
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput
podioevent = EICDataSvc("EventDataSvc", inputs=["derp.root"], OutputLevel=DEBUG)
# reads HepMC text file and write the HepMC::GenEvent to the data service
from Configurables import PodioInput, ReadTestConsumer
podioinput = PodioInput("PodioReader", collections=["mcparticles","FAEC_ShHits"], OutputLevel=DEBUG)
podioinput = PodioInput("PodioReader", collections=["mcparticles"], OutputLevel=DEBUG)
checker = ReadTestConsumer()
out = PodioOutput("out", filename="test.root")
......
......@@ -2,18 +2,20 @@
#define JUG_RECO_SourceLinks_HH
#include "Acts/EventData/Measurement.hpp"
//#include "ActsFatras/EventData/Hit.hpp"
#include "JugReco/GeometryContainers.hpp"
#include <stdexcept>
#include <string>
#include "dd4pod/Geant4Particle.h"
#include "eicd/TrackerHitCollection.h"
namespace Jug {
/* Source link class for simulation in the acts-framework.
/** Source Link for simulation in the acts-framework.
*
* https://github.com/acts-project/acts/blob/master/Core/include/Acts/EventData/SourceLinkConcept.hpp
* The source link stores the measuremts, surface, and the associated simulated
* truth hit.
*
......@@ -21,6 +23,7 @@ namespace Jug {
*
*/
class SourceLink {
private:
Acts::BoundVector m_values;
Acts::BoundMatrix m_cov;
......@@ -30,6 +33,7 @@ class SourceLink {
// need to store pointers to make the object copyable
const Acts::Surface* m_surface;
//const ActsFatras::Hit* m_truthHit;
const eic::TrackerHit* m_Hit ;
public:
SourceLink(const Acts::Surface& surface, //const ActsFatras::Hit& truthHit,
......
//
#include "TrackFindingAlgorithm.h"
#include "JugReco/GeometryContainers.hpp"
// Gaudi
#include "GaudiAlg/GaudiAlgorithm.h"
......@@ -10,36 +9,15 @@
#include "GaudiKernel/RndmGenerators.h"
#include "GaudiKernel/Property.h"
#include "JugBase/DataHandle.h"
#include "JugBase/IGeoSvc.h"
#include "DDRec/CellIDPositionConverter.h"
#include "DDRec/SurfaceManager.h"
#include "DDRec/Surface.h"
#include "Acts/Geometry/TrackingGeometry.hpp"
#include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp"
#include "Acts/Utilities/Definitions.hpp"
#include "Acts/Utilities/Helpers.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "JugReco/SourceLinks.h"
#include "JugReco/Track.hpp"
#include "JugReco/BField.h"
#include "eicd/TrackerHitCollection.h"
#include "Acts/Surfaces/PerigeeSurface.hpp"
#include "JugReco/SourceLinks.h"
#include <functional>
#include <stdexcept>
#include <vector>
#include "Acts/Geometry/TrackingGeometry.hpp"
#include "Acts/TrackFinding/CKFSourceLinkSelector.hpp"
#include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp"
#include "Acts/TrackFitting/GainMatrixSmoother.hpp"
#include "Acts/TrackFitting/GainMatrixUpdater.hpp"
#include "Acts/MagneticField/ConstantBField.hpp"
......@@ -48,11 +26,29 @@
#include "Acts/Propagator/EigenStepper.hpp"
#include "Acts/Propagator/Navigator.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Utilities/Definitions.hpp"
#include "Acts/Utilities/Helpers.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/Units.hpp"
#include "JugBase/DataHandle.h"
#include "JugBase/IGeoSvc.h"
#include "JugReco/GeometryContainers.hpp"
#include "JugReco/SourceLinks.h"
#include "JugReco/Track.hpp"
#include "JugReco/BField.h"
#include "JugReco/SourceLinks.h"
#include "eicd/TrackerHitCollection.h"
#include <functional>
#include <stdexcept>
#include <vector>
#include <random>
#include <stdexcept>
namespace Jug::Reco {
using namespace Acts::UnitLiterals;
......@@ -74,16 +70,11 @@ namespace Jug::Reco {
}
m_BField = std::make_shared<Acts::ConstantBField>(Acts::Vector3D{0.0, 0.0, m_geoSvc->centralMagneticField()});
m_fieldctx = BFieldVariant(m_BField);
m_sourcelinkSelectorCfg = {
{Acts::GeometryIdentifier(), {15, 10}},
m_sourcelinkSelectorCfg = { {Acts::GeometryIdentifier(), {100, 100}},
};
findTracks = TrackFindingAlgorithm::makeTrackFinderFunction(m_geoSvc->trackingGeometry(), m_BField);
// IRndmGenSvc* randSvc = svc<IRndmGenSvc>("RndmGenSvc", true);
// StatusCode sc = m_gaussDist.initialize(randSvc, Rndm::Gauss(0.0, m_timeResolution.value()));
// if (!sc.isSuccess()) {
// return StatusCode::FAILURE;
//}
return StatusCode::SUCCESS;
}
......@@ -196,3 +187,4 @@ namespace Jug::Reco {
std::move(magneticField));
}
} // 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