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& part);
54  const std::string & genVersion,
55  const std::unordered_map<std::string, std::string>& genConfig);
56  void SetOrigin(simb::Origin_t origin);
57  void SetNeutrino(int CCNC,
58  int mode,
59  int interactionType,
60  int target,
61  int nucleon,
62  int quark,
63  double w,
64  double x,
65  double y,
66  double qsqr);
67 
68  friend std::ostream& operator<< (std::ostream& o, simb::MCTruth const& a);
69  };
70 }
71 
73 inline simb::Origin_t simb::MCTruth::Origin() const { return fOrigin; }
74 inline int simb::MCTruth::NParticles() const { return (int)fPartList.size(); }
75 inline const simb::MCParticle& simb::MCTruth::GetParticle(int i) const { return fPartList[i]; }
76 inline const simb::MCNeutrino& simb::MCTruth::GetNeutrino() const { return fMCNeutrino; }
77 inline bool simb::MCTruth::NeutrinoSet() const { return fNeutrinoSet; }
78 
79 inline void simb::MCTruth::Add(simb::MCParticle& part) { fPartList.push_back(part); }
80 inline void simb::MCTruth::SetOrigin(simb::Origin_t origin) { fOrigin = origin; }
81 
83  const std::string &genVersion,
84  const std::unordered_map<std::string, std::string>& genConfig)
85 {
86  fGenInfo = simb::MCGeneratorInfo(generator, genVersion, genConfig);
87 }
88 
89 #endif //SIMB_MCTRUTH_H
90 ////////////////////////////////////////////////////////////////////////
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:76
const XML_Char * target
Definition: expat.h:268
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:80
simb::Origin_t Origin() const
Definition: MCTruth.h:73
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:74
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
void Add(simb::MCParticle &part)
Definition: MCTruth.h:79
simb::MCGeneratorInfo fGenInfo
information about the generator that produced this event
Definition: MCTruth.h:41
TString part[npart]
Definition: Style.C:32
single particles thrown at the detector
Definition: MCTruth.h:26
const double a
This class describes a particle created in the detector Monte Carlo simulation.
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:75
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:82
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Supernova neutrinos.
Definition: MCTruth.h:25
bool NeutrinoSet() const
Definition: MCTruth.h:77
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
Float_t w
Definition: plot.C:20
Cosmic rays.
Definition: MCTruth.h:24
Beam neutrinos.
Definition: MCTruth.h:23
const simb::MCGeneratorInfo & GeneratorInfo() const
Definition: MCTruth.h:72