Belle II Software development
ParticleVertexFitterModule Class Reference

Vertex fitter module. More...

#include <ParticleVertexFitterModule.h>

Inheritance diagram for ParticleVertexFitterModule:
Module PathElement

Public Types

enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 ParticleVertexFitterModule ()
 Constructor.
 
virtual void initialize () override
 Initialize the Module.
 
virtual void beginRun () override
 Called when entering a new run.
 
virtual void event () override
 Event processor.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void endRun ()
 This method is called if the current run ends.
 
virtual void terminate ()
 This method is called at the end of the event processing.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T>
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python.
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side.
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module.
 
void setType (const std::string &type)
 Set the module type.
 
template<typename T>
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module.
 
template<typename T>
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

bool doVertexFit (Particle *p)
 Main steering routine.
 
bool doKVertexFit (Particle *p, bool ipProfileConstraint, bool ipTubeConstraint)
 Unconstrained vertex fit using KFit.
 
bool doKMassVertexFit (Particle *p)
 Mass-constrained vertex fit using KFit.
 
bool doKMassPointingVertexFit (Particle *p)
 Mass-constrained vertex fit with additional pointing constraint using KFit.
 
bool doKMassFit (Particle *p)
 Mass fit using KFit.
 
bool doKFourCFit (Particle *p)
 FourC fit using KFit.
 
bool doKMassFourCFit (Particle *p)
 MassFourC fit using KFit.
 
bool doKRecoilMassFit (Particle *p)
 RecoilMass fit using KFit.
 
bool makeKVertexMother (analysis::VertexFitKFit &kv, Particle *p)
 Update mother particle after unconstrained vertex fit using KFit.
 
bool makeKMassVertexMother (analysis::MassVertexFitKFit &kv, Particle *p)
 Update mother particle after mass-constrained vertex fit using KFit.
 
bool makeKMassPointingVertexMother (analysis::MassPointingVertexFitKFit &kv, Particle *p)
 Update mother particle after mass-constrained vertex fit with additional pointing constraint using KFit.
 
bool makeKMassMother (analysis::MassFitKFit &kv, Particle *p)
 Update mother particle after mass fit using KFit.
 
bool makeKFourCMother (analysis::FourCFitKFit &kv, Particle *p)
 Update mother particle after FourC fit using KFit.
 
bool makeMassKFourCMother (analysis::MassFourCFitKFit &kv, Particle *p)
 Update mother particle after MassFourC fit using KFit.
 
bool makeKRecoilMassMother (analysis::RecoilMassKFit &kf, Particle *p)
 Update mother particle after RecoilMass fit using KFit.
 
void updateMapOfTrackAndDaughter (unsigned &l, std::vector< std::vector< unsigned > > &pars, std::vector< unsigned > &pard, std::vector< Particle * > &allparticles, const Particle *daughter)
 update the map of daughter and tracks, find out which tracks belong to each daughter.
 
bool addChildofParticletoKFit (analysis::FourCFitKFit &kv, const Particle *particle)
 Adds given particle's child to the FourCFitKFit.
 
bool addChildofParticletoMassKFit (analysis::MassFourCFitKFit &kf, const Particle *particle, std::vector< unsigned > &particleId)
 Adds given particle's child to the MassFourCFitKFit.
 
void addIPProfileToKFit (analysis::VertexFitKFit &kv)
 Adds IPProfile constraint to the vertex fit using KFit.
 
void addIPTubeToKFit (analysis::VertexFitKFit &kv)
 Adds IPTube constraint to the vertex fit using KFit.
 
bool fillFitParticles (const Particle *mother, std::vector< const Particle * > &fitChildren, std::vector< const Particle * > &twoPhotonChildren)
 Fills valid particle's children (with valid error matrix) in the vector of Particles that will enter the fit.
 
bool fillNotFitParticles (const Particle *mother, std::vector< const Particle * > &notFitChildren, const std::vector< const Particle * > &fitChildren)
 Fills valid particle's children (with valid error matrix) in the vector of Particles that will not enter the fit.
 
bool redoTwoPhotonDaughterMassFit (Particle *postFit, const Particle *preFit, const analysis::VertexFitKFit &kv)
 Combines preFit particle and vertex information from vertex fit kv to create new postFit particle.
 
bool doRaveFit (Particle *mother)
 Fit using Rave.
 
bool allSelectedDaughters (const Particle *mother, const std::vector< const Particle * > &tracksVertex)
 check if all the Daughters (o grand-daughters) are selected for the vertex fit
 
void findConstraintBoost (double cut)
 calculate iptube constraint (quasi cylinder along boost direction) for RAVE fit
 
void smearBeamSpot (double width)
 smear beam spot covariance
 
double getChi2TracksLBoost (const analysis::VertexFitKFit &kv)
 calculate the chi2 using only lboost information of tracks
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

StoreObjPtr< ParticleListm_plist
 particle list
 
std::string m_listName
 particle list name
 
double m_confidenceLevel
 required fit confidence level
 
double m_Bfield
 magnetic field from data base
 
std::string m_vertexFitter
 Vertex Fitter name.
 
std::string m_fitType
 type of the kinematic fit
 
std::string m_withConstraint
 additional constraint on vertex
 
std::string m_decayString
 daughter particles selection
 
bool m_updateDaughters
 flag for daughters update
 
DecayDescriptor m_decaydescriptor
 Decay descriptor of decays to look for.
 
bool m_hasCovMatrix = false
 flag for mother covariance matrix (PseudoFitter)
 
ROOT::Math::XYZVector m_BeamSpotCenter
 Beam spot position.
 
TMatrixDSym m_beamSpotCov
 Beam spot covariance matrix.
 
DBObjPtr< BeamSpotm_beamSpotDB
 Beam spot database object.
 
double m_smearing
 smearing width applied to IP tube
 
double m_recoilMass
 recoil mass for constraint
 
std::vector< int > m_massConstraintList
 PDG codes of the particles to be mass constraint (massfourC)
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

Vertex fitter module.

Definition at line 45 of file ParticleVertexFitterModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

77 {
78 c_Input = 1,
79 c_Output = 2,
80 c_ParallelProcessingCertified = 4,
81 c_HistogramManager = 8,
82 c_InternalSerializer = 16,
83 c_TerminateInAllProcesses = 32,
84 c_DontCollectStatistics = 64,
85 };
@ c_Output
Output Process.
Definition ProcHelper.h:19
@ c_Input
Input Process.
Definition ProcHelper.h:17

Constructor & Destructor Documentation

◆ ParticleVertexFitterModule()

Constructor.

Definition at line 66 of file ParticleVertexFitterModule.cc.

66 : Module(),
67 m_Bfield(0)
68{
69 // set module description (e.g. insert text)
70 setDescription("Vertex fitter for modular analysis");
72
73 // Add parameters
74 addParam("listName", m_listName, "name of particle list", string(""));
75 addParam("confidenceLevel", m_confidenceLevel,
76 "Confidence level to accept the fit. Particle candidates with "
77 "p-value less than confidenceLevel are removed from the particle "
78 "list. If set to -1, all candidates are kept; if set to 0, "
79 "the candidates failing the fit are removed.",
80 0.001);
81 addParam("vertexFitter", m_vertexFitter, "KFit or Rave", string("KFit"));
82 addParam("fitType", m_fitType, "type of the kinematic fit (vertex, massvertex, mass)", string("vertex"));
83 addParam("withConstraint", m_withConstraint,
84 "additional constraint on vertex: ipprofile, iptube, mother, iptubecut, pointing, btube",
85 string(""));
86 addParam("decayString", m_decayString, "specifies which daughter particles are included in the kinematic fit", string(""));
87 addParam("updateDaughters", m_updateDaughters, "true: update the daughters after the vertex fit", false);
88 addParam("smearing", m_smearing, "smear IP tube width by given length", 0.002);
89 addParam("recoilMass", m_recoilMass, "recoil invariant mass (GeV)", 0.);
90 addParam("massConstraintList", m_massConstraintList,
91 "Type::[int]. List of daughter particles to mass constrain with int = pdg code. (only for MassFourCKFit)", {});
92}
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
std::string m_withConstraint
additional constraint on vertex
bool m_updateDaughters
flag for daughters update
std::string m_decayString
daughter particles selection
std::vector< int > m_massConstraintList
PDG codes of the particles to be mass constraint (massfourC)
std::string m_vertexFitter
Vertex Fitter name.
double m_recoilMass
recoil mass for constraint
double m_confidenceLevel
required fit confidence level
double m_Bfield
magnetic field from data base
double m_smearing
smearing width applied to IP tube
std::string m_fitType
type of the kinematic fit
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559

Member Function Documentation

◆ addChildofParticletoKFit()

bool addChildofParticletoKFit ( analysis::FourCFitKFit & kv,
const Particle * particle )
private

Adds given particle's child to the FourCFitKFit.

Parameters
kvreference to KFit FourCFit object
particlepointer to particle

Definition at line 1424 of file ParticleVertexFitterModule.cc.

1425{
1426 for (unsigned ichild = 0; ichild < particle->getNDaughters(); ichild++) {
1427 const Particle* child = particle->getDaughter(ichild);
1428 if (child->getNDaughters() > 0) addChildofParticletoKFit(kf, child);
1429 else {
1430 if (child->getPValue() < 0) return false; // error matrix not valid
1431
1432 kf.addParticle(child);
1433 }
1434 }
1435 return true;
1436}
bool addChildofParticletoKFit(analysis::FourCFitKFit &kv, const Particle *particle)
Adds given particle's child to the FourCFitKFit.
double getPValue() const
Returns chi^2 probability of fit if done or -1.
Definition Particle.h:687
unsigned getNDaughters(void) const
Returns number of daughter particles.
Definition Particle.h:747

◆ addChildofParticletoMassKFit()

bool addChildofParticletoMassKFit ( analysis::MassFourCFitKFit & kf,
const Particle * particle,
std::vector< unsigned > & particleId )
private

Adds given particle's child to the MassFourCFitKFit.

Parameters
kfreference to KFit FourCFit object
particlepointer to particle
particleIdvector of daughters track id

Definition at line 1438 of file ParticleVertexFitterModule.cc.

1440{
1441 for (unsigned ichild = 0; ichild < particle->getNDaughters(); ichild++) {
1442 const Particle* child = particle->getDaughter(ichild);
1443 if (child->getNDaughters() > 0) {
1444 bool massconstraint = std::find(m_massConstraintList.begin(), m_massConstraintList.end(),
1445 std::abs(child->getPDGCode())) != m_massConstraintList.end();
1446 std::vector<unsigned> childId;
1447 addChildofParticletoMassKFit(kf, child, childId);
1448 if (massconstraint) kf.addMassConstraint(child->getPDGMass(), childId);
1449 particleId.insert(particleId.end(), childId.begin(), childId.end());
1450 } else {
1451 if (child->getPValue() < 0) return false; // error matrix not valid
1452 kf.addParticle(child);
1453 particleId.push_back(kf.getTrackCount() - 1);
1454 }
1455 }
1456 return true;
1457}
bool addChildofParticletoMassKFit(analysis::MassFourCFitKFit &kf, const Particle *particle, std::vector< unsigned > &particleId)
Adds given particle's child to the MassFourCFitKFit.
int getPDGCode(void) const
Returns PDG code.
Definition Particle.h:465
double getPDGMass(void) const
Returns uncertainty on the invariant mass (requires valid momentum error matrix)
Definition Particle.cc:635
enum KFitError::ECode addParticle(const Particle *particle)
Add a particle to the fitter.
Definition KFitBase.cc:59
int getTrackCount(void) const
Get the number of added tracks.
Definition KFitBase.cc:107
enum KFitError::ECode addMassConstraint(const double m, std::vector< unsigned > &childTrackId)
Set an invariant mass of daughter particle for the mass-four-momentum-constraint fit.

◆ addIPProfileToKFit()

void addIPProfileToKFit ( analysis::VertexFitKFit & kv)
private

Adds IPProfile constraint to the vertex fit using KFit.

Definition at line 1459 of file ParticleVertexFitterModule.cc.

1460{
1461 HepPoint3D pos = ROOTToCLHEP::getPoint3D(m_BeamSpotCenter);
1462 CLHEP::HepSymMatrix covMatrix = ROOTToCLHEP::getHepSymMatrix(m_beamSpotCov);
1463
1464 kv.setIpProfile(pos, covMatrix);
1465}
TMatrixDSym m_beamSpotCov
Beam spot covariance matrix.
ROOT::Math::XYZVector m_BeamSpotCenter
Beam spot position.
enum KFitError::ECode setIpProfile(const HepPoint3D &ip, const CLHEP::HepSymMatrix &ipe)
Set an IP-ellipsoid shape for the vertex constraint fit.

◆ addIPTubeToKFit()

void addIPTubeToKFit ( analysis::VertexFitKFit & kv)
private

Adds IPTube constraint to the vertex fit using KFit.

Definition at line 1467 of file ParticleVertexFitterModule.cc.

1468{
1469 CLHEP::HepSymMatrix err(7, 0);
1470
1471 for (int i = 0; i < 3; i++) {
1472 for (int j = 0; j < 3; j++) {
1473 err[i + 4][j + 4] = m_beamSpotCov(i, j);
1474 }
1475 }
1476
1477 PCmsLabTransform T;
1478 ROOT::Math::PxPyPzEVector iptube_mom = T.getBeamFourMomentum();
1479
1481 ROOTToCLHEP::getHepLorentzVector(iptube_mom),
1482 ROOTToCLHEP::getPoint3D(m_BeamSpotCenter),
1483 err,
1484 0.);
1485}
ROOT::Math::PxPyPzEVector getBeamFourMomentum() const
Returns LAB four-momentum of e+e-, i.e.
enum KFitError::ECode setIpTubeProfile(const CLHEP::HepLorentzVector &p, const HepPoint3D &x, const CLHEP::HepSymMatrix &e, const double q)
Set a virtual IP-tube track for the vertex constraint fit.

◆ allSelectedDaughters()

bool allSelectedDaughters ( const Particle * mother,
const std::vector< const Particle * > & tracksVertex )
private

check if all the Daughters (o grand-daughters) are selected for the vertex fit

Definition at line 1400 of file ParticleVertexFitterModule.cc.

1402{
1403 bool isAll = false;
1404 if (mother->getNDaughters() == 0) return false;
1405
1406 int nNotIncluded = mother->getNDaughters();
1407
1408 for (unsigned i = 0; i < mother->getNDaughters(); i++) {
1409 bool dauOk = false;
1410 for (auto& vi : tracksVertex) {
1411 if (vi == mother->getDaughter(i)) {
1412 nNotIncluded = nNotIncluded - 1;
1413 dauOk = true;
1414 }
1415 }
1416 if (!dauOk) {
1417 if (allSelectedDaughters(mother->getDaughter(i), tracksVertex)) nNotIncluded--;
1418 }
1419 }
1420 if (nNotIncluded == 0) isAll = true;
1421 return isAll;
1422}
bool allSelectedDaughters(const Particle *mother, const std::vector< const Particle * > &tracksVertex)
check if all the Daughters (o grand-daughters) are selected for the vertex fit
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
Definition Particle.cc:662

◆ beginRun()

void beginRun ( void )
overridevirtual

Called when entering a new run.

Set run dependent things like run header parameters, alignment, etc.

Reimplemented from Module.

Definition at line 120 of file ParticleVertexFitterModule.cc.

121{
122 // TODO: set magnetic field for each run
123 // m_Bfield = BFieldManager::getFieldInTesla(ROOT::Math::XYZVector(0, 0, 0)).Z();
124 // TODO: set IP spot size for each run
125}

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

