forked from kvtsang/Supera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MCParticleTree.h
145 lines (115 loc) · 3.58 KB
/
MCParticleTree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
* \file MCParticleTree.h
*
* \ingroup MeatSlicer
*
* \brief Class def header for a class MCParticleTree
*
* @author kazuhiro
*/
/** \addtogroup MeatSlicer
@{*/
#ifndef MCPARTICLETREE_H
#define MCPARTICLETREE_H
#include <iostream>
#include "larcv/core/DataFormat/Vertex.h"
#include "larcv/core/DataFormat/Particle.h"
#include "FMWKInterface.h"
#include "larcv/core/Base/larcv_base.h"
namespace supera {
class MCNode {
public:
enum class SourceType_t {
kMCTrack,
kMCShower,
kUnknown
};
public:
MCNode() : origin(0)
, pdg(0)
, track_id(larcv::kINVALID_SIZE)
, start()
, end()
, source_index(larcv::kINVALID_SIZE)
, source_type(SourceType_t::kUnknown)
{}
~MCNode() {}
unsigned short origin;
int pdg;
size_t track_id;
larcv::Vertex start;
larcv::Vertex end;
size_t source_index;
SourceType_t source_type;
std::string dump() const;
};
class MCRoot : public MCNode {
public:
MCRoot() : MCNode()
, daughter_v()
{}
MCRoot(const MCNode& node) : MCNode(node)
, daughter_v()
{}
~MCRoot() {}
/// Check if supplied parent track id belongs to this tree
bool is_daughter(const size_t& parent_id) const;
/**
Check if supplied node belongs to this Root via 0) start-start, 1) end-start matching
*/
bool is_daughter(const larcv::Vertex& start) const;
/**
Compute the smallest positive dT among any particle in this tree and the provided node
*/
double dt(const MCNode& node) const;
std::vector<supera::MCNode> daughter_v;
//::larcv::Particle part;
};
/**
\class MCParticleTree
User defined class MCParticleTree ... these comments are used to generate
doxygen documentation!
*/
class MCParticleTree : public larcv::larcv_base {
public:
/// Default constructor
MCParticleTree() : larcv::larcv_base("MCParticleTree")
, _origin_filter(0)
{}
/// Default destructor
~MCParticleTree() {}
void configure(const Config_t& cfg)
{
set_verbosity((::larcv::msg::Level_t)(cfg.get<unsigned short>("Verbosity", logger().level())));
_dt_max = cfg.get<double>("DTMax");
}
void Register(const std::vector<supera::LArMCTrack_t>& mctrack_v,
const std::vector<supera::LArMCShower_t>& mcshower_v);
void FilterOrigin(unsigned short flag)
{ _origin_filter = flag; }
const std::vector<supera::MCRoot>& PrimaryArray() const
{ return _primary_v; }
void dump() const;
private:
std::vector<supera::MCRoot> _primary_v;
std::vector<int> _used_mctrack_v;
std::vector<int> _used_mcshower_v;
unsigned short _origin_filter;
double _dt_max;
MCNode FillNode(const supera::LArMCTrack_t& mct);
MCNode FillNode(const supera::LArMCShower_t& mcs);
size_t FindPrimary(const larcv::Vertex& start,
const size_t parent_id,
const size_t ancestor_id) const;
size_t FindPrimary(const size_t parent_id,
const size_t ancestor_id) const;
void DefinePrimary(const std::vector<supera::LArMCTrack_t>& mctrack_v,
const std::vector<supera::LArMCShower_t>& mcshower_v);
void DefineSecondary(const std::vector<supera::LArMCTrack_t>& mctrack_v,
const std::vector<supera::LArMCShower_t>& mcshower_v);
void EstimateSecondary(const std::vector<supera::LArMCTrack_t>& mctrack_v,
const std::vector<supera::LArMCShower_t>& mcshower_v);
};
}
#endif
/** @} */ // end of doxygen group