LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
larg4::UpdateDaughterInformation Class Reference

Public Member Functions

 UpdateDaughterInformation (sim::ParticleList &p)
 
void operator() (sim::ParticleList::value_type &particleListEntry) const
 
 UpdateDaughterInformation ()
 
void SetParticleList (sim::ParticleList *p)
 
void operator() (sim::ParticleList::value_type &particleListEntry) const
 

Private Attributes

sim::ParticleListparticleList
 

Detailed Description

Utility class for the EndOfEventAction method: update the daughter relationships in the particle list.

Definition at line 665 of file ParticleListAction.cc.

Constructor & Destructor Documentation

larg4::UpdateDaughterInformation::UpdateDaughterInformation ( sim::ParticleList p)
inlineexplicit

Definition at line 667 of file ParticleListAction.cc.

667 : particleList{&p} {}
larg4::UpdateDaughterInformation::UpdateDaughterInformation ( )
inline

Definition at line 417 of file ParticleListAction.cxx.

417 : particleList(0) {}

Member Function Documentation

void larg4::UpdateDaughterInformation::operator() ( sim::ParticleList::value_type particleListEntry) const
inline

Definition at line 419 of file ParticleListAction.cxx.

References simb::MCParticle::AddDaughter().

420  {
421  // We're looking at this Particle in the list.
422  int particleID = particleListEntry.first;
423 
424  // The parent ID of this particle;
425  // we ask the particle list since the particle itself might have been lost
426  // ("archived"), but the particle list still holds the information we need
427  int parentID = particleList->GetMotherOf(particleID);
428 
429  // If the parentID <= 0, this is a primary particle.
430  if (parentID <= 0) return;
431 
432  // If we get here, this particle is somebody's daughter. Add
433  // it to the list of daughter particles for that parent.
434 
435  // Get the parent particle from the list.
436  sim::ParticleList::iterator parentEntry = particleList->find(parentID);
437 
438  if (parentEntry == particleList->end()) {
439  // We have an "orphan": a particle whose parent isn't
440  // recorded in the particle list. This is not signficant;
441  // it's possible for a particle not to be saved in the list
442  // because it failed an energy cut, but for it to have a
443  // daughter that passed the cut (e.g., a nuclear decay).
444  return;
445  }
446  if (!parentEntry->second) return; // particle archived, nothing to update
447 
448  // Add the current particle to the daughter list of the
449  // parent.
450  simb::MCParticle* parent = (*parentEntry).second;
451  parent->AddDaughter(particleID);
452  }
void AddDaughter(const int trackID)
Definition: MCParticle.h:269
list_type::iterator iterator
Definition: ParticleList.h:131
iterator find(const key_type &key)
Definition: ParticleList.h:318
int GetMotherOf(const key_type &key) const
This function seeks for the exact key, not its absolute value.
void larg4::UpdateDaughterInformation::operator() ( sim::ParticleList::value_type particleListEntry) const
inline

Definition at line 668 of file ParticleListAction.cc.

References simb::MCParticle::AddDaughter().

669  {
670  // We're looking at this Particle in the list.
671  int particleID = particleListEntry.first;
672 
673  // The parent ID of this particle;
674  // we ask the particle list since the particle itself might have been lost
675  // ("archived"), but the particle list still holds the information we need
676  int parentID = particleList->GetMotherOf(particleID);
677 
678  // If the parentID <= 0, this is a primary particle.
679  if (parentID <= 0) return;
680 
681  // If we get here, this particle is somebody's daughter. Add
682  // it to the list of daughter particles for that parent.
683 
684  // Get the parent particle from the list.
685  sim::ParticleList::iterator parentEntry = particleList->find(parentID);
686 
687  if (parentEntry == particleList->end()) {
688  // We have an "orphan": a particle whose parent isn't
689  // recorded in the particle list. This is not signficant;
690  // it's possible for a particle not to be saved in the list
691  // because it failed an energy cut, but for it to have a
692  // daughter that passed the cut (e.g., a nuclear decay).
693  return;
694  }
695  if (!parentEntry->second) return; // particle archived, nothing to update
696 
697  // Add the current particle to the daughter list of the parent.
698  simb::MCParticle* parent = parentEntry->second;
699  parent->AddDaughter(particleID);
700  }
void AddDaughter(const int trackID)
Definition: MCParticle.h:269
list_type::iterator iterator
Definition: ParticleList.h:131
iterator find(const key_type &key)
Definition: ParticleList.h:318
int GetMotherOf(const key_type &key) const
This function seeks for the exact key, not its absolute value.
void larg4::UpdateDaughterInformation::SetParticleList ( sim::ParticleList p)
inline

Definition at line 418 of file ParticleListAction.cxx.

Referenced by larg4::ParticleListAction::EndOfEventAction().

418 { particleList = p; }

Member Data Documentation

sim::ParticleList * larg4::UpdateDaughterInformation::particleList
private

Definition at line 703 of file ParticleListAction.cc.


The documentation for this class was generated from the following files: