9 #include <analysis/modules/HelixErrorScaler/HelixErrorScalerModule.h>
11 #include <analysis/DecayDescriptor/ParticleListName.h>
12 #include <mdst/dataobjects/HitPatternCDC.h>
13 #include <mdst/dataobjects/HitPatternVXD.h>
14 #include <framework/datastore/RelationArray.h>
15 #include <framework/gearbox/Const.h>
16 #include <framework/geometry/B2Vector3.h>
18 #include <Math/Vector3D.h>
37 Creates a new charged particle list whose helix errors are scaled by constant factors.
38 Different sets of scale factors are defined for tracks with/without a PXD hit.
39 For tracks with a PXD hit, in order to avoid severe underestimation of d0 and z0 errors,
40 lower limits (best resolution) can be set in a momentum-dependent form.
41 The module also accepts a V0 Kshort particle list as input and applies the error correction to its daughters.
42 Note the difference in impact parameter resolution between V0 daughters and tracks from IP,
43 as V0 daughters are free from multiple scattering through the beam pipe.
47 addParam(
"inputListName",
m_inputListName,
"The name of input particle list (charged stable or V0 Kshort)", std::string(
""));
50 "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});
52 "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});
55 addParam(
"d0MomentumThreshold",
m_d0MomThr,
"d0 best resolution is kept constant below this momentum.", 0.0);
56 addParam(
"z0MomentumThreshold",
m_z0MomThr,
"z0 best resolution is kept constant below this momentum.", 0.0);
73 B2ERROR(
"Invalid input ParticleList PDG code (must be ChargedStable): " <<
m_pdgCode);
78 B2ERROR(
"Input and output particle list names are the same: " <<
m_inputListName);
116 for (
unsigned i = 0; i < nPar; i++) {
118 if (particle->getParticleSource() != Particle::EParticleSourceObject::c_V0) {
120 " contains a particle which is not from V0. It will not be copied to output list.");
124 if (particle->getNDaughters() != 2)
125 B2ERROR(
"V0 particle should have exactly two daughters");
127 const Particle* dauP = particle->getDaughter(0);
128 const Particle* dauM = particle->getDaughter(1);
135 Particle::EParticleSourceObject::c_V0, particle->getMdstArrayIndex());
148 for (
unsigned i = 0; i < nPar; i++) {
162 Particle new_charged(particle->getMdstArrayIndex(), new_trkfit, chargedtype);
170 if (mcCharged !=
nullptr) newCharged->
addRelationTo(mcCharged);
179 const std::vector<float> helix = trkfit->
getTau();
180 const std::vector<float> cov5 = trkfit->
getCov();
182 const double pvalue = trkfit->
getPValue();
185 const int ndf = trkfit->
getNDF();
188 std::vector<float> cov5_scaled;
189 unsigned int counter = 0;
190 for (
unsigned int j = 0; j < 5; j++) {
191 for (
unsigned int k = j; k < 5; k++) {
192 cov5_scaled.push_back(cov5[counter++] * scaleFactors[j] * scaleFactors[k]);
205 double sinTheta = TMath::Sin(p.Theta());
206 double pD0 = p.Mag2() / (particle->getEnergy()) * TMath::Power(sinTheta, 1.5);
207 double pZ0 = pD0 * sinTheta;
216 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.
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.
void appendDaughter(const Particle *daughter, const bool updateType=true, const int daughterProperty=c_Ordinary)
Appends index of daughter to daughters index array.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
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).
Values of the result of a track fit with a given particle hypothesis.
std::vector< float > getTau() const
Getter for all perigee parameters.
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 > 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;.
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Abstract base class for different kinds of events.