65 particleMap[particle->
TrackId()] = particle;
68 int neutrinoCounter(0);
77 const pandora::CartesianVector
momentum(neutrino.Nu().Px(), neutrino.Nu().Py(), neutrino.Nu().Pz());
85 PandoraApi::MCParticle::Parameters mcParticleParameters;
86 mcParticleParameters.m_energy = neutrino.Nu().E();
87 mcParticleParameters.m_momentum = newmomentum;
88 mcParticleParameters.m_vertex = newvertex;
89 mcParticleParameters.m_endpoint = newendpoint;
90 mcParticleParameters.m_particleId = neutrino.Nu().PdgCode();
91 mcParticleParameters.m_mcParticleType = pandora::MC_3D;
92 mcParticleParameters.m_pParentAddress = &neutrino;
94 PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::MCParticle::Create(
m_pandora, mcParticleParameters));
102 if (particle->
Mother() == 0)
106 PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetMCParentDaughterRelationship(
m_pandora, &neutrino, particle.
get()));
108 catch (
const pandora::StatusCodeException &)
110 MF_LOG_WARNING(
"MCParticleCreator") <<
"CreatePandoraMCParticles - unable to create mc particle relationship, invalid information supplied " <<
std::endl;
118 MF_LOG_DEBUG(
"MCParticleCreator") <<
" Number of Pandora neutrinos: " << neutrinoCounter <<
std::endl;
125 const pandora::CartesianVector
momentum(pMcParticle->
Px(), pMcParticle->
Py(), pMcParticle->
Pz());
133 PandoraApi::MCParticle::Parameters mcParticleParameters;
134 mcParticleParameters.m_energy = pMcParticle->
E();
135 mcParticleParameters.m_particleId = pMcParticle->
PdgCode();
136 mcParticleParameters.m_mcParticleType = pandora::MC_3D;
137 mcParticleParameters.m_pParentAddress = pMcParticle.
get();
138 mcParticleParameters.m_momentum = newmomentum;
139 mcParticleParameters.m_vertex = newvertex;
140 mcParticleParameters.m_endpoint = newendpoint;
142 MF_LOG_DEBUG(
"MCParticleCreator") <<
" Adding MC Particle with parameters " 143 <<
" mcParticleParameters.m_energy = " << mcParticleParameters.m_energy.Get()
144 <<
" mcParticleParameters.m_particleId = " << mcParticleParameters.m_particleId.Get()
145 <<
" mcParticleParameters.m_mcParticleType = " << mcParticleParameters.m_mcParticleType.Get()
146 <<
" mcParticleParameters.m_pParentAddress = " << mcParticleParameters.m_pParentAddress.Get()
147 <<
" mcParticleParameters.m_momentum = " << mcParticleParameters.m_momentum.Get()
148 <<
" mcParticleParameters.m_vertex = " << mcParticleParameters.m_vertex.Get()
149 <<
" mcParticleParameters.m_endpoint = " << mcParticleParameters.m_endpoint.Get();
154 <<
" Creating mc particle " << pMcParticle.
get()
155 <<
" of pdg " << pMcParticle->
PdgCode()
156 <<
" with TrackID " << pMcParticle->
TrackId()
157 <<
" and energy " << pMcParticle->
E() <<
" GeV";
159 PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::MCParticle::Create(
m_pandora, mcParticleParameters));
162 const int id_mother(pMcParticle->
Mother());
164 if (iterJ != particleMap.end())
169 <<
" Adding daughter relation " << iterJ->second.get()
170 <<
" to mc particle " << pMcParticle.
get();
172 PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetMCParentDaughterRelationship(
m_pandora, iterJ->second.get(), pMcParticle.
get()));
174 catch (
const pandora::StatusCodeException &)
176 MF_LOG_WARNING(
"MCParticleCreator") <<
"CreatePandoraMCParticles - Unable to create mc particle relationship, invalid information supplied " <<
std::endl;
181 catch (
const pandora::StatusCodeException &)
188 return pandora::STATUS_CODE_SUCCESS;
static constexpr double cm
double E(const int i=0) const
const simb::MCNeutrino & GetNeutrino() const
double Py(const int i=0) const
const RotationTransformation & m_rotation
double Px(const int i=0) const
const pandora::Pandora & m_pandora
Reference to the pandora object to create the mc particles.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
MCTruthToMCParticles artMCTruthToMCParticles
MCParticlesToMCTruth artMCParticlesToMCTruth
std::map< int, art::Ptr< simb::MCParticle > > MCParticleMap
double Vx(const int i=0) const
double Pz(const int i=0) const
double Vz(const int i=0) const
#define MF_LOG_WARNING(category)
def momentum(x1, x2, x3, scale=1.)
Event generator information.
double Vy(const int i=0) const
QTextStream & endl(QTextStream &s)