Skip to content

Commit ad8cdc5

Browse files
Merge pull request #50 from sindhu-ku/neutrino_info
Modify neutrino class to add flow variables
2 parents 2785f06 + b4fd656 commit ad8cdc5

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

larcv/core/DataFormat/Neutrino.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace larcv {
1313
{
1414
std::stringstream ss;
1515
std::stringstream buf;
16-
ss << " \033[95m" << "Neutrino " << " (PdgCode,TrackID) = (" << pdg_code() << "," << nu_track_id() << ")\033[00m " << std::endl;
16+
ss << " \033[95m" << "Neutrino " << " (PdgCode,TrackID) = (" << pdg_code() << "," << track_id() << ")\033[00m " << std::endl;
1717
buf << " ";
1818

1919
ss << buf.str() << "Vertex (x, y, z, t) = (" << x() << "," << y() << "," << z() << "," << t() << ")" << std::endl

larcv/core/DataFormat/Neutrino.h

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ namespace larcv {
3030

3131
/// Default constructor
3232
Neutrino()
33-
: _id (kINVALID_INDEX)
33+
: _id (kINVALID_INDEX)
34+
, _genid (kINVALID_INDEX)
3435
, _mcst_index (kINVALID_INDEX)
3536
, _mct_index (kINVALID_INDEX)
36-
, _nu_trackid (kINVALID_UINT)
37+
, _trackid (kINVALID_UINT)
3738
, _lepton_trackid (kINVALID_UINT)
3839
, _current_type (-1)
3940
, _interaction_mode (-1)
@@ -45,12 +46,16 @@ namespace larcv {
4546
, _x (0.)
4647
, _y (0.)
4748
, _qsqr (0.)
49+
, _q0 (0.)
50+
, _q3 (0.)
4851
//, _pt (0.)
4952
, _theta (0.)
5053
, _pdg (0)
54+
, _lepton_pdg (0)
5155
, _px (0.)
5256
, _py (0.)
5357
, _pz (0.)
58+
, _lepton_p (0.)
5459
, _dist_travel (-1)
5560
, _energy_init (0.)
5661
, _energy_deposit (0.)
@@ -61,7 +66,9 @@ namespace larcv {
6166
/// Default destructor
6267
~Neutrino(){}
6368
/// particle's ID getter
64-
inline InstanceID_t id () const { return _id; }
69+
inline InstanceID_t id () const { return _id; }
70+
inline InstanceID_t gen_id () const { return _genid; }
71+
6572
// origin/generator info getter
6673
inline MCSTIndex_t mcst_index () const { return _mcst_index; }
6774
inline MCTIndex_t mct_index () const { return _mct_index; }
@@ -72,18 +79,22 @@ namespace larcv {
7279
inline int nucleon () const { return _nucleon; }
7380
inline int quark () const { return _quark; }
7481
inline double momentum_transfer () const { return _qsqr; }
82+
inline double momentum_transfer_mag () const { return _q3; }
83+
inline double energy_transfer () const { return _q0; }
7584
inline double bjorken_x () const { return _x; }
7685
inline double hadronic_invariant_mass () const { return _w; }
7786
inline double inelasticity () const { return _y; }
7887
inline double theta () const { return _theta; }
7988

8089
// particle's info getter
81-
inline unsigned int nu_track_id () const { return _nu_trackid; }
90+
inline unsigned int track_id () const { return _trackid; }
8291
inline unsigned int lepton_track_id () const { return _lepton_trackid; }
8392
inline int pdg_code () const { return _pdg; }
93+
inline int lepton_pdg_code () const { return _lepton_pdg; }
8494
inline double px () const { return _px; }
8595
inline double py () const { return _py; }
8696
inline double pz () const { return _pz; }
97+
inline double lepton_p () const { return _lepton_p; }
8798
//inline double pt () const { return _pt; }
8899
inline double p () const { return sqrt(pow(_px,2)+pow(_py,2)+pow(_pz,2)); }
89100
inline const larcv::Vertex& position() const { return _vtx; }
@@ -110,7 +121,8 @@ namespace larcv {
110121
// Setters
111122
//
112123
// generator/origin info setter
113-
inline void id (InstanceID_t id ) { _id = id; }
124+
inline void id (InstanceID_t id ) { _id = id; }
125+
inline void gen_id (InstanceID_t genid ) { _genid = genid; }
114126
inline void mcst_index (MCSTIndex_t id ) { _mcst_index = id; }
115127
inline void mct_index (MCTIndex_t id ) { _mct_index = id; }
116128
inline void current_type (short curr) {_current_type = curr; }
@@ -120,19 +132,23 @@ namespace larcv {
120132
inline void nucleon (int nucleon) { _nucleon = nucleon; }
121133
inline void quark (int quark) { _quark = quark; }
122134
inline void momentum_transfer (double q2) { _qsqr = q2; }
135+
inline void momentum_transfer_mag (double q3) { _q3 = q3; }
136+
inline void energy_transfer (double q0) { _q0 = q0; }
123137
inline void bjorken_x (double x) { _x = x; }
124138
inline void hadronic_invariant_mass (double w) { _w = w; }
125139
inline void inelasticity (double y) { _y = y; }
126140
inline void theta (double theta) { _theta = theta; }
127141

128142
// particle's info setter
129-
inline void nu_track_id (unsigned int id ) { _nu_trackid = id; }
130-
inline void lepton_track_id (unsigned int id ) { _nu_trackid = id; }
143+
inline void track_id (unsigned int id ) { _trackid = id; }
144+
inline void lepton_track_id (unsigned int id ) { _lepton_trackid = id; }
131145
inline void pdg_code (int code) { _pdg = code; }
146+
inline void lepton_pdg_code (int code) { _lepton_pdg = code; }
132147
inline void momentum (double px, double py, double pz) { _px = px; _py = py; _pz = pz; }
148+
inline void lepton_p (double lepton_p) {_lepton_p = lepton_p; }
133149
inline void position (const larcv::Vertex& vtx) { _vtx = vtx; }
134150
inline void position (double x, double y, double z, double t) { _vtx = Vertex(x,y,z,t); }
135-
inline void distance_travel ( double dist ) { _dist_travel = dist; }
151+
inline void distance_travel (double dist ) { _dist_travel = dist; }
136152
inline void energy_init (double e) { _energy_init = e; }
137153
inline void energy_deposit (double e) { _energy_deposit = e; }
138154
inline void creation_process (const std::string& proc) { _process = proc; }
@@ -150,13 +166,13 @@ namespace larcv {
150166
std::string dump() const;
151167

152168
private:
153-
154-
InstanceID_t _id; ///< "ID" of this particle in ParticleSet collection
169+
InstanceID_t _id; ///< "ID" of interaction, unique inside the file
170+
InstanceID_t _genid; ///Original generator ID, if different from Geant4 one (e.g.: GENIE particle ID)
155171
/// index number in the origin MCShower/MCTrack container array (kINVALID_USHORT if neither)
156172
MCSTIndex_t _mcst_index;
157173
///< index number in the origin MCTruth container array (kINVALID_USHORT if MCShower/MCTrack)
158174
MCTIndex_t _mct_index;
159-
unsigned int _nu_trackid; ///< Geant4 track id
175+
unsigned int _trackid; ///< Geant4 track id
160176
unsigned int _lepton_trackid;
161177
short _current_type; ///< if neutrino, shows interaction GENIE current type. else kINVALID_USHORT
162178
short _interaction_mode; ///< if neutrino, shows interaction GENIE mode (QE / 1-pi / DIS / ...)
@@ -167,12 +183,16 @@ namespace larcv {
167183
double _w;
168184
double _x; ///< if neutrino, Bjorken variable x
169185
double _y;
170-
double _qsqr; ///< if neutrino, momentum transfer Q^2
186+
double _qsqr; ///< if neutrino, momentum transfer Q^2 [MeV]
187+
double _q3; ///< Maginitude of momentum transfer [MeV]
188+
double _q0; ///< Energy transfer [MeV]
171189
double _theta;
172190
//double _pt;
173191

174192
int _pdg; ///< PDG code
193+
int _lepton_pdg; ///< PDG code of the outgoing lepton
175194
double _px,_py,_pz; ///< (x,y,z) component of particle's initial momentum
195+
double _lepton_p; // outgoing lepton momentum
176196
Vertex _vtx; ///< (x,y,z,t) of particle's vertex information
177197
double _dist_travel; ///< filled only if MCTrack origin: distance measured along the trajectory
178198
double _energy_init; ///< initial energy of the particle

0 commit comments

Comments
 (0)