MCTruth.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file MCTruth.cxx
3 /// \brief Simple MC truth class, holds a vector of TParticles
4 ///
5 /// \version $Id: MCTruth.h,v 1.5 2012-10-15 20:36:27 brebel Exp $
6 /// \author jpaley@indiana.edu
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef SIMB_MCTRUTH_H
9 #define SIMB_MCTRUTH_H
10 
11 #include <string>
12 #include <vector>
15 
16 namespace simb {
17 
18  class MCParticle;
19 
20  /// event origin types
21  typedef enum _ev_origin{
22  kUnknown, ///< ???
23  kBeamNeutrino, ///< Beam neutrinos
24  kCosmicRay, ///< Cosmic rays
25  kSuperNovaNeutrino, ///< Supernova neutrinos
26  kSingleParticle ///< single particles thrown at the detector
27  } Origin_t;
28 
29  //......................................................................
30 
31  /// Event generator information
32  class MCTruth {
33  public:
34  MCTruth();
35 
36  private:
37 
38  std::vector<simb::MCParticle> fPartList; ///< list of particles in this event
39  simb::MCNeutrino fMCNeutrino; ///< reference to neutrino info - null if not a neutrino
40  simb::Origin_t fOrigin; ///< origin for this event
41  simb::MCGeneratorInfo fGenInfo; ///< information about the generator that produced this event
42  bool fNeutrinoSet; ///< flag for whether the neutrino information has been set
43 
44  public:
45  const simb::MCGeneratorInfo& GeneratorInfo() const;
46  simb::Origin_t Origin() const;
47  int NParticles() const;
48  const simb::MCParticle& GetParticle(int i) const;
49  const simb::MCNeutrino& GetNeutrino() const;
50  bool NeutrinoSet() const;
51 
52  void Add(simb::MCParticle const& part);
53  void Add(simb::MCParticle&& part);
55  const std::string & genVersion,
56  const std::unordered_map<std::string, std::string>& genConfig);
58  void SetNeutrino(int CCNC,
59  int mode,
60  int interactionType,
61  int target,
62  int nucleon,
63  int quark,
64  double w,
65  double x,
66  double y,
67  double qsqr);
68 
69  friend std::ostream& operator<< (std::ostream& o, simb::MCTruth const& a);
70  };
71 }
72 
74 inline simb::Origin_t simb::MCTruth::Origin() const { return fOrigin; }
75 inline int simb::MCTruth::NParticles() const { return (int)fPartList.size(); }
76 inline const simb::MCParticle& simb::MCTruth::GetParticle(int i) const { return fPartList[i]; }
77 inline const simb::MCNeutrino& simb::MCTruth::GetNeutrino() const { return fMCNeutrino; }
78 inline bool simb::MCTruth::NeutrinoSet() const { return fNeutrinoSet; }
79 
80 inline void simb::MCTruth::Add(simb::MCParticle const& part) { fPartList.push_back(part); }
81 inline void simb::MCTruth::Add(simb::MCParticle&& part) { fPartList.push_back(std::move(part)); }
83 
85  const std::string &genVersion,
86  const std::unordered_map<std::string, std::string>& genConfig)
87 {
88  fGenInfo = simb::MCGeneratorInfo(generator, genVersion, genConfig);
89 }
90 
91 #endif //SIMB_MCTRUTH_H
92 ////////////////////////////////////////////////////////////////////////
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:82
std::string string
Definition: nybbler.cc:12
simb::Origin_t Origin() const
Definition: MCTruth.h:74
enum simb::_ev_origin Origin_t
event origin types
_ev_origin
event origin types
Definition: MCTruth.h:21
enum simb::_ev_generator Generator_t
generator used to produce event, if applicable
int NParticles() const
Definition: MCTruth.h:75
void SetNeutrino(int CCNC, int mode, int interactionType, int target, int nucleon, int quark, double w, double x, double y, double qsqr)
Definition: MCTruth.cxx:30
simb::MCNeutrino fMCNeutrino
reference to neutrino info - null if not a neutrino
Definition: MCTruth.h:39
simb::MCGeneratorInfo fGenInfo
information about the generator that produced this event
Definition: MCTruth.h:41
single particles thrown at the detector
Definition: MCTruth.h:26
const double a
def move(depos, offset)
Definition: depos.py:107
generator
Definition: train.py:468
Base utilities and modules for event generation and detector simulation.
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:76
simb::Origin_t fOrigin
origin for this event
Definition: MCTruth.h:40
friend std::ostream & operator<<(std::ostream &o, simb::MCTruth const &a)
Definition: MCTruth.cxx:70
void SetGeneratorInfo(simb::Generator_t generator, const std::string &genVersion, const std::unordered_map< std::string, std::string > &genConfig)
Definition: MCTruth.h:84
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
Supernova neutrinos.
Definition: MCTruth.h:25
list x
Definition: train.py:276
bool NeutrinoSet() const
Definition: MCTruth.h:78
Event generator information.
Definition: MCTruth.h:32
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:42
Event generator information.
Definition: MCNeutrino.h:18
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
const simb::MCGeneratorInfo & GeneratorInfo() const
Definition: MCTruth.h:73