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