8#include <tracking/modules/recoTrackParticleLoader/RecoTrackParticleLoaderModule.h>
10#include <framework/geometry/B2Vector3.h>
12#include <TMatrixDSym.h>
24 "Takes fitted RecoTracks and creates Particles from them directly, skipping the step of creating Tracks and TrackFitResults.");
32 "PDG code of the hypothesis of the output Particles",
m_pdgCode);
44 extraInfo.registerInDataStore();
55 if (!recoTrack.wasFitSuccessful()) {
56 B2DEBUG(20,
"Skipping unfitted RecoTrack.");
59 auto rep = recoTrack.getCardinalRepresentation();
60 int pdg = rep->getPDG();
61 auto firstHit = recoTrack.getMeasuredStateOnPlaneFromFirstHit(rep);
62 genfit::MeasuredStateOnPlane extrapolatedMSoP = firstHit;
66 B2WARNING(
"Could not extrapolate the fit result for pdg " << pdg <<
67 " to the IP. Why, I don't know.");
73 extrapolatedMSoP.getPosMomCov(pos, mom, cov);
74 double mass = rep->getMass(extrapolatedMSoP);
75 double charge = rep->getCharge(extrapolatedMSoP);
76 double E = std::sqrt(mom.x() * mom.x() + mom.y() * mom.y() + mom.z() * mom.z() + mass * mass);
77 double pValue = recoTrack.getTrackFitStatus(rep)->getPVal();
78 ROOT::Math::PxPyPzEVector lorentzMom(mom.x(), mom.y(), mom.z(),
E);
81 newPart->
setVertex(ROOT::Math::XYZVector(pos));
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class to store reconstructed particles.
void writeExtraInfo(const std::string &name, const double value)
Sets the user defined extraInfo.
void setVertex(const ROOT::Math::XYZVector &vertex)
Sets position (decay vertex)
void setPValue(double pValue)
Sets chi^2 probability of fit.
RecoTrackParticleLoaderModule()
Constructor.
std::string m_particleListName
Name of the particleList holding the output Particles.
void initialize() override
Require and register the datastore arrays.
void event() override
Build Particle array.
StoreArray< Particle > m_Particles
Particles StoreArray.
std::string m_recoTrackColName
Name of the collection holding the input RecoTracks.
StoreObjPtr< ParticleList > m_ParticleList
ParticleList StoreObjPtr.
int m_pdgCode
PDG code of the hypothesis of the output Particles.
StoreArray< RecoTrack > m_RecoTracks
RecoTracks StoreArray.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
T * appendNew()
Construct a new T object at the end of the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Type-safe access to single objects in the data store.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Abstract base class for different kinds of events.