LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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  DumpSimEnergyDeposits
 Prints the content of all the deposited energies on screen. More...
 
class  DumpSimPhotons
 
class  DumpSimPhotonsLite
 
class  EmEveIdCalculator
 
class  EveIdCalculator
 
class  GeneratedParticleInfo
 Contains information about a generated particle. More...
 
class  GenericCRT
 
class  GenericCRTUtility
 
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  MCParticleLite
 
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
 
struct  OnePhoton
 All information of a photon entering the sensitive optical detector volume. More...
 
class  OpDetBacktrackerRecord
 Energy deposited on a readout Optical Detector by simulated tracks. More...
 
class  ParticleAncestryMap
 
class  ParticleHistory
 
class  ParticleList
 
class  PhotonHitConverter
 
class  PhotonVoxel
 Representation of a single small volume (voxel). More...
 
class  PhotonVoxelDef
 Representation of a region of space diced into voxels. More...
 
class  POTaccumulator
 Prints on console the total Protons On Target from the input subruns. More...
 
struct  SDP
 
class  SimChannel
 Energy deposited on a readout channel by simulated tracks. More...
 
class  SimDriftedElectronCluster
 
class  SimEnergyDeposit
 Energy deposition in the active material. More...
 
class  SimEnergyDepositLite
 Energy deposition in the active material (lite version). More...
 
class  SimListUtils
 
class  SimPhotons
 Collection of photons which recorded on one channel. More...
 
class  SimPhotonsCollection
 Collection of sim::SimPhotons, indexed by channel number. More...
 
class  SimPhotonsLite
 Compact representation of photons on a channel. More...
 
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
 
typedef std::vector< SimEnergyDepositLiteSimEnergyDepositLiteCollection
 

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 ()
 
bool operator< (OnePhoton const &, OnePhoton const &)
 a is smaller than b if has earlier Time, or lower MotherTrackID. More...
 
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 &out, sim::PhotonVoxelDef const &voxelDef)
 Prints the content of the specified voxel definition into a stream. More...
 
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...
 

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
 

Functions to name `simb::MCTruth` enumerators and codes.

enum  RescatterCategory { RescatterCategory::GENIE_INukeFateHA, RescatterCategory::LArSoftDefault = GENIE_INukeFateHA }
 Possible sources of rescattering code (which is generator-dependent). More...
 
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)
 
std::string RescatteringName (int code, RescatterCategory cat=RescatterCategory::LArSoftDefault)
 The name of the specified rescattering code. More...
 
std::string GENIE_INukeFateHA_RescatteringName (int code)
 Description of a rescattering code from GENIE INukeFateHA_t. More...
 

Detailed Description

Monte Carlo Simulation.

TECHNICAL NOTES:

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

Description: Class that counts up sim photons, leading towards comparisons with flashes and flash hypotheses.

Title: GenericCRT Utility Class Author: Andrzej Szelc (andrz.nosp@m.ejs@.nosp@m.fnal..nosp@m.gov)

Description: Class with Algorithms to convert sim::AuxDetHits to sim::AuxDetSimChannels

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.

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 126 of file AuxDetHit.h.

Definition at line 100 of file AuxDetSimChannel.h.

Definition at line 226 of file SimEnergyDeposit.h.

Definition at line 84 of file SimEnergyDepositLite.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 118 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 86 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

Possible sources of rescattering code (which is generator-dependent).

Enumerator
GENIE_INukeFateHA 

GENIE genie::EINukeFateHA_t

LArSoftDefault 

Definition at line 37 of file MCDumperUtils.h.

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

std::string sim::GENIE_INukeFateHA_RescatteringName ( int  code)

Description of a rescattering code from GENIE INukeFateHA_t.

Definition at line 182 of file MCDumperUtils.cxx.

References util::to_string().

Referenced by RescatteringName().

