25 for(
auto const&
id : pset.
get<std::vector<int> >(
"SavePathPDGList"))
33 _x_min = std::min_element(geo->
begin_TPC(), geo->
end_TPC(), [](
auto const &lhs,
auto const &rhs){
return lhs.BoundingBox().MinX() < rhs.BoundingBox().MinX();})->MinX();
34 _y_min = std::min_element(geo->
begin_TPC(), geo->
end_TPC(), [](
auto const &lhs,
auto const &rhs){
return lhs.BoundingBox().MinY() < rhs.BoundingBox().MinY();})->MinY();
35 _z_min = std::min_element(geo->
begin_TPC(), geo->
end_TPC(), [](
auto const &lhs,
auto const &rhs){
return lhs.BoundingBox().MinZ() < rhs.BoundingBox().MinZ();})->MinZ();
36 _x_max = std::max_element(geo->
begin_TPC(), geo->
end_TPC(), [](
auto const &lhs,
auto const &rhs){
return lhs.BoundingBox().MaxX() < rhs.BoundingBox().MaxX();})->MaxX();
37 _y_max = std::max_element(geo->
begin_TPC(), geo->
end_TPC(), [](
auto const &lhs,
auto const &rhs){
return lhs.BoundingBox().MaxY() < rhs.BoundingBox().MaxY();})->MaxY();
38 _z_max = std::max_element(geo->
begin_TPC(), geo->
end_TPC(), [](
auto const &lhs,
auto const &rhs){
return lhs.BoundingBox().MaxZ() < rhs.BoundingBox().MaxZ();})->MaxZ();
47 unsigned int result = this->at(part_index)._mother;
49 if(!result)
return this->at(part_index)._track_id;
55 unsigned int daughter_id = this->at(part_index)._track_id;
57 for(
auto const& part : *
this) {
59 if(part._daughters.find(daughter_id) != part._daughters.end())
61 return part._track_id;
73 if((*
this)[part_index]._ancestor !=
kINVALID_UINT)
return (*
this)[part_index]._ancestor;
77 if(result == this->at(part_index)._track_id)
return result;
79 if(!result)
return this->at(part_index)._track_id;
89 if(new_result == this->at(mother_index)._track_id)
break;
96 auto const old_result =
result;
97 for(
auto const&
p : *
this) {
99 if(
p._daughters.find(result) !=
p._daughters.end()) {
100 result =
p._track_id;
104 if(result == old_result)
112 (*this)[part_index]._ancestor =
result;
119 const double&
z)
const 129 const std::vector<simb::Origin_t>& orig_v)
132 if(orig_v.size() != mcp_v.size())
throw cet::exception(__FUNCTION__) <<
"MCParticle and Origin_t vector size not same!";
137 for(
size_t i=0; i < mcp_v.size(); ++i) {
139 auto const& mcp = mcp_v[i];
143 _track_index.insert(std::make_pair((
size_t)(mcp.TrackId()),(
size_t)(this->
size())));
147 auto& mini_mcp = (*this->rbegin());
149 for(
size_t i=0; i<(size_t)(mcp.NumberDaughters()); ++i)
150 mini_mcp._daughters.insert(mcp.Daughter(i));
152 mini_mcp._track_id = mcp.TrackId();
153 mini_mcp._pdgcode = mcp.PdgCode();
154 mini_mcp._mother = mcp.Mother();
155 mini_mcp._process = mcp.Process();
156 mini_mcp._start_vtx = mcp.Position();
157 mini_mcp._start_mom = mcp.Momentum();
158 mini_mcp._end_vtx = mcp.EndPosition();
159 mini_mcp._end_mom = mcp.EndMomentum();
160 mini_mcp._origin = orig_v[i];
163 for(
size_t i=0; i<4; ++i) {
164 mini_mcp._start_mom[i] *= 1.e3;
165 mini_mcp._end_mom[i] *= 1.e3;
178 std::set<size_t> det_path_index;
180 for(
size_t i=0; i<mcp.NumberTrajectoryPoints(); ++i) {
184 det_path_index.insert(i);
188 if(det_path_index.size()) {
189 if( (*det_path_index.begin()) )
190 det_path_index.insert( (*det_path_index.begin())-1 );
191 if( det_path_index.size()>1 ) {
192 if( ((*det_path_index.rbegin())+1) < mcp.NumberTrajectoryPoints() )
193 det_path_index.insert( (*det_path_index.rbegin())+1 );
195 mini_mcp._det_path.reserve(det_path_index.size());
196 for(
auto const&
index : det_path_index) {
198 TLorentzVector vec(mcp.Momentum(
index));
199 for(
size_t i=0; i<4; ++i) vec[i] *= 1.e3;
201 mini_mcp._det_path.push_back(std::make_pair(mcp.Position(
index),vec));
double _z_max
z-max of volume box used to determine whether to save track information
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.
art framework interface to geometry description
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
double _z_min
z-min of volume box used to determine whether to save track information
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
unsigned int AncestorTrackID(const unsigned int part_index)
MCRecoPart(fhicl::ParameterSet const &pset)
Default constructor with fhicl parameters.
void AddParticles(const std::vector< simb::MCParticle > &mcp_v, const std::vector< simb::Origin_t > &orig_v)
T get(std::string const &key) const
Code to link reconstructed objects back to the MC truth information.
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
Access the description of detector geometry.
vector< vector< double > > clear
LArSoft geometry interface.
bool InDetector(const double &x, const double &y, const double &z) const
unsigned int TrackToParticleIndex(const unsigned int track_id) const
cet::coded_exception< error, detail::translate > exception
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.