21 for(
auto const&
id : pset.
get<std::vector<int> >(
"SavePathPDGList"))
41 unsigned int result = this->at(part_index)._mother;
43 if(!result)
return this->at(part_index)._track_id;
49 unsigned int daughter_id = this->at(part_index)._track_id;
51 for(
auto const&
part : *
this) {
53 if(
part._daughters.find(daughter_id) !=
part._daughters.end())
55 return part._track_id;
67 if((*
this)[part_index]._ancestor !=
kINVALID_UINT)
return (*
this)[part_index]._ancestor;
71 if(result == this->at(part_index)._track_id)
return result;
73 if(!result)
return this->at(part_index)._track_id;
83 if(new_result == this->at(mother_index)._track_id)
break;
90 auto const old_result = result;
91 for(
auto const& p : *
this) {
93 if(p._daughters.find(result) != p._daughters.end()) {
98 if(result == old_result)
106 (*this)[part_index]._ancestor = result;
113 const double&
z)
const 123 const std::vector<simb::Origin_t>& orig_v)
126 if(orig_v.size() != mcp_v.size())
throw cet::exception(__FUNCTION__) <<
"MCParticle and Origin_t vector size not same!";
131 for(
size_t i=0; i < mcp_v.size(); ++i) {
133 auto const& mcp = mcp_v[i];
137 _track_index.insert(std::make_pair((
size_t)(mcp.TrackId()),(
size_t)(this->size())));
141 auto& mini_mcp = (*this->rbegin());
143 for(
size_t i=0; i<(size_t)(mcp.NumberDaughters()); ++i)
144 mini_mcp._daughters.insert(mcp.Daughter(i));
146 mini_mcp._track_id = mcp.TrackId();
147 mini_mcp._pdgcode = mcp.PdgCode();
148 mini_mcp._mother = mcp.Mother();
149 mini_mcp._process = mcp.Process();
150 mini_mcp._start_vtx = mcp.Position();
151 mini_mcp._start_mom = mcp.Momentum();
152 mini_mcp._end_vtx = mcp.EndPosition();
153 mini_mcp._end_mom = mcp.EndMomentum();
154 mini_mcp._origin = orig_v[i];
157 for(
size_t i=0; i<4; ++i) {
158 mini_mcp._start_mom[i] *= 1.e3;
159 mini_mcp._end_mom[i] *= 1.e3;
172 std::set<size_t> det_path_index;
174 for(
size_t i=0; i<mcp.NumberTrajectoryPoints(); ++i) {
178 det_path_index.insert(i);
182 if(det_path_index.size()) {
183 if( (*det_path_index.begin()) )
184 det_path_index.insert( (*det_path_index.begin())-1 );
185 if( det_path_index.size()>1 ) {
186 if( ((*det_path_index.rbegin())+1) < mcp.NumberTrajectoryPoints() )
187 det_path_index.insert( (*det_path_index.rbegin())+1 );
189 mini_mcp._det_path.reserve(det_path_index.size());
190 for(
auto const& index : det_path_index) {
192 TLorentzVector vec(mcp.Momentum(index));
193 for(
size_t i=0; i<4; ++i) vec[i] *= 1.e3;
195 mini_mcp._det_path.push_back(std::make_pair(mcp.Position(index),vec));
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
unsigned int MotherTrackID(const unsigned int part_index) const
std::map< unsigned int, unsigned int > _track_index
Track ID => Index Map.
unsigned int AncestorTrackID(const unsigned int part_index)
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
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
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
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
cet::coded_exception< error, detail::translate > exception