Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding of a function to obtain MC indices array and a parents tuples … #112

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion analyzers/dataframe/MCParticle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ ROOT::VecOps::RVec<int> MCParticle::get_parentid(ROOT::VecOps::RVec<int> mcind,
return result;
}


// ----------------------------------------------------------------------------------------------------------------------------------

// returns one MCParticle selected by its index in the particle block
Expand Down Expand Up @@ -676,9 +675,20 @@ ROOT::VecOps::RVec<float> MCParticle::AngleBetweenTwoMCParticles( ROOT::VecOps::
}

return result;
}

ROOT::VecOps::RVec<edm4hep::MCParticleData> MCParticle::get_subMC(ROOT::VecOps::RVec<int> index, ROOT::VecOps::RVec<edm4hep::MCParticleData> in){
ROOT::VecOps::RVec<edm4hep::MCParticleData> result;
for (size_t i = 0; i < index.size(); ++i) {
if (index[i]>-1)
result.push_back(in.at(index[i]));
//else
// std::cout << "electron index negative " << index[i]<<std::endl;
}
return result;
}





6 changes: 4 additions & 2 deletions analyzers/dataframe/MCParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ namespace MCParticle{
bool m_chargeconjugate = true;
ROOT::VecOps::RVec<edm4hep::MCParticleData> operator() (ROOT::VecOps::RVec<edm4hep::MCParticleData> in);
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 2 spaces



/// get MC history tree for a given MCParticle index
struct get_tree{
Expand Down Expand Up @@ -91,7 +93,6 @@ namespace MCParticle{
ROOT::VecOps::RVec<edm4hep::MCParticleData> in ,
ROOT::VecOps::RVec<int> ind);


/// return the parent index of a given list of MC particles
ROOT::VecOps::RVec<int> get_parentid(ROOT::VecOps::RVec<int> mcind, ROOT::VecOps::RVec<edm4hep::MCParticleData> mc, ROOT::VecOps::RVec<int> parents);

Expand Down Expand Up @@ -200,7 +201,8 @@ namespace MCParticle{
ROOT::VecOps::RVec<edm4hep::MCParticleData> in,
ROOT::VecOps::RVec<int> ind) ;


/// return a sub list of MCParticles from a given list of indices
ROOT::VecOps::RVec<edm4hep::MCParticleData> get_subMC(ROOT::VecOps::RVec<int> index, ROOT::VecOps::RVec<edm4hep::MCParticleData> in);


}
Expand Down