Skip to content
Snippets Groups Projects

EDM4hep: mcparticles -> MCParticles

Merged Wouter Deconinck requested to merge edm4hep-mcparticles into master
1 file
+ 25
20
Compare changes
  • Side-by-side
  • Inline
@@ -2,13 +2,15 @@
#include "TCanvas.h"
#include "TLegend.h"
#include "TH1D.h"
#include "THStack.h"
#include "TProfile.h"
#include "Math/Vector4D.h"
#include <iostream>
R__LOAD_LIBRARY(libJugBase.so)
R__LOAD_LIBRARY(libeicd.so)
R__LOAD_LIBRARY(libDD4pod.so)
#include "dd4pod/Geant4ParticleCollection.h"
#include "edm4hep/MCParticleCollection.h"
#include "eicd/TrackParametersCollection.h"
#include "eicd/ClusterCollection.h"
#include "eicd/ClusterData.h"
@@ -26,10 +28,10 @@ auto p_track = [](std::vector<eic::TrackParametersData> const& in) {
};
std::vector<float> pt (std::vector<dd4pod::Geant4ParticleData> const& in){
std::vector<float> pt (std::vector<edm4hep::MCParticleData> const& in){
std::vector<float> result;
for (size_t i = 0; i < in.size(); ++i) {
result.push_back(std::sqrt(in[i].ps.x * in[i].ps.x + in[i].ps.y * in[i].ps.y));
result.push_back(std::sqrt(in[i].momentum.x * in[i].momentum.x + in[i].momentum.y * in[i].momentum.y));
}
return result;
}
@@ -48,11 +50,11 @@ auto theta = [](std::vector<ROOT::Math::PxPyPzMVector> const& in) {
}
return result;
};
auto fourvec = [](ROOT::VecOps::RVec<dd4pod::Geant4ParticleData> const& in) {
auto fourvec = [](ROOT::VecOps::RVec<edm4hep::MCParticleData> const& in) {
std::vector<ROOT::Math::PxPyPzMVector> result;
ROOT::Math::PxPyPzMVector lv;
for (size_t i = 0; i < in.size(); ++i) {
lv.SetCoordinates(in[i].ps.x, in[i].ps.y, in[i].ps.z, in[i].mass);
lv.SetCoordinates(in[i].momentum.x, in[i].momentum.y, in[i].momentum.z, in[i].mass);
result.push_back(lv);
}
return result;
@@ -87,11 +89,11 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root")
ROOT::EnableImplicitMT();
ROOT::RDataFrame df("events", fname);
auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1")
.Define("thrownParticles", "mcparticles[isThrown]")
auto df0 = df.Define("isThrown", "MCParticles.generatorStatus == 1")
.Define("thrownParticles", "MCParticles[isThrown]")
.Define("thrownP", fourvec, {"thrownParticles"})
.Define("nThrown", "thrownParticles.size()")
.Define("nProto", "outputProtoTracks.size()")
.Define("nProto", "nProtoTracks")
.Define("p_thrown", momentum, {"thrownP"})
.Define("theta_thrown", theta, {"thrownP"})
.Define("theta0", "theta_thrown[0]")
Loading