File indexing completed on 2025-07-11 08:51:52
0001
0002
0003
0004 #include "Gaudi/Algorithm.h"
0005 #include "GaudiKernel/RndmGenerators.h"
0006 #include "GaudiKernel/PhysicalConstants.h"
0007 #include <algorithm>
0008 #include <cmath>
0009
0010 #include "JugBase/IParticleSvc.h"
0011 #include <k4FWCore/DataHandle.h>
0012
0013 #include "JugBase/Utilities/Beam.h"
0014
0015 #include "Math/Vector4D.h"
0016 using ROOT::Math::PxPyPzEVector;
0017
0018
0019 #include "edm4hep/MCParticleCollection.h"
0020
0021 namespace Jug::Fast {
0022
0023 class ScatteredElectronFinder : public Gaudi::Algorithm {
0024 private:
0025 mutable DataHandle<edm4hep::MCParticleCollection> m_inputMCParticleCollection{
0026 "inputMCParticles",
0027 Gaudi::DataHandle::Reader,
0028 this};
0029 mutable DataHandle<edm4hep::MCParticleCollection> m_outputMCScatteredElectron{
0030 "outputMCScatteredElectron",
0031 Gaudi::DataHandle::Writer,
0032 this};
0033
0034 public:
0035 ScatteredElectronFinder(const std::string& name, ISvcLocator* svcLoc)
0036 : Gaudi::Algorithm(name, svcLoc) {
0037 declareProperty("inputMCParticles", m_inputMCParticleCollection, "MCParticles");
0038 declareProperty("outputMCScatteredElectron", m_outputMCScatteredElectron, "MCScatteredElectron");
0039 }
0040
0041 StatusCode initialize() override {
0042 return Gaudi::Algorithm::initialize();
0043 }
0044
0045 StatusCode execute(const EventContext&) const override {
0046
0047 const auto& mcparts = *(m_inputMCParticleCollection.get());
0048
0049 auto& out_electron = *(m_outputMCScatteredElectron.createAndPut());
0050 out_electron.setSubsetCollection();
0051
0052
0053
0054
0055
0056
0057
0058
0059 const auto ef_coll = Jug::Base::Beam::find_first_scattered_electron(mcparts);
0060 out_electron.push_back(ef_coll.front());
0061
0062 return StatusCode::SUCCESS;
0063 }
0064 };
0065
0066
0067 DECLARE_COMPONENT(ScatteredElectronFinder)
0068
0069 }