Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
larg4::ParticleListAction Class Reference

#include <ParticleListAction.h>

Inheritance diagram for larg4::ParticleListAction:

Classes

struct  ParticleInfo_t
 

Public Types

using GeneratedParticleIndex_t = simb::GeneratedParticleIndex_t
 

Public Member Functions

 ParticleListAction (double energyCut, bool storeTrajectories=false, bool keepEMShowerDaughters=false, bool keepMCParticleList=true)
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
virtual void PreTrackingAction (const G4Track *)
 
virtual void PostTrackingAction (const G4Track *)
 
virtual void SteppingAction (const G4Step *)
 
void ParticleFilter (std::unique_ptr< util::PositionInVolumeFilter > &&filter)
 Grabs a particle filter. More...
 
void ResetTrackIDOffset ()
 
const sim::ParticleList * GetList () const
 
std::map< int, GeneratedParticleIndex_t > const & GetPrimaryTruthMap () const
 
bool hasList () const
 Returns whether a particle list is being kept. More...
 
GeneratedParticleIndex_t GetPrimaryTruthIndex (int trackId) const
 Returns the index of primary truth (sim::NoGeneratorIndex if none). More...
 
sim::ParticleList && YieldList ()
 

Static Public Member Functions

static int GetCurrentTrackID ()
 
static int GetCurrentPdgCode ()
 
static bool isDropped (simb::MCParticle const *p)
 returns whether the specified particle has been marked as dropped More...
 

Private Member Functions

int GetParentage (int trackid) const
 
void AddPointToCurrentParticle (TLorentzVector const &pos, TLorentzVector const &mom, std::string const &process)
 Adds a trajectory point to the current particle, and runs the filter. More...
 

Private Attributes

G4double fenergyCut
 
ParticleInfo_t fCurrentParticle
 
std::unique_ptr< sim::ParticleList > fparticleList
 
G4bool fstoreTrajectories
 Whether to store particle trajectories with each particle. More...
 
std::map< int, int > fParentIDMap
 key is current track ID, value is parent ID More...
 
bool fKeepEMShowerDaughters
 whether to keep EM shower secondaries, tertiaries, etc More...
 
std::unique_ptr< util::PositionInVolumeFilterfFilter
 filter for particles to be kept More...
 
std::map< int, GeneratedParticleIndex_tfPrimaryTruthMap
 Map: particle track ID -> index of primary information in MC truth. More...
 

Static Private Attributes

static int fCurrentTrackID = sim::NoParticleId
 
static int fCurrentPdgCode = 0
 pdg code of current particle More...
 
static int fTrackIDOffset = 0
 

Detailed Description

Definition at line 45 of file ParticleListAction.h.

Member Typedef Documentation

Definition at line 47 of file ParticleListAction.h.

Constructor & Destructor Documentation

larg4::ParticleListAction::ParticleListAction ( double  energyCut,
bool  storeTrajectories = false,
bool  keepEMShowerDaughters = false,
bool  keepMCParticleList = true 
)

Definition at line 57 of file ParticleListAction.cxx.

62  : fenergyCut(energyCut * CLHEP::GeV)
63  , fparticleList(keepMCParticleList ? std::make_unique<sim::ParticleList>() : nullptr)
64  , fstoreTrajectories(storeTrajectories)
65  , fKeepEMShowerDaughters(keepEMShowerDaughters)
66  {}
G4bool fstoreTrajectories
Whether to store particle trajectories with each particle.
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
static constexpr double GeV
Definition: Units.h:28
std::unique_ptr< sim::ParticleList > fparticleList

Member Function Documentation

void larg4::ParticleListAction::AddPointToCurrentParticle ( TLorentzVector const &  pos,
TLorentzVector const &  mom,
std::string const &  process 
)
private

Adds a trajectory point to the current particle, and runs the filter.

Definition at line 509 of file ParticleListAction.cxx.

512  {
513 
514  // Add the first point in the trajectory.
515  fCurrentParticle.particle->AddTrajectoryPoint(pos, mom, process);
516 
517  // also see if we can decide to keep the particle
519 
520  } // ParticleListAction::AddPointToCurrentParticle()
def process(f, kind)
Definition: search.py:254
std::unique_ptr< util::PositionInVolumeFilter > fFilter
filter for particles to be kept
cet::exempt_ptr< simb::MCParticle > particle
Object representing particle.
void larg4::ParticleListAction::BeginOfEventAction ( const G4Event *  )
virtual

Definition at line 71 of file ParticleListAction.cxx.

72  {
73  // Clear any previous particle information.
75  if (fparticleList) fparticleList->clear();
76  fParentIDMap.clear();
78  fCurrentPdgCode = 0;
79  }
static int fCurrentPdgCode
pdg code of current particle
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
void clear()
Resets the information (does not release memory it does not own)
static const int NoParticleId
Definition: sim.h:28
std::unique_ptr< sim::ParticleList > fparticleList
void larg4::ParticleListAction::EndOfEventAction ( const G4Event *  )
virtual

Definition at line 440 of file ParticleListAction.cxx.

441  {
442  if (!fparticleList) return;
443 
444  // Set up the utility class for the "for_each" algorithm. (We only
445  // need a separate set-up for the utility class because we need to
446  // give it the pointer to the particle list. We're using the STL
447  // "for_each" instead of the C++ "for loop" because it's supposed
448  // to be faster.
449  UpdateDaughterInformation updateDaughterInformation;
450  updateDaughterInformation.SetParticleList(fparticleList.get());
451 
452  // Update the daughter information for each particle in the list.
453  std::for_each(fparticleList->begin(), fparticleList->end(), updateDaughterInformation);
454  }
std::unique_ptr< sim::ParticleList > fparticleList
static int larg4::ParticleListAction::GetCurrentPdgCode ( )
inlinestatic

Definition at line 123 of file ParticleListAction.h.

124  {
125  return fCurrentPdgCode;
126  }
static int fCurrentPdgCode
pdg code of current particle
static int larg4::ParticleListAction::GetCurrentTrackID ( )
inlinestatic

Definition at line 118 of file ParticleListAction.h.

119  {
120  return fCurrentTrackID;
121  }
const sim::ParticleList * larg4::ParticleListAction::GetList ( ) const

Definition at line 459 of file ParticleListAction.cxx.

460  {
461  if (!fparticleList) return nullptr;
462 
463  // check if the ParticleNavigator has entries, and if
464  // so grab the highest track id value from it to
465  // add to the fTrackIDOffset
466  int highestID = 0;
467  for (auto pn = fparticleList->begin(); pn != fparticleList->end(); pn++)
468  if ((*pn).first > highestID) highestID = (*pn).first;
469 
470  //Only change the fTrackIDOffset if there is in fact a particle to add to the event
471  if ((fparticleList->size()) != 0) { fTrackIDOffset = highestID + 1; }
472 
473  return fparticleList.get();
474  }
std::unique_ptr< sim::ParticleList > fparticleList
int larg4::ParticleListAction::GetParentage ( int  trackid) const
private

Definition at line 87 of file ParticleListAction.cxx.

88  {
89  int parentid = sim::NoParticleId;
90 
91  // search the fParentIDMap recursively until we have the parent id
92  // of the first EM particle that led to this one
94  while (itr != fParentIDMap.end()) {
95  MF_LOG_DEBUG("ParticleListAction") << "parentage for " << trackid << " " << (*itr).second;
96 
97  // set the parentid to the current parent ID, when the loop ends
98  // this id will be the first EM particle
99  parentid = (*itr).second;
100  itr = fParentIDMap.find(parentid);
101  }
102  MF_LOG_DEBUG("ParticleListAction") << "final parent ID " << parentid;
103 
104  return parentid;
105  }
intermediate_table::const_iterator const_iterator
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
static const int NoParticleId
Definition: sim.h:28
#define MF_LOG_DEBUG(id)
simb::GeneratedParticleIndex_t larg4::ParticleListAction::GetPrimaryTruthIndex ( int  trackId) const