180{
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
void setParameters(const ModuleParamList &params)
Set values for parameters from other parameter list.
const ModuleParamList & getParamList() const
Return module param list.
Definition Module.h:362
const std::string & getName() const
Returns the name of the module.
Definition Module.h:186
const std::string & getType() const
Returns the type of the module (i.e.
Definition Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition Module.h:511
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition Module.h:515
void setName(const std::string &name)
Set the name of the module.
Definition Module.h:213
LogConfig m_logConfig
The log system configuration of the module.
Definition Module.h:513
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition Module.h:520
std::string m_package
Package this module is found in (may be empty).
Definition Module.h:509
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition Module.h:43

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 425 of file Module.h.

425{ beginRun(); }

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 438 of file Module.h.

438{ endRun(); }

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 431 of file Module.h.

431{ event(); }

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 419 of file Module.h.

419{ initialize(); }

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 444 of file Module.h.

444{ terminate(); }

◆ doKFourCFit()

bool doKFourCFit ( Particle * p)
private

FourC fit using KFit.

Parameters
ppointer to particle
Returns
true for successful fit

Definition at line 738 of file ParticleVertexFitterModule.cc.

739{
740 if (mother->getNDaughters() < 2) return false;
741
742 analysis::FourCFitKFit kf;
744
745 for (unsigned ichild = 0; ichild < mother->getNDaughters(); ichild++) {
746 const Particle* child = mother->getDaughter(ichild);
747
748 if (child->getNDaughters() > 0) {
749 bool err = addChildofParticletoKFit(kf, child);
750 if (!err) return false;
751 } else {
752 if (child->getPValue() < 0) return false; // error matrix not valid
753
754 kf.addParticle(child);
755 }
756 }
757
758 // apply four momentum constraint
759 PCmsLabTransform T;
761
762 int err = kf.doFit();
763
764 if (err != 0) return false;
765
766 bool ok = makeKFourCMother(kf, mother);
767
768 return ok;
769}
bool makeKFourCMother(analysis::FourCFitKFit &kv, Particle *p)
Update mother particle after FourC fit using KFit.
enum KFitError::ECode setFourMomentum(const ROOT::Math::PxPyPzEVector &m)
Set an 4 Momentum for the FourC-constraint fit.
enum KFitError::ECode doFit(void)
Perform a four momentum-constraint fit.
enum KFitError::ECode setMagneticField(const double mf)
Change a magnetic field from the default value KFitConst::kDefaultMagneticField.
Definition KFitBase.cc:93

◆ doKMassFit()

bool doKMassFit ( Particle * p)
private

Mass fit using KFit.

Parameters
ppointer to particle
Returns
true for successful fit

Definition at line 711 of file ParticleVertexFitterModule.cc.

712{
713 if (mother->getNDaughters() < 2) return false;
714
715 analysis::MassFitKFit km;
717
718 for (unsigned ichild = 0; ichild < mother->getNDaughters(); ichild++) {
719 const Particle* child = mother->getDaughter(ichild);
720
721 if (child->getPValue() < 0) return false; // error matrix not valid
722
723 km.addParticle(child);
724 }
725
726 // apply mass constraint
727 km.setInvariantMass(mother->getPDGMass());
728
729 int err = km.doFit();
730
731 if (err != 0) return false;
732
733 bool ok = makeKMassMother(km, mother);
734
735 return ok;
736}
bool makeKMassMother(analysis::MassFitKFit &kv, Particle *p)
Update mother particle after mass fit using KFit.
enum KFitError::ECode doFit(void)
Perform a mass-constraint fit.
enum KFitError::ECode setInvariantMass(const double m)
Set an invariant mass for the mass-constraint fit.

◆ doKMassFourCFit()

bool doKMassFourCFit ( Particle * p)
private

MassFourC fit using KFit.

Parameters
ppointer to particle
Returns
true for successful fit

Definition at line 771 of file ParticleVertexFitterModule.cc.

772{
773 if (mother->getNDaughters() < 2) return false;
774
775 analysis::MassFourCFitKFit kf;
777
778 for (unsigned ichild = 0; ichild < mother->getNDaughters(); ichild++) {
779 const Particle* child = mother->getDaughter(ichild);
780
781 if (child->getNDaughters() > 0) {
782 bool massconstraint = std::find(m_massConstraintList.begin(), m_massConstraintList.end(),
783 std::abs(child->getPDGCode())) != m_massConstraintList.end();
784 std::vector<unsigned> childId;
785 bool err = addChildofParticletoMassKFit(kf, child, childId);
786 if (massconstraint) kf.addMassConstraint(child->getPDGMass(), childId);
787 if (!err) return false;
788 } else {
789 if (child->getPValue() < 0) return false; // error matrix not valid
790 kf.addParticle(child);
791 }
792 }
793
794 // apply four momentum constraint
795 PCmsLabTransform T;
797
798 int err = kf.doFit();
799
800 if (err != 0) return false;
801
802 bool ok = makeMassKFourCMother(kf, mother);
803
804 return ok;
805}
bool makeMassKFourCMother(analysis::MassFourCFitKFit &kv, Particle *p)
Update mother particle after MassFourC fit using KFit.
enum KFitError::ECode setFourMomentum(const ROOT::Math::PxPyPzEVector &m)
Set an 4 Momentum for the mass-four-constraint fit.
enum KFitError::ECode doFit(void)
Perform a mass-four-momentum-constraint fit.

◆ doKMassPointingVertexFit()

bool doKMassPointingVertexFit ( Particle * p)
private

Mass-constrained vertex fit with additional pointing constraint using KFit.

Parameters
ppointer to particle
Returns
true for successful fit

Definition at line 666 of file ParticleVertexFitterModule.cc.

667{
668 if (!(mother->hasExtraInfo("prodVertX") && mother->hasExtraInfo("prodVertY") && mother->hasExtraInfo("prodVertZ"))) {
669 return false;
670 }
671
672 if (mother->getNDaughters() < 2) return false;
673
674 std::vector<const Particle*> fitChildren;
675 std::vector<const Particle*> twoPhotonChildren;
676 bool validChildren = fillFitParticles(mother, fitChildren, twoPhotonChildren);
677
678 if (!validChildren)
679 return false;
680
681 if (twoPhotonChildren.size() > 0) {
682 B2FATAL("[ParticleVertexFitterModule::doKMassPointingVertexFit] MassPointingVertex fit using KFit does not support fit with two-photon daughters (yet).");
683 }
684
685 if (fitChildren.size() < 2) {
686 B2WARNING("[ParticleVertexFitterModule::doKMassPointingVertexFit] Number of particles with valid error matrix entering the vertex fit using KFit is less than 2.");
687 return false;
688 }
689
690 bool ok = false;
691 // Initialise the Fitter
692 analysis::MassPointingVertexFitKFit kmpv;
694
695 for (auto child : fitChildren)
696 kmpv.addParticle(child);
697
698 kmpv.setInvariantMass(mother->getPDGMass());
699 HepPoint3D productionVertex(mother->getExtraInfo("prodVertX"),
700 mother->getExtraInfo("prodVertY"),
701 mother->getExtraInfo("prodVertZ"));
702 kmpv.setProductionVertex(productionVertex);
703 int err = kmpv.doFit();
704 if (err != 0) return false;
705
706 ok = makeKMassPointingVertexMother(kmpv, mother);
707
708 return ok;
709}
bool makeKMassPointingVertexMother(analysis::MassPointingVertexFitKFit &kv, Particle *p)
Update mother particle after mass-constrained vertex fit with additional pointing constraint using KF...
bool fillFitParticles(const Particle *mother, std::vector< const Particle * > &fitChildren, std::vector< const Particle * > &twoPhotonChildren)
Fills valid particle's children (with valid error matrix) in the vector of Particles that will enter ...
enum KFitError::ECode doFit(void)
Perform a mass-vertex-pointing constraint fit.
enum KFitError::ECode setInvariantMass(const double m)
Set an invariant mass for the mass-vertex-pointing constraint fit.
enum KFitError::ECode setProductionVertex(const HepPoint3D &v)
Set the production vertex of the particle.

◆ doKMassVertexFit()

bool doKMassVertexFit ( Particle * p)
private

Mass-constrained vertex fit using KFit.

Parameters
ppointer to particle
Returns
true for successful fit

Definition at line 579 of file ParticleVertexFitterModule.cc.

580{
581 if (mother->getNDaughters() < 2) return false;
582
583 std::vector<const Particle*> fitChildren;
584 std::vector<const Particle*> twoPhotonChildren;
585 bool validChildren = fillFitParticles(mother, fitChildren, twoPhotonChildren);
586
587 if (!validChildren)
588 return false;
589
590 if (twoPhotonChildren.size() > 1) {
591 B2FATAL("[ParticleVertexFitterModule::doKVertexFit] MassVertex fit using KFit does not support fit with multiple particles decaying to two photons like pi0 (yet).");
592 }
593
594 if (fitChildren.size() < 2) {
595 B2WARNING("[ParticleVertexFitterModule::doKVertexFit] Number of particles with valid error matrix entering the vertex fit using KFit is less than 2.");
596 return false;
597 }
598
599 bool ok = false;
600 if (twoPhotonChildren.size() == 0) {
601 // Initialise the Fitter
602 analysis::MassVertexFitKFit kmv;
604
605 if (mother->getV0()) {
606 HepPoint3D V0vertex_heppoint(mother->getV0()->getFittedVertexX(),
607 mother->getV0()->getFittedVertexY(),
608 mother->getV0()->getFittedVertexZ());
609 kmv.setInitialVertex(V0vertex_heppoint);
610 }
611
612 for (auto child : fitChildren)
613 kmv.addParticle(child);
614
615 kmv.setInvariantMass(mother->getPDGMass());
616 int err = kmv.doFit();
617 if (err != 0)
618 return false;
619
620 // in the case daughters do not include particles with two photon daughters like pi0 - this is it (fit done)
621 ok = makeKMassVertexMother(kmv, mother);
622 } else if (twoPhotonChildren.size() == 1) {
623 // there is a daughter reconstructed from two photons so without position information
624 // 1. determine vertex based on all other valid daughters
625 // 2. set position and error matrix of two-photon daughter to previously determined vertex
626 // 3. redo the fit using all particles (including two-photon particle this time)
627
628 analysis::VertexFitKFit kv;
630
631 for (auto child : fitChildren)
632 kv.addParticle(child);
633
634 // Perform vertex fit using only the particles with valid error matrices
635 int err = kv.doFit();
636 if (err != 0)
637 return false;
638
639 const Particle* twoPhotonDaughter = twoPhotonChildren[0];
640 Particle fixedTwoPhotonDaughter(twoPhotonDaughter->get4Vector(), twoPhotonDaughter->getPDGCode());
641 ok = redoTwoPhotonDaughterMassFit(&fixedTwoPhotonDaughter, twoPhotonDaughter, kv);
642 if (!ok)
643 return false;
644
645 // finally perform the fit using all daughter particles
646 analysis::MassVertexFitKFit kmv2;
648
649 for (auto child : fitChildren)
650 kmv2.addParticle(child);
651 kmv2.addParticle(&fixedTwoPhotonDaughter);
652
653 kmv2.setInvariantMass(mother->getPDGMass());
654 err = kmv2.doFit();
655
656 if (err != 0)
657 return false;
658
659 ok = makeKMassVertexMother(kmv2, mother);
660 }
661
662 return ok;
663
664}
bool redoTwoPhotonDaughterMassFit(Particle *postFit, const Particle *preFit, const analysis::VertexFitKFit &kv)
Combines preFit particle and vertex information from vertex fit kv to create new postFit particle.
bool makeKMassVertexMother(analysis::MassVertexFitKFit &kv, Particle *p)
Update mother particle after mass-constrained vertex fit using KFit.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
Definition Particle.h:567
enum KFitError::ECode setInitialVertex(const HepPoint3D &v)
Set an initial vertex point for the mass-vertex constraint fit.
enum KFitError::ECode doFit(void)
Perform a mass-vertex-constraint fit.
enum KFitError::ECode setInvariantMass(const double m)
Set an invariant mass for the mass-vertex constraint fit.
enum KFitError::ECode doFit(void)
Perform a vertex-constraint fit.

◆ doKRecoilMassFit()

bool doKRecoilMassFit ( Particle * p)
private

RecoilMass fit using KFit.

Parameters
ppointer to particle
Returns
true for successful fit

Definition at line 807 of file ParticleVertexFitterModule.cc.

808{
809 analysis::RecoilMassKFit kf;
811
812 for (unsigned ichild = 0; ichild < mother->getNDaughters(); ichild++) {
813 const Particle* child = mother->getDaughter(ichild);
814
815 if (child->getPValue() < 0) return false; // error matrix not valid
816
817 kf.addParticle(child);
818 }
819
820 // apply four momentum constraint
821 PCmsLabTransform T;
823
824 // apply recoil mass constraint
826
827 int err = kf.doFit();
828
829 if (err != 0) return false;
830
831 bool ok = makeKRecoilMassMother(kf, mother);
832
833 return ok;
834}
bool makeKRecoilMassMother(analysis::RecoilMassKFit &kf, Particle *p)
Update mother particle after RecoilMass fit using KFit.
enum KFitError::ECode setFourMomentum(const ROOT::Math::PxPyPzEVector &m)
Set a recoil mass .
enum KFitError::ECode setRecoilMass(const double m)
Set an invariant mass for the four momentum-constraint fit.
enum KFitError::ECode doFit(void)
Perform a recoil-mass constraint fit.

◆ doKVertexFit()

bool doKVertexFit ( Particle * p,
bool ipProfileConstraint,
bool ipTubeConstraint )
private

Unconstrained vertex fit using KFit.

Parameters
ppointer to particle
ipProfileConstraintflag for IP profile constraint
ipTubeConstraintflag for IP tube constraint
Returns
true for successful fit

Definition at line 483 of file ParticleVertexFitterModule.cc.

484{
485 if ((mother->getNDaughters() < 2 && !ipTubeConstraint) || mother->getNDaughters() < 1) return false;
486
487 std::vector<const Particle*> fitChildren;
488 std::vector<const Particle*> twoPhotonChildren;
489 bool validChildren = fillFitParticles(mother, fitChildren, twoPhotonChildren);
490
491 if (!validChildren)
492 return false;
493
494 std::vector<const Particle*> notFitChildren;
495 fillNotFitParticles(mother, notFitChildren, fitChildren);
496
497
498 if (twoPhotonChildren.size() > 1) {
499 B2FATAL("[ParticleVertexFitterModule::doKVertexFit] Vertex fit using KFit does not support fit with multiple particles decaying to two photons like pi0 (yet).");
500 }
501
502 if ((fitChildren.size() < 2 && !ipTubeConstraint) || fitChildren.size() < 1) {
503 B2WARNING("[ParticleVertexFitterModule::doKVertexFit] Number of particles with valid error matrix entering the vertex fit using KFit is too low.");
504 return false;
505 }
506
507 // Initialise the Fitter
508 analysis::VertexFitKFit kv;
510
511 if (mother->getV0()) {
512 kv.setInitialVertex(mother->getV0()->getFittedVertexPosition());
513 }
514
515 for (auto& child : fitChildren)
516 kv.addParticle(child);
517
518 if (ipProfileConstraint)
520
521 if (ipTubeConstraint)
522 addIPTubeToKFit(kv);
523
524 // Perform vertex fit using only the particles with valid error matrices
525 int err = kv.doFit();
526 if (err != 0)
527 return false;
528
529 double chi2_track = getChi2TracksLBoost(kv);
530 unsigned track_count = kv.getTrackCount();
531 mother->writeExtraInfo("chiSquared_trackL", chi2_track);
532 mother->writeExtraInfo("kFit_nTracks", track_count);
533
534 bool ok = false;
535 if (twoPhotonChildren.size() == 0)
536 // in the case daughters do not include pi0 - this is it (fit done)
537 ok = makeKVertexMother(kv, mother);
538 else if (twoPhotonChildren.size() == 1) {
539 // there is a daughter reconstructed from two photons so without position information
540 // 1. determine vertex based on all other valid daughters
541 // 2. set position and error matrix of two-photon daughter to previously determined vertex
542 // 3. redo the fit using all particles (including two-photon particle this time)
543
544 const Particle* twoPhotonDaughter = twoPhotonChildren[0];
545 Particle fixedTwoPhotonDaughter(twoPhotonDaughter->get4Vector(), twoPhotonDaughter->getPDGCode());
546 ok = redoTwoPhotonDaughterMassFit(&fixedTwoPhotonDaughter, twoPhotonDaughter, kv);
547 if (!ok)
548 return false;
549
550 // finally perform the fit using all daughter particles
551 analysis::VertexFitKFit kv2;
553
554 for (auto& child : fitChildren)
555 kv2.addParticle(child);
556
557 kv2.addParticle(&fixedTwoPhotonDaughter);
558
559 if (ipProfileConstraint)
561
562 err = kv2.doFit();
563
564 if (err != 0)
565 return false;
566
567 ok = makeKVertexMother(kv2, mother);
568 }
569
570 // update 4-vector using not-fit-particles
571 ROOT::Math::PxPyPzEVector total4Vector(mother->get4Vector());
572 for (auto& child : notFitChildren)
573 total4Vector += child->get4Vector();
574 mother->set4Vector(total4Vector);
575
576 return ok;
577}
void addIPTubeToKFit(analysis::VertexFitKFit &kv)
Adds IPTube constraint to the vertex fit using KFit.
bool makeKVertexMother(analysis::VertexFitKFit &kv, Particle *p)
Update mother particle after unconstrained vertex fit using KFit.
bool fillNotFitParticles(const Particle *mother, std::vector< const Particle * > &notFitChildren, const std::vector< const Particle * > &fitChildren)
Fills valid particle's children (with valid error matrix) in the vector of Particles that will not en...
double getChi2TracksLBoost(const analysis::VertexFitKFit &kv)
calculate the chi2 using only lboost information of tracks
void addIPProfileToKFit(analysis::VertexFitKFit &kv)
Adds IPProfile constraint to the vertex fit using KFit.
enum KFitError::ECode setInitialVertex(const HepPoint3D &v)
Set an initial vertex point for the vertex-vertex constraint fit.

◆ doRaveFit()

bool doRaveFit ( Particle * mother)
private

Fit using Rave.

Parameters
motherpointer to particle
Returns
true for successful fit and update of mother

Definition at line 1245 of file ParticleVertexFitterModule.cc.

1246{
1247 if ((m_decayString.empty() ||
1248 (m_withConstraint == "" && m_fitType != "mass")) && mother->getNDaughters() < 2) return false;
1250 if (m_withConstraint == "ipprofile" || m_withConstraint == "iptube" || m_withConstraint == "mother"
1251 || m_withConstraint == "iptubecut" || m_withConstraint == "btube")
1253
1254 analysis::RaveKinematicVertexFitter rf;
1255 if (m_fitType == "mass") rf.setVertFit(false);
1256
1257 if (m_decayString.empty()) {
1258 rf.addMother(mother);
1259 } else {
1260 std::vector<const Particle*> tracksVertex = m_decaydescriptor.getSelectionParticles(mother);
1261 std::vector<std::string> tracksName = m_decaydescriptor.getSelectionNames();
1262
1263 if (allSelectedDaughters(mother, tracksVertex)) {
1264 for (auto& itrack : tracksVertex) {
1265 if (itrack != mother) rf.addTrack(itrack);
1266 }
1267 rf.setMother(mother);
1268 } else {
1269
1270 analysis::RaveKinematicVertexFitter rsf;
1271 bool mothSel = false;
1272 int nTrk = 0;
1273 for (unsigned itrack = 0; itrack < tracksVertex.size(); itrack++) {
1274 if (tracksVertex[itrack] != mother) {
1275 rsf.addTrack(tracksVertex[itrack]);
1276 B2DEBUG(1, "ParticleVertexFitterModule: Adding particle " << tracksName[itrack] << " to vertex fit ");
1277 nTrk++;
1278 }
1279 if (tracksVertex[itrack] == mother) mothSel = true;
1280 }
1281
1282
1283 // Fit one particle constrained to originate from the beam spot
1284 bool mothIPfit = false;
1285 if (tracksVertex.size() == 1 && mothSel == true && m_withConstraint != "" && nTrk == 0) {
1286 rsf.addTrack(tracksVertex[0]);
1287 if (tracksVertex[0] != mother)
1288 B2FATAL("ParticleVertexFitterModule: FATAL Error in IP constrained mother fit");
1289 nTrk++;
1290 mothIPfit = true;
1291 }
1292
1293
1294 ROOT::Math::XYZVector pos;
1295 TMatrixDSym RerrMatrix(3);
1296 int nvert = 0;
1297
1298 // one track fit is not kinematic
1299 if (nTrk == 1) {
1300 analysis::RaveVertexFitter rsg;
1301 for (auto& itrack : tracksVertex) {
1302 rsg.addTrack(itrack);
1303 nvert = rsg.fit("kalman");
1304 if (nvert > 0) {
1305 pos = rsg.getPos(0);
1306 RerrMatrix = rsg.getCov(0);
1307 double prob = rsg.getPValue(0);
1308 ROOT::Math::PxPyPzEVector mom(mother->get4Vector());
1309 TMatrixDSym errMatrix(7);
1310 for (int i = 0; i < 7; i++) {
1311 for (int j = 0; j < 7; j++) {
1312 if (i > 3 && j > 3) {errMatrix[i][j] = RerrMatrix[i - 4][j - 4];}
1313 else {errMatrix[i][j] = 0;}
1314 }
1315 }
1316 if (mothIPfit) {
1317 mother->writeExtraInfo("prodVertX", pos.X());
1318 mother->writeExtraInfo("prodVertY", pos.Y());
1319 mother->writeExtraInfo("prodVertZ", pos.Z());
1320 mother->writeExtraInfo("prodVertSxx", RerrMatrix[0][0]);
1321 mother->writeExtraInfo("prodVertSxy", RerrMatrix[0][1]);
1322 mother->writeExtraInfo("prodVertSxz", RerrMatrix[0][2]);
1323 mother->writeExtraInfo("prodVertSyx", RerrMatrix[1][0]);
1324 mother->writeExtraInfo("prodVertSyy", RerrMatrix[1][1]);
1325 mother->writeExtraInfo("prodVertSyz", RerrMatrix[1][2]);
1326 mother->writeExtraInfo("prodVertSzx", RerrMatrix[2][0]);
1327 mother->writeExtraInfo("prodVertSzy", RerrMatrix[2][1]);
1328 mother->writeExtraInfo("prodVertSzz", RerrMatrix[2][2]);
1329 } else {
1330 mother->updateMomentum(mom, pos, errMatrix, prob);
1331 }
1332 return true;
1333 } else {return false;}
1334 }
1335 } else {
1336 nvert = rsf.fit();
1337 }
1338
1339 if (nvert > 0) {
1340 pos = rsf.getPos();
1341 RerrMatrix = rsf.getVertexErrorMatrix();
1342 double prob = rsf.getPValue();
1343 ROOT::Math::PxPyPzEVector mom(mother->get4Vector());
1344 TMatrixDSym errMatrix(7);
1345 for (int i = 0; i < 7; i++) {
1346 for (int j = 0; j < 7; j++) {
1347 if (i > 3 && j > 3) {errMatrix[i][j] = RerrMatrix[i - 4][j - 4];}
1348 else {errMatrix[i][j] = 0;}
1349 }
1350 }
1351 mother->updateMomentum(mom, pos, errMatrix, prob);
1352 } else {return false;}
1353
1354
1355 if (mothSel && nTrk > 1) {
1357 rf.addMother(mother);
1358 int nKfit = rf.fit();
1359 rf.updateMother();
1361
1362 if (nKfit > 0) {return true;}
1363 else return false;
1364 } else return true;
1365 }
1366 }
1367
1368 bool okFT = false;
1369 if (m_fitType == "vertex") {
1370 okFT = true;
1371 int nVert = rf.fit();
1372 rf.updateMother();
1373 if (m_decayString.empty() && m_updateDaughters == true) rf.updateDaughters();
1374 if (nVert != 1) return false;
1375 }
1376 if (m_fitType == "mass") {
1377 // add protection
1378 okFT = true;
1379 rf.setMassConstFit(true);
1380 rf.setVertFit(false);
1381 int nVert = rf.fit();
1382 rf.updateMother();
1383 if (nVert != 1) return false;
1384 };
1385 if (m_fitType == "massvertex") {
1386 okFT = true;
1387 rf.setMassConstFit(true);
1388 int nVert = rf.fit();
1389 rf.updateMother();
1390 if (m_decayString.empty() && m_updateDaughters == true) rf.updateDaughters();
1391 if (nVert != 1) return false;
1392 };
1393 if (!okFT) {
1394 B2FATAL("fitType : " << m_fitType << " ***invalid fit type ");
1395 }
1396
1397 return true;
1398}
DecayDescriptor m_decaydescriptor
Decay descriptor of decays to look for.
void writeExtraInfo(const std::string &name, const double value)
Sets the user defined extraInfo.
Definition Particle.cc:1393
void updateMomentum(const ROOT::Math::PxPyPzEVector &p4, const ROOT::Math::XYZVector &vertex, const TMatrixFSym &errMatrix, double pValue)
Sets Lorentz vector, position, 7x7 error matrix and p-value.
Definition Particle.h:397
void addMother(const Particle *aMotherParticlePtr)
All daughters of the argument of this function will be used as input for the vertex fit.
ROOT::Math::XYZVector getPos()
get the position of the fitted vertex.
void addTrack(const Particle *aParticlePtr)
add a track (in the format of a Particle) to set of tracks that should be fitted to a vertex
void setMother(const Particle *aMotherParticlePtr)
Set Mother particle for Vertex/momentum update.
int fit()
do the kinematic vertex fit with all tracks previously added with the addTrack or addMother function.
void setVertFit(bool isVertFit=true)
Set vertex fit: set false in case of mass fit only.
void setMassConstFit(bool isConstFit=true)
Set mass constrained fit.
double getPValue()
get the p value of the fitted vertex.
TMatrixDSym getVertexErrorMatrix()
get the covariance matrix (3x3) of the of the fitted vertex position.
void updateDaughters()
update the Daughters particles
void unsetBeamSpot()
unset beam spot constraint
Definition RaveSetup.cc:82
static RaveSetup * getInstance()
get the pointer to the instance to get/set any of options stored in RaveSetup
Definition RaveSetup.h:40
void setBeamSpot(const ROOT::Math::XYZVector &beamSpot, const TMatrixDSym &beamSpotCov)
The beam spot position and covariance is known you can set it here so that and a vertex in the beam s...
Definition RaveSetup.cc:74
TMatrixDSym getCov(VecSize vertexId=0) const
get the covariance matrix (3x3) of the of the fitted vertex position.
int fit(std::string options="default")
do the vertex fit with all tracks previously added with the addTrack or addMother function.
ROOT::Math::XYZVector getPos(VecSize vertexId=0) const
get the position of the fitted vertex.
void addTrack(const Particle *const aParticlePtr)
add a track (in the format of a Particle) to set of tracks that should be fitted to a vertex
double getPValue(VecSize vertexId=0) const
get the p value of the fitted vertex.

◆ doVertexFit()

bool doVertexFit ( Particle * p)
private

Main steering routine.

Parameters
ppointer to particle
Returns
true for successful fit and prob(chi^2,ndf) > m_confidenceLevel

Definition at line 205 of file ParticleVertexFitterModule.cc.

206{
207 // steering starts here
208
209 if (m_Bfield == 0) {
210 B2FATAL("ParticleVertexFitter: No magnetic field");
211 }
212
213 if (m_withConstraint != "ipprofile" &&
214 m_withConstraint != "iptube" &&
215 m_withConstraint != "mother" &&
216 m_withConstraint != "iptubecut" &&
217 m_withConstraint != "pointing" &&
218 m_withConstraint != "btube" &&
219 m_withConstraint != "")
220 B2FATAL("ParticleVertexFitter: " << m_withConstraint << " ***invalid Constraint ");
221
222 bool ok = false;
223 // fits with KFit
224 if (m_vertexFitter == "KFit") {
225
226 if (m_decayString != "" and m_fitType != "vertex")
227 B2FATAL("ParticleVertexFitter: KFit does not support yet selection of daughters via decay string except for vertex fit!");
228
229 // vertex fit
230 if (m_fitType == "vertex") {
231 if (m_withConstraint == "ipprofile") {
232 ok = doKVertexFit(mother, true, false);
233 } else if (m_withConstraint == "iptube") {
234 ok = doKVertexFit(mother, false, true);
235 } else {
236 ok = doKVertexFit(mother, false, false);
237 }
238 }
239
240 // mass-constrained vertex fit
241 if (m_fitType == "massvertex") {
242 if (m_withConstraint == "ipprofile" || m_withConstraint == "iptube" || m_withConstraint == "iptubecut") {
243 B2FATAL("ParticleVertexFitter: Invalid options - mass-constrained fit using KFit does not work with iptube or ipprofile constraint.");
244 } else if (m_withConstraint == "pointing") {
245 ok = doKMassPointingVertexFit(mother);
246 } else {
247 ok = doKMassVertexFit(mother);
248 }
249 }
250
251 // mass fit
252 if (m_fitType == "mass") {
253 if (m_withConstraint == "ipprofile" || m_withConstraint == "iptube" || m_withConstraint == "iptubecut") {
254 B2FATAL("ParticleVertexFitter: Invalid options - mass fit using KFit does not work with iptube or ipprofile constraint.");
255 } else {
256 ok = doKMassFit(mother);
257 }
258 }
259
260 // four C fit
261 if (m_fitType == "fourC") {
262 if (m_withConstraint == "ipprofile" || m_withConstraint == "iptube" || m_withConstraint == "iptubecut") {
263 B2FATAL("ParticleVertexFitter: Invalid options - four C fit using KFit does not work with iptube or ipprofile constraint.");
264 } else {
265 ok = doKFourCFit(mother);
266 }
267 }
268
269 // four mass C fit
270 if (m_fitType == "massfourC") {
271 if (m_withConstraint == "ipprofile" || m_withConstraint == "iptube" || m_withConstraint == "iptubecut") {
272 B2FATAL("ParticleVertexFitter: Invalid options - four C fit using KFit does not work with iptube or ipprofile constraint.");
273 } else {
274 ok = doKMassFourCFit(mother);
275 }
276 }
277
278 // recoil mass C fit
279 if (m_fitType == "recoilmass") {
280 if (m_withConstraint == "ipprofile" || m_withConstraint == "iptube" || m_withConstraint == "iptubecut") {
281 B2FATAL("ParticleVertexFitter: Invalid options - recoil mass fit using KFit does not work with iptube or ipprofile constraint.");
282 } else {
283 ok = doKRecoilMassFit(mother);
284 }
285 }
286
287 // invalid KFit fit type
288 if (m_fitType != "vertex"
289 && m_fitType != "massvertex"
290 && m_fitType != "mass"
291 && m_fitType != "fourC"
292 && m_fitType != "massfourC"
293 && m_fitType != "recoilmass")
294 B2FATAL("ParticleVertexFitter: " << m_fitType << " ***invalid fit type for the vertex fitter ");
295 }
296
297 // fits using Rave
298 if (m_vertexFitter == "Rave") {
299 try {
300 ok = doRaveFit(mother);
301 } catch (const rave::CheckedFloatException&) {
302 B2ERROR("Invalid inputs (nan/inf)?");
303 ok = false;
304 }
305 }
306
307 // invalid fitter
308 if (m_vertexFitter != "KFit" && m_vertexFitter != "Rave")
309 B2FATAL("ParticleVertexFitter: " << m_vertexFitter << " ***invalid vertex fitter ");
310
311 if (!ok) return false;
312
313 // steering ends here
314
315 //if (mother->getPValue() < m_confidenceLevel) return false;
316 return true;
317
318}
bool doKMassPointingVertexFit(Particle *p)
Mass-constrained vertex fit with additional pointing constraint using KFit.
bool doKVertexFit(Particle *p, bool ipProfileConstraint, bool ipTubeConstraint)
Unconstrained vertex fit using KFit.
bool doKMassVertexFit(Particle *p)
Mass-constrained vertex fit using KFit.
bool doKFourCFit(Particle *p)
FourC fit using KFit.
bool doKRecoilMassFit(Particle *p)
RecoilMass fit using KFit.
bool doRaveFit(Particle *mother)
Fit using Rave.
bool doKMassFit(Particle *p)
Mass fit using KFit.
bool doKMassFourCFit(Particle *p)
MassFourC fit using KFit.

◆ endRun()

virtual void endRun ( void )
inlinevirtualinherited

This method is called if the current run ends.

Use this method to store information, which should be aggregated over one run.

This method can be implemented by subclasses.

Reimplemented in AlignDQMModule, AnalysisPhase1StudyModule, arichBtestModule, ARICHDQMModule, AWESOMEBasicModule, B2BIIConvertMdstModule, B2BIIMCParticlesMonitorModule, B2BIIMdstInputModule, BeamabortModule, BeamabortStudyModule, BeamDigitizerModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BelleMCOutputModule, BgoDigitizerModule, BgoModule, BgoStudyModule, BGOverlayInputModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, CalibrationCollectorModule, CaveModule, CDCCosmicAnalysisModule, CDCCRTestModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, CDCDedxDQMModule, CDCDedxValidationModule, cdcDQM7Module, CDCDQMModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CertifyParallelModule, ClawDigitizerModule, ClawModule, ClawStudyModule, ClawsDigitizerModule, CLAWSModule, ClawsStudyModule, Convert2RawDetModule, CosmicsAlignmentValidationModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, CurlTaggerModule, DAQPerfModule, DataWriterModule, DeSerializerPXDModule, DosiDigitizerModule, DosiModule, DosiStudyModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEcmsMonObjModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisExampleModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisKLMModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTRGModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DqmHistoManagerModule, DQMHistOutputToEPICSModule, DQMHistReferenceModule, DQMHistSnapshotsModule, Ds2RawFileModule, Ds2RawModule, Ds2RbufModule, Ds2SampleModule, ECLLOMModule, ECLBackgroundModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMEXTENDEDModule, ECLDQMModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, EffPlotsModule, EKLMDataCheckerModule, ElapsedTimeModule, EventInfoPrinterModule, EventT0ValidationModule, EvReductionModule, EvtGenDecayModule, ExtModule, FANGSDigitizerModule, FANGSModule, FANGSStudyModule, FastRbuf2DsModule, FullSimModule, TRGGDLUnpackerModule, GenfitVisModule, GenRawSendModule, GetEventFromSocketModule, He3DigitizerModule, He3tubeModule, He3tubeStudyModule, HistoManagerModule, HistoModule, HitXPModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQM2Module, KLMDQMModule, KLMMuonIDDNNExpertModule, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMTrackingModule, KLMTriggerModule, KLMUnpackerModule, KlongValidationModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, MCMatcherTRGECLModule, MCTrackCandClassifierModule, MCV0MatcherModule, MicrotpcModule, MicrotpcStudyModule, TpcDigitizerModule, TPCStudyModule, MonitorDataModule, MuidModule, NoKickCutsEvalModule, NtuplePhase1_v6Module, OverrideGenerationFlagsModule, PartialSeqRootReaderModule, Ph1bpipeModule, Ph1sustrModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, PinDigitizerModule, PindiodeModule, PindiodeStudyModule, PlumeDigitizerModule, PlumeModule, PrintDataModule, PrintEventRateModule, PXDBackgroundModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDROIFinderModule, PyModule, QcsmonitorDigitizerModule, QcsmonitorModule, QcsmonitorStudyModule, RandomBarrierModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, ReceiveEventModule, ReprocessorModule, Root2BinaryModule, Root2RawModule, RT2SPTCConverterModule, RxModule, RxSocketModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, SectorMapBootstrapModule, SeqRootInputModule, SeqRootMergerModule, SeqRootOutputModule, SerializerModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, SrsensorModule, StatisticsSummaryModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, SubEventModule, SVD3SamplesEmulatorModule, SVDBackgroundModule, SVDClusterizerModule, SVDPackerModule, SVDRecoDigitCreatorModule, SVDUnpackerModule, SVDB4CommissioningPlotsModule, SVDClusterCalibrationsMonitorModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, svdDumpModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsMonitorModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPositionErrorScaleFactorImporterModule, SVDROIDQMModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SVDShaperDigitsFromTracksModule, SVDTimeCalibrationsMonitorModule, SVDTriggerQualityGeneratorModule, SVDUnpackerDQMModule, SwitchDataStoreModule, TOPBackgroundModule, TOPChannelT0MCModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPLaserHitSelectorModule, TOPMCTrackMakerModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTriggerDigitizerModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPWaveformQualityPlotterModule, TOPXTalkChargeShareSetterModule, TrackAnaModule, TrackFinderMCTruthRecoTracksModule, FindletModule< AFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackFinderLegendre >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< FacetCreator >, FindletModule< FacetCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< HitBasedT0Extractor >, FindletModule< HitReclaimer >, FindletModule< HitReclaimer >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackExporter >, FindletModule< TrackFinder >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< TrackRejecter >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, FindletModule< WireHitPreparer >, TrackFinderVXDAnalizerModule, TrackingPerformanceEvaluationModule, TrackSetEvaluatorHopfieldNNDEVModule, TRGCDCETFUnpackerModule, TRGCDCModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSStreamModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLFAMModule, TRGECLModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLModule, TRGGDLSummaryModule, TRGGRLDQMModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLUnpackerModule, TRGRAWDATAModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TxModule, TxSocketModule, V0findingPerformanceEvaluationModule, vxdDigitMaskingModule, VXDSimpleClusterizerModule, VXDTFTrainingDataCollectorModule, ZMQTxInputModule, and ZMQTxWorkerModule.

Definition at line 165 of file Module.h.

165{};

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition Module.h:518
bool m_hasReturnValue
True, if the return value is set.
Definition Module.h:517

◆ event()

void event ( void )
overridevirtual

Event processor.

Reimplemented from Module.

Definition at line 127 of file ParticleVertexFitterModule.cc.

128{
129 if (m_vertexFitter == "Rave")
131
132 m_BeamSpotCenter = m_beamSpotDB->getIPPosition();
133 m_beamSpotCov.ResizeTo(3, 3);
134 if (m_withConstraint == "ipprofile") m_beamSpotCov = m_beamSpotDB->getCovVertex();
135 if (m_withConstraint == "iptube") {
136 if (m_smearing > 0 && m_vertexFitter == "KFit") {
138 } else {
140 }
141 }
142 if (m_withConstraint == "iptubecut") { // for development purpose only
143 m_BeamSpotCenter = ROOT::Math::XYZVector(0.001, 0., .013);
145 }
146 if ((m_vertexFitter == "Rave") && (m_withConstraint == "ipprofile" || m_withConstraint == "iptube"
147 || m_withConstraint == "mother" || m_withConstraint == "iptubecut" || m_withConstraint == "btube"))
149
150 std::vector<unsigned int> toRemove;
151 unsigned int nParticles = m_plist->getListSize();
152
153 for (unsigned iPart = 0; iPart < nParticles; iPart++) {
154 Particle* particle = m_plist->getParticle(iPart);
155 m_hasCovMatrix = false;
156 if (m_updateDaughters == true) {
157 if (m_decayString.empty() || m_vertexFitter == "KFit")
159 else B2ERROR("Daughters update works only when all daughters are selected. Daughters will not be updated");
160 }
161
162 if (m_withConstraint == "mother") {
163 m_BeamSpotCenter = particle->getVertex();
164 m_beamSpotCov = particle->getVertexErrorMatrix();
165 }
166
167 TMatrixFSym mother_errMatrix(7);
168 mother_errMatrix = particle->getMomentumVertexErrorMatrix();
169 for (int k = 0; k < 7; k++) {
170 for (int j = 0; j < 7; j++) {
171 if (mother_errMatrix[k][j] > 0) {
172 m_hasCovMatrix = true;
173 }
174 }
175 }
176
177 bool hasTube = true;
178 if (m_withConstraint == "btube") {
179 Btube* Ver = particle->getRelatedTo<Btube>();
180 if (!Ver) {
181 hasTube = false;
182 toRemove.push_back(particle->getArrayIndex());
183 } else {
184 m_BeamSpotCenter.SetXYZ(Ver->getTubeCenter()(0, 0), Ver->getTubeCenter()(1, 0), Ver->getTubeCenter()(2, 0));
186 }
187 }
188 bool ok = false;
189 if (hasTube) {
190 ok = doVertexFit(particle);
191 }
192 if (!ok)
193 particle->setPValue(-1);
194 if (particle->getPValue() < m_confidenceLevel)
195 toRemove.push_back(particle->getArrayIndex());
196
197 }
198 m_plist->removeParticles(toRemove);
199
200 //free memory allocated by rave. initialize() would be enough, except that we must clean things up before program end...
201 if (m_vertexFitter == "Rave")
203}
TMatrixFSym getTubeMatrix() const
Returns Btube matrix.
Definition Btube.h:73
Eigen::Matrix< double, 3, 1 > getTubeCenter() const
Returns Btube center.
Definition Btube.h:59
void smearBeamSpot(double width)
smear beam spot covariance
bool m_hasCovMatrix
flag for mother covariance matrix (PseudoFitter)
DBObjPtr< BeamSpot > m_beamSpotDB
Beam spot database object.
bool doVertexFit(Particle *p)
Main steering routine.
void findConstraintBoost(double cut)
calculate iptube constraint (quasi cylinder along boost direction) for RAVE fit
StoreObjPtr< ParticleList > m_plist
particle list
static void initialize(int verbosity=1, double MagneticField=1.5)
Set everything up so everything needed for vertex fitting is there.
Definition RaveSetup.cc:35
void reset()
frees memory allocated by initialize().
Definition RaveSetup.cc:60
void copyDaughters(Particle *mother)
Function copies all (grand-)^n-daughter particles of the argument mother Particle.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional paths */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 When using parallel processing, call this module's terminate() function in all processes. This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.
372)")
373 .value("INPUT", Module::EModulePropFlags::c_Input)
374 .value("OUTPUT", Module::EModulePropFlags::c_Output)
375 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
376 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
377 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
378 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
379 ;
380
381 //Python class definition
382 class_<Module, PyModule> module("Module", R"(
383Base class for Modules.
384
385A module is the smallest building block of the framework.
386A typical event processing chain consists of a Path containing
387modules. By inheriting from this base class, various types of
388modules can be created. To use a module, please refer to
389:func:`Path.add_module()`. A list of modules is available by running
390``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
391given by e.g. ``basf2 -m RootInput``.
392
393The 'Module Development' section in the manual provides detailed information
394on how to create modules, setting parameters, or using return values/conditions:
395https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
396
397)");
398 module
399 .def("__str__", &Module::getPathString)
400 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
401 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
402 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
403 "Returns the type of the module (i.e. class name minus 'Module')")
404 .def("set_name", &Module::setName, args("name"), R"(
405Set custom name, e.g. to distinguish multiple modules of the same type.
406
407>>> path.add_module('EventInfoSetter')
408>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
409>>> ro.set_name('RootOutput_metadata_only')
410>>> print(path)
411[EventInfoSetter -> RootOutput_metadata_only]
412
413)")
414 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
415 "Returns the description of this module.")
416 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
417 "Returns the package this module belongs to.")
418 .def("available_params", &_getParamInfoListPython,
419 "Return list of all module parameters as `ModuleParamInfo` instances")
420 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
421 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
422
423>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
424>>> ...
425
426Parameters:
427 properties (int): bitmask of `ModulePropFlags` to check for.
428)DOCSTRING")
429 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
430 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
431 {
432 // python signature is too crowded, make ourselves
433 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
434 module
435 .def("if_value", &Module::if_value,
436 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
437 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
438
439Sets a conditional sub path which will be executed after this
440module if the return value set in the module passes the given ``expression``.
441
442Modules can define a return value (int or bool) using ``setReturnValue()``,
443which can be used in the steering file to split the Path based on this value, for example
444
445>>> module_with_condition.if_value("<1", another_path)
446
447In case the return value of the ``module_with_condition`` for a given event is
448less than 1, the execution will be diverted into ``another_path`` for this event.
449
450You could for example set a special return value if an error occurs, and divert
451the execution into a path containing :b2:mod:`RootOutput` if it is found;
452saving only the data producing/produced by the error.
453
454After a conditional path has executed, basf2 will by default stop processing
455the path for this event. This behaviour can be changed by setting the
456``after_condition_path`` argument.
457
458Parameters:
459 expression (str): Expression to determine if the conditional path should be executed.
460 This should be one of the comparison operators ``<``, ``>``, ``<=``,
461 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
462 condition_path (Path): path to execute in case the expression is fulfilled
463 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
464)DOCSTRING")
465 .def("if_false", &Module::if_false,
466 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
467 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
468
469Sets a conditional sub path which will be executed after this module if
470the return value of the module evaluates to False. This is equivalent to
471calling `if_value` with ``expression=\"<1\"``)DOC")
472 .def("if_true", &Module::if_true,
473 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
474 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
475
476Sets a conditional sub path which will be executed after this module if
477the return value of the module evaluates to True. It is equivalent to
478calling `if_value` with ``expression=\">=1\"``)DOC");
479 }
480 module
481 .def("has_condition", &Module::hasCondition,
482 "Return true if a conditional path has been set for this module "
483 "using `if_value`, `if_true` or `if_false`")
484 .def("get_all_condition_paths", &_getAllConditionPathsPython,
485 "Return a list of all conditional paths set for this module using "
486 "`if_value`, `if_true` or `if_false`")
487 .def("get_all_conditions", &_getAllConditionsPython,
488 "Return a list of all conditional path expressions set for this module using "
489 "`if_value`, `if_true` or `if_false`")
490 .add_property("logging", make_function(&Module::getLogConfig, return_value_policy<reference_existing_object>()),
491 &Module::setLogConfig)
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">".
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "==".
@ c_ST
Smaller than: "<".
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition Module.cc:79
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition Module.cc:90
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition Module.cc:220
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition Module.h:81
@ c_Input
This module is an input module (reads data).
Definition Module.h:78
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition Module.h:82
@ c_Output
This module is an output module (writes data).
Definition Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition Module.h:83
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition Module.cc:85
ModuleCondition::EAfterConditionPath EAfterConditionPath
Forward the EAfterConditionPath definition from the ModuleCondition.
Definition Module.h:88

