12 #include <analysis/modules/TrackingSystematics/TrackingSystematics.h>
15 #include <analysis/dataobjects/Particle.h>
16 #include <analysis/dataobjects/ParticleList.h>
18 #include <framework/datastore/StoreObjPtr.h>
31 R
"DOC(Module to remove tracks from the lists at random. Include in your code as
35 mypath.add_module("TrackingEfficiency", particleLists=['pi+:cut'], frac=0.01)
37 The module modifies the input particleLists by randomly removing tracks with the probability frac.
42 addParam(
"frac",
m_frac,
"probability to remove the particle", 0.0);
48 std::map <unsigned, bool> indexToRemove;
55 B2ERROR(
"ParticleList " << iList <<
" not found");
60 B2ERROR(
"The provided particlelist " << iList <<
" does not contain track-based particles.");
63 std::vector<unsigned int> toRemove;
64 size_t nPart = particleList->getListSize();
65 for (
size_t iPart = 0; iPart < nPart; iPart++) {
66 auto particle = particleList->getParticle(iPart);
67 unsigned mdstIndex = particle->getMdstArrayIndex();
69 if (indexToRemove.find(mdstIndex) != indexToRemove.end()) {
71 remove = indexToRemove.at(mdstIndex);
74 auto prob = gRandom->Uniform();
76 indexToRemove.insert(std::pair{mdstIndex, remove});
78 if (remove) toRemove.push_back(particle->getArrayIndex());
80 particleList->removeParticles(toRemove);
87 R
"DOC(Module to modify momentum of tracks from the lists. Include in your code as
91 mypath.add_module("TrackingMomentum", particleLists=['pi+:cut'], scale=0.999)
93 The module modifies the input particleLists by scaling track momenta as given by the parameter scale
97 addParam(
"particleLists", m_ParticleLists,
"input particle lists");
98 addParam(
"scale", m_scale,
"scale factor to be applied to 3-momentum", 0.999);
108 B2ERROR(
"ParticleList " << iList <<
" not found");
113 B2ERROR(
"The provided particlelist " << iList <<
" does not contain track-based particles.");
116 size_t nPart = particleList->getListSize();
117 for (
size_t iPart = 0; iPart < nPart; iPart++) {
118 auto particle = particleList->getParticle(iPart);
120 double m = particle->getMass();
121 TVector3 p =
m_scale * particle->getMomentum();
122 double e = sqrt(p.Mag2() + m * m);
123 particle->set4Vector(TLorentzVector(p, e));