9#include <analysis/modules/HelixErrorScaler/HelixErrorScalerModule.h>
11#include <analysis/DecayDescriptor/ParticleListName.h>
12#include <analysis/utility/ParticleCopy.h>
13#include <mdst/dataobjects/HitPatternCDC.h>
14#include <mdst/dataobjects/HitPatternVXD.h>
15#include <framework/datastore/RelationArray.h>
16#include <framework/gearbox/Const.h>
17#include <framework/geometry/B2Vector3.h>
19#include <Math/Vector3D.h>
38Creates a new charged particle list whose helix errors are scaled by constant factors.
39Different sets of scale factors are defined for tracks with/without a PXD hit.
40For tracks with a PXD hit, in order to avoid severe underestimation of d0 and z0 errors,
41lower limits (best resolution) can be set in a momentum-dependent form.
42The module also accepts a V0 Kshort particle list as input and applies the error correction to its daughters.
43Note the difference in impact parameter resolution between V0 daughters and tracks from IP,
44as V0 daughters are free from multiple scattering through the beam pipe.
48 addParam(
"inputListName",
m_inputListName,
"The name of input particle list (charged stable or V0 Kshort)", std::string(
""));
51 "vector of five scale factors for helix parameter errors (for tracks with a PXD hit)", {1.0, 1.0, 1.0, 1.0, 1.0});
53 "vector of five scale factors for helix parameter errors (for tracks without a PXD hit)", {1.0, 1.0, 1.0, 1.0, 1.0});
56 addParam(
"d0MomentumThreshold",
m_d0MomThr,
"d0 best resolution is kept constant below this momentum.", 0.0);
57 addParam(
"z0MomentumThreshold",
m_z0MomThr,
"z0 best resolution is kept constant below this momentum.", 0.0);
74 B2ERROR(
"Invalid input ParticleList PDG code (must be ChargedStable): " <<
m_pdgCode);
79 B2ERROR(
"Input and output particle list names are the same: " <<
m_inputListName);
117 for (
unsigned i = 0; i < nPar; i++) {
121 " contains a particle which is not from V0. It will not be copied to output list.");
126 B2ERROR(
"V0 particle should have exactly two daughters");
150 for (
unsigned i = 0; i < nPar; i++) {
172 if (mcCharged !=
nullptr) newCharged->
addRelationTo(mcCharged);
181 const std::vector<float> helix = trkfit->
getTau();
182 const std::vector<float> cov5 = trkfit->
getCov();
184 const double pvalue = trkfit->
getPValue();
187 const int ndf = trkfit->
getNDF();
190 std::vector<float> cov5_scaled;
191 unsigned int counter = 0;
192 for (
unsigned int j = 0; j < 5; j++) {
193 for (
unsigned int k = j; k < 5; k++) {
194 cov5_scaled.push_back(cov5[counter++] * scaleFactors[j] * scaleFactors[k]);
207 double sinTheta = TMath::Sin(p.Theta());
208 double pD0 = p.Mag2() / (particle->
getEnergy()) * TMath::Power(sinTheta, 1.5);
209 double pZ0 = pD0 * sinTheta;
218 std::vector<double> scaleFactors = { TMath::Max(d0Resol / d0Err,
m_scaleFactors_PXD[0]),
Provides a type-safe way to pass members of the chargedStableSet set.
The ParticleType class for identifying different particle types.
static const ParticleSet chargedStableSet
set of charged stable particles
static const ParticleType invalidParticle
Invalid particle, used internally.
static const ParticleType Kshort
K^0_S particle.
Represents a particle in the DecayDescriptor.
int getPDGCode() const
Return PDG code.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptorParticle * getMother() const
return mother.
bool m_scaleKshort
Whether the input particle list is Kshort or not.
StoreArray< TrackFitResult > m_trackfitresults
StoreArray of TrackFitResult objects.
std::vector< double > m_d0ResolPars
parameters (a,b) to define d0 best resolution = a (+) b / (p*beta*sinTheta**1.5)
StoreObjPtr< ParticleList > m_outputparticleList
StoreObjptr for output particlelist.
virtual void initialize() override
Register input and output data.
virtual void event() override
loop over the input charged particles
StoreArray< MCParticle > m_mcparticles
StoreArray of MCParticle objects.
double m_d0MomThr
d0 best resolution is kept constant below this momentum.
std::vector< double > m_scaleFactors_PXD
vector of five scale factors for helix parameter errors (for tracks with a PXD hit)
StoreArray< Particle > m_particles
StoreArray of Particle objects.
std::vector< double > getScaleFactors(const Particle *particle, const TrackFitResult *trkfit)
get scale factors
StoreArray< PIDLikelihood > m_pidlikelihoods
StoreArray of PIDLikelihood objects.
HelixErrorScalerModule()
Constructor: Sets the description, the properties and the parameters of the module.
const TrackFitResult * getTrackFitResultWithScaledError(const Particle *particle)
create a TrackFitResult with scaled errors
std::vector< double > m_z0ResolPars
parameters (a,b) to define z0 best resolution = a (+) b / (p*beta*sinTheta**2.5)
StoreObjPtr< ParticleList > m_inputparticleList
StoreObjptr for input charged particlelist.
Particle * getChargedWithScaledError(const Particle *particle)
create a Particle with scaled errors
StoreObjPtr< ParticleList > m_outputAntiparticleList
StoreObjptr for output antiparticlelist.
DecayDescriptor m_decaydescriptor
Decay descriptor of the charged particle.
double m_z0MomThr
z0 best resolution is kept constant below this momentum.
int m_pdgCode
PDG code of the charged particle to be scaled.
std::string m_outputAntiListName
output anti-particle list name
std::vector< double > m_scaleFactors_noPXD
vector of five scale factors for helix parameter errors (for tracks without a PXD hit)
std::string m_inputListName
The name of input charged particle list.
std::string m_outputListName
The name of output charged particle list.
ULong64_t getInteger() const
Getter for underlying integer type.
unsigned int getInteger() const
Getter for the underlying integer.
unsigned short getNPXDHits() const
Get total number of hits in the PXD.
A Class to store the Monte Carlo particle information.
void setDescription(const std::string &description)
Sets the description of the module.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Class to store reconstructed particles.
bool replaceDaughter(const Particle *oldDaughter, Particle *newDaughter)
Replace index of given daughter with new daughter, return true if a replacement is made.
void set4VectorDividingByMomentumScaling(const ROOT::Math::PxPyPzEVector &p4)
Sets Lorentz vector dividing by the momentum scaling factor.
double getEnergy() const
Returns total energy.
unsigned getMdstArrayIndex(void) const
Returns 0-based index of MDST store array object (0 for composite particles)
const PIDLikelihood * getPIDLikelihood() const
Returns the pointer to the PIDLikelihood object that is related to the Track, which was used to creat...
int getPDGCode(void) const
Returns PDG code.
unsigned getNDaughters(void) const
Returns number of daughter particles.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
const TrackFitResult * getTrackFitResult() const
Returns the pointer to the TrackFitResult that was used to create this Particle (ParticleType == c_Tr...
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
Low-level class to create/modify relations between StoreArrays.
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).
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
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.
Values of the result of a track fit with a given particle hypothesis.
TMatrixDSym getCovariance5() const
Getter for covariance matrix of perigee parameters in matrix form.
float getNDF() const
Getter for number of degrees of freedom of the track fit.
double getPValue() const
Getter for Chi2 Probability of the track fit.
std::vector< float > getTau() const
Getter for all perigee parameters.
std::vector< float > getCov() const
Getter for all covariance matrix elements of perigee parameters.
Const::ParticleType getParticleType() const
Getter for ParticleType of the mass hypothesis of the track fit.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
HitPatternVXD getHitPatternVXD() const
Getter for the hit pattern in the VXD;.
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.
Particle * copyParticle(const Particle *original)
Function takes argument Particle and creates a copy of it and copies of all its (grand-)^n-daughters.
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Abstract base class for different kinds of events.