◆ fillFitParticles()

bool fillFitParticles ( const Particle * mother,
std::vector< const Particle * > & fitChildren,
std::vector< const Particle * > & twoPhotonChildren )
private

Fills valid particle's children (with valid error matrix) in the vector of Particles that will enter the fit.

Particles formed from two photons (e.g. pi0) are treated separately so they are filled to another vector.

Definition at line 320 of file ParticleVertexFitterModule.cc.

322{
323 if (m_decayString.empty()) {
324 // if decayString is empty, just use all primary daughters
325 for (unsigned ichild = 0; ichild < mother->getNDaughters(); ichild++) {
326 const Particle* child = mother->getDaughter(ichild);
327 // This if allows to skip the daughters, which cannot be used in the fits, particularly K_L0 from KLM.
328 // Useful for fully-inclusive particles.
329 if (mother->getProperty() == Particle::PropertyFlags::c_IsUnspecified and child->getPValue() < 0) {
330 continue;
331 }
332 fitChildren.push_back(child);
333 }
334 } else {
335 fitChildren = m_decaydescriptor.getSelectionParticles(mother);
336 }
337
338 auto itr = fitChildren.begin();
339 while (itr != fitChildren.end()) {
340 const Particle* child = *itr;
341
342 if (child->getPValue() < 0) {
343 B2WARNING("Daughter with PDG code " << child->getPDGCode() << " does not have a valid error matrix.");
344 return false; // error matrix not valid
345 }
346 bool isTwoPhotonParticle = false;
347 if (m_hasCovMatrix == false) {
348 if (child->getPDGCode() == Const::pi0.getPDGCode() or child->getPDGCode() == 221) { // pi0 or eta
349 if (child->getNDaughters() == 2) {
350 if (child->getDaughter(0)->getPDGCode() == Const::photon.getPDGCode()
351 && child->getDaughter(1)->getPDGCode() == Const::photon.getPDGCode()) {
352 isTwoPhotonParticle = true;
353 }
354 }
355 }
356 }
357 if (isTwoPhotonParticle) {
358 // move children from fitChildren to twoPhotonChildren
359 twoPhotonChildren.push_back(child);
360 itr = fitChildren.erase(itr);
361 } else {
362 itr++;
363 }
364 }
365
366 return true;
367}
int getPDGCode() const
PDG code.
Definition Const.h:473
static const ParticleType pi0
neutral pion particle
Definition Const.h:674
static const ParticleType photon
photon particle
Definition Const.h:673
int getProperty() const
Returns particle property as a bit pattern The values are defined in the PropertyFlags enum and descr...
Definition Particle.h:518
@ c_IsUnspecified
Ordinary particles.
Definition Particle.h:120