Returns the index of primary truth (sim::NoGeneratorIndex if none).

Definition at line 478 of file ParticleListAction.cxx.

479  {
480  auto const iInfo = GetPrimaryTruthMap().find(trackId);
481  return (iInfo == GetPrimaryTruthMap().end()) ? simb::NoGeneratedParticleIndex : iInfo->second;
482  } // ParticleListAction::GetPrimaryTruthIndex()
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
constexpr GeneratedParticleIndex_t NoGeneratedParticleIndex
Constant representing the absence of generator truth information.
Definition: simb.h:34
std::map< int, GeneratedParticleIndex_t > const & GetPrimaryTruthMap() const
std::map<int, GeneratedParticleIndex_t> const& larg4::ParticleListAction::GetPrimaryTruthMap ( ) const
inline

Returns a map of truth record information index for each of the primary particles (by track ID).

Definition at line 140 of file ParticleListAction.h.

141  {
142  return fPrimaryTruthMap;
143  }
std::map< int, GeneratedParticleIndex_t > fPrimaryTruthMap
Map: particle track ID -> index of primary information in MC truth.
bool larg4::ParticleListAction::hasList ( ) const
inline

Returns whether a particle list is being kept.

Definition at line 147 of file ParticleListAction.h.

148  {
149  return static_cast<bool>(fparticleList);
150  }
std::unique_ptr< sim::ParticleList > fparticleList
bool larg4::ParticleListAction::isDropped ( simb::MCParticle const *  p)
static

returns whether the specified particle has been marked as dropped

Definition at line 50 of file ParticleListAction.cxx.

51  {
52  return !p || p->Trajectory().empty();
53  } // ParticleListAction::isDropped()
p
Definition: test.py:223
void larg4::ParticleListAction::ParticleFilter ( std::unique_ptr< util::PositionInVolumeFilter > &&  filter)
inline

Grabs a particle filter.

Definition at line 111 of file ParticleListAction.h.

112  {
113  fFilter = std::move(filter);
114  }
def move(depos, offset)
Definition: depos.py:107
std::unique_ptr< util::PositionInVolumeFilter > fFilter
filter for particles to be kept
void larg4::ParticleListAction::PostTrackingAction ( const G4Track *  aTrack)
virtual

Definition at line 260 of file ParticleListAction.cxx.

261  {
262  if (!fCurrentParticle.hasParticle()) return;
263  assert(fparticleList);
264 
265  // if we have found no reason to keep it, drop it!
266  // (we might still need parentage information though)
267  if (!fCurrentParticle.keep) {
269  // after the particle is archived, it is deleted
271  return;
272  }
273 
274  if (aTrack) {
275  fCurrentParticle.particle->SetWeight(aTrack->GetWeight());
276  G4String process =
277  aTrack->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
278  fCurrentParticle.particle->SetEndProcess(process);
279  }
280 
281  // store truth record pointer, only if it is available
282  if (fCurrentParticle.isPrimary()) {
284  }
285 
286  return;
287  }
std::map< int, GeneratedParticleIndex_t > fPrimaryTruthMap
Map: particle track ID -> index of primary information in MC truth.
constexpr pointer get() const noexcept
Definition: exempt_ptr.h:148
GeneratedParticleIndex_t truthInfoIndex() const
Returns the index of the particle in the generator truth record.
def process(f, kind)
Definition: search.py:254
void clear()
Resets the information (does not release memory it does not own)
std::unique_ptr< sim::ParticleList > fparticleList
bool isPrimary() const
Returns whether there is a particle.
cet::exempt_ptr< simb::MCParticle > particle
Object representing particle.
bool hasParticle() const
Returns whether there is a particle.
void larg4::ParticleListAction::PreTrackingAction ( const G4Track *  track)
virtual