183 {
184 
185 #ifdef _INTRANUKE_FATES_H_ // from GENIE
186 
187  return genie::INukeHadroFates::AsString(static_cast<genie::INukeFateHA_t>(code));
188 
189 #else // !_INTRANUKE_FATES_H_:
190 
191  using namespace std::string_literals;
192 
193  /*
194  * Here we do an horrible thing, that is to copy GENIE code into LArSoft.
195  * By defining `HAS_GENIE`, the proper code branch would be taken instead,
196  * which directly refers to GENIE.
197  * But LArSoft does not do that, because we don't want to be forced to have
198  * GENIE around all the time we use `simb::MCParticle`.
199  *
200  */
201  switch (code) {
202  // from Fermilab UPS GENIE v3_0_0_b4a, `Physics/HadronTransport/INukeHadroFates.h`:
203  case 0 /* kIHAFtUndefined */: return "** Undefined HA-mode fate **"s; break;
204  case 1 /* kIHAFtNoInteraction */: return "HA-mode / no interaction"s; break;
205  case 2 /* kIHAFtCEx */: return "HA-mode / cex"s; break;
206  case 3 /* kIHAFtElas */: return "HA-mode / elas"s; break;
207  case 4 /* kIHAFtInelas */: return "HA-mode / inelas"s; break;
208  case 5 /* kIHAFtAbs */: return "HA-mode / abs"s; break;
209  case 6 /* kIHAFtKo */: return "HA-mode / knock-out"s; break;
210  case 7 /* kIHAFtCmp */: return "HA-mode / compound"s; break;
211  case 8 /* kIHAFtPiProd */: return "HA-mode / pi-production"s; break;
212  case 9 /* kIHAFtInclPip */: return "HA-mode / pi-prod incl pi+"s; break;
213  case 10 /* kIHAFtInclPim */: return "HA-mode / pi-prod incl pi-"s; break;
214  case 11 /* kIHAFtInclPi0 */: return "HA-mode / pi-prod incl pi0"s; break;
215  case 12 /* kIHAFtDCEx */: return "HA-mode / dcex"s; break;
216  default: return "unknown ("s + std::to_string(code) + ")"s;
217  } // switch(code)
218 
219 #endif // ?_INTRANUKE_FATES_H_
220 
221 } // sim::GENIE_INukeFateHA_RescatteringName()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
unsigned int sim::GetRandomNumberSeed ( )
inline

Definition at line 25 of file sim.h.

26 {
27 
28  // the maximum allowed seed for the art::RandomNumberGenerator
29  // is 900000000. Use TRandom3 to get the seed value in that range.
30  // Instantiating TRandom3 with a 0 means that its seed is set based
31  // on the TUUID and should always be random, even for jobs running on the
32  // same machine
33  TRandom3 rand(0);
34  return rand.Integer(900000000);
35 }
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 45 of file LArVoxelList.cxx.

References sim::LArVoxelList::LArVoxelList(), and value.

46  {
47  return LArVoxelList(list) *= value;
48  }
double value
Definition: spectrum.C:18
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 68 of file LArVoxelData.cxx.

References sim::LArVoxelData::LArVoxelData(), and value.

69  {
70  return LArVoxelData(data) *= value;
71  }
double value
Definition: spectrum.C:18
bool sim::operator< ( const BeamGateInfo lhs,
const BeamGateInfo rhs 
)

Definition at line 40 of file BeamGateInfo.h.

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

41  {
42  // Sort by start; in the enormously-unlikely case that two beam
43  // gates (BNB and NuMI?) start at the same time, sort by width.
44  if (lhs.Start() < rhs.Start()) return true;
45  if (lhs.Start() == rhs.Start()) return (lhs.Width() < lhs.Width());
46  return false;
47  }
bool sim::operator< ( OnePhoton const &  a,
OnePhoton const &  b 
)
inline

a is smaller than b if has earlier Time, or lower MotherTrackID.

Definition at line 219 of file SimPhotons.h.

References sim::OnePhoton::MotherTrackID, and sim::OnePhoton::Time.

220 {
221  if (a.Time < b.Time) return true;
222  if (a.Time > b.Time) return false;
223 
224  return (a.MotherTrackID < b.MotherTrackID);
225 } // sim::operator< (OnePhoton const&, OnePhoton const&)
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 74 of file LArVoxelData.cxx.

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

Referenced by sim::PhotonVoxelDef::isInsideImpl().

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

Definition at line 89 of file LArVoxelList.cxx.

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

90  {
91  // Determine a field width for the voxel number.
92  LArVoxelList::size_type numberOfVoxels = list.size();
93  int numberOfDigits = (int)std::log10((double)numberOfVoxels) + 1;
94 
95  // A simple header.
96  output.width(numberOfDigits);
97  output << "#"
98  << ": < ID, energy >" << std::endl;
99 
100  // Write each voxel on a separate line.
101  LArVoxelList::size_type nVoxel = 0;
102  for (LArVoxelList::const_iterator voxel = list.begin(); voxel != list.end();
103  ++voxel, ++nVoxel) {
104  output.width(numberOfDigits);
105  output << nVoxel << ": "
106  << "< " << (*voxel).first << ", " << (*voxel).second << " >\n";
107  }
108 
109  return output;
110  }
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 113 of file LArVoxelID.cxx.

114  {
115  output << "(" << id.X() << "," << id.Y() << "," << id.Z() << "," << id.T() << ")";
116 
117  return output;
118  }
std::ostream & sim::operator<< ( std::ostream &  out,
sim::PhotonVoxelDef const &  voxelDef 
)

Prints the content of the specified voxel definition into a stream.

Definition at line 221 of file PhotonVoxels.cxx.

References sim::PhotonVoxelDef::GetNVoxels(), sim::PhotonVoxelDef::GetRegionLowerCorner(), sim::PhotonVoxelDef::GetRegionUpperCorner(), sim::PhotonVoxelDef::GetSteps(), sim::PhotonVoxelDef::GetVolumeSize(), and sim::PhotonVoxelDef::GetVoxelSize().

222  {
223 
224  auto const& lower = voxelDef.GetRegionLowerCorner();
225  auto const& upper = voxelDef.GetRegionUpperCorner();
226  auto const& steps = voxelDef.GetSteps();
227  auto const& stepSize = voxelDef.GetVoxelSize();
228 
229  out << "Volume " << voxelDef.GetVolumeSize() << " cm^3 split in " << voxelDef.GetNVoxels()
230  << " voxels:"
231  << "\n - x axis: [ " << lower.X() << " ; " << upper.X() << " ] split in " << steps[0]
232  << "x " << stepSize.X() << " cm steps"
233  << "\n - y axis: [ " << lower.Y() << " ; " << upper.Y() << " ] split in " << steps[1]
234  << "x " << stepSize.Y() << " cm steps"
235  << "\n - z axis: [ " << lower.Z() << " ; " << upper.Z() << " ] split in " << steps[2]
236  << "x " << stepSize.Z() << " cm steps"
237  << "\n";
238 
239  return out;
240  } // operator<< (sim::PhotonVoxelDef)
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 158 of file MCDumperUtils.cxx.

References util::to_string().

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

159 {
160  TParticlePDG const* PDGinfo = TDatabasePDG::Instance()->GetParticle(pigid);
161  return PDGinfo ? PDGinfo->GetTitle() : ("PDG ID " + std::to_string(pigid));
162 } // sim::ParticleName()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::string sim::ParticleStatusName ( int  code)

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

Definition at line 137 of file MCDumperUtils.cxx.

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

138 {
139 
140  switch (code) {
141  case -1: return "undefined";
142  case 0: return "initial state";
143  case 1: return "stable final state";
144  case 2: return "intermediate";
145  case 3: return "decayed";
146  case 11: return "nucleon target";
147  case 12: return "pre-fragmentation hadronic state";
148  case 13: return "pre-decay resonant state";
149  case 14: return "hadron in nucleus";
150  case 15: return "final state nuclear remnant";
151  case 16: return "nucleon cluster target";
152  default: return "unknown";
153  } // switch
154 
155 } // sim::ParticleStatusName
std::string sim::RescatteringName ( int  code,
RescatterCategory  cat = RescatterCategory::LArSoftDefault 
)

The name of the specified rescattering code.

Parameters
codethe rescattering code
typethe category of rescattering code belongs to
Returns
a string describing the rescattering code

The meaning of the rescattering code is generator-dependent, and also within a generator it may be algorithm-dependent. The category pins down which set of possible meaning the code belongs to. In LArSoft, if the code is unassigned by the generator, it will default to simb::MCParticle::s_uninitialized.

Definition at line 165 of file MCDumperUtils.cxx.

References GENIE_INukeFateHA_RescatteringName(), simb::MCParticle::s_uninitialized, and util::to_string().

167 {
168  using namespace std::string_literals;
169 
170  if (code == simb::MCParticle::s_uninitialized) return "(unset)"s;
171 
172  switch (cat) {
173  case RescatterCategory::GENIE_INukeFateHA: return GENIE_INukeFateHA_RescatteringName(code);
174  default:
175  return "unknown category "s + std::to_string(static_cast<int>(cat)) + " (code: "s +
176  std::to_string(code) + ")"s;
177  } // switch(code)
178 
179 } // sim::RescatteringName()
static const int s_uninitialized
Definition: MCParticle.h:28
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::string GENIE_INukeFateHA_RescatteringName(int code)
Description of a rescattering code from GENIE INukeFateHA_t.
std::string sim::TruthCCNCname ( int  ccnc)

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

Definition at line 39 of file MCDumperUtils.cxx.

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

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

40 {
41  switch (ccnc) {
42  case simb::kCC: return "charged weak current";
43  case simb::kNC: return "neutral weak current";
44  default: return "unsupported (" + std::to_string(ccnc) + ")";
45  } // switch
46 } // sim::TruthCCNCname()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::string sim::TruthInteractionTypeName ( int  type)

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

Definition at line 63 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::to_string().

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

64 {
65  switch (type) {
66  case simb::kUnknownInteraction: return "unknown interaction";
67  case simb::kQE: return "quasi-elastic scattering";
68  case simb::kRes: return "resonant scattering";
69  case simb::kDIS: return "deep inelastic scattering";
70  case simb::kCoh: return "coherent scattering";
71  case simb::kCohElastic: return "coherent elastic scattering";
72  case simb::kElectronScattering: return "electron scattering";
73  case simb::kIMDAnnihilation: return "inverse muon decay annihilation";
74  case simb::kInverseBetaDecay: return "inverse beta decay";
75  case simb::kGlashowResonance: return "Glashow resonance";
76  case simb::kAMNuGamma: return "anomalous neutrino-photon interaction";
77  case simb::kMEC: return "meson exchange current";
78  case simb::kDiffractive: return "diffractive";
79  case simb::kEM: return "electromagnetic";
80  case simb::kWeakMix: return "weak mixing";
81  case simb::kNuanceOffset: return "<nuance offset>";
82  case simb::kCCQE: return "charged current quasi-elastic scattering";
83  case simb::kNCQE: return "neutral current quasi-elastic scattering";
84  case simb::kResCCNuProtonPiPlus: return "resonant charged current neutrino proton pi+";
85  case simb::kResCCNuNeutronPi0: return "resonant charged current neutrino neutron pi0";
86  case simb::kResCCNuNeutronPiPlus: return "resonant charged current neutrino neutron pi+";
87  case simb::kResNCNuProtonPi0: return "resonant neutral current neutrino proton pi0";
88  case simb::kResNCNuProtonPiPlus: return "resonant neutral current neutrino proton pi+";
89  case simb::kResNCNuNeutronPi0: return "resonant neutral current neutrino neutron pi0";
90  case simb::kResNCNuNeutronPiMinus: return "resonant neutral current neutrino neutron pi-";
91  case simb::kResCCNuBarNeutronPiMinus: return "resonant charged current antineutrino neutron pi-";
92  case simb::kResCCNuBarProtonPi0: return "resonant charged current antineutrino proton pi0";
93  case simb::kResCCNuBarProtonPiMinus: return "resonant charged current antineutrino proton pi-";
94  case simb::kResNCNuBarProtonPi0: return "resonant neutral current antineutrino proton pi0";
95  case simb::kResNCNuBarProtonPiPlus: return "resonant neutral current antineutrino proton pi+";
96  case simb::kResNCNuBarNeutronPi0: return "resonant neutral current antineutrino neutron pi0";
97  case simb::kResNCNuBarNeutronPiMinus: return "resonant neutral current antineutrino neutron pi-";
98  case simb::kResCCNuDeltaPlusPiPlus: return "resonant charged current neutrino Delta+ pi+";
99  case simb::kResCCNuDelta2PlusPiMinus: return "resonant charged current neutrino Delta++ pi-";
100  case simb::kResCCNuBarDelta0PiMinus: return "resonant charged current antineutrino Delta0 pi-";
101  case simb::kResCCNuBarDeltaMinusPiPlus: return "resonant charged current antineutrino Delta- pi+";
102  case simb::kResCCNuProtonRhoPlus: return "resonant charged current neutrino proton rho+";
103  case simb::kResCCNuNeutronRhoPlus: return "resonant charged current neutrino neutron rho+";
105  return "resonant charged current antineutrino neutron rho-";
106  case simb::kResCCNuBarNeutronRho0: return "resonant charged current antineutrino neutron rho0";
107  case simb::kResCCNuSigmaPlusKaonPlus: return "resonant charged current neutrino Sigma+ kaon+";
108  case simb::kResCCNuSigmaPlusKaon0: return "resonant charged current neutrino Sigma+ kaon0";
110  return "resonant charged current antineutrino Sigma- kaon0";
111  case simb::kResCCNuBarSigma0Kaon0: return "resonant charged current antineutrino Sigma0 kaon0";
112  case simb::kResCCNuProtonEta: return "resonant charged current neutrino proton eta";
113  case simb::kResCCNuBarNeutronEta: return "resonant charged current antineutrino neutron eta";
114  case simb::kResCCNuKaonPlusLambda0: return "resonant charged current neutrino Kaon+ Lambda0";
115  case simb::kResCCNuBarKaon0Lambda0: return "resonant charged current antineutrino kaon0 Lambda0";
116  case simb::kResCCNuProtonPiPlusPiMinus: return "resonant charged current neutrino proton pi+ pi-";
117  case simb::kResCCNuProtonPi0Pi0: return "resonant charged current neutrino proton pi0 pi0";
119  return "resonant charged current antineutrino neutron pi+ pi-";
121  return "resonant charged current antineutrino neutron pi0 pi0";
122  case simb::kResCCNuBarProtonPi0Pi0: return "resonant charged current antineutrino proton pi0 pi0";
123  case simb::kCCDIS: return "charged current deep inelastic scattering";
124  case simb::kNCDIS: return "neutral current deep inelastic scattering";
125  case simb::kUnUsed1: return "unused (1)";
126  case simb::kUnUsed2: return "unused (2)";
127  case simb::kCCQEHyperon: return "charged current quasi-elastic scattering with hyperon";
128  case simb::kNCCOH: return "neutral current coherent scattering";
129  case simb::kCCCOH: return "charged current coherent scattering";
130  case simb::kNuElectronElastic: return "electron neutrino elastic";
131  case simb::kInverseMuDecay: return "inverse muon decay";
132  default: return "unsupported (" + std::to_string(type) + ")";
133  } // switch
134 } // sim::TruthInteractionTypeName()
neutral current quasi-elastic
Definition: MCNeutrino.h:97
resonant charged current, nubar p -> nubar n pi+
Definition: MCNeutrino.h:109
resonant neutral current, nu p -> nu p pi0
Definition: MCNeutrino.h:101
charged current deep inelastic scatter
Definition: MCNeutrino.h:134
resonant charged current, nubar p -> l+ p pi-
Definition: MCNeutrino.h:107
neutrino electron elastic scatter
Definition: MCNeutrino.h:140
resonant charged current, nubar p -> l+ n pi0
Definition: MCNeutrino.h:106
offset to account for adding in Nuance codes to this enum
Definition: MCNeutrino.h:95
charged current quasi-elastic
Definition: MCNeutrino.h:96
resonant charged current, nubar p -> nubar p pi0
Definition: MCNeutrino.h:108
resonant charged current, nu n -> l- p pi0
Definition: MCNeutrino.h:99
resonant neutral current, nu n -> nu n pi0
Definition: MCNeutrino.h:103
resonant charged current, nu n -> l- n pi+
Definition: MCNeutrino.h:100
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
resonant charged current, nubar n -> nubar p pi-
Definition: MCNeutrino.h:111
charged current deep inelastic scatter
Definition: MCNeutrino.h:133
resonant charged current, nu p -> l- p pi+
Definition: MCNeutrino.h:98
n.b.: this group is similar but not quite, entirely unlike GENIE ScatteringType convention ...
Definition: MCNeutrino.h:80
charged current coherent pion
Definition: MCNeutrino.h:139
resonant neutral current, nu n -> nu p pi-
Definition: MCNeutrino.h:104
inverse muon decay
Definition: MCNeutrino.h:141
resonant charged current, nubar n -> l+ n pi-
Definition: MCNeutrino.h:105
resonant charged current, nubar n -> nubar n pi0
Definition: MCNeutrino.h:110
resonant neutral current, nu p -> nu p pi+
Definition: MCNeutrino.h:102
std::string sim::TruthOriginName ( simb::Origin_t  origin)