◆ fillNotFitParticles()

bool fillNotFitParticles ( const Particle * mother,
std::vector< const Particle * > & notFitChildren,
const std::vector< const Particle * > & fitChildren )
private

Fills valid particle's children (with valid error matrix) in the vector of Particles that will not enter the fit.

Definition at line 369 of file ParticleVertexFitterModule.cc.

371{
372 if (fitChildren.empty())
373 B2WARNING("[ParticleVertexFitterModule::fillNotFitParticles] fitChildren is empty! Please call fillFitParticles firstly");
374 if (!notFitChildren.empty())
375 B2WARNING("[ParticleVertexFitterModule::fillNotFitParticles] notFitChildren is NOT empty!"
376 << " The function should be called only once");
377
378 if (m_decayString.empty())
379 // if decayString is empty, just use all primary daughters
380 return true;
381
382 std::function<bool(const Particle*)> funcCheckInFit =
383 [&funcCheckInFit, &notFitChildren, fitChildren](const Particle * part) {
384
385 // check if the given particle in fitChildren
386 // if it is included, return true
387 if (std::find(fitChildren.begin(), fitChildren.end(), part) != fitChildren.end())
388 return true;
389
390 // if not, firstly check if particle has children
391 if (part->getNDaughters() == 0)
392 // if it has no children (=final-state-particle), return false
393 return false;
394
395 // here, the given particle is not in fitChildren and has children
396 bool isAnyChildrenInFit = false;
397 vector<const Particle*> notFitChildren_tmp;
398 for (unsigned ichild = 0; ichild < part->getNDaughters(); ichild++) {
399 // call funcCheckInFit recursively for all children
400 const Particle* child = part->getDaughter(ichild);
401 bool isChildrenInFit = funcCheckInFit(child);
402 isAnyChildrenInFit = isChildrenInFit or isAnyChildrenInFit;
403
404 // if the child is not in fitChildren, fill the child in a temporary vector
405 if (!isChildrenInFit)
406 notFitChildren_tmp.push_back(child);
407 }
408
409 // if there are a sister in fitChildren, the children in the temporary vector will be filled in notFitChildren
410 if (isAnyChildrenInFit)
411 notFitChildren.insert(notFitChildren.end(), notFitChildren_tmp.begin(), notFitChildren_tmp.end());
412
413 // if no children in fitChildren, the given particle should be filled instead of all children.
414
415 return isAnyChildrenInFit;
416 };
417
418
419 // call funcCheckInFit for all primary children
420 for (unsigned ichild = 0; ichild < mother->getNDaughters(); ichild++) {
421 const Particle* child = mother->getDaughter(ichild);
422 bool isGivenParticleOrAnyChildrenInFit = funcCheckInFit(child);
423 if (!isGivenParticleOrAnyChildrenInFit)
424 notFitChildren.push_back(child);
425 }
426
427 return true;
428}

◆ findConstraintBoost()

void findConstraintBoost ( double cut)
private

calculate iptube constraint (quasi cylinder along boost direction) for RAVE fit

Definition at line 1487 of file ParticleVertexFitterModule.cc.

1488{
1489 PCmsLabTransform T;
1490
1491 ROOT::Math::XYZVector boostDir = T.getBoostVector().Unit();
1492
1493 TMatrixDSym beamSpotCov = m_beamSpotDB->getCovVertex();
1494 beamSpotCov(2, 2) = cut * cut;
1495 double thetab = boostDir.Theta();
1496 double phib = boostDir.Phi();
1497
1498 double stb = TMath::Sin(thetab);
1499 double ctb = TMath::Cos(thetab);
1500 double spb = TMath::Sin(phib);
1501 double cpb = TMath::Cos(phib);
1502
1503
1504 TMatrix rz(3, 3); rz(2, 2) = 1;
1505 rz(0, 0) = cpb; rz(0, 1) = spb;
1506 rz(1, 0) = -1 * spb; rz(1, 1) = cpb;
1507
1508 TMatrix ry(3, 3); ry(1, 1) = 1;
1509 ry(0, 0) = ctb; ry(0, 2) = -1 * stb;
1510 ry(2, 0) = stb; ry(2, 2) = ctb;
1511
1512 TMatrix r(3, 3); r.Mult(rz, ry);
1513 TMatrix rt(3, 3); rt.Transpose(r);
1514
1515 TMatrix TubePart(3, 3); TubePart.Mult(rt, beamSpotCov);
1516 TMatrix Tube(3, 3); Tube.Mult(TubePart, r);
1517
1518 m_beamSpotCov(0, 0) = Tube(0, 0); m_beamSpotCov(0, 1) = Tube(0, 1); m_beamSpotCov(0, 2) = Tube(0, 2);
1519 m_beamSpotCov(1, 0) = Tube(1, 0); m_beamSpotCov(1, 1) = Tube(1, 1); m_beamSpotCov(1, 2) = Tube(1, 2);
1520 m_beamSpotCov(2, 0) = Tube(2, 0); m_beamSpotCov(2, 1) = Tube(2, 1); m_beamSpotCov(2, 2) = Tube(2, 2);
1521}
ROOT::Math::XYZVector getBoostVector() const
Returns boost vector (beta=p/E)

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 323 of file Module.h.

324 {
325 return m_conditions;
326 }

◆ getChi2TracksLBoost()

double getChi2TracksLBoost ( const analysis::VertexFitKFit & kv)
private

calculate the chi2 using only lboost information of tracks

Definition at line 1532 of file ParticleVertexFitterModule.cc.