Definition at line 110 of file ParticleListAction.cxx.

111  {
112  // Particle type.
113  G4ParticleDefinition* particleDefinition = track->GetDefinition();
114  G4int pdgCode = particleDefinition->GetPDGEncoding();
115 
116  // Get Geant4's ID number for this track. This will be the same
117  // ID number that we'll use in the ParticleList.
118  // It is offset by the number of tracks accumulated from the previous Geant4
119  // runs (if any)
120  G4int trackID = track->GetTrackID() + fTrackIDOffset;
121  fCurrentTrackID = trackID;
122  fCurrentPdgCode = pdgCode;
123 
124  if (!fparticleList) {
125  // the rest is about adding a new particle to the list: skip
126  return; // note that fCurrentParticle is clear()'ed
127  }
128 
129  // And the particle's parent (same offset as above):
130  G4int parentID = track->GetParentID() + fTrackIDOffset;
131 
132  std::string process_name = "unknown";
133 
134  // Is there an MCTruth object associated with this G4Track? We
135  // have to go up a "chain" of information to find out:
136  const G4DynamicParticle* dynamicParticle = track->GetDynamicParticle();
137  const G4PrimaryParticle* primaryParticle = dynamicParticle->GetPrimaryParticle();
139  if (primaryParticle != 0) {
140  const G4VUserPrimaryParticleInformation* gppi = primaryParticle->GetUserInformation();
141  const g4b::PrimaryParticleInformation* ppi =
142  dynamic_cast<const g4b::PrimaryParticleInformation*>(gppi);
143  if (ppi != 0) {
144  primaryIndex = ppi->MCParticleIndex();
145 
146  // If we've made it this far, a PrimaryParticleInformation
147  // object exists and we are using a primary particle, set the
148  // process name accordingly
149  process_name = "primary";
150 
151  // primary particles should have parentID = 0, even if there
152  // are multiple MCTruths for this event
153  parentID = 0;
154  } // end else no primary particle information
155  } // Is there a G4PrimaryParticle?
156  // If this is not a primary particle...
157  else {
158  // check if this particle was made in an EM shower, don't put it in the particle
159  // list as we don't care about secondaries, tertiaries, etc for these showers
160  // figure out what process is making this track - skip it if it is
161  // one of pair production, compton scattering, photoelectric effect
162  // bremstrahlung, annihilation, any ionization - who wants to save
163  // a buttload of electrons that arent from a CC interaction?
164  process_name = track->GetCreatorProcess()->GetProcessName();
165  if (!fKeepEMShowerDaughters && (process_name.find("conv") != std::string::npos ||
166  process_name.find("LowEnConversion") != std::string::npos ||
167  process_name.find("Pair") != std::string::npos ||
168  process_name.find("compt") != std::string::npos ||
169  process_name.find("Compt") != std::string::npos ||
170  process_name.find("Brem") != std::string::npos ||
171  process_name.find("phot") != std::string::npos ||
172  process_name.find("Photo") != std::string::npos ||
173  process_name.find("Ion") != std::string::npos ||
174  process_name.find("annihil") != std::string::npos)) {
175 
176  // figure out the ultimate parentage of this particle
177  // first add this track id and its parent to the fParentIDMap
178  fParentIDMap[trackID] = parentID;
179 
180  fCurrentTrackID = -1 * this->GetParentage(trackID);
181 
182  // check that fCurrentTrackID is in the particle list - it is possible
183  // that this particle's parent is a particle that did not get tracked.
184  // An example is a partent that was made due to muMinusCaptureAtRest
185  // and the daughter was made by the phot process. The parent likely
186  // isn't saved in the particle list because it is below the energy cut
187  // which will put a bogus track id value into the sim::IDE object for
188  // the sim::SimChannel if we don't check it.
190 
191  // clear current particle as we are not stepping this particle and
192  // adding trajectory points to it
194  return;
195 
196  } // end if keeping EM shower daughters
197 
198  // Check the energy of the particle. If it falls below the energy
199  // cut, don't add it to our list.
200  G4double energy = track->GetKineticEnergy();
201  if (energy < fenergyCut) {
203 
204  // do add the particle to the parent id map though
205  // and set the current track id to be it's ultimate parent
206  fParentIDMap[trackID] = parentID;
207 
208  fCurrentTrackID = -1 * this->GetParentage(trackID);
209 
210  return;
211  }
212 
213  // check to see if the parent particle has been stored in the particle navigator
214  // if not, then see if it is possible to walk up the fParentIDMap to find the
215  // ultimate parent of this particle. Use that ID as the parent ID for this
216  // particle
217  if (!fparticleList->KnownParticle(parentID)) {
218  // do add the particle to the parent id map
219  // just in case it makes a daughter that we have to track as well
220  fParentIDMap[trackID] = parentID;
221  int pid = this->GetParentage(parentID);
222 
223  // if we still can't find the parent in the particle navigator,
224  // we have to give up
225  if (!fparticleList->KnownParticle(pid)) {
226  MF_LOG_WARNING("ParticleListAction")
227  << "can't find parent id: " << parentID << " in the particle list, or fParentIDMap."
228  << " Make " << parentID << " the mother ID for"
229  << " track ID " << fCurrentTrackID << " in the hope that it will aid debugging.";
230  }
231  else
232  parentID = pid;
233  }
234 
235  } // end if not a primary particle
236 
237  // This is probably the PDG mass, but just in case:
238  double mass = dynamicParticle->GetMass() / CLHEP::GeV;
239 
240  // Create the sim::Particle object.
243  new simb::MCParticle(trackID, pdgCode, process_name, parentID, mass);
244  fCurrentParticle.truthIndex = primaryIndex;
245 
246  // if we are not filtering, we have a decision already
247  if (!fFilter) fCurrentParticle.keep = true;
248 
249  // Polarization.
250  const G4ThreeVector& polarization = track->GetPolarization();
251  fCurrentParticle.particle->SetPolarization(
252  TVector3(polarization.x(), polarization.y(), polarization.z()));
253 
254  // Save the particle in the ParticleList.
256  }
int GetParentage(int trackid) const
static int fCurrentPdgCode
pdg code of current particle
std::string string
Definition: nybbler.cc:12
GeneratedParticleIndex_t truthIndex
Index of the particle in the original generator truth record.
constexpr pointer get() const noexcept
Definition: exempt_ptr.h:148
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
constexpr GeneratedParticleIndex_t NoGeneratedParticleIndex
Constant representing the absence of generator truth information.
Definition: simb.h:34
void clear()
Resets the information (does not release memory it does not own)
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
static constexpr double GeV
Definition: Units.h:28
static const int NoParticleId
Definition: sim.h:28
std::unique_ptr< util::PositionInVolumeFilter > fFilter
filter for particles to be kept
std::unique_ptr< sim::ParticleList > fparticleList
cet::exempt_ptr< simb::MCParticle > particle
Object representing particle.
#define MF_LOG_WARNING(category)
std::size_t GeneratedParticleIndex_t
Type of particle index in the generator truth record (simb::MCTruth).
Definition: simb.h:30
void larg4::ParticleListAction::ResetTrackIDOffset ( )
inline

