Skip to content

Commit

Permalink
Merge pull request #104 from EmanuelPerez/master
Browse files Browse the repository at this point in the history
Minor fixes in a few methods of MCParticle, to improve the robustness…
  • Loading branch information
clementhelsens authored Jul 29, 2021
2 parents 56a42b8 + f801a13 commit 1703add
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion analyzers/dataframe/MCParticle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ ROOT::VecOps::RVec<int> MCParticle::get_parentid(ROOT::VecOps::RVec<int> mcind,
// returns one MCParticle selected by its index in the particle block
edm4hep::MCParticleData MCParticle::sel_byIndex( int idx, ROOT::VecOps::RVec<edm4hep::MCParticleData> in) {
edm4hep::MCParticleData dummy;
if ( idx < in.size() ) {
if ( idx >= 0 && idx < in.size() ) {
return in.at(idx) ;
}
else {
Expand All @@ -454,6 +454,8 @@ std::vector<int> MCParticle::get_list_of_stable_particles_from_decay( int i, ROO
// returns a vector with the indices (in the Particle block) of the stable daughters of the particle i,
// from the complete decay chain.

if ( i < 0 || i >= in.size() ) return res;

int db = in.at(i).daughters_begin ;
int de = in.at(i).daughters_end;

Expand Down Expand Up @@ -486,6 +488,8 @@ std::vector<int> MCParticle::get_list_of_particles_from_decay(int i, ROOT::VecOp

// returns a vector with the indices (in the Particle block) of the daughters of the particle i

if ( i < 0 || i >= in.size() ) return res;

int db = in.at(i).daughters_begin ;
int de = in.at(i).daughters_end;
if ( db == de ) return res; // particle is stable
Expand Down

0 comments on commit 1703add

Please sign in to comment.