1533{
1534 double chi2TrackL = 0;
1535
1536 for (int iTrack = 0; iTrack < kv.getTrackCount(); iTrack++) {
1537
1538 analysis::KFitTrack trk_i = kv.getTrack(iTrack); // KFitTrack contains parameters before/after fit.
1539
1540 TMatrixFSym err = CLHEPToROOT::getTMatrixFSym(trk_i.getError(analysis::KFitConst::kBeforeFit)); // px, py, pz, E, x, y, z
1541
1542 ROOT::Math::XYZVector x_before = CLHEPToROOT::getXYZVector(trk_i.getPosition(analysis::KFitConst::kBeforeFit));
1543 ROOT::Math::XYZVector x_after = CLHEPToROOT::getXYZVector(trk_i.getPosition());
1544 ROOT::Math::XYZVector dPos = x_after - x_before;
1545
1546 PCmsLabTransform T;
1547 ROOT::Math::XYZVector boost3 = T.getBoostVector().Unit();
1548 TVectorD boostD(0, 6, 0., 0., 0., 0., boost3.X(), boost3.Y(), boost3.Z(), "END");
1549
1550 double dLBoost = dPos.Dot(boost3);
1551
1552 chi2TrackL += TMath::Power(dLBoost, 2) / err.Similarity(boostD);
1553 }
1554 return chi2TrackL;
1555}
const KFitTrack getTrack(const int id) const
Get a specified track object.
Definition KFitBase.cc:175
const CLHEP::HepSymMatrix getError(const int flag=KFitConst::kAfterFit) const
Get an error matrix of the track.
Definition KFitTrack.cc:171
const HepPoint3D getPosition(const int flag=KFitConst::kAfterFit) const
Get a position of the track.
Definition KFitTrack.cc:163
static const int kBeforeFit
Input parameter to specify before-fit when setting/getting a track attribute.
Definition KFitConst.h:33

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 313 of file Module.h.

314 {
315 if (m_conditions.empty()) {
316 return nullptr;
317 } else {
318 return &m_conditions.front();
319 }
320 }

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).

Definition at line 113 of file Module.cc.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition Path.h:35

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 201 of file Module.h.

201{return m_description;}

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootInputModule, RootOutputModule, and StorageRootOutputModule.

Definition at line 133 of file Module.h.

134 {
135 return std::vector<std::string>();
136 }

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 224 of file Module.h.

