All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Event.hh
Go to the documentation of this file.
1 #ifndef __sbnanalysis_core_Event__
2 #define __sbnanalysis_core_Event__
3 
4 /**
5  * \file Event.hh
6  *
7  * The standard minimum output tree.
8  *
9  * This event structure is written out by every Processor subclass.
10  *
11  * Author: A. Mastbaum <mastbaum@uchicago.edu>, 2018/01/25
12  */
13 
14 #include <map>
15 #include <string>
16 #include <vector>
17 //#include <TTree.h>
18 
19 #ifdef GEN_FLATRECORD_CONTEXT
20 namespace event{
21  struct TVector3{TVector3(){}TVector3(double,double,double){}float x; float y; float z;};
22  struct Pair{std::string first; std::vector<float> second;};
23 }
24 #else
25 #include <TVector3.h>
26 #endif
27 
28 #include "Experiment.hh"
29 
30 namespace event {
31 
32 static const int kUnfilled = -99999; //!< Value for unfilled variables
33 
34 /**
35  * \class Metadata
36  * \brief Event-level information
37  */
38 class Metadata {
39 public:
40  /** Constructor. */
42 
43  /** Reset members to defaults. */
44  void Init() {
45  run = kUnfilled;
46  subrun = kUnfilled;
48  }
49 
50  int run; //!< Run ID
51  int subrun; //!< Subrun ID
52  int eventID; //!< Event ID
53  int fileEntry; //!< Index of of file
54 };
55 
56 
57 /**
58  * \class Neutrino
59  * \brief Neutrino interaction information
60  */
61 class Neutrino {
62 public:
63  /** Constructor. */
65  : isnc(false), iscc(false), initpdg(0), pdg(0), targetPDG(0),
73 
74  bool isnc; //!< same as LArSoft "ccnc" - 0=CC, 1=NC
75  bool iscc; //!< CC (true) or NC/interference (false)
76  int initpdg; //!< Initial PDG code of probe neutrino
77  int pdg; //!< PDG code of probe neutrino
78  int targetPDG; //!< PDG code of struck target
79  int genie_intcode; //!< Interaction mode (as for LArSoft MCNeutrino::Mode() )
80  float bjorkenX; //!< Bjorken x
81  float inelasticityY; //!< Inelasticity y
82  float Q2; //!< Q squared
83  float q0; //!< q0, struck nucleon rest frame
84  float modq; //!< |q|, struck nucleon rest frame
85  float q0_lab; //!< q0, lab frame
86  float modq_lab; //!< |q|, lab frame
87  float w; //!< Hadronic invariant mass W
88  float t; //!< Kinematic t
89  float eccqe; //!< CCQE energy
90  float energy; //!< Neutrino energy (GeV)
91  TVector3 momentum; //!< Neutrino three-momentum
92  TVector3 position; //!< Neutrino interaction position
93  int parentPDG; //!< Parent hadron/muon PDG
94  int parentDecayMode; //!< Parent hadron/muon decay mode
95  TVector3 parentDecayVtx; //!< Parent hadron/muon decay vertex
96  float baseline; //!< Distance from decay to interaction
97 };
98 
99 
100 /**
101  * \class FinalStateParticle
102  * \brief Final state particle information
103  */
105 public:
106  /** Constructor. */
110 
111  /** GENIE status codes, see Framework/GHEP/GHepStatus.h for details */
112  enum GenieStatus {
125  };
126 
127  int pdg; //!< PDG Code
128  float energy; //!< Energy
129  TVector3 momentum; //!< Three-momentum
130  TVector3 start; //!< Start position in detector coords [cm]
131  TVector3 end; //!< End position in detector coords (may be outside of AV) [cm]
132 
133  /**
134  * Length of particle contained in the detector active volume [cm]
135  * Set to -1 if no Detector is defined through the ProviderManager
136  * Set to 0 for a particle that originates outside the detector active volume
137  */
139 
140  float length; //!< Total length of the energy depositions [cm]
141  bool is_primary; //!< Whether the process producing the particle was "primary"
142  int status_code; //!< Status code returned by GENIE (see GenieStatus enum)
143 };
144 
145 
146 /**
147  * \class Interaction
148  * \brief All truth information associated with one neutrino interaction
149  */
150 class Interaction {
151 public:
152  Neutrino neutrino; //!< The neutrino
153  FinalStateParticle lepton; //!< The primary final state lepton
154  std::vector<FinalStateParticle> finalstate; //!< Other final state particles
155  size_t nfinalstate; //!< Size of finalstate
156 
157  /**
158  * Event weights.
159  *
160  * This is a map from the weight calculator name to the list of weights
161  * for all the sampled universes.
162  */
163 #ifndef GEN_FLATRECORD_CONTEXT
164  std::map<std::string, std::vector<float> > weights;
165 #else
166  std::vector<Pair> weights;
167 #endif
168 
169  size_t index; //!< Index in the MCTruth
170 };
171 
172 
173 /**
174  * \class RecoInteraction
175  * \brief Contains truth level information and additional fields for
176  * selection-defined reconstruction information
177  */
179 public:
180  /** Default Constructor */
182  : truth_index(-1), reco_energy(kUnfilled), weight(1) {}
183 
184  /** Fill in truth information -- other fields set as in default */
185  explicit RecoInteraction(int tindex)
186  : truth_index(tindex), reco_energy(kUnfilled), weight(1) {}
187 
188  /**
189  * Index into the vector of truth interaction objects in the Event
190  * (same as the index into MCTruth objects). Equal to -1 if there is
191  * no corresponding truth interaction.
192  */
194 
195  float reco_energy; //!< Reconstructed neutrino energy [GeV]
196  float weight; //!< Selection-defined event weight
197  size_t index; //!< Index in the reco vector
198 };
199 
200 
201 /**
202  * \class RecoEvent
203  * \brief The reconstructed event data definition.
204  *
205  * An Event contains a single reconstructed neutrino with the corresponding
206  * truth information for the best-matched true neutrino, if available.
207  */
208 class RecoEvent {
209 public:
211  return truth.empty() ? NULL : &truth.at(0);
212  }
213 
214  Metadata metadata; //!< Event metadata
215  RecoInteraction reco; //!< Reconstructed interaction
216  std::vector<Interaction> truth; //!< Associated truth interaction
217  Experiment experiment; //!< Experiment identifier
218 };
219 
220 
221 /**
222  * \class Event
223  * \brief The standard event data definition.
224  *
225  * An Event contains all Monte Carlo events, with lists of all true
226  * and reconstructed neutrinos.
227  */
228 class Event {
229 public:
230  Metadata metadata; //!< Event metadata
231  size_t ntruth; //!< Size of truth
232  std::vector<Interaction> truth; //!< All truth interactions
233  size_t nreco; //!< Size of reco
234  std::vector<RecoInteraction> reco; //!< Reconstructed interactions
235  Experiment experiment; //!< Experiment identifier
236 };
237 
238 } // namespace event
239 
240 #endif // __sbnanalysis_core_Event__
241 
TVector3 momentum
Neutrino three-momentum.
Definition: Event.hh:91
process_name opflash particleana ie ie ie z
void Init()
Definition: Event.hh:44
Metadata metadata
Event metadata.
Definition: Event.hh:230
Experiment
Definition: Experiment.hh:13
TVector3 momentum
Three-momentum.
Definition: Event.hh:129
float energy
Energy.
Definition: Event.hh:128
int pdg
PDG Code.
Definition: Event.hh:127
process_name opflash particleana ie x
Final state particle information.
Definition: Event.hh:104
size_t index
Index in the reco vector.
Definition: Event.hh:197
FinalStateParticle lepton
The primary final state lepton.
Definition: Event.hh:153
int parentDecayMode
Parent hadron/muon decay mode.
Definition: Event.hh:94
Neutrino neutrino
The neutrino.
Definition: Event.hh:152
float Q2
Q squared.
Definition: Event.hh:82
TVector3 start
Start position in detector coords [cm].
Definition: Event.hh:130
int parentPDG
Parent hadron/muon PDG.
Definition: Event.hh:93
Interaction * GetTruth()
Definition: Event.hh:210
bool iscc
CC (true) or NC/interference (false)
Definition: Event.hh:75
RecoInteraction reco
Reconstructed interaction.
Definition: Event.hh:215
float length
Total length of the energy depositions [cm].
Definition: Event.hh:140
Experiment experiment
Experiment identifier.
Definition: Event.hh:217
The reconstructed event data definition.
Definition: Event.hh:208
size_t ntruth
Size of truth.
Definition: Event.hh:231
Event-level information.
Definition: Event.hh:38
int status_code
Status code returned by GENIE (see GenieStatus enum)
Definition: Event.hh:142
float modq_lab
|q|, lab frame
Definition: Event.hh:86
TVector3 end
End position in detector coords (may be outside of AV) [cm].
Definition: Event.hh:131
RecoInteraction(int tindex)
Definition: Event.hh:185
float t
Kinematic t.
Definition: Event.hh:88
int fileEntry
Index of of file.
Definition: Event.hh:53
Contains truth level information and additional fields for selection-defined reconstruction informati...
Definition: Event.hh:178
float reco_energy
Reconstructed neutrino energy [GeV].
Definition: Event.hh:195
process_name opflash particleana ie ie y
int eventID
Event ID.
Definition: Event.hh:52
float bjorkenX
Bjorken x.
Definition: Event.hh:80
float eccqe
CCQE energy.
Definition: Event.hh:89
float weight
Selection-defined event weight.
Definition: Event.hh:196
int targetPDG
PDG code of struck target.
Definition: Event.hh:78
bool is_primary
Whether the process producing the particle was &quot;primary&quot;.
Definition: Event.hh:141
std::vector< RecoInteraction > reco
Reconstructed interactions.
Definition: Event.hh:234
float inelasticityY
Inelasticity y.
Definition: Event.hh:81
float w
Hadronic invariant mass W.
Definition: Event.hh:87
Metadata metadata
Event metadata.
Definition: Event.hh:214
std::vector< Interaction > truth
Associated truth interaction.
Definition: Event.hh:216
size_t index
Index in the MCTruth.
Definition: Event.hh:169
float baseline
Distance from decay to interaction.
Definition: Event.hh:96
Experiment experiment
Experiment identifier.
Definition: Event.hh:235
The standard event data definition.
Definition: Event.hh:228
size_t nfinalstate
Size of finalstate.
Definition: Event.hh:155
float q0
q0, struck nucleon rest frame
Definition: Event.hh:83
float modq
|q|, struck nucleon rest frame
Definition: Event.hh:84
std::vector< FinalStateParticle > finalstate
Other final state particles.
Definition: Event.hh:154
float q0_lab
q0, lab frame
Definition: Event.hh:85
float energy
Neutrino energy (GeV)
Definition: Event.hh:90
TVector3 position
Neutrino interaction position.
Definition: Event.hh:92
Neutrino interaction information.
Definition: Event.hh:61
int pdg
PDG code of probe neutrino.
Definition: Event.hh:77
int subrun
Subrun ID.
Definition: Event.hh:51
int initpdg
Initial PDG code of probe neutrino.
Definition: Event.hh:76
size_t nreco
Size of reco.
Definition: Event.hh:233
All truth information associated with one neutrino interaction.
Definition: Event.hh:150
static const int kUnfilled
Value for unfilled variables.
Definition: Event.hh:32
int genie_intcode
Interaction mode (as for LArSoft MCNeutrino::Mode() )
Definition: Event.hh:79
TVector3 parentDecayVtx
Parent hadron/muon decay vertex.
Definition: Event.hh:95
bool isnc
same as LArSoft &quot;ccnc&quot; - 0=CC, 1=NC
Definition: Event.hh:74
std::map< std::string, std::vector< float > > weights
Definition: Event.hh:164
std::vector< Interaction > truth
All truth interactions.
Definition: Event.hh:232
int run
Run ID.
Definition: Event.hh:50