LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
sim Namespace Reference

Monte Carlo Simulation. More...

Namespaces

 details
 
 dump
 Functions to dump Monte Carlo object information into a stream.
 

Classes

class  AuxDetHit
 
class  AuxDetIDE
 MC truth information to make RawDigits and do back tracking. More...
 
class  AuxDetSimChannel
 Collection of particles crossing one auxiliary detector cell. More...
 
class  BeamGateInfo
 
class  DumpGTruth
 
class  DumpMCParticles
 
class  DumpMCShowers
 
class  DumpMCTracks
 
class  DumpMCTruth
 
class  DumpOpDetBacktrackerRecords
 
class  DumpSimChannels
 
class  DumpSimPhotons
 
class  DumpSimPhotonsLite
 
class  EmEveIdCalculator
 
class  EveIdCalculator
 
class  GeneratedParticleInfo
 Contains information about a generated particle. More...
 
struct  IDE
 Ionization at a point of the TPC sensitive volume. More...
 
class  LArG4Parameters
 
class  LArVoxelCalculator
 
class  LArVoxelData
 
class  LArVoxelID
 
class  LArVoxelList
 
class  MCBaseException
 
struct  MCEdep
 
class  MCEdepHit
 
class  MCEnDep
 
class  MCHit
 
class  MCHitCollection
 
class  MCMiniPart
 
class  MCRecoEdep
 
class  MCRecoPart
 
class  MCShower
 
class  MCShowerRecoAlg
 
class  MCShowerRecoPart
 
class  MCStep
 
class  MCTrack
 
class  MCTrackCollectionAnaAlg
 
class  MCTrackRecoAlg
 
class  MCWire
 
class  MCWireCollection
 
class  MergeSimSources
 
class  MergeSimSourcesUtility
 
class  OnePhoton
 
class  OpDetBacktrackerRecord
 Energy deposited on a readout Optical Detector by simulated tracks. More...
 
class  ParticleHistory
 
class  ParticleList
 
class  PhotonVoxel
 
class  PhotonVoxelDef
 
struct  SDP
 
class  SimChannel
 Energy deposited on a readout channel by simulated tracks. More...
 
class  SimDriftedElectronCluster
 
class  SimEnergyDeposit
 
class  SimListUtils
 
class  SimPhotons
 
class  SimPhotonsCollection
 
class  SimPhotonsLite
 
class  SupernovaTruth
 
struct  TrackIDE
 Ionization energy from a Geant4 track. More...
 
struct  TrackSDP
 Ionization photons from a Geant4 track. More...
 
class  UniquePosition
 

Typedefs

typedef std::vector< AuxDetHitAuxDetHitCollection
 
typedef std::vector< AuxDetSimChannelAuxDetSimChannelCollection
 
typedef std::pair< double, std::vector< sim::SDP > > timePDclockSDP_t
 List of energy deposits at the same time (on this Optical Detector) More...
 
typedef std::pair< unsigned short, std::vector< sim::IDE > > TDCIDE
 List of energy deposits at the same time (on this channel) More...
 
typedef std::vector< SimEnergyDepositSimEnergyDepositCollection
 

Enumerations

enum  BeamType_t { kUnknown =0, kBNB, kNuMI, kBeamTypeMax }
 Defines category of beams to be stored in sim::BeamGateInfo. More...
 
enum  SupernovaSamplingMode_t {
  kUnknownSupernovaSamplingMode = 0, kUnbiased, kUniformTime, kUniformEnergy,
  kSupernovaSamplingModeMax
}
 

Functions

bool operator< (const BeamGateInfo &lhs, const BeamGateInfo &rhs)
 
unsigned int GetRandomNumberSeed ()
 
const LArVoxelData operator* (const double &value, const LArVoxelData &data)
 
std::ostream & operator<< (std::ostream &output, const LArVoxelData &data)
 
std::ostream & operator<< (std::ostream &output, const LArVoxelID &id)
 
const LArVoxelList operator* (const double &value, const LArVoxelList &list)
 
std::ostream & operator<< (std::ostream &output, const LArVoxelList &list)
 
std::ostream & operator<< (std::ostream &output, const ParticleHistory &list)
 
std::ostream & operator<< (std::ostream &output, const ParticleList &list)
 
std::ostream & operator<< (std::ostream &output, const ParticleList::archived_info_type &info)
 
Function to name `simb::MCParticle` enumerators and codes.
std::string ParticleName (int pigid)
 Returns a string with the name of particle the specified with PDG ID. More...
 
std::string ParticleStatusName (int code)
 Describes the status of a particle (simb::MCParticle::StatusCode()). More...
 
Functions to name `simb::MCTruth` enumerators and codes.
std::string TruthOriginName (simb::Origin_t origin)
 Returns a string representing the specified process origin. More...
 
std::string TruthCCNCname (int ccnc)
 
std::string TruthReactionMode (int mode)
 Returns the "mode" of the reaction (a lesser version of interaction type). More...
 
