Belle II Software  light-2212-foldex
ParticleLoaderModule Class Reference

Loads MDST dataobjects as Particle objects to the StoreArray<Particle> and collects them in specified ParticleList. More...

#include <ParticleLoaderModule.h>

Inheritance diagram for ParticleLoaderModule:
Collaboration diagram for ParticleLoaderModule:

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

 ParticleLoaderModule ()
 Constructor.
 
virtual void initialize () override
 Initialize the Module. More...
 
virtual void event () override
 Event processor.
 
virtual void terminate () override
 Terminate the Module. More...
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules. More...
 
virtual void beginRun ()
 Called when entering a new run. More...
 
virtual void endRun ()
 This method is called if the current run ends. More...
 
const std::string & getName () const
 Returns the name of the module. More...
 
const std::string & getType () const
 Returns the type of the module (i.e. More...
 
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. More...
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties. More...
 
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. More...
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module. More...
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module. More...
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module. More...
 
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. More...
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer). More...
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished. More...
 
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. More...
 
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. More...
 
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. More...
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module. More...
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters. More...
 

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. More...
 
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. More...
 
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. More...
 
void setType (const std::string &type)
 Set the module type. More...
 
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. More...
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module. More...
 
void setReturnValue (int value)
 Sets the return value for this module as integer. More...
 
void setReturnValue (bool value)
 Sets the return value for this module as bool. More...
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Types

enum  PListIndex {
  c_PListPDGCode ,
  c_PListName ,
  c_AntiPListName ,
  c_IsPListSelfConjugated
}
 Enum for describing each element in the above tuple.
 
typedef std::tuple< int, std::string, std::string, bool > PList
 tuple for collecting everything we know about the ParticlList to be created. More...
 

Private Member Functions

void mcParticlesToParticles ()
 Loads specified MCParticles as Particle to StoreArray<Particle>
 
void mdstToParticle ()
 Loads specified MSDT object as Particle to StoreArray<Particle>
 
void tracksToParticles ()
 Loads Track object as Particle to StoreArray<Particle> and adds it to the ParticleList.
 
void eclAndKLMClustersToParticles ()
 Loads ECLCluster and KLMCluster object as Particle to StoreArray<Particle> and adds it to the ParticleList.
 
void v0sToParticles ()
 Loads V0 object as Particle of specified type to StoreArray<Particle> and adds it to the ParticleList.
 
void roeToParticles ()
 Loads ROE object as Particle of specified type to StoreArray<Particle> and adds it to the ParticleList.
 
void addROEToParticleList (RestOfEvent *roe, int mdstIndex, int pdgCode=0, bool isSelfConjugatedParticle=true)
 Helper method to load ROE object as Particle.
 
void dummyToParticles ()
 Loads dummy object as Particle of specified type to StoreArray<Particle> and adds it to the ParticleList.
 
bool isValidPDGCode (const int pdgCode)
 returns true if the PDG code determined from the decayString is valid
 
void appendDaughtersRecursive (Particle *mother)
 recursively append bottom of a particle's decay chain (daughters of mother, granddaughters of daughter and so on).
 
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. More...
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary. More...
 

Private Attributes

StoreArray< Particlem_particles
 StoreArray of Particles.
 
StoreArray< MCParticlem_mcparticles
 StoreArray of MCParticles.
 
StoreArray< ECLClusterm_eclclusters
 StoreArray of ECLCluster.
 
StoreArray< KLMClusterm_klmclusters
 StoreArray of KLMCluster.
 
StoreArray< PIDLikelihoodm_pidlikelihoods
 StoreArray of PIDLikelihoods.
 
StoreArray< Trackm_tracks
 StoreArray of Tracks.
 
StoreArray< TrackFitResultm_trackfitresults
 StoreArray of TrackFitResults.
 
StoreObjPtr< EventExtraInfom_eventExtraInfo
 object pointer to event extra info
 
StoreObjPtr< ParticleExtraInfoMapm_particleExtraInfoMap
 object pointer to extra info map
 
StoreArray< RestOfEventm_roes
 StoreArray of ROEs.
 
StoreArray< V0m_v0s
 StoreArray of V0s.
 
bool m_useMCParticles
 Load MCParticle as Particle instead of the corresponding MDST dataobject.
 
bool m_useROEs
 Switch to load ROE as Particle.
 
bool m_useDummy
 Switch to load dummy as Particle.
 
DecayDescriptor m_decaydescriptor
 Decay descriptor for parsing the user specified DecayString.
 
std::vector< std::string > m_decayStrings
 Input decay strings specifying the particles being created/loaded.
 
std::vector< PListm_MCParticles2Plists
 Collection of PLists that will collect Particles created from MCParticles.
 
std::vector< PListm_Tracks2Plists
 Collection of PLists that will collect Particles created from Tracks.
 
std::vector< PListm_V02Plists
 Collection of PLists that will collect Particles created from V0.
 
std::vector< PListm_ROE2Plists
 Collection of PLists that will collect Particles created from V0.
 
std::vector< PListm_ECLKLMClusters2Plists
 Collection of PLists that will collect Particles created from ECLClusters and KLMClusters.
 
std::vector< PListm_Dummies2Plists
 Collection of PLists that will collect Particles created from Dummies.
 
bool m_writeOut
 toggle particle list btw. More...
 
bool m_skipNonPrimary
 toggle skip of secondary MC particle
 
bool m_addDaughters
 toggle addition of the bottom part of the particle's decay chain
 
bool m_skipNonPrimaryDaughters
 toggle skip of secondary MC daughters
 
std::string m_roeMaskName
 ROE mask name to load.
 
std::string m_sourceParticleListName
 Particle list name from which we need to get related ROEs.
 
bool m_useMissing
 Use missing momentum to build a particle.
 
int m_trackHypothesis
 pdg code for track hypothesis that should be used to create the particle
 
int m_dummyMDSTIndex
 mdst index for dummy particles
 
double m_dummyCovMatrix
 diag value of cov matrix for dummy particles
 
bool m_dummyTreatAsInvisible
 should treeFitter treat the particle as invisible?
 
bool m_enforceFitHypothesis
 If true, a Particle is only created if a track fit with the particle hypothesis passed to the ParticleLoader is available. More...
 
std::vector< int > m_chargeZeroTrackCounts
 internally used to count number of tracks with charge zero
 
std::vector< int > m_sameChargeDaughtersV0Counts
 internally used to count the number of V0s with same charge daughters
 
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

Loads MDST dataobjects as Particle objects to the StoreArray<Particle> and collects them in specified ParticleList.

Charge conjugated particles are loaded as well and collected in the anti-ParticleList.

The type of the particle to be loaded is specified via the decayString module parameter. The type of the MDST dataobject that is used as an input is determined from the type of the particle.

The following types of the particles can be loaded:

o) charged final state particles (input MDST type = Tracks)

  • e+, mu+, pi+, K+, p, deuteron (and charge conjugated particles)

o) neutral final state particles

  • gamma (input MDST type = ECLCluster with 'n photons' ECLCluster::Hypothesis::c_nPhotons)
  • K_S0, Lambda0, converted photons (input MDST type = V0)
  • K_L0, n0 (input MDST type = KLMCluster, or ECLCluster with neutral hadron hypothesis)

The following basf2 relations are set by the ParticleLoader:

o) in the case of charged final state particles

o) in the case of neutral final state particles

In the case the useMCParticles module parameter is set to true the module loads specific MCParticle(s) as Particle(s) instead of the MDST dataobjects. In this case any particle type can be specified via the decayString module parameter.

Definition at line 77 of file ParticleLoaderModule.h.

Member Typedef Documentation

◆ PList

typedef std::tuple<int, std::string, std::string, bool> PList
private

tuple for collecting everything we know about the ParticlList to be created.

The elements are: PDGCode, name, anti-list name, and isListSelfConjugated

Definition at line 83 of file ParticleLoaderModule.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.

Member Function Documentation

◆ beginRun()

◆ 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.

◆ 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 439 of file Module.h.

◆ 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 420 of file Module.h.

◆ endRun()

virtual void endRun ( )
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 PyModule, AWESOMEBasicModule, TxModule, RxModule, SeqRootOutputModule, SeqRootInputModule, StatisticsSummaryModule, HistoManagerModule, RandomBarrierModule, EventInfoPrinterModule, SwitchDataStoreModule, SubEventModule, HistoModule, BelleMCOutputModule, B2BIIMdstInputModule, B2BIIConvertMdstModule, B2BIIMCParticlesMonitorModule, LowEnergyPi0VetoExpertModule, LowEnergyPi0IdentificationExpertModule, and CurlTaggerModule.

Definition at line 166 of file Module.h.

◆ 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.

◆ 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.

◆ 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.

◆ 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 RootOutputModule, and RootInputModule.

Definition at line 134 of file Module.h.

◆ 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 187 of file Module.h.

◆ 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.

◆ 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 381 of file Module.h.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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://confluence.desy.de/display/BI/Software+ModCondTut 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.

◆ initialize()

void initialize ( )
overridevirtual

Initialize the Module.

This method is called at the beginning of data processing.

Reimplemented from Module.

Definition at line 98 of file ParticleLoaderModule.cc.

99 {
100  B2INFO("ParticleLoader's Summary of Actions:");
101 
102  m_particles.registerInDataStore();
103  m_particleExtraInfoMap.registerInDataStore();
104  m_eventExtraInfo.registerInDataStore();
105  //register relations if these things exists
106  if (m_mcparticles.isOptional()) {
107  m_particles.registerRelationTo(m_mcparticles);
108  }
109  if (m_pidlikelihoods.isOptional()) {
110  m_particles.registerRelationTo(m_pidlikelihoods);
111  }
112  if (m_trackfitresults.isOptional()) {
113  m_particles.registerRelationTo(m_trackfitresults);
114  }
115 
116  if (m_useMCParticles) {
117  m_mcparticles.isRequired();
118  }
119 
120  if (m_useROEs) {
121  m_roes.isRequired();
122  m_roes.registerRelationTo(m_particles);
123 
124  StoreArray<RestOfEvent> nestedRoes("NestedRestOfEvents");
125  if (nestedRoes.isOptional())
126  nestedRoes.registerRelationTo(m_particles);
127  }
128 
129  if (m_decayStrings.empty()) {
130  B2WARNING("Obsolete usage of the ParticleLoader module (load all MDST objects as all possible Particle object types). Specify the particle type via decayStrings module parameter instead.");
131  } else {
132  for (auto decayString : m_decayStrings) {
133 
134  // obtain the output particle lists from the decay string
135  bool valid = m_decaydescriptor.init(decayString);
136  if (!valid)
137  B2ERROR("ParticleLoaderModule::initialize Invalid input DecayString: " << decayString);
138 
139  // Mother particle
141  int nProducts = m_decaydescriptor.getNDaughters();
142 
143  int pdgCode = mother->getPDGCode();
144  // The default list name is "all"
145  string listName = mother->getName() + ":all";
146  // ROE particles get the full name
147  if (m_useROEs) listName = mother->getFullName();
148  // dummy particles get the full name
149  else if (m_useDummy) listName = mother->getFullName();
150  // MC particles get the full name
151  else if (m_useMCParticles) listName = mother->getFullName();
152  // V0s get the label "V0"
153  else if (nProducts > 0) listName = mother->getName() + ":V0";
154 
155  string antiListName = ParticleListName::antiParticleListName(listName);
156  bool isSelfConjugatedParticle = (listName == antiListName);
157 
158  StoreObjPtr<ParticleList> particleList(listName);
159  // if the particle list doesn't exist, we have to register it
160  if (!particleList.isOptional()) {
162  particleList.registerInDataStore(flags);
163  if (!isSelfConjugatedParticle) {
164  StoreObjPtr<ParticleList> antiParticleList(antiListName);
165  antiParticleList.registerInDataStore(flags);
166  }
167  } else if (m_useMCParticles) {
168  B2WARNING("ParticleList " << listName << " already exists and will not be created again. " <<
169  "The given options (addDaughters, skipNonPrimaryDaughters, skipNonPrimary) do not applied on the existing list.");
170  }
171 
172  if (not isValidPDGCode(pdgCode) and (m_useMCParticles == false and m_useROEs == false and m_useDummy == false))
173  B2ERROR("Invalid particle type requested to be loaded. Set a valid decayString module parameter.");
174 
175  // if we're not loading MCParticles and we are loading K0S, Lambdas, or photons --> ee then this decaystring is a V0
176  bool mdstSourceIsV0 = false;
177  if (!m_useMCParticles &&
178  (abs(pdgCode) == abs(Const::Kshort.getPDGCode()) || abs(pdgCode) == abs(Const::Lambda.getPDGCode())
179  || (abs(pdgCode) == abs(Const::photon.getPDGCode()) && m_addDaughters == true)))
180  mdstSourceIsV0 = true;
181 
182  if (mdstSourceIsV0 == false) {
183  if (nProducts > 0) {
184  if (!m_useROEs and !m_useDummy) {
185  B2ERROR("ParticleLoaderModule::initialize Invalid input DecayString " << decayString
186  << ". DecayString should not contain any daughters, only the mother particle.");
187  } else {
188  B2INFO("ParticleLoaderModule: Replacing the source particle list name by " <<
190  << " all other daughters will be ignored.");
192  }
193  }
194  } else {
195  if (nProducts != 2)
196  B2ERROR("ParticleLoaderModule::initialize Invalid input DecayString " << decayString
197  << ". MDST source of the particle list is V0, DecayString should contain exactly two daughters, as well as the mother particle.");
198  else {
200  B2ERROR("MDST source of the particle list is V0, the two daughters should have opposite charge");
201  }
202  }
203 
204  // add PList to corresponding collection of Lists
205  B2INFO(" o) creating (anti-)ParticleList with name: " << listName << " (" << antiListName << ")");
206  if (m_useROEs) {
207  B2INFO(" -> MDST source: RestOfEvents");
208  m_ROE2Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
209  } else if (m_useDummy) {
210  B2INFO(" -> MDST source: No MDST source");
211  m_Dummies2Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
212  } else if (m_useMCParticles) {
213  B2INFO(" -> MDST source: MCParticles");
214  m_MCParticles2Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
215  } else {
216  bool chargedFSP = Const::chargedStableSet.contains(Const::ParticleType(abs(pdgCode)));
217  if (chargedFSP) {
218  B2INFO(" -> MDST source: Tracks");
219  m_Tracks2Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
220  }
221 
222  if (abs(pdgCode) == abs(Const::photon.getPDGCode())) {
223  if (m_addDaughters == false) {
224  m_ECLKLMClusters2Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
225  B2INFO(" -> MDST source: ECLClusters and KLMClusters");
226  } else {
227  B2INFO(" -> MDST source: V0");
228  m_V02Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
229  }
230  }
231 
232  if (abs(pdgCode) == abs(Const::Kshort.getPDGCode())) {
233  B2INFO(" -> MDST source: V0");
234  m_V02Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
235  }
236 
237  if (abs(pdgCode) == abs(Const::Klong.getPDGCode()) || abs(pdgCode) == abs(Const::neutron.getPDGCode())) {
238  B2INFO(" -> MDST source: exclusively KLMClusters or exclusively ECLClusters (matching between those not used)");
239  m_ECLKLMClusters2Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
240  }
241 
242  if (abs(pdgCode) == abs(Const::Lambda.getPDGCode())) {
243  B2INFO(" -> MDST source: V0");
244  m_V02Plists.emplace_back(pdgCode, listName, antiListName, isSelfConjugatedParticle);
245  }
246  }
247  }
248  }
249 
250 
251  m_chargeZeroTrackCounts = std::vector<int>(m_Tracks2Plists.size(), 0);
252  m_sameChargeDaughtersV0Counts = std::vector<int>(m_V02Plists.size(), 0);
253 }
bool contains(const ParticleType &p) const
Returns true if and only if the set contains 'p'.
Definition: UnitConst.cc:423
The ParticleType class for identifying different particle types.
Definition: Const.h:399
static const ParticleType neutron
neutron particle
Definition: Const.h:666
static const ParticleType Lambda
Lambda particle.
Definition: Const.h:669
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:609
static const ParticleType Klong
K^0_L particle.
Definition: Const.h:668
static const ParticleType Kshort
K^0_S particle.
Definition: Const.h:667
static const ParticleType photon
photon particle
Definition: Const.h:664
EStoreFlags
Flags describing behaviours of objects etc.
Definition: DataStore.h:69
@ c_WriteOut
Object/array should be saved by output modules.
Definition: DataStore.h:70
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:71
Represents a particle in the DecayDescriptor.
int getPDGCode() const
Return PDG code.
std::string getFullName() const
returns the full name of the particle full_name = name:label
std::string getName() const
evt.pdl name of the particle.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptorParticle * getMother() const
return mother.
int getNDaughters() const
return number of direct daughters.
const DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
std::vector< PList > m_ECLKLMClusters2Plists
Collection of PLists that will collect Particles created from ECLClusters and KLMClusters.
StoreArray< TrackFitResult > m_trackfitresults
StoreArray of TrackFitResults.
std::vector< PList > m_Dummies2Plists
Collection of PLists that will collect Particles created from Dummies.
std::vector< std::string > m_decayStrings
Input decay strings specifying the particles being created/loaded.
std::vector< int > m_sameChargeDaughtersV0Counts
internally used to count the number of V0s with same charge daughters
std::string m_sourceParticleListName
Particle list name from which we need to get related ROEs.
bool isValidPDGCode(const int pdgCode)
returns true if the PDG code determined from the decayString is valid
StoreArray< MCParticle > m_mcparticles
StoreArray of MCParticles.
StoreArray< Particle > m_particles
StoreArray of Particles.
StoreObjPtr< ParticleExtraInfoMap > m_particleExtraInfoMap
object pointer to extra info map
bool m_addDaughters
toggle addition of the bottom part of the particle's decay chain
StoreArray< PIDLikelihood > m_pidlikelihoods
StoreArray of PIDLikelihoods.
std::vector< PList > m_ROE2Plists
Collection of PLists that will collect Particles created from V0.
StoreArray< RestOfEvent > m_roes
StoreArray of ROEs.
std::vector< PList > m_MCParticles2Plists
Collection of PLists that will collect Particles created from MCParticles.
std::vector< PList > m_V02Plists
Collection of PLists that will collect Particles created from V0.
DecayDescriptor m_decaydescriptor
Decay descriptor for parsing the user specified DecayString.
bool m_useDummy
Switch to load dummy as Particle.
bool m_writeOut
toggle particle list btw.
std::vector< int > m_chargeZeroTrackCounts
internally used to count number of tracks with charge zero
std::vector< PList > m_Tracks2Plists
Collection of PLists that will collect Particles created from Tracks.
StoreObjPtr< EventExtraInfo > m_eventExtraInfo
object pointer to event extra info
bool m_useROEs
Switch to load ROE as Particle.
bool m_useMCParticles
Load MCParticle as Particle instead of the corresponding MDST dataobject.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.

◆ 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.

◆ 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.

◆ 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 214 of file Module.h.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ terminate()

void terminate ( )
overridevirtual

Terminate the Module.

This method is called at the end of data processing.

Reimplemented from Module.

Definition at line 274 of file ParticleLoaderModule.cc.

Member Data Documentation

◆ m_enforceFitHypothesis

bool m_enforceFitHypothesis
private
Initial value:
=
false

If true, a Particle is only created if a track fit with the particle hypothesis passed to the ParticleLoader is available.

Definition at line 211 of file ParticleLoaderModule.h.

◆ m_writeOut

bool m_writeOut
private

toggle particle list btw.

transient/persistent

Definition at line 198 of file ParticleLoaderModule.h.


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