LArSoft  v08_35_01
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  OnePhoton
 
class  OpDetBacktrackerRecord
 Energy deposited on a readout Optical Detector by simulated tracks. More...
 
class  ParticleHistory
 
class  ParticleList
 
class  PhotonVoxel
 Representation of a single small volume (voxel). More...
 
class  PhotonVoxelDef
 Representation of a region of space diced into voxels. More...
 
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...
 

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:

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 const> 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.

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

Definition at line 104 of file AuxDetSimChannel.h.

Definition at line 237 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 122 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 104 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 39 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 181 of file MCDumperUtils.cxx.

References s, and util::to_string().

Referenced by RescatteringName().

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

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

46  {
47  return LArVoxelList(list) *= value;
48  }
std::string value(std::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 71 of file LArVoxelData.cxx.

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

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

Definition at line 45 of file BeamGateInfo.h.

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

46  {
47  // Sort by start; in the enormously-unlikely case that two beam
48  // gates (BNB and NuMI?) start at the same time, sort by width.
49  if ( lhs.Start() < rhs.Start() )
50  return true;
51  if ( lhs.Start() == rhs.Start() )
52  return ( lhs.Width() < lhs.Width() );
53  return false;
54  }
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 77 of file LArVoxelData.cxx.

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

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

Definition at line 91 of file LArVoxelList.cxx.

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

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

References RescatteringName(), and util::to_string().

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

155  {
156  TParticlePDG const* PDGinfo = TDatabasePDG::Instance()->GetParticle(pigid);
157  return PDGinfo? PDGinfo->GetTitle(): ("PDG ID " + std::to_string(pigid));
158 } // sim::ParticleName()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:60
std::string sim::ParticleStatusName ( int  code)

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

Definition at line 134 of file MCDumperUtils.cxx.

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

134  {
135 
136  switch(code) {
137  case -1: return "undefined";
138  case 0: return "initial state";
139  case 1: return "stable final state";
140  case 2: return "intermediate";
141  case 3: return "decayed";
142  case 11: return "nucleon target";
143  case 12: return "pre-fragmentation hadronic state";
144  case 13: return "pre-decay resonant state";
145  case 14: return "hadron in nucleus";
146  case 15: return "final state nuclear remnant";
147  case 16: return "nucleon cluster target";
148  default: return "unknown";
149  } // switch
150 
151 } // 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 163 of file MCDumperUtils.cxx.

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

Referenced by ParticleName().

164 {
165  using namespace std::string_literals;
166 
167  if (code == simb::MCParticle::s_uninitialized) return "(unset)"s;
168 
169  switch (cat) {
170  case RescatterCategory::GENIE_INukeFateHA:
172  default:
173  return "unknown category "s + std::to_string(static_cast<int>(cat))
174  + " (code: "s + std::to_string(code) + ")"s;
175  } // switch(code)
176 
177 } // sim::RescatteringName()
Float_t s
Definition: plot.C:23
static const int s_uninitialized
Definition: MCParticle.h:28
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:60
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 40 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.
Definition: StdUtils.h:60
std::string sim::TruthInteractionTypeName ( int  type)

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

Definition at line 64 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+";
104  case simb::kResCCNuBarNeutronRhoMinus : return "resonant charged current antineutrino neutron rho-";
105  case simb::kResCCNuBarNeutronRho0 : return "resonant charged current antineutrino neutron rho0";
106  case simb::kResCCNuSigmaPlusKaonPlus : return "resonant charged current neutrino Sigma+ kaon+";
107  case simb::kResCCNuSigmaPlusKaon0 : return "resonant charged current neutrino Sigma+ kaon0";
108  case simb::kResCCNuBarSigmaMinusKaon0 : return "resonant charged current antineutrino Sigma- kaon0";
109  case simb::kResCCNuBarSigma0Kaon0 : return "resonant charged current antineutrino Sigma0 kaon0";
110  case simb::kResCCNuProtonEta : return "resonant charged current neutrino proton eta";
111  case simb::kResCCNuBarNeutronEta : return "resonant charged current antineutrino neutron eta";
112  case simb::kResCCNuKaonPlusLambda0 : return "resonant charged current neutrino Kaon+ Lambda0";
113  case simb::kResCCNuBarKaon0Lambda0 : return "resonant charged current antineutrino kaon0 Lambda0";
114  case simb::kResCCNuProtonPiPlusPiMinus : return "resonant charged current neutrino proton pi+ pi-";
115  case simb::kResCCNuProtonPi0Pi0 : return "resonant charged current neutrino proton pi0 pi0";
116  case simb::kResCCNuBarNeutronPiPlusPiMinus: return "resonant charged current antineutrino neutron pi+ pi-";
117  case simb::kResCCNuBarNeutronPi0Pi0 : return "resonant charged current antineutrino neutron pi0 pi0";
118  case simb::kResCCNuBarProtonPi0Pi0 : return "resonant charged current antineutrino proton pi0 pi0";
119  case simb::kCCDIS : return "charged current deep inelastic scattering";
120  case simb::kNCDIS : return "neutral current deep inelastic scattering";
121  case simb::kUnUsed1 : return "unused (1)";
122  case simb::kUnUsed2 : return "unused (2)";
123  case simb::kCCQEHyperon : return "charged current quasi-elastic scattering with hyperon";
124  case simb::kNCCOH : return "neutral current coherent scattering";
125  case simb::kCCCOH : return "charged current coherent scattering";
126  case simb::kNuElectronElastic : return "electron neutrino elastic";
127  case simb::kInverseMuDecay : return "inverse muon decay";
128  default : return "unsupported (" + std::to_string(type) + ")";
129  } // switch
130 } // 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.
Definition: StdUtils.h:60
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 27 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.
Definition: StdUtils.h:60
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:227
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 50 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()