std::string TruthInteractionTypeName (int type)
 

Variables

const double kINVALID_DOUBLE = std::numeric_limits <double>::max()
 
const float kINVALID_FLOAT = std::numeric_limits <float>::max()
 
const unsigned int kINVALID_UINT = std::numeric_limits <unsigned int>::max()
 
const int kINVALID_INT = std::numeric_limits <int>::max()
 
static const int NoParticleId = std::numeric_limits<int>::min()
 
static std::unique_ptr< EveIdCalculatoreveIdCalculator
 

Detailed Description

Monte Carlo Simulation.

TECHNICAL NOTES:

Title: MergeSimSources Utility Class Author: Wes Ketchum (wketc.nosp@m.hum@.nosp@m.lanl..nosp@m.gov)

Description: Class that merges different simulation sources together to created a combined sim list. Typically just merges vectors/maps/etc together. But, if anything as a G4 trackID, applies a user-defined offset to those IDs.

Author
bjpjo.nosp@m.nes@.nosp@m.mit.e.nosp@m.du

This class encapsulates the calculations associated with computing the LArVoxelID, and provides access to the any LArVoxel parameters from the input file(s). It is to be called using art::ServiceHandle<sim::LArVoxelCalculator> lvx; The service makes it act like a singleton, but it knows about the Parameters defined in the input file. Definition: "Voxels" are three-dimensional "pixels"; basically they divide the energy deposition in the LAr into (x,y,z) cubes. Well, hyper-cubes actually, since we have to potentially include divisions in time as well. Example of a typical use: const sim::LArVoxelCalculator* lhc = sim::LArVoxelCalculator::Instance(); double xSize = lhc->VoxelSizeX();

This service encapsulates the calculations associated with computing the LArVoxelID, and provides access to the any LArVoxel parameters from the input file(s). Definition: "Voxels" are three-dimensional "pixels"; basically they divide the energy deposition in the LAr into (x,y,z) cubes. Well, hyper-cubes actually, since we have to potentially include divisions in time as well.

LArVoxelList associates a voxel ID with voxel data. LArVoxelID describes the ID (position); this class describes the data.

In particular, this class stores the association between particle tracks and the energy deposited within a voxel.

The key item of information stored for a voxel is the energy. Another, less important item is the association of a particular particle track to an amount of energy stored in the voxel. If all you want is the energy in a voxel, use LArVoxelData::Energy() and ignore the rest of this discussion. If you want to understand the source of that energy, you have to dig deeper:

LArVoxelData::Energy[trackID] returns the amount of energy deposited by the particle with the given track ID (note the use of square brackets).

LArVoxelData::NumberParticles() returns the number of individual particles whose energy deposits are recorded for this voxel.

LArVoxelData::Energy(i) returns the amount of energy deposited by the "i-th" particle (note the use of parenthesis).

LArVoxelData::TrackID(i) returns the track ID of the "i-th" particle.

LArVoxelData::UnassignedEnergy() returns the amount of energy in the voxel that's not assigned to any particle. There might be "unassigned" energy for one of two reasons:

1) In the Monte Carlo, particles can be cut from the ParticleList because they fall below the energy cut. If that happens, the particle is also removed from the LArVoxelData lists, and its energy placed in "unassigned" energy.

For example, a voxel might contain the sum of many low-energy electrons. It may be that none of the individual electron tracks would be written to the output, but their sum might be enough for the voxel to be written to the output file.

2) If any form of "voxel arithmetic" is performed (e.g,. adding two LArVoxelLists together), it becomes too difficult to maintain the particle<->energy relationship because the track IDs change. In that case, all the voxel energies are moved to "unassigned" energy.

LArVoxelData::AssignedEnergy() returns, in effect, Energy() - UnassignedEnergy()