Returns a string representing the specified process origin.

Definition at line 26 of file MCDumperUtils.cxx.

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

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

27 {
28  switch (origin) {
29  case simb::kUnknown: return "unknown origin";
30  case simb::kBeamNeutrino: return "neutrinos from beam";
31  case simb::kCosmicRay: return "cosmic rays";
32  case simb::kSuperNovaNeutrino: return "supernova neutrinos";
33  case simb::kSingleParticle: return "single particle";
34  default: return "unsupported (" + std::to_string((int)origin) + ")";
35  } // switch
36 } // sim::TruthOriginName()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
single particles thrown at the detector
Definition: MCTruth.h:26
Supernova neutrinos.
Definition: MCTruth.h:25
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:229
Cosmic rays.
Definition: MCTruth.h:24
Beam neutrinos.
Definition: MCTruth.h:23
std::string sim::TruthReactionMode ( int  mode)

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

Definition at line 49 of file MCDumperUtils.cxx.

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

50 {
51 
52  switch (mode) {
53  case 0: return "quasi-elastic";
54  case 1: return "resonant";
55  case 2: return "deep inelastic";
56  case 3: return "coherent";
57  default: return "unknown mode";
58  } // switch
59 
60 } // 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::MCHit::Reset(), and sim::MCEnDep::Reset().

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