Definition at line 129 of file ParticleListAction.h.

130  {
131  fTrackIDOffset = 0;
132  }
void larg4::ParticleListAction::SteppingAction ( const G4Step *  step)
virtual

Definition at line 292 of file ParticleListAction.cxx.

293  {
294 
295  if (!fCurrentParticle.hasParticle()) { return; }
296 
297  // Temporary fix for problem where DeltaTime on the first step
298  // of optical photon propagation is calculated incorrectly. -wforeman
299  globalTime = step->GetTrack()->GetGlobalTime();
300  velocity_G4 = step->GetTrack()->GetVelocity();
301  velocity_step = step->GetStepLength() / step->GetDeltaTime();
302  if ((step->GetTrack()->GetDefinition()->GetPDGEncoding() == 0) &&
303  fabs(velocity_G4 - velocity_step) > 0.0001) {
304  // Subtract the faulty step time from the global time,
305  // and add the correct step time based on G4 velocity.
306  step->GetPostStepPoint()->SetGlobalTime(globalTime - step->GetDeltaTime() +
307  step->GetStepLength() / velocity_G4);
308  }
309 
310  // For the most part, we just want to add the post-step
311  // information to the particle's trajectory. There's one
312  // exception: In PreTrackingAction, the correct time information
313  // is not available. So add the correct vertex information here.
314 
315  if (fCurrentParticle.particle->NumberTrajectoryPoints() == 0) {
316 
317  // Get the pre/along-step information from the G4Step.
318  const G4StepPoint* preStepPoint = step->GetPreStepPoint();
319 
320  const G4ThreeVector position = preStepPoint->GetPosition();
321  G4double time = preStepPoint->GetGlobalTime();
322 
323  // Remember that LArSoft uses cm, ns, GeV.
324  TLorentzVector fourPos(position.x() / CLHEP::cm,
325  position.y() / CLHEP::cm,
326  position.z() / CLHEP::cm,
327  time / CLHEP::ns);
328 
329  const G4ThreeVector momentum = preStepPoint->GetMomentum();
330  const G4double energy = preStepPoint->GetTotalEnergy();
331  TLorentzVector fourMom(momentum.x() / CLHEP::GeV,
332  momentum.y() / CLHEP::GeV,
333  momentum.z() / CLHEP::GeV,
334  energy / CLHEP::GeV);
335 
336  // Add the first point in the trajectory.
337  AddPointToCurrentParticle(fourPos, fourMom, "Start");
338 
339  } // end if this is the first step
340 
341  // At this point, the particle is being transported through the
342  // simulation. This method is being called for every voxel that
343  // the track passes through, but we don't want to update the
344  // trajectory information if we're just updating voxels. To check
345  // for this, look at the process name for the step, and compare it
346  // against the voxelization process name (set in PhysicsList.cxx).
347  G4String process = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
348  G4bool ignoreProcess = process.contains("LArVoxel") || process.contains("OpDetReadout");
349 
350  MF_LOG_DEBUG("ParticleListAction::SteppingAction")
351  << ": DEBUG - process='" << process << "'"
352  << " ignoreProcess=" << ignoreProcess << " fstoreTrajectories=" << fstoreTrajectories;
353 
354  // We store the initial creation point of the particle
355  // and its final position (ie where it has no more energy, or at least < 1 eV) no matter
356  // what, but whether we store the rest of the trajectory depends
357  // on the process, and on a user switch.
358  if (fstoreTrajectories && !ignoreProcess) {
359  // Get the post-step information from the G4Step.
360  const G4StepPoint* postStepPoint = step->GetPostStepPoint();
361 
362  const G4ThreeVector position = postStepPoint->GetPosition();
363  G4double time = postStepPoint->GetGlobalTime();
364 
365  // Remember that LArSoft uses cm, ns, GeV.
366  TLorentzVector fourPos(position.x() / CLHEP::cm,
367  position.y() / CLHEP::cm,
368  position.z() / CLHEP::cm,
369  time / CLHEP::ns);
370 
371  const G4ThreeVector momentum = postStepPoint->GetMomentum();
372  const G4double energy = postStepPoint->GetTotalEnergy();
373  TLorentzVector fourMom(momentum.x() / CLHEP::GeV,
374  momentum.y() / CLHEP::GeV,
375  momentum.z() / CLHEP::GeV,
376  energy / CLHEP::GeV);
377 
378  // Add another point in the trajectory.
379  AddPointToCurrentParticle(fourPos, fourMom, std::string(process));
380  }
381  }
static constexpr double cm
Definition: Units.h:68
G4bool fstoreTrajectories
Whether to store particle trajectories with each particle.
void AddPointToCurrentParticle(TLorentzVector const &pos, TLorentzVector const &mom, std::string const &process)
Adds a trajectory point to the current particle, and runs the filter.
std::string string
Definition: nybbler.cc:12
double globalTime
def process(f, kind)
Definition: search.py:254
static constexpr double GeV
Definition: Units.h:28
double velocity_step
cet::exempt_ptr< simb::MCParticle > particle
Object representing particle.
#define MF_LOG_DEBUG(id)
double velocity_G4
bool hasParticle() const
Returns whether there is a particle.
def momentum(x1, x2, x3, scale=1.)
QAsciiDict< Entry > ns
sim::ParticleList && larg4::ParticleListAction::YieldList ( )