This class defines a unique identifier for a given volume element ("voxel") in the LAr volume. It is sortable, can be tested for equality, and is persistent under ROOT I/O. (Actually, the term "voxel" is a mis-nomer, since we're also keeping track of the time slice. What's a four-dimensional volume element? A "tesseract element or "tessel"?)

A container for LAr voxel information. Although there's nothing in the class below that assumes units, the standard for LArSoft is that distances are in cm, and energy is in GeV.

It acts like a map<LArVoxelID,LArVoxelData>, but with additional features:

  • An Add(LArVoxelList) method allows you to add one LArVoxelList to another. Voxels with the same ID are added together; otherwise the lists are merged. Usage: sim::LArVoxelList a,b; a.Add(b); There's even an operator+ so you can write "a += b", but be careful about wasting memory if you write "a = a+b". Of course, you can do: sim:LArVoxelList c = a + b;
  • An operator* so you can scale all the voxel energies for calibration: sim::LArVoxelList c; double calib = 1.00000012 c *= calib; c = c * calib; // same as above, but wastes memory sim::LArVoxelList d = c * calib; (Yes, I know we probably won't do calibration in this way, but it's here if you need it.)
  • A method Cut(double) that will remove all voxels with energy less than the argument.
  • Methods ID(int) and Energy(int) for those who are unfamiliar with the concept of "first" and "second" as used with STL maps: sim::LArVoxelList* voxelList = // ...; int numberOfVoxels = voxelList->size(); for (int i=0; i<numberOfVoxels; ++i) { sim::LArVoxelID = voxelList->ID(i); double energy = voxelList->Energy(i); } The STL equivalent to the above statements (more efficient): sim::LArVoxelList* voxelList = // ... ; for ( sim::LArVoxelList::const_iterator i = voxelList->begin(); i != voxelList->end(); ++i ) { sim::LArVoxelID = (*i).first; double energy = (*i).second.Energy(); }
  • operator<< method for ROOT display and ease of debugging.
Author
brebe.nosp@m.l@fn.nosp@m.al.go.nosp@m.v

this class is designed to hold methods that access the event handle to make the various simulation lists, ie ParticleList, LArVoxelList, etc

If you haven't done so already, read the comments in front of Simulation/EveIdCalculator.h. 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 "EmEveIdCalculator" to whatever name you prefer. Then copy the implementation file "EmEveIdCalculator.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::EmEveIdCalculator" 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.

This is the base class for an algorithm to calculate the "eve ID". This begs two questions:- What is an eve ID?- What does it mean to be a base class? The "eve ID" is the ultimate "mother" of a particle in a shower produced by the detector simulation. Consider the following example chain of particles: TrackID Particle "Mother" 2 pi+ 0 101 nu_mu 2 102 mu+ 2 341 nu_mu_bar 102 342 nu_e 102 343 e+ 102 1022 gamma 343 1123 e+ 1022 1124 e- 1022 The "mother" (or parent) particle of track ID 1123 is 1022; the "mother" of track ID 102 is 2. The mother of ID 2 is 0 because it is a primary particle, created by the event generator instead of the detector simulation. The track IDs were originally assigned by the simulation. Each particle is stored in a simb::MCParticle object. All of the particles for a given event are stored in a sim::ParticleList object. When you are studying an event, especially one with many primary particles, it can be helpful to go up the decay chain, from "child" to mother to "grand-mother", to eventually the ultimate mother particle of the chain. The track ID of the ultimate mother is the "eve ID". In the above example, if we want the eve ID to refer to primary particles, the eve ID of track ID 1123 is 2. This class is never called directly. Instead, it's invoked indirectly via the sim::ParticleList class. For example: const sim::ParticleList* particleList = // ... from somewhere int trackID = // ... an ID you select according to some criteria int eveID = particleList->EveId( trackID ); The class below defines the eve ID to be a primary particle that comes from the event. But what if you want a different definition of the ultimate mother; for example, perhaps you only want to go up the chain of particles for basic e-m showers, but stop at more significant physics; for example, in the chain above, you might want the eve ID of track 1123 to be 343, since all the particles descended from 343 are part of the same e-m shower. You can override the default calculation of this class (the "base" calculation) with one of your own. For an example of how to do this, see EmEveIdCalculator.h. (If you're familiar with design patterns, this base class implements 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.)

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 ParticleHistory class to quickly go through the production chain: sim::ParticleList* particleList = // ... from somewhere int trackID = 343; const sim::ParticleHistory particleHistory( particleList, trackID ); for ( int i = 0; i != particleHistory.size(); ++i ) { const simb::MCParticle* particle = particleHistory[i]; // ... } In the above example: particleHistory.size() == 3 particleHistory[0] points to the particle with track ID 2 particleHistory[1] points to the particle with track ID 102 particleHistory[2] points to the particle with track ID 343 So as you go through a ParticleHistory "array," the first element is a primary particle in the event, and the last element is the particle you used to create the history. ParticleHistory 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.ParticleHistory behaves mostly like a vector, but it's actually a deque. This means that you can't assume that &particleHistory[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 ParticleHistory 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 ParticleHistory object(s) are garbage. If you create a ParticleHistory object like this: const sim::ParticleHistory ph(particleList,1123); and there is no track 1123 in the particle list, then ph.size()==0. particleHistory[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.

  • A method EveId(int) to determine the "eve ID" (or ultimate mother) for a given particle. For more information, including how to supply your own eve ID calculation, see Simulation/EveIdCalculator.h and Simulation/EmEveIdCalculator.h. - Two ParticleLists can be merged, which may be useful for modeling overlays: sim::ParticleList a,b; a.Add(b); There's also an operator+ that does the same thing: sim::ParticleList c = a + b; WARNING! If the track IDs of the two lists overlapped, then the results would be garbage. Therefore, the track IDs of the second operand are adjusted when the two lists are merged (without actually changing the IDs in that second list). Don't rely on the track IDs remaining unchanged!
  • The previous procedure requires that the track IDs for an entire list be adjust by a fixed offset. In case this functionality is useful for cases other than merging lists, it's been made available via Add(int) and operator+(int) methods: sim::ParticleList a,b,combinedAB; sim::ParticleList c = b + 10000000; // add 1000000 to all the track IDs in list b combinedAB = a + c;
  • If you use the clear() or erase() methods, the list will also delete the underlying Particle*. (This means that if you use insert() or Add() to add a particle to the list, the ParticleList will take over management of it. Don't delete the pointer yourself!)
  • Print() and operator<< methods for ROOT display and ease of debugging.

Typedef Documentation

typedef std::vector<AuxDetHit> sim::AuxDetHitCollection

Definition at line 185 of file AuxDetHit.h.

Definition at line 107 of file AuxDetSimChannel.h.

Definition at line 228 of file SimEnergyDeposit.h.

typedef std::pair<unsigned short, std::vector<sim::IDE> > sim::TDCIDE

List of energy deposits at the same time (on this channel)

Definition at line 125 of file SimChannel.h.

typedef std::pair< double, std::vector<sim::SDP> > sim::timePDclockSDP_t

List of energy deposits at the same time (on this Optical Detector)

Definition at line 108 of file OpDetBacktrackerRecord.h.

Enumeration Type Documentation

Defines category of beams to be stored in sim::BeamGateInfo.

Enumerator
kUnknown 

Unknown beam type.

kBNB 

BNB.

kNuMI 

NuMI.

kBeamTypeMax 

Max value of enum for iteration.

Definition at line 9 of file BeamTypes.h.

9  {
10  kUnknown=0,
11  kBNB,
12  kNuMI,
14  };
Max value of enum for iteration.
Definition: BeamTypes.h:13
Unknown beam type.
Definition: BeamTypes.h:10
NuMI.
Definition: BeamTypes.h:12
BNB.
Definition: BeamTypes.h:11
Enumerator
kUnknownSupernovaSamplingMode 

Unknown sampling mode.

kUnbiased 

Sample directly from cross-section weighted spectrum.

kUniformTime 

Arrival times were sampled uniformly.

kUniformEnergy 

Neutrino energies were sampled uniformly.

kSupernovaSamplingModeMax 

Max value of enum for iteration.

Definition at line 14 of file SupernovaTruth.h.

14  {
16  kUnbiased,
17  kUniformTime,
20  };
Max value of enum for iteration.
Arrival times were sampled uniformly.
Sample directly from cross-section weighted spectrum.
Neutrino energies were sampled uniformly.

Function Documentation

unsigned int sim::GetRandomNumberSeed ( )
inline

Definition at line 32 of file sim.h.

32  {
33 
34  // the maximum allowed seed for the art::RandomNumberGenerator
35  // is 900000000. Use TRandom3 to get the seed value in that range.
36  // Instantiating TRandom3 with a 0 means that its seed is set based
37  // on the TUUID and should always be random, even for jobs running on the
38  // same machine
39  TRandom3 rand(0);
40  return rand.Integer(900000000);
41 }
const LArVoxelList sim::operator* ( const double &  value,
const LArVoxelList list 
)

Just in case: define the result of "scalar * LArVoxelList" to be the same as "LArVoxelList * scalar".

Definition at line 46 of file LArVoxelList.cxx.

References sim::LArVoxelList::LArVoxelList(), and fhicl::detail::atom::value().

47  {
48  return LArVoxelList(list) *= value;
49  }
std::string value(boost::any const &)
const LArVoxelData sim::operator* ( const double &  value,
const LArVoxelData data 
)

Just in case: define the result of "scalar * LArVoxelData" to be the same as "LArVoxelData * scalar".

Definition at line 69 of file LArVoxelData.cxx.

References sim::LArVoxelData::LArVoxelData(), and fhicl::detail::atom::value().

70  {
71  return LArVoxelData(data) *= value;
72  }
std::string value(boost::any const &)
bool sim::operator< ( const BeamGateInfo lhs,
const BeamGateInfo rhs 
)

Definition at line 48 of file BeamGateInfo.h.

References sim::BeamGateInfo::Start(), and sim::BeamGateInfo::Width().

49  {
50  // Sort by start; in the enormously-unlikely case that two beam
51  // gates (BNB and NuMI?) start at the same time, sort by width.
52  if ( lhs.Start() < rhs.Start() )
53  return true;
54  if ( lhs.Start() == rhs.Start() )
55  return ( lhs.Width() < lhs.Width() );
56  return false;
57  }
std::ostream& sim::operator<< ( std::ostream &  output,
const ParticleHistory list 
)

Definition at line 47 of file ParticleHistory.cxx.

48  {
49  // Determine a field width for the particle number.
50  ParticleHistory::size_type numberOfParticles = list.size();
51  int numberOfDigits = (int) std::log10( (double) numberOfParticles ) + 1;
52 
53  // A simple header.
54  output.width( numberOfDigits );
55  output << "#" << ": < ID, particle >" << "\n";
56 
57  // Write each particle on a separate line.
58  ParticleHistory::size_type nParticle = 0;
59  for ( ParticleHistory::const_iterator particle = list.begin();
60  particle != list.end(); ++particle, ++nParticle ){
61  output.width( numberOfDigits );
62  output << nParticle << ": "
63  << (*particle)
64  << "\n";
65  }
66 
67  return output;
68  }
intermediate_table::const_iterator const_iterator
std::ostream& sim::operator<< ( std::ostream &  output,
const LArVoxelData data 
)

Definition at line 75 of file LArVoxelData.cxx.

References sim::LArVoxelData::begin(), sim::LArVoxelData::end(), sim::LArVoxelData::Energy(), sim::LArVoxelData::UnassignedEnergy(), and sim::LArVoxelData::VoxelID().

76  {
77  output << "Voxel: " << data.VoxelID() << std::endl;
78 
79  double unassigned = data.UnassignedEnergy();
80  // Display the total energy then the breakdown of
81  // the sum.
82  output << data.Energy() << " = <ID,E>=";
83  for ( LArVoxelData::const_iterator i = data.begin(); i != data.end(); ++i){
84  if ( i != data.begin() )
85  output << ",";
86 
87  output << "<" << (*i).first << "," << (*i).second << ">";
88  }
89  if( unassigned > 0 )
90  output << ",<*," << unassigned << ">";
91 
92  return output;
93  }
intermediate_table::const_iterator const_iterator
std::ostream& sim::operator<< ( std::ostream &  output,
const LArVoxelList list 
)

Definition at line 92 of file LArVoxelList.cxx.

References sim::LArVoxelList::begin(), sim::LArVoxelList::end(), and sim::LArVoxelList::size().

93  {
94  // Determine a field width for the voxel number.
95  LArVoxelList::size_type numberOfVoxels = list.size();
96  int numberOfDigits = (int) std::log10( (double) numberOfVoxels ) + 1;
97 
98  // A simple header.
99  output.width( numberOfDigits );
100  output << "#" << ": < ID, energy >" << std::endl;
101 
102  // Write each voxel on a separate line.
103  LArVoxelList::size_type nVoxel = 0;
104  for ( LArVoxelList::const_iterator voxel = list.begin(); voxel != list.end(); ++voxel, ++nVoxel ){
105  output.width( numberOfDigits );
106  output << nVoxel << ": "
107  << "< " << (*voxel).first
108  << ", " << (*voxel).second
109  << " >\n";
110  }
111 
112  return output;
113  }
intermediate_table::const_iterator const_iterator
std::ostream& sim::operator<< ( std::ostream &  output,
const LArVoxelID id 
)

Put the contents on the output stream. We have a choice: write the bin number, or write the position represented by the bins. For now, let's pick writing the positions.

Definition at line 121 of file LArVoxelID.cxx.

122  {
123  output << "(" << id.X()
124  << "," << id.Y()
125  << "," << id.Z()
126  << "," << id.T()
127  << ")";
128 
129  return output;
130  }
std::ostream& sim::operator<< ( std::ostream &  output,
const ParticleList list 
)

Definition at line 352 of file ParticleList.cxx.

References sim::ParticleList::begin(), sim::ParticleList::end(), sim::ParticleList::m_archive, and sim::ParticleList::size().

353  {
354  // Determine a field width for the particle number.
355  ParticleList::size_type numberOfParticles = list.size();
356  int numberOfDigits = (int) std::log10( (double) numberOfParticles ) + 1;
357 
358  // A simple header.
359  output.width( numberOfDigits );
360  output << "#" << ": < ID, particle >" << std::endl;
361 
362  // Write each particle on a separate line.
363  ParticleList::size_type nParticle = 0;
364  for ( ParticleList::const_iterator particle = list.begin();
365  particle != list.end(); ++particle, ++nParticle ){
366  output.width( numberOfDigits );
367  output << nParticle << ": "
368  << "<" << (*particle).first << ",";
369  if (particle->second)
370  output << *(particle->second);
371  else {
372  auto iArch = list.m_archive.find(particle->first);
373  if (iArch == list.m_archive.end())
374  output << "lost [INTERNAL ERROR!]";
375  else
376  output << "(archived) " << iArch->second;
377  }
378  output << ">" << std::endl;
379  }
380 
381  return output;
382  }
intermediate_table::const_iterator const_iterator
std::ostream& sim::operator<< ( std::ostream &  output,
const ParticleList::archived_info_type info 
)

Definition at line 425 of file ParticleList.cxx.

426  {
427  output << "Mother ID=" << info.Mother() << std::endl;
428  return output;
429  }
std::string sim::ParticleName ( int  pigid)

Returns a string with the name of particle the specified with PDG ID.

Definition at line 147 of file MCDumperUtils.cxx.

References util::flags::to_string().

Referenced by sim::dump::DumpGTruth(), sim::dump::DumpMCNeutrino(), and sim::dump::DumpMCParticle().

147  {
148  TParticlePDG const* PDGinfo = TDatabasePDG::Instance()->GetParticle(pigid);
149  return PDGinfo? PDGinfo->GetTitle(): ("PDG ID " + std::to_string(pigid));
150 } // sim::ParticleName()
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
Definition: BitMask.h:187
std::string sim::ParticleStatusName ( int  code)

Describes the status of a particle (simb::MCParticle::StatusCode()).

Definition at line 126 of file MCDumperUtils.cxx.

Referenced by sim::dump::DumpMCParticle(), evgen::NUANCEGen::ParticleStatus(), evgen::NDKGen::ParticleStatus(), and evgen::GENIEGen::ParticleStatus().

126  {
127 
128  switch(code) {
129  case -1: return "undefined";
130  case 0: return "initial state";
131  case 1: return "stable final state";
132  case 2: return "intermediate";
133  case 3: return "decayed";
134  case 11: return "nucleon target";
135  case 12: return "pre-fragmentation hadronic state";
136  case 13: return "pre-decay resonant state";
137  case 14: return "hadron in nucleus";
138  case 15: return "final state nuclear remnant";
139  case 16: return "nucleon cluster target";
140  default: return "unknown";
141  } // switch
142 
143 } // sim::ParticleStatusName
std::string sim::TruthCCNCname ( int  ccnc)

Returns a string representing the specified process from simb::MCTruth (CC or NC, nothing fancy).

Definition at line 32 of file MCDumperUtils.cxx.

References simb::kCC, simb::kNC, and util::flags::to_string().

Referenced by sim::dump::DumpMCNeutrino().

32  {
33  switch (ccnc) {
34  case simb::kCC: return "charged weak current";
35  case simb::kNC: return "neutral weak current";
36  default: return "unsupported (" + std::to_string(ccnc) + ")";
37  } // switch
38 } // sim::TruthCCNCname()
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
Definition: BitMask.h:187
std::string sim::TruthInteractionTypeName ( int  type)

Returns a string representing the specified interaction type as in simb::MCTruth convention.

Definition at line 56 of file MCDumperUtils.cxx.

References simb::kAMNuGamma, simb::kCCCOH, simb::kCCDIS, simb::kCCQE, simb::kCCQEHyperon, simb::kCoh, simb::kCohElastic, simb::kDiffractive, simb::kDIS, simb::kElectronScattering, simb::kEM, simb::kGlashowResonance, simb::kIMDAnnihilation, simb::kInverseBetaDecay, simb::kInverseMuDecay, simb::kMEC, simb::kNCCOH, simb::kNCDIS, simb::kNCQE, simb::kNuanceOffset, simb::kNuElectronElastic, simb::kQE, simb::kRes, simb::kResCCNuBarDelta0PiMinus, simb::kResCCNuBarDeltaMinusPiPlus, simb::kResCCNuBarKaon0Lambda0, simb::kResCCNuBarNeutronEta, simb::kResCCNuBarNeutronPi0Pi0, simb::kResCCNuBarNeutronPiMinus, simb::kResCCNuBarNeutronPiPlusPiMinus, simb::kResCCNuBarNeutronRho0, simb::kResCCNuBarNeutronRhoMinus, simb::kResCCNuBarProtonPi0, simb::kResCCNuBarProtonPi0Pi0, simb::kResCCNuBarProtonPiMinus, simb::kResCCNuBarSigma0Kaon0, simb::kResCCNuBarSigmaMinusKaon0, simb::kResCCNuDelta2PlusPiMinus, simb::kResCCNuDeltaPlusPiPlus, simb::kResCCNuKaonPlusLambda0, simb::kResCCNuNeutronPi0, simb::kResCCNuNeutronPiPlus, simb::kResCCNuNeutronRhoPlus, simb::kResCCNuProtonEta, simb::kResCCNuProtonPi0Pi0, simb::kResCCNuProtonPiPlus, simb::kResCCNuProtonPiPlusPiMinus, simb::kResCCNuProtonRhoPlus, simb::kResCCNuSigmaPlusKaon0, simb::kResCCNuSigmaPlusKaonPlus, simb::kResNCNuBarNeutronPi0, simb::kResNCNuBarNeutronPiMinus, simb::kResNCNuBarProtonPi0, simb::kResNCNuBarProtonPiPlus, simb::kResNCNuNeutronPi0, simb::kResNCNuNeutronPiMinus, simb::kResNCNuProtonPi0, simb::kResNCNuProtonPiPlus, simb::kUnknownInteraction, simb::kUnUsed1, simb::kUnUsed2, simb::kWeakMix, and util::flags::to_string().

Referenced by sim::dump::DumpMCNeutrino().

56  {
57  switch (type) {
58  case simb::kUnknownInteraction : return "unknown interaction";
59  case simb::kQE : return "quasi-elastic scattering";
60  case simb::kRes : return "resonant scattering";
61  case simb::kDIS : return "deep inelastic scattering";
62  case simb::kCoh : return "coherent scattering";
63  case simb::kCohElastic : return "coherent elastic scattering";
64  case simb::kElectronScattering : return "electron scattering";
65  case simb::kIMDAnnihilation : return "inverse muon decay annihilation";
66  case simb::kInverseBetaDecay : return "inverse beta decay";
67  case simb::kGlashowResonance : return "Glashow resonance";
68  case simb::kAMNuGamma : return "anomalous neutrino-photon interaction";
69  case simb::kMEC : return "meson exchange current";
70  case simb::kDiffractive : return "diffractive";
71  case simb::kEM : return "electromagnetic";
72  case simb::kWeakMix : return "weak mixing";
73  case simb::kNuanceOffset : return "<nuance offset>";
74  case simb::kCCQE : return "charged current quasi-elastic scattering";
75  case simb::kNCQE : return "neutral current quasi-elastic scattering";
76  case simb::kResCCNuProtonPiPlus : return "resonant charged current neutrino proton pi+";
77  case simb::kResCCNuNeutronPi0 : return "resonant charged current neutrino neutron pi0";
78  case simb::kResCCNuNeutronPiPlus : return "resonant charged current neutrino neutron pi+";
79  case simb::kResNCNuProtonPi0 : return "resonant neutral current neutrino proton pi0";
80  case simb::kResNCNuProtonPiPlus : return "resonant neutral current neutrino proton pi+";
81  case simb::kResNCNuNeutronPi0 : return "resonant neutral current neutrino neutron pi0";
82  case simb::kResNCNuNeutronPiMinus : return "resonant neutral current neutrino neutron pi-";
83  case simb::kResCCNuBarNeutronPiMinus : return "resonant charged current antineutrino neutron pi-";
84  case simb::kResCCNuBarProtonPi0 : return "resonant charged current antineutrino proton pi0";
85  case simb::kResCCNuBarProtonPiMinus : return "resonant charged current antineutrino proton pi-";
86  case simb::kResNCNuBarProtonPi0 : return "resonant neutral current antineutrino proton pi0";
87  case simb::kResNCNuBarProtonPiPlus : return "resonant neutral current antineutrino proton pi+";
88  case simb::kResNCNuBarNeutronPi0 : return "resonant neutral current antineutrino neutron pi0";
89  case simb::kResNCNuBarNeutronPiMinus : return "resonant neutral current antineutrino neutron pi-";
90  case simb::kResCCNuDeltaPlusPiPlus : return "resonant charged current neutrino Delta+ pi+";
91  case simb::kResCCNuDelta2PlusPiMinus : return "resonant charged current neutrino Delta++ pi-";
92  case simb::kResCCNuBarDelta0PiMinus : return "resonant charged current antineutrino Delta0 pi-";
93  case simb::kResCCNuBarDeltaMinusPiPlus : return "resonant charged current antineutrino Delta- pi+";
94  case simb::kResCCNuProtonRhoPlus : return "resonant charged current neutrino proton rho+";
95  case simb::kResCCNuNeutronRhoPlus : return "resonant charged current neutrino neutron rho+";
96  case simb::kResCCNuBarNeutronRhoMinus : return "resonant charged current antineutrino neutron rho-";
97  case simb::kResCCNuBarNeutronRho0 : return "resonant charged current antineutrino neutron rho0";
98  case simb::kResCCNuSigmaPlusKaonPlus : return "resonant charged current neutrino Sigma+ kaon+";
99  case simb::kResCCNuSigmaPlusKaon0 : return "resonant charged current neutrino Sigma+ kaon0";
100  case simb::kResCCNuBarSigmaMinusKaon0 : return "resonant charged current antineutrino Sigma- kaon0";
101  case simb::kResCCNuBarSigma0Kaon0 : return "resonant charged current antineutrino Sigma0 kaon0";
102  case simb::kResCCNuProtonEta : return "resonant charged current neutrino proton eta";
103  case simb::kResCCNuBarNeutronEta : return "resonant charged current antineutrino neutron eta";
104  case simb::kResCCNuKaonPlusLambda0 : return "resonant charged current neutrino Kaon+ Lambda0";
105  case simb::kResCCNuBarKaon0Lambda0 : return "resonant charged current antineutrino kaon0 Lambda0";
106  case simb::kResCCNuProtonPiPlusPiMinus : return "resonant charged current neutrino proton pi+ pi-";
107  case simb::kResCCNuProtonPi0Pi0 : return "resonant charged current neutrino proton pi0 pi0";
108  case simb::kResCCNuBarNeutronPiPlusPiMinus: return "resonant charged current antineutrino neutron pi+ pi-";
109  case simb::kResCCNuBarNeutronPi0Pi0 : return "resonant charged current antineutrino neutron pi0 pi0";
110  case simb::kResCCNuBarProtonPi0Pi0 : return "resonant charged current antineutrino proton pi0 pi0";
111  case simb::kCCDIS : return "charged current deep inelastic scattering";
112  case simb::kNCDIS : return "neutral current deep inelastic scattering";
113  case simb::kUnUsed1 : return "unused (1)";
114  case simb::kUnUsed2 : return "unused (2)";
115  case simb::kCCQEHyperon : return "charged current quasi-elastic scattering with hyperon";
116  case simb::kNCCOH : return "neutral current coherent scattering";
117  case simb::kCCCOH : return "charged current coherent scattering";
118  case simb::kNuElectronElastic : return "electron neutrino elastic";
119  case simb::kInverseMuDecay : return "inverse muon decay";
120  default : return "unsupported (" + std::to_string(type) + ")";
121  } // switch
122 } // sim::TruthInteractionTypeName()
neutral current quasi-elastic
Definition: MCNeutrino.h:101
resonant charged current, nubar p -> nubar n pi+
Definition: MCNeutrino.h:113
resonant neutral current, nu p -> nu p pi0
Definition: MCNeutrino.h:105
charged current deep inelastic scatter
Definition: MCNeutrino.h:138
resonant charged current, nubar p -> l+ p pi-
Definition: MCNeutrino.h:111
neutrino electron elastic scatter
Definition: MCNeutrino.h:144
resonant charged current, nubar p -> l+ n pi0
Definition: MCNeutrino.h:110
offset to account for adding in Nuance codes to this enum
Definition: MCNeutrino.h:99
charged current quasi-elastic
Definition: MCNeutrino.h:100
resonant charged current, nubar p -> nubar p pi0
Definition: MCNeutrino.h:112
resonant charged current, nu n -> l- p pi0
Definition: MCNeutrino.h:103
resonant neutral current, nu n -> nu n pi0
Definition: MCNeutrino.h:107
resonant charged current, nu n -> l- n pi+
Definition: MCNeutrino.h:104
resonant charged current, nubar n -> nubar p pi-
Definition: MCNeutrino.h:115
charged current deep inelastic scatter
Definition: MCNeutrino.h:137
resonant charged current, nu p -> l- p pi+
Definition: MCNeutrino.h:102
n.b.: this group is similar but not quite, entirely unlike GENIE ScatteringType convention ...
Definition: MCNeutrino.h:84
charged current coherent pion
Definition: MCNeutrino.h:143
resonant neutral current, nu n -> nu p pi-
Definition: MCNeutrino.h:108
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
Definition: BitMask.h:187
inverse muon decay
Definition: MCNeutrino.h:145
resonant charged current, nubar n -> l+ n pi-
Definition: MCNeutrino.h:109
resonant charged current, nubar n -> nubar n pi0
Definition: MCNeutrino.h:114
resonant neutral current, nu p -> nu p pi+
Definition: MCNeutrino.h:106
std::string sim::TruthOriginName ( simb::Origin_t  origin)

Returns a string representing the specified process origin.

Definition at line 19 of file MCDumperUtils.cxx.

References simb::kBeamNeutrino, simb::kCosmicRay, simb::kSingleParticle, simb::kSuperNovaNeutrino, simb::kUnknown, and util::flags::to_string().

Referenced by sim::dump::DumpMCTruth().

19  {
20  switch (origin) {
21  case simb::kUnknown : return "unknown origin";
22  case simb::kBeamNeutrino : return "neutrinos from beam";
23  case simb::kCosmicRay : return "cosmic rays";
24  case simb::kSuperNovaNeutrino: return "supernova neutrinos";
25  case simb::kSingleParticle : return "single particle";
26  default: return "unsupported (" + std::to_string((int)origin) + ")";
27  } // switch
28 } // sim::TruthOriginName()
single particles thrown at the detector
Definition: MCTruth.h:24
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
Definition: BitMask.h:187
Supernova neutrinos.
Definition: MCTruth.h:23
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
Cosmic rays.
Definition: MCTruth.h:22
Beam neutrinos.
Definition: MCTruth.h:21
std::string sim::TruthReactionMode ( int  mode)

Returns the "mode" of the reaction (a lesser version of interaction type).

Definition at line 42 of file MCDumperUtils.cxx.

Referenced by sim::dump::DumpMCNeutrino().

42  {
43 
44  switch (mode) {
45  case 0: return "quasi-elastic";
46  case 1: return "resonant";
47  case 2: return "deep inelastic";
48  case 3: return "coherent";
49  default: return "unknown mode";
50  } // switch
51 
52 } // sim::TruthReactionMode()

Variable Documentation

std::unique_ptr<EveIdCalculator> sim::eveIdCalculator
static

Definition at line 388 of file ParticleList.cxx.

const double sim::kINVALID_DOUBLE = std::numeric_limits <double>::max()
const float sim::kINVALID_FLOAT = std::numeric_limits <float>::max()

Definition at line 12 of file MCLimits.h.

Referenced by sim::MCEnDep::Reset(), and sim::MCHit::Reset().

const int sim::kINVALID_INT = std::numeric_limits <int>::max()