Monte Carlo Simulation. More...
Classes | |
struct | TrackIDE |
Ionization energy from a Geant4 track. More... | |
class | MCTruthAssociations |
Obtains truth matching by using hit <–> MCParticle associations. More... | |
class | MCTruthEmEveIdCalculator |
class | MCTruthEveIdCalculator |
class | MCTruthParticleHistory |
class | MCTruthParticleList |
class | AssociationsTruth |
class | BackTrackerTruth |
class | IMCTruthMatching |
Typedefs | |
using | MCTruthTruthVec = std::vector< art::Ptr< simb::MCTruth >> |
using | MCParticleVec = std::vector< art::Ptr< simb::MCParticle >> |
using | MCTruthAssns = art::FindOneP< simb::MCTruth > |
using | HitParticleAssociations = art::Assns< simb::MCParticle, recob::Hit, anab::BackTrackerHitMatchingData > |
using | HitParticleAssociationsVec = std::vector< const HitParticleAssociations * > |
using | MCTruthParticleAssociations = art::Assns< simb::MCTruth, simb::MCParticle, void > |
Functions | |
std::ostream & | operator<< (std::ostream &output, const MCTruthParticleHistory &list) |
std::ostream & | operator<< (std::ostream &output, const MCTruthParticleList &list) |
std::ostream & | operator<< (std::ostream &output, const MCTruthParticleList::archived_info_type &info) |
Monte Carlo Simulation.
code to link reconstructed objects back to the MC truth information
TECHNICAL NOTES:
The default calculator for the eve ID, EveIdCalculator, goes up the chain of particles in an event to return the track ID of a primary particle from the event generator. But what if you want different defintion of the eve ID? There's a way to substitute your own calculation; this class is an example of how to do it. This particular class attempts to find the "ultimate mother" for electromagnetic showers. It goes up the chain of particles in an event, until it encounters a particle that is either primary or was not produced by a "trivial" e-m process. To create your own eve ID calculation, copy this header file and change the name from "MCTruthEmEveIdCalculator" to whatever name you prefer. Then copy the implementation file "MCTruthEmEveIdCalculator.cxx", again changing the name to your class. Then revise the calculation in the DoCalculateEveId method to whatever you want. To use this new calculation within sim::ParticleList, use the following statement: If you've written your own calculator, subtitute it for "sim::MCTruthEmEveIdCalculator" in the above statement. Just do this once, in the initialization portion of your program. (You can call it for every event, but you'll be wasting time.) It may look like there's a memory leak in the above statement, but there isn't: the "Adopt" in the method name means that ParticleList will take control of the pointer. Don't delete it; ParticleList will do that. If you're familiar with design patterns, this class makes use of the Template Method. No, this has nothing to do with C++ templates; see "Design Patterns" by Gemma et al., or "Effective C++" by Scott Meyers. If you're a good enough programmer to contemplate buffering of results or lazy evaluation, don't bother; ParticleList and EveIdCalculator already take care of this.
A container for a chain of particles in an event. It's a meant as a convenience for looking at a sequence of particles within a sim::ParticeList. Here's an example to illustrate the purpose and use of a list. Assume a pi+ is a primary particle in an event whose decay is modeled like this: TrackID Particle 2 pi+ 101 nu_mu 102 mu+ 341 nu_mu_bar 342 nu_e 343 e+ I'm playing around with the ParticleList for the event, and I'm interested in what produced track ID 343, which is an e+. I can use the MCTruthParticleHistory class to quickly go through the production chain: sim::ParticleList* particleList = // ... from somewhere int trackID = 343; const sim::MCTruthParticleHistory MCTruthParticleHistory( particleList, trackID ); for ( int i = 0; i != MCTruthParticleHistory.size(); ++i ) { const simb::MCParticle* particle = MCTruthParticleHistory[i]; // ... } In the above example: MCTruthParticleHistory.size() == 3 MCTruthParticleHistory[0] points to the particle with track ID 2 MCTruthParticleHistory[1] points to the particle with track ID 102 MCTruthParticleHistory[2] points to the particle with track ID 343 So as you go through a MCTruthParticleHistory "array," the first element is a primary particle in the event, and the last element is the particle you used to create the history. MCTruthParticleHistory looks like a vector< const simb::MCParticle* >, with the following additions: - a ParticleList() method that returns a ParticleList* to the object that's associated with the history. - an EndParticleID() method that returns the track ID of the last particle in the chain; that is, it's the second argument in the constructor.- operator<< method for ROOT display and ease of debugging.MCTruthParticleHistory behaves mostly like a vector, but it's actually a deque. This means that you can't assume that &MCTruthParticleHistory[0] is a continugous array of Particle*. If those two sentences mean nothing to you, don't worry about it; this only matters to folks familiar with STL. A given MCTruthParticleHistory object is associated with the ParticleList used to create it. If you delete the ParticleList (by reading in a new event, for example) then the contents of the corresponding MCTruthParticleHistory object(s) are garbage. If you create a MCTruthParticleHistory object like this: const sim::MCTruthParticleHistory ph(particleList,1123); and there is no track 1123 in the particle list, then ph.size()==0. MCTruthParticleHistory[0] is not necessarily a primary particle in the event. It's possible for a production chain to be broken due to simulation cuts. The first element just represents as far back we can go in the production chain given the ParticleList.
using truth::HitParticleAssociations = typedef art::Assns<simb::MCParticle, recob::Hit, anab::BackTrackerHitMatchingData> |
Definition at line 44 of file MCTruthAssociations.h.
using truth::HitParticleAssociationsVec = typedef std::vector<const HitParticleAssociations*> |
Definition at line 45 of file MCTruthAssociations.h.
using truth::MCParticleVec = typedef std::vector<art::Ptr<simb::MCParticle>> |
Definition at line 42 of file MCTruthAssociations.h.
using truth::MCTruthAssns = typedef art::FindOneP<simb::MCTruth> |
Definition at line 43 of file MCTruthAssociations.h.
using truth::MCTruthParticleAssociations = typedef art::Assns<simb::MCTruth, simb::MCParticle, void> |
Definition at line 46 of file MCTruthAssociations.h.
using truth::MCTruthTruthVec = typedef std::vector<art::Ptr<simb::MCTruth>> |
Definition at line 41 of file MCTruthAssociations.h.
std::ostream& truth::operator<< | ( | std::ostream & | output, |
const MCTruthParticleHistory & | list | ||
) |
Definition at line 47 of file MCTruthParticleHistory.cxx.
std::ostream& truth::operator<< | ( | std::ostream & | output, |
const MCTruthParticleList & | list | ||
) |
Definition at line 336 of file MCTruthParticleList.cxx.
std::ostream& truth::operator<< | ( | std::ostream & | output, |
const MCTruthParticleList::archived_info_type & | info | ||
) |
Definition at line 405 of file MCTruthParticleList.cxx.