Definition at line 487 of file ParticleListAction.cxx.

488  {
489  if (!fparticleList) {
490  // check with `hasList()` before calling this method
491  throw cet::exception("ParticleListAction")
492  << "ParticleListAction::YieldList(): particle list not build by user request.\n";
493  }
494  // check if the ParticleNavigator has entries, and if
495  // so grab the highest track id value from it to
496  // add to the fTrackIDOffset
497  int highestID = 0;
498  for (auto pn = fparticleList->begin(); pn != fparticleList->end(); pn++)
499  if ((*pn).first > highestID) highestID = (*pn).first;
500 
501  //Only change the fTrackIDOffset if there is in fact a particle to add to the event
502  if ((fparticleList->size()) != 0) { fTrackIDOffset = highestID + 1; }
503 
504  return std::move(*fparticleList);
505  } // ParticleList&& ParticleListAction::YieldList()
def move(depos, offset)
Definition: depos.py:107
std::unique_ptr< sim::ParticleList > fparticleList
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

ParticleInfo_t larg4::ParticleListAction::fCurrentParticle
private

information about the particle currently being simulated for a single particle.

Definition at line 168 of file ParticleListAction.h.

int larg4::ParticleListAction::fCurrentPdgCode = 0
staticprivate

pdg code of current particle

Definition at line 176 of file ParticleListAction.h.

int larg4::ParticleListAction::fCurrentTrackID = sim::NoParticleId
staticprivate

track ID of the current particle, set to eve ID for EM shower particles

Definition at line 174 of file ParticleListAction.h.

G4double larg4::ParticleListAction::fenergyCut
private

The minimum energy for a particle to be included in the list.

Definition at line 166 of file ParticleListAction.h.

std::unique_ptr<util::PositionInVolumeFilter> larg4::ParticleListAction::fFilter
private

filter for particles to be kept

Definition at line 181 of file ParticleListAction.h.

bool larg4::ParticleListAction::fKeepEMShowerDaughters
private

whether to keep EM shower secondaries, tertiaries, etc

Definition at line 179 of file ParticleListAction.h.

std::map<int, int> larg4::ParticleListAction::fParentIDMap
private

key is current track ID, value is parent ID

Definition at line 173 of file ParticleListAction.h.

std::unique_ptr<sim::ParticleList> larg4::ParticleListAction::fparticleList
private

The accumulated particle information for all particles in the event.

Definition at line 170 of file ParticleListAction.h.

std::map<int, GeneratedParticleIndex_t> larg4::ParticleListAction::fPrimaryTruthMap
private

Map: particle track ID -> index of primary information in MC truth.

Definition at line 184 of file ParticleListAction.h.

G4bool larg4::ParticleListAction::fstoreTrajectories
private

Whether to store particle trajectories with each particle.

Definition at line 172 of file ParticleListAction.h.

int larg4::ParticleListAction::fTrackIDOffset = 0
staticprivate

offset added to track ids when running over multiple MCTruth objects.

Definition at line 177 of file ParticleListAction.h.


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