20 : _x_max{std::numeric_limits<double>::min()}
21 ,
_x_min{std::numeric_limits<double>::max()}
22 ,
_y_max{std::numeric_limits<double>::min()}
23 ,
_y_min{std::numeric_limits<double>::max()}
24 ,
_z_max{std::numeric_limits<double>::min()}
25 ,
_z_min{std::numeric_limits<double>::max()}
26 ,
_trackIDOffsets{pset.get<std::vector<unsigned int>>(
"TrackIDOffsets", {0})}
31 for (
auto const&
id : pset.get<std::vector<int>>(
"SavePathPDGList"))
41 _x_min = std::min(_x_min, tpc.BoundingBox().MinX());
42 _y_max = std::max(_y_max, tpc.BoundingBox().MaxY());
43 _y_min = std::min(_y_min, tpc.BoundingBox().MinY());
44 _z_max = std::max(_z_max, tpc.BoundingBox().MaxZ());
45 _z_min = std::min(_z_min, tpc.BoundingBox().MinZ());
55 unsigned int result = this->at(part_index)._mother;
59 if (result == offset)
return this->at(part_index)._track_id;
66 unsigned int daughter_id = this->at(part_index)._track_id;
68 for (
auto const&
part : *
this) {
70 if (
part.HasDaughter(daughter_id))
return part._track_id;
81 if ((*
this)[part_index]._ancestor !=
kINVALID_UINT)
return (*
this)[part_index]._ancestor;
85 if (result == this->at(part_index)._track_id)
return result;
89 if (result == offset)
return this->at(part_index)._track_id;
100 if (new_result == this->at(mother_index)._track_id)
break;
107 auto const old_result = result;
108 for (
auto const& p : *
this) {
110 if (p.HasDaughter(result)) {
111 result = p._track_id;
115 if (result == old_result)
break;
121 (*this)[part_index]._ancestor = result;
134 const std::vector<simb::Origin_t>& orig_v,
135 const std::vector<simb::MCParticle>& mcmp_v)
138 if (orig_v.size() != mcp_v.size())
139 throw cet::exception(__FUNCTION__) <<
"MCParticle and Origin_t vector size not same!";
144 for (
size_t i = 0; i < mcp_v.size(); ++i) {
146 auto const& mcp = mcp_v[i];
150 _track_index.insert(std::make_pair((
size_t)(mcp.TrackId()), (
size_t)(this->
size())));
156 auto& mini_mcp = (*this->rbegin());
158 for (
size_t i = 0; i < (size_t)(mcp.NumberDaughters()); ++i) {
159 mini_mcp.AddDaughter(mcp.Daughter(i));
161 mini_mcp._origin = orig_v[i];
165 std::set<size_t> det_path_index;
167 for (
size_t i = 0; i < mcp.NumberTrajectoryPoints(); ++i) {
169 if (
InDetector(mcp.Vx(i), mcp.Vy(i), mcp.Vz(i))) det_path_index.insert(i);
172 if (det_path_index.size()) {
173 if ((*det_path_index.begin())) det_path_index.insert((*det_path_index.begin()) - 1);
174 if (det_path_index.size() > 1) {
175 if (((*det_path_index.rbegin()) + 1) < mcp.NumberTrajectoryPoints())
176 det_path_index.insert((*det_path_index.rbegin()) + 1);
178 std::vector<std::pair<TLorentzVector, TLorentzVector>> det_path;
179 det_path.reserve(det_path_index.size());
180 for (
auto const& index : det_path_index) {
182 TLorentzVector vec(mcp.Momentum(index));
183 for (
size_t i = 0; i < 4; ++i)
186 det_path.emplace_back(mcp.Position(index), vec);
188 mini_mcp._det_path = std::move(det_path);
194 for (
auto const& mcmp : mcmp_v) {
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
double _z_max
z-max of volume box used to determine whether to save track information
Geometry information for a single TPC.
unsigned int MotherTrackID(const unsigned int part_index) const
double _y_max
y-max of volume box used to determine whether to save track information
double _y_min
y-min of volume box used to determine whether to save track information
std::map< unsigned int, unsigned int > _track_index
Track ID => Index Map.
void AddParticles(const std::vector< simb::MCParticle > &mcp_v, const std::vector< simb::Origin_t > &orig_v, const std::vector< simb::MCParticle > &mcmp_v={})
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Access the description of detector geometry.
double _z_min
z-min of volume box used to determine whether to save track information
std::vector< unsigned int > _trackIDOffsets
Track ID offsets for different MCTruths.
unsigned int AncestorTrackID(const unsigned int part_index)
MCRecoPart(fhicl::ParameterSet const &pset)
Default constructor with fhicl parameters.
double _x_max
x-max of volume box used to determine whether to save track information
double _x_min
x-min of volume box used to determine whether to save track information
std::set< int > _pdg_list
PDG code list for which particle's trajectory within the detector is saved.
const unsigned int kINVALID_UINT
Namespace collecting geometry-related classes utilities.
bool InDetector(const double &x, const double &y, const double &z) const
unsigned int TrackToParticleIndex(const unsigned int track_id) const
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception