LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Particle list in DetSim contains Monte Carlo particle information. More...
#include "nusimdata/SimulationBase/MCParticle.h"
#include <set>
#include <ostream>
#include <map>
#include <cstdlib>
Go to the source code of this file.
Classes | |
class | sim::ParticleList |
struct | sim::ParticleList::archived_info_type |
Namespaces | |
sim | |
Monte Carlo Simulation. | |
Particle list in DetSim contains Monte Carlo particle information.
A container for particles generated during an event simulation. It acts like a map<int,Particle*> but with additional features:
Methods to access the list of primary particles in the event: sim::ParticleList particleList = // ...; int numberOfPrimaries = particleList->NumberOfPrimaries(); for ( int i = 0; i != numberOfPrimaries; ++i ) { simb::MCParticle* particle = particleList->Primary(i); ... } There's also a simple test: int trackID = // ...; if ( particleList->IsPrimary(trackID) ) {...}
(Aside: note that particleList[i] does NOT give you the "i-th" particle in the list; it gives you the particle whose trackID is "i".) Also this form becomes unacceptably inefficient when looping over all the particles in a crowded event: prefer to do a bit more of typing as: sim::ParticleList* particleList = // ...; for ( const auto& i: particleList) { int trackID = i.first; if (!particleList->IsPrimary(trackID)) continue; const simb::MCParticle primary = i.second; // ... }
Definition in file ParticleList.h.