224{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 505 of file Module.h.

505{ return std::list<ModulePtr>(); }

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 186 of file Module.h.

186{return m_name;}

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 196 of file Module.h.

196{return m_package;}

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 362 of file Module.h.

362{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 380 of file Module.h.

380{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition Module.h:508

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 310 of file Module.h.

310{ return not m_conditions.empty(); };

◆ hasProperties()

bool hasProperties ( unsigned int propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 377 of file Module.h.

377{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ if_false()

void if_false ( const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ if_true()

void if_true ( const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ if_value()

void if_value ( const std::string & expression,
const std::shared_ptr< Path > & path,
EAfterConditionPath afterConditionPath = EAfterConditionPath::c_End )
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://xwiki.desy.de/xwiki/rest/p/a94f2 or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initialize()

void initialize ( void )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 94 of file ParticleVertexFitterModule.cc.

95{
96 // Particle list with name m_listName has to exist
97 m_plist.isRequired(m_listName);
98
99 // magnetic field
100 m_Bfield = BFieldManager::getFieldInTesla(ROOT::Math::XYZVector(0, 0, 0)).Z();
101
102 // RAVE setup
103 if (m_vertexFitter == "Rave")
105
106 B2DEBUG(1, "ParticleVertexFitterModule : magnetic field = " << m_Bfield);
107
108
109 if (m_decayString != "")
111
112 B2INFO("ParticleVertexFitter: Performing " << m_fitType << " fit on " << m_listName << " using " << m_vertexFitter);
113 if (m_decayString != "")
114 B2INFO("ParticleVertexFitter: Using specified decay string: " << m_decayString);
115 if (m_withConstraint != "")
116 B2INFO("ParticleVertexFitter: Additional " << m_withConstraint << " will be applied");
117
118}
static ROOT::Math::XYZVector getFieldInTesla(const ROOT::Math::XYZVector &pos)
return the magnetic field at a given position in Tesla.

◆ makeKFourCMother()

bool makeKFourCMother ( analysis::FourCFitKFit & kv,
Particle * p )
private

Update mother particle after FourC fit using KFit.

Parameters
kvreference to KFit MassFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 1054 of file ParticleVertexFitterModule.cc.

1055{
1056 enum analysis::KFitError::ECode fitError;
1057 fitError = kf.updateMother(mother);
1058 if (fitError != analysis::KFitError::kNoError)
1059 return false;
1060 mother->addExtraInfo("FourCFitProb", kf.getCHIsq());
1061 mother->addExtraInfo("FourCFitChi2", kf.getNDF());
1062 if (m_decayString.empty() && m_updateDaughters == true) {
1063 // update daughter momenta as well
1064 // the order of daughters in the *fitter is the same as in the mother Particle
1065
1066 std::vector<Particle*> daughters = mother->getDaughters();
1067
1068 const unsigned nd = daughters.size();
1069 unsigned l = 0;
1070 std::vector<std::vector<unsigned>> pars;
1071 pars.reserve(nd);
1072 std::vector<Particle*> allparticles;
1073 allparticles.reserve(nd);
1074 for (unsigned ichild = 0; ichild < nd; ichild++) {
1075 const Particle* daughter = mother->getDaughter(ichild);
1076 std::vector<unsigned> pard;
1077 if (daughter->getNDaughters() > 0) {
1078 updateMapOfTrackAndDaughter(l, pars, pard, allparticles, daughter);
1079 pars.push_back(std::move(pard));
1080 allparticles.push_back(daughters[ichild]);
1081 } else {
1082 pard.push_back(l);
1083 pars.push_back(std::move(pard));
1084 allparticles.push_back(daughters[ichild]);
1085 l++;
1086 }
1087 }
1088
1089 unsigned track_count = kf.getTrackCount();
1090 if (l != track_count)
1091 return false;
1092
1093 for (unsigned iDaug = 0; iDaug < allparticles.size(); iDaug++) {
1094 ROOT::Math::PxPyPzEVector childMoms;
1095 ROOT::Math::XYZVector childPoss;
1096 TMatrixFSym childErrMatrixs(7);
1097 for (unsigned int iChild : pars[iDaug]) {
1098 childMoms = childMoms +
1099 CLHEPToROOT::getLorentzVector(
1100 kf.getTrackMomentum(iChild));
1101 childPoss = childPoss +
1102 CLHEPToROOT::getXYZVector(
1103 kf.getTrackPosition(iChild));
1104 TMatrixFSym childErrMatrix =
1105 CLHEPToROOT::getTMatrixFSym(kf.getTrackError(iChild));
1106 childErrMatrixs = childErrMatrixs + childErrMatrix;
1107 }
1108 allparticles[iDaug]->set4Vector(childMoms);
1109 allparticles[iDaug]->setVertex(childPoss);
1110 allparticles[iDaug]->setMomentumVertexErrorMatrix(childErrMatrixs);
1111 }
1112 }
1113
1114 return true;
1115}
void updateMapOfTrackAndDaughter(unsigned &l, std::vector< std::vector< unsigned > > &pars, std::vector< unsigned > &pard, std::vector< Particle * > &allparticles, const Particle *daughter)
update the map of daughter and tracks, find out which tracks belong to each daughter.
ECode
ECode is a error code enumerate.
Definition KFitError.h:33

◆ makeKMassMother()

bool makeKMassMother ( analysis::MassFitKFit & kv,
Particle * p )
private

Update mother particle after mass fit using KFit.

Parameters
kvreference to KFit MassFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 1014 of file ParticleVertexFitterModule.cc.

1016{
1017 enum analysis::KFitError::ECode fitError;
1018 fitError = km.updateMother(mother);
1019 if (fitError != analysis::KFitError::kNoError)
1020 return false;
1021 if (m_decayString.empty() && m_updateDaughters == true) {
1022 // update daughter momenta as well
1023 // the order of daughters in the *fitter is the same as in the mother Particle
1024
1025 std::vector<Particle*> daughters = mother->getDaughters();
1026
1027 unsigned track_count = km.getTrackCount();
1028 if (daughters.size() != track_count)
1029 return false;
1030
1031 for (unsigned iChild = 0; iChild < track_count; iChild++) {
1032 double a = -1 * Const::speedOfLight * 1e-4 * m_Bfield * daughters[iChild]->getCharge();
1033 double dx = km.getVertex().x() - km.getTrackPosition(iChild).x();
1034 double dy = km.getVertex().y() - km.getTrackPosition(iChild).y();
1035
1036 ROOT::Math::PxPyPzEVector i4Vector(km.getTrackMomentum(iChild).x() - a * dy,
1037 km.getTrackMomentum(iChild).y() + a * dx,
1038 km.getTrackMomentum(iChild).z(),
1039 km.getTrackMomentum(iChild).t());
1040 daughters[iChild]->set4VectorDividingByMomentumScaling(i4Vector);
1041
1042 daughters[iChild]->setVertex(
1043 CLHEPToROOT::getXYZVector(km.getTrackPosition(iChild)));
1044 daughters[iChild]->setMomentumVertexErrorMatrix(
1045 CLHEPToROOT::getTMatrixFSym(km.getTrackError(iChild)));
1046 }
1047 }
1048
1049 return true;
1050}
static const double speedOfLight
[cm/ns]
Definition Const.h:695

◆ makeKMassPointingVertexMother()

bool makeKMassPointingVertexMother ( analysis::MassPointingVertexFitKFit & kv,
Particle * p )
private

Update mother particle after mass-constrained vertex fit with additional pointing constraint using KFit.

Parameters
kvreference to KFit MassPointingVertexFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 973 of file ParticleVertexFitterModule.cc.

975{
976 enum analysis::KFitError::ECode fitError;
977 fitError = kmpv.updateMother(mother);
978 if (fitError != analysis::KFitError::kNoError) {
979 return false;
980 }
981
982 if (m_decayString.empty() && m_updateDaughters == true) {
983 // update daughter momenta as well
984 // the order of daughters in the *fitter is the same as in the mother Particle
985
986 std::vector<Particle*> daughters = mother->getDaughters();
987
988 unsigned track_count = kmpv.getTrackCount();
989 if (daughters.size() != track_count)
990 return false;
991
992 for (unsigned iChild = 0; iChild < track_count; iChild++) {
993 double a = -1 * Const::speedOfLight * 1e-4 * m_Bfield * daughters[iChild]->getCharge();
994 double dx = kmpv.getVertex().x() - kmpv.getTrackPosition(iChild).x();
995 double dy = kmpv.getVertex().y() - kmpv.getTrackPosition(iChild).y();
996
997 ROOT::Math::PxPyPzEVector i4Vector(kmpv.getTrackMomentum(iChild).x() - a * dy,
998 kmpv.getTrackMomentum(iChild).y() + a * dx,
999 kmpv.getTrackMomentum(iChild).z(),
1000 kmpv.getTrackMomentum(iChild).t());
1001 daughters[iChild]->set4VectorDividingByMomentumScaling(i4Vector);
1002
1003 daughters[iChild]->setVertex(
1004 CLHEPToROOT::getXYZVector(kmpv.getTrackPosition(iChild)));
1005 daughters[iChild]->setMomentumVertexErrorMatrix(
1006 CLHEPToROOT::getTMatrixFSym(kmpv.getTrackError(iChild)));
1007 }
1008 }
1009
1010 return true;
1011}

◆ makeKMassVertexMother()

bool makeKMassVertexMother ( analysis::MassVertexFitKFit & kv,
Particle * p )
private

Update mother particle after mass-constrained vertex fit using KFit.

Parameters
kvreference to KFit MassVertexFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 935 of file ParticleVertexFitterModule.cc.

937{
938 enum analysis::KFitError::ECode fitError;
939 fitError = kmv.updateMother(mother);
940 if (fitError != analysis::KFitError::kNoError)
941 return false;
942 if (m_decayString.empty() && m_updateDaughters == true) {
943 // update daughter momenta as well
944 // the order of daughters in the *fitter is the same as in the mother Particle
945
946 std::vector<Particle*> daughters = mother->getDaughters();
947
948 unsigned track_count = kmv.getTrackCount();
949 if (daughters.size() != track_count)
950 return false;
951
952 for (unsigned iChild = 0; iChild < track_count; iChild++) {
953 double a = -1 * Const::speedOfLight * 1e-4 * m_Bfield * daughters[iChild]->getCharge();
954 double dx = kmv.getVertex().x() - kmv.getTrackPosition(iChild).x();
955 double dy = kmv.getVertex().y() - kmv.getTrackPosition(iChild).y();
956
957 ROOT::Math::PxPyPzEVector i4Vector(kmv.getTrackMomentum(iChild).x() - a * dy,
958 kmv.getTrackMomentum(iChild).y() + a * dx,
959 kmv.getTrackMomentum(iChild).z(),
960 kmv.getTrackMomentum(iChild).t());
961 daughters[iChild]->set4VectorDividingByMomentumScaling(i4Vector);
962
963 daughters[iChild]->setVertex(
964 CLHEPToROOT::getXYZVector(kmv.getTrackPosition(iChild)));
965 daughters[iChild]->setMomentumVertexErrorMatrix(
966 CLHEPToROOT::getTMatrixFSym(kmv.getTrackError(iChild)));
967 }
968 }
969
970 return true;
971}

◆ makeKRecoilMassMother()

bool makeKRecoilMassMother ( analysis::RecoilMassKFit & kf,
Particle * p )
private

Update mother particle after RecoilMass fit using KFit.

Parameters
kfreference to KFit MassFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 1181 of file ParticleVertexFitterModule.cc.

1182{
1183 enum analysis::KFitError::ECode fitError;
1184 fitError = kf.updateMother(mother);
1185 if (fitError != analysis::KFitError::kNoError)
1186 return false;
1187 mother->addExtraInfo("RecoilMassFitProb", TMath::Prob(kf.getCHIsq(), kf.getNDF()));
1188 mother->addExtraInfo("RecoilMassFitChi2", kf.getCHIsq());
1189 mother->addExtraInfo("RecoilMassFitNDF", kf.getNDF());
1190 if (m_decayString.empty() && m_updateDaughters == true) {
1191 // update daughter momenta as well
1192 // the order of daughters in the *fitter is the same as in the mother Particle
1193
1194 std::vector<Particle*> daughters = mother->getDaughters();
1195
1196 unsigned track_count = kf.getTrackCount();
1197 if (daughters.size() != track_count)
1198 return false;
1199
1200 for (unsigned iChild = 0; iChild < track_count; iChild++) {
1201 double a = -1 * Const::speedOfLight * 1e-4 * m_Bfield * daughters[iChild]->getCharge();
1202 double dx = kf.getVertex().x() - kf.getTrackPosition(iChild).x();
1203 double dy = kf.getVertex().y() - kf.getTrackPosition(iChild).y();
1204
1205 ROOT::Math::PxPyPzEVector i4Vector(kf.getTrackMomentum(iChild).x() - a * dy,
1206 kf.getTrackMomentum(iChild).y() + a * dx,
1207 kf.getTrackMomentum(iChild).z(),
1208 kf.getTrackMomentum(iChild).t());
1209 daughters[iChild]->set4VectorDividingByMomentumScaling(i4Vector);
1210
1211 daughters[iChild]->setVertex(
1212 CLHEPToROOT::getXYZVector(kf.getTrackPosition(iChild)));
1213 daughters[iChild]->setMomentumVertexErrorMatrix(
1214 CLHEPToROOT::getTMatrixFSym(kf.getTrackError(iChild)));
1215 }
1216 }
1217
1218 return true;
1219}
const CLHEP::HepSymMatrix getTrackError(const int id) const
Get an error matrix of the track.
Definition KFitBase.cc:168
const CLHEP::HepLorentzVector getTrackMomentum(const int id) const
Get a Lorentz vector of the track.
Definition KFitBase.cc:154
const HepPoint3D getTrackPosition(const int id) const
Get a position of the track.
Definition KFitBase.cc:161
virtual int getNDF(void) const
Get an NDF of the fit.
Definition KFitBase.cc:114
double getCHIsq(void) const override
Get a chi-square of the fit.
enum KFitError::ECode updateMother(Particle *mother)
Update mother particle.
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.

◆ makeKVertexMother()

bool makeKVertexMother ( analysis::VertexFitKFit & kv,
Particle * p )
private

Update mother particle after unconstrained vertex fit using KFit.

Parameters
kvreference to KFit VertexFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 836 of file ParticleVertexFitterModule.cc.

838{
839 enum analysis::KFitError::ECode fitError;
840 fitError = kv.updateMother(mother);
841 if (fitError != analysis::KFitError::kNoError)
842 return false;
843 if (m_decayString.empty() && m_updateDaughters == true) {
844 // update daughter momenta as well
845 // the order of daughters in the *fitter is the same as in the mother Particle
846
847 std::vector<Particle*> daughters = mother->getDaughters();
848
849 unsigned track_count = kv.getTrackCount();
850 if (daughters.size() != track_count)
851 return false;
852
853 for (unsigned iChild = 0; iChild < track_count; iChild++) {
854 double a = -1 * Const::speedOfLight * 1e-4 * m_Bfield * daughters[iChild]->getCharge();
855 double dx = kv.getVertex().x() - kv.getTrackPosition(iChild).x();
856 double dy = kv.getVertex().y() - kv.getTrackPosition(iChild).y();
857
858 ROOT::Math::PxPyPzEVector i4Vector(kv.getTrackMomentum(iChild).x() - a * dy,
859 kv.getTrackMomentum(iChild).y() + a * dx,
860 kv.getTrackMomentum(iChild).z(),
861 kv.getTrackMomentum(iChild).t());
862 daughters[iChild]->set4VectorDividingByMomentumScaling(i4Vector);
863
864 daughters[iChild]->setVertex(
865 CLHEPToROOT::getXYZVector(kv.getTrackPosition(iChild)));
866 daughters[iChild]->setMomentumVertexErrorMatrix(
867 CLHEPToROOT::getTMatrixFSym(kv.getTrackError(iChild)));
868 }
869
870 } else if (m_updateDaughters == true) { // if decayString is not empty
871 // first, update only the fit children
872 std::vector<const Particle*> fitChildren = m_decaydescriptor.getSelectionParticles(mother);
873
874 unsigned track_count = kv.getTrackCount();
875 if (fitChildren.size() != track_count)
876 return false;
877
878 for (unsigned iChild = 0; iChild < track_count; iChild++) {
879 auto daughter = const_cast<Particle*>(fitChildren[iChild]);
880
881 double a = -1 * Const::speedOfLight * 1e-4 * m_Bfield * daughter->getCharge();
882 double dx = kv.getVertex().x() - kv.getTrackPosition(iChild).x();
883 double dy = kv.getVertex().y() - kv.getTrackPosition(iChild).y();
884
885 ROOT::Math::PxPyPzEVector i4Vector(kv.getTrackMomentum(iChild).x() - a * dy,
886 kv.getTrackMomentum(iChild).y() + a * dx,
887 kv.getTrackMomentum(iChild).z(),
888 kv.getTrackMomentum(iChild).t());
889 daughter->set4VectorDividingByMomentumScaling(i4Vector);
890
891 daughter->setVertex(CLHEPToROOT::getXYZVector(kv.getTrackPosition(iChild)));
892 daughter->setMomentumVertexErrorMatrix(CLHEPToROOT::getTMatrixFSym(kv.getTrackError(iChild)));
893 }
894
895 // then, update other particles that have a fit-child in decay
896 std::function<bool(Particle*)> funcUpdateMomentum =
897 [&funcUpdateMomentum, fitChildren](Particle * part) {
898
899 if (part->getNDaughters() == 0) {
900 // check if part is included in fitChildren
901 if (std::find(fitChildren.begin(), fitChildren.end(), part) != fitChildren.end())
902 return true;
903 else
904 return false;
905 }
906
907 bool includeFitChildren = false;
908
909 // Update daughters' momentum
910 for (auto daughter : part->getDaughters())
911 includeFitChildren = funcUpdateMomentum(daughter) || includeFitChildren;
912
913 if (includeFitChildren) {
914 // Using updated daughters, update part's momentum
915 ROOT::Math::PxPyPzEVector sum4Vector;
916 for (auto daughter : part->getDaughters())
917 sum4Vector += daughter->get4Vector();
918
919 part->set4VectorDividingByMomentumScaling(sum4Vector);
920 }
921
922 return includeFitChildren;
923 };
924
925 // Update all daughters
926 for (auto daughter : mother->getDaughters())
927 funcUpdateMomentum(daughter);
928
929 }
930
931
932 return true;
933}
enum KFitError::ECode updateMother(Particle *mother)
Update mother particle.
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.

◆ makeMassKFourCMother()

bool makeMassKFourCMother ( analysis::MassFourCFitKFit & kv,
Particle * p )
private

Update mother particle after MassFourC fit using KFit.

Parameters
kvreference to KFit MassFit object
ppointer to particle
Returns
true for successful construction of mother

Definition at line 1117 of file ParticleVertexFitterModule.cc.

1118{
1119 enum analysis::KFitError::ECode fitError;
1120 fitError = kf.updateMother(mother);
1121 if (fitError != analysis::KFitError::kNoError)
1122 return false;
1123 mother->addExtraInfo("MassFourCFitProb", TMath::Prob(kf.getCHIsq(), kf.getNDF()));
1124 mother->addExtraInfo("MassFourCFitChi2", kf.getCHIsq());
1125 mother->addExtraInfo("MassFourCFitNDF", kf.getNDF());
1126 if (m_decayString.empty() && m_updateDaughters == true) {
1127 // update daughter momenta as well
1128 // the order of daughters in the *fitter is the same as in the mother Particle
1129
1130 std::vector<Particle*> daughters = mother->getDaughters();
1131
1132 const unsigned nd = daughters.size();
1133 unsigned l = 0;
1134 std::vector<std::vector<unsigned>> pars;
1135 pars.reserve(nd);
1136 std::vector<Particle*> allparticles;
1137 allparticles.reserve(nd);
1138 for (unsigned ichild = 0; ichild < nd; ichild++) {
1139 const Particle* daughter = mother->getDaughter(ichild);
1140 std::vector<unsigned> pard;
1141 if (daughter->getNDaughters() > 0) {
1142 updateMapOfTrackAndDaughter(l, pars, pard, allparticles, daughter);
1143 pars.push_back(std::move(pard));
1144 allparticles.push_back(daughters[ichild]);
1145 } else {
1146 pard.push_back(l);
1147 pars.push_back(std::move(pard));
1148 allparticles.push_back(daughters[ichild]);
1149 l++;
1150 }
1151 }
1152
1153 unsigned track_count = kf.getTrackCount();
1154 if (l != track_count)
1155 return false;
1156
1157 for (unsigned iDaug = 0; iDaug < allparticles.size(); iDaug++) {
1158 ROOT::Math::PxPyPzEVector childMoms;
1159 ROOT::Math::XYZVector childPoss;
1160 TMatrixFSym childErrMatrixs(7);
1161 for (unsigned int iChild : pars[iDaug]) {
1162 childMoms = childMoms +
1163 CLHEPToROOT::getLorentzVector(
1164 kf.getTrackMomentum(iChild));
1165 childPoss = childPoss +
1166 CLHEPToROOT::getXYZVector(
1167 kf.getTrackPosition(iChild));
1168 TMatrixFSym childErrMatrix =
1169 CLHEPToROOT::getTMatrixFSym(kf.getTrackError(iChild));
1170 childErrMatrixs = childErrMatrixs + childErrMatrix;
1171 }
1172 allparticles[iDaug]->set4Vector(childMoms);
1173 allparticles[iDaug]->setVertex(childPoss);
1174 allparticles[iDaug]->setMomentumVertexErrorMatrix(childErrMatrixs);
1175 }
1176 }
1177
1178 return true;
1179}

◆ redoTwoPhotonDaughterMassFit()

bool redoTwoPhotonDaughterMassFit ( Particle * postFit,
const Particle * preFit,
const analysis::VertexFitKFit & kv )
private

Combines preFit particle and vertex information from vertex fit kv to create new postFit particle.

A mass refit of this new particle is performed assuming that it originates from the point given by VertexFit.

Definition at line 430 of file ParticleVertexFitterModule.cc.

432{
433 // TODO: something like setGammaError is necessary
434 // this is just workaround for the moment
435
436 const Particle* g1Orig = preFit->getDaughter(0);
437 const Particle* g2Orig = preFit->getDaughter(1);
438 Particle g1Temp(g1Orig->get4Vector(), 22);
439 Particle g2Temp(g2Orig->get4Vector(), 22);
440
441 TMatrixFSym g1ErrMatrix = g1Orig->getMomentumVertexErrorMatrix();
442 TMatrixFSym g2ErrMatrix = g2Orig->getMomentumVertexErrorMatrix();
443
444 ROOT::Math::XYZVector pos(kv.getVertex().x(), kv.getVertex().y(), kv.getVertex().z());
445 CLHEP::HepSymMatrix posErrorMatrix = kv.getVertexError();
446
447 TMatrixFSym errMatrix(3);
448 for (int i = 0; i < 3; i++)
449 for (int j = 0; j < 3; j++)
450 errMatrix(i, j) = posErrorMatrix[i][j];
451
452 g1ErrMatrix.SetSub(4, errMatrix);
453 g2ErrMatrix.SetSub(4, errMatrix);
454
455 g1Temp.updateMomentum(g1Orig->get4Vector(), pos, g1ErrMatrix, 1.0);
456 g2Temp.updateMomentum(g2Orig->get4Vector(), pos, g2ErrMatrix, 1.0);
457
458 // perform the mass fit for the two-photon particle
459 analysis::MassFitKFit km;
461
462 km.addParticle(&g1Temp);
463 km.addParticle(&g2Temp);
464
465 km.setVertex(kv.getVertex());
467 km.setInvariantMass(preFit->getPDGMass());
468
469 int err = km.doFit();
470 if (err != 0) {
471 return false;
472 }
473
474 // The update of the daughters is disabled for this mass fit.
475 bool updateDaughters = m_updateDaughters;
476 m_updateDaughters = false;
477 bool ok = makeKMassMother(km, postFit);
478 m_updateDaughters = updateDaughters;
479
480 return ok;
481}
TMatrixFSym getMomentumVertexErrorMatrix() const
Returns 7x7 error matrix.
Definition Particle.cc:451
enum KFitError::ECode setVertex(const HepPoint3D &v)
Set an initial vertex position for the mass-constraint fit.
enum KFitError::ECode setVertexError(const CLHEP::HepSymMatrix &e)
Set an initial vertex error matrix for the mass-constraint fit.
const CLHEP::HepSymMatrix getVertexError(void) const
Get a fitted vertex error matrix.

◆ setAbortLevel()

void setAbortLevel ( int abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition LogConfig.h:98

◆ setDescription()

void setDescription ( const std::string & description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}
std::string m_description
The description of the module.
Definition Module.h:510

◆ setLogConfig()

void setLogConfig ( const LogConfig & logConfig)
inlineinherited

Set the log system configuration.

Definition at line 229 of file Module.h.

229{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int logLevel,
unsigned int logInfo )
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition LogConfig.cc:25

◆ setName()

void setName ( const std::string & name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 213 of file Module.h.

213{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList & params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 500 of file Module.h.

500{ m_moduleParamList = params; }

◆ setParamPython()

void setParamPython ( const std::string & name,
const boost::python::object & pyObj )
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition LogSystem.h:200
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition LogSystem.cc:28
LogConfig & getLogConfig()
Returns the log system configuration.
Definition Module.h:224
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition Module.h:507
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict & dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition Module.cc:234

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ setReturnValue() [2/2]

void setReturnValue ( int value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ setType()

void setType ( const std::string & type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ smearBeamSpot()

void smearBeamSpot ( double width)
private

smear beam spot covariance

Definition at line 1523 of file ParticleVertexFitterModule.cc.

1524{
1525 TMatrixDSym beamSpotCov = m_beamSpotDB->getCovVertex();
1526 for (int i = 0; i < 3; i++)
1527 beamSpotCov(i, i) += width * width;
1528
1529 m_beamSpotCov = beamSpotCov;
1530}

◆ terminate()

virtual void terminate ( void )
inlinevirtualinherited

This method is called at the end of the event processing.

This method is called only once after the event processing finished. Use this method for cleaning up, closing files, etc.

This method can be implemented by subclasses.

Reimplemented in AafhInputModule, AnalysisPhase1StudyModule, ARICHBackgroundModule, arichBtestModule, ARICHNtupleModule, arichToNtupleModule, AsyncWrapper, AWESOMEBasicModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMCParticlesMonitorModule, B2BIIMdstInputModule, BabayagaNLOInputModule, BBBremInputModule, BeamabortModule, BeamabortStudyModule, BeamDigitizerModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BeamSpotMonitorModule, BelleMCOutputModule, BgoDigitizerModule, BgoModule, BgoStudyModule, BGOverlayInputModule, BHWideInputModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, CalibrationCollectorModule, CaveModule, CDCCosmicAnalysisModule, CDCCRTestModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, CDCCrossTalkAdderModule, CDCDedxCorrectionModule, CDCDedxDQMModule, CDCDedxPIDModule, CDCDedxScanModule, CDCDedxSkimCDSTModule, CDCDedxSkimModule, CDCDedxValidationModule, CDCDigitizerModule, cdcDQM7Module, CDCDQMModule, CDCInitialT0DeterminationModule, CDCTrigger2DFinderModule, CDCTriggerHoughETFModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDataModule, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerNeuroIDHistModule, CDCTriggerTSFFirmwareModule, CDCTriggerTSFModule, CDCTriggerUnpackerModule, CertifyParallelModule, CheckErrorEventModule, Chi2MCTrackMatcherModule, ClawDigitizerModule, ClawModule, ClawStudyModule, ClawsDigitizerModule, CLAWSModule, ClawsStudyModule, CollectorTestModule, Convert2RawDetModule, CosmicsAlignmentValidationModule, CRYInputModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, CurlingTrackCandSplitterModule, CurlTaggerModule, DAQPerfModule, DataWriterModule, DeSerializerModule, DeSerializerPXDModule, DisplayModule, DosiDigitizerModule, DosiModule, DosiStudyModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEcmsMonObjModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisExampleModule, DQMHistAnalysisHLTModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTRGModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DqmHistoManagerModule, DQMHistOutputToEPICSModule, DQMHistReferenceModule, DQMHistSnapshotsModule, Ds2RawFileModule, Ds2RawModule, Ds2RbufModule, Ds2SampleModule, ECLLOMModule, ECLBackgroundModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDModule, ECLClusterPSDModule, ECLCompressBGOverlayModule, ECLCovarianceMatrixModule, EclCovMatrixNtupleModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigiStudyModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMEXTENDEDModule, ECLDQMModule, ECLExpertModule, ECLFillCellIdMappingModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLMatchingPerformanceExpertModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLTrackClusterMatchingModule, ECLTrackClusterMatchingParametrizationExpertModule, ECLTrackClusterMatchingPerformanceModule, ECLTRGInformationModule, ECLTrimShowersAndDigitsModule, ECLUnpackerModule, eclWaveformCalibCollectorModule, ECLWaveformFitModule, EffPlotsModule, EKLMDataCheckerModule, ElapsedTimeModule, EventKinematicsModule, EvReductionModule, EvtGenDecayModule, ExtModule, FANGSDigitizerModule, FANGSModule, FANGSStudyModule, FastBDTClassifierAnalyzerModule, FastBDTClassifierTrainingModule, FastRbuf2DsModule, FillTrackFitNtupleModule, FlavorTaggerInfoFillerModule, FragmentationModule, FullSimModule, FullSimTimingModule, TRGGDLUnpackerModule, GeneratedVertexDisplacerModule, GeneratorPreselectionModule, GenfitVisModule, GenRawSendModule, GeometryModule, GetEventFromSocketModule, GFTC2SPTCConverterModule, GRLNeuroModule, GRLNeuroTrainerModule, He3DigitizerModule, He3tubeModule, He3tubeStudyModule, HepevtOutputModule, HepMCInputModule, HepMCOutputModule, HistoManagerModule, HistoModule, HitLevelInfoWriterModule, HitXPModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, KinkFinderModule, KKGenInputModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQM2Module, KLMDQMModule, KLMExpertModule, KLMMuonIDDNNExpertModule, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMTrackingModule, KLMTriggerModule, KLMUnpackerModule, KlongValidationModule, KoralWInputModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, MasterClassModule, MCMatcherTRGECLModule, MCTrackCandClassifierModule, MCV0MatcherModule, MergeDataStoreModule, MicrotpcModule, MicrotpcStudyModule, TpcDigitizerModule, MLSegmentNetworkProducerModule, MonitorDataModule, MuidModule, MVAExpertModule, MVAMultipleExpertsModule, NoKickCutsEvalModule, NtuplePhase1_v6Module, ParticleKinematicFitterModule, OverrideGenerationFlagsModule, PartialSeqRootReaderModule, ParticleLoaderModule, ParticleMassHypothesesUpdaterModule, ParticleMassUpdaterModule, ParticleMCDecayStringModule, ParticleMomentumUpdaterModule, ParticleStatsModule, ParticleWeightingLookUpCreatorModule, Ph1bpipeModule, Ph1sustrModule, PhaseSpaceAnalysisModule, PhokharaInputModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, PIDNtupleModule, PinDigitizerModule, PindiodeModule, PindiodeStudyModule, PlumeDigitizerModule, PlumeModule, ProfileModule, ProgressBarModule, PXDBackgroundModule, PXDBgTupleProducerModule, PXDMCBgTupleProducerModule, PXDPackerErrModule, PXDPackerModule, PXDReadRawBonnDAQMatchedModule, PXDReadRawBonnDAQModule, PXDReadRawONSENModule, PXDUnpackerModule, PXDUnpackerOldModule, PXDUnpackerOTModule, PXDClustersFromTracksModule, PXDDQMEfficiencyNtupleModule, PXDDQMEfficiencyNtupleSelftrackModule, PXDDQMTrackRawNtupleModule, PXDPerformanceModule, PXDROIFinderAnalysisModule, PXDSpacePointCreatorModule, PyModule, QcsmonitorDigitizerModule, QcsmonitorModule, QcsmonitorStudyModule, RandomBarrierModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, ReceiveEventModule, RemoveMCParticlesModule, RemoveParticlesNotInListsModule, ReprocessorModule, ROIDQMModule, ROIReadTestModule, ROISenderModule, Root2BinaryModule, Root2RawModule, RootInputModule, RootOutputModule, RT2SPTCConverterModule, RxModule, RxSocketModule, ScanCDCGeoModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, SegmentNetworkAnalyzerModule, SeqRootInputModule, SeqRootMergerModule, SeqRootOutputModule, SerializerModule, SkimFilterModule, SoftwareTriggerModule, SoftwareTriggerResultPrinterModule, SpacePoint2TrueHitConnectorModule, SpacePointCreatorTestModule, SPTC2GFTCConverterModule, SPTC2RTConverterModule, SPTCRefereeModule, SrsensorModule, StandardTrackingPerformanceModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, StudyMaterialEffectsModule, SubEventModule, SVD3SamplesEmulatorModule, SVDBackgroundModule, SVDDigitizerModule, SVDPackerModule, SVDVariablesToStorageModule, SVDChannelMappingModule, SVDChargeSharingAnalysisModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDClusterQualityEstimatorCalibrationModule, SVDClusterQualityEstimatorModule, SVDCoGTimeEstimatorModule, SVDCrossTalkFinderModule, SVDDataFormatCheckModule, SVDDQMClustersOnTrackModule, SVDDQMExpressRecoModule, svdDumpModule, SVDEventT0PerformanceTTreeModule, SVDHotStripFinderModule, SVDMaxStripTTreeModule, SVDPerformanceTTreeModule, SVDROIFinderAnalysisDataModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SVDShaperDigitsFromTracksModule, SVDSpacePointCreatorModule, SVDSpacePointQICalibrationModule, SVDTriggerQualityGeneratorModule, SwitchDataStoreModule, TCConvertersTestModule, TeeggInputModule, TOPAlignerModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelT0CalibratorModule, TOPChannelT0MCModule, TOPCommonT0CalibratorModule, TOPCosmicT0FinderModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPLaserHitSelectorModule, TOPLLScannerModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPPDFCheckerModule, TOPRawDigitConverterModule, TOPRingPlotterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTriggerDigitizerModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, TrackAnaModule, TrackFilterModule, FindletModule< AFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackFinderLegendre >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< FacetCreator >, FindletModule< FacetCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< HitBasedT0Extractor >, FindletModule< HitReclaimer >, FindletModule< HitReclaimer >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackExporter >, FindletModule< TrackFinder >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFindingCDC::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< TrackRejecter >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, FindletModule< WireHitPreparer >, TrackFinderVXDAnalizerModule, TrackingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, TreeFitterModule, TrepsInputModule, TRGCDCETFUnpackerModule, TRGCDCModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSStreamModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLFAMModule, TRGECLModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLModule, TRGGDLSummaryModule, TRGGRLDQMModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLUnpackerModule, TRGRAWDATAModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TxModule, TxSocketModule, V0FinderModule, V0findingPerformanceEvaluationModule, VariablesToEventBasedTreeModule, VariablesToHistogramModule, VariablesToNtupleModule, VXDMisalignmentModule, VXDDedxPIDModule, VXDQETrainingDataCollectorModule, VXDTFTrainingDataCollectorModule, ZMQRxOutputModule, ZMQRxWorkerModule, ZMQTxInputModule, and ZMQTxWorkerModule.

Definition at line 175 of file Module.h.

175{};

◆ updateMapOfTrackAndDaughter()

void updateMapOfTrackAndDaughter ( unsigned & l,
std::vector< std::vector< unsigned > > & pars,
std::vector< unsigned > & pard,
std::vector< Particle * > & allparticles,
const Particle * daughter )
private

update the map of daughter and tracks, find out which tracks belong to each daughter.

Parameters
lrepresent the tracks ID
parsmap of all parameters
pardvector of parameters
allparticlesvector of all particles
daughterpointer to particle

Definition at line 1222 of file ParticleVertexFitterModule.cc.

1224{
1225 std::vector <Particle*> daughters = daughter->getDaughters();
1226 for (unsigned ichild = 0; ichild < daughter->getNDaughters(); ichild++) {
1227 const Particle* child = daughter->getDaughter(ichild);
1228 std::vector<unsigned> pard;
1229 if (child->getNDaughters() > 0) {
1230 updateMapOfTrackAndDaughter(l, pars, pard, allparticles, child);
1231 parm.insert(parm.end(), pard.begin(), pard.end());
1232 pars.push_back(pard);
1233 allparticles.push_back(daughters[ichild]);
1234 } else {
1235 pard.push_back(l);
1236 parm.push_back(l);
1237 pars.push_back(pard);
1238 allparticles.push_back(daughters[ichild]);
1239 l++;
1240 }
1241 }
1242}

Member Data Documentation

◆ m_BeamSpotCenter

ROOT::Math::XYZVector m_BeamSpotCenter
private

Beam spot position.

Definition at line 84 of file ParticleVertexFitterModule.h.

◆ m_beamSpotCov

TMatrixDSym m_beamSpotCov
private

Beam spot covariance matrix.

Definition at line 85 of file ParticleVertexFitterModule.h.

◆ m_beamSpotDB

DBObjPtr<BeamSpot> m_beamSpotDB
private

Beam spot database object.

Definition at line 86 of file ParticleVertexFitterModule.h.

◆ m_Bfield

double m_Bfield
private

magnetic field from data base

Definition at line 76 of file ParticleVertexFitterModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 520 of file Module.h.

◆ m_confidenceLevel

double m_confidenceLevel
private

required fit confidence level

Definition at line 75 of file ParticleVertexFitterModule.h.

◆ m_decaydescriptor

DecayDescriptor m_decaydescriptor
private

Decay descriptor of decays to look for.

Definition at line 82 of file ParticleVertexFitterModule.h.

◆ m_decayString

std::string m_decayString
private

daughter particles selection

Definition at line 80 of file ParticleVertexFitterModule.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 510 of file Module.h.

◆ m_fitType

std::string m_fitType
private

type of the kinematic fit

Definition at line 78 of file ParticleVertexFitterModule.h.

◆ m_hasCovMatrix

bool m_hasCovMatrix = false
private

flag for mother covariance matrix (PseudoFitter)

Definition at line 83 of file ParticleVertexFitterModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 517 of file Module.h.

◆ m_listName

std::string m_listName
private

particle list name

Definition at line 74 of file ParticleVertexFitterModule.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 513 of file Module.h.

◆ m_massConstraintList

std::vector<int> m_massConstraintList
private

PDG codes of the particles to be mass constraint (massfourC)

Definition at line 89 of file ParticleVertexFitterModule.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 515 of file Module.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 507 of file Module.h.

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 509 of file Module.h.

◆ m_plist

StoreObjPtr<ParticleList> m_plist
private

particle list

Definition at line 73 of file ParticleVertexFitterModule.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 511 of file Module.h.

◆ m_recoilMass

double m_recoilMass
private

recoil mass for constraint

Definition at line 88 of file ParticleVertexFitterModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 518 of file Module.h.

◆ m_smearing

double m_smearing
private

smearing width applied to IP tube

Definition at line 87 of file ParticleVertexFitterModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 508 of file Module.h.

◆ m_updateDaughters

bool m_updateDaughters
private

flag for daughters update

Definition at line 81 of file ParticleVertexFitterModule.h.

◆ m_vertexFitter

std::string m_vertexFitter
private

Vertex Fitter name.

Definition at line 77 of file ParticleVertexFitterModule.h.

◆ m_withConstraint

std::string m_withConstraint
private

additional constraint on vertex

Definition at line 79 of file ParticleVertexFitterModule.h.


The documentation for this class was generated from the following files: