10#include <analysis/modules/ParticleCombiner/ParticleCombinerModule.h>
13#include <framework/logging/Logger.h>
16#include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
19#include <analysis/DecayDescriptor/ParticleListName.h>
20#include <analysis/utility/EvtPDLUtil.h>
21#include <analysis/utility/PCmsLabTransform.h>
46 "Input DecayDescriptor string (see :ref:`DecayString`).");
49 "Max. number of candidates reconstructed. By default, if the limit is reached no candidates will be produced.\n"
50 "This behaviour can be changed by \'ignoreIfTooManyCandidates\' flag.", 10000);
53 "Don't reconstruct channel if more candidates than given by \'maximumNumberOfCandidates\' are produced.",
true);
55 addParam(
"decayMode",
m_decayModeID,
"User-specified decay mode identifier (saved in 'decayModeID' extra-info for each Particle)",
58 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
60the mother Particle is reconstructed in the recoil against the daughter particles.
61In the case of the following decay chain M -> D1 D2 ... Dn and
63- recoilParticleType = 1:
64 - the mother momentum is given by: p(M) = p(e+e-) - p(D1) - p(D2) - ... - p(DN)
65 - D1, D2, ..., DN are attached as daughters of M
66- recoilParticleType = 2:
67 - the mother momentum is given by: p(M) = p(D1) - p(D2) - ... - p(DN)
68 - D1, D2, ..., DN are attached as daughters of M
71 "If true, the charge-conjugated mode will be reconstructed as well",
true);
73 "If true the decay string does not have to conserve electric charge",
false);
103 int daughtersNetCharge = 0;
104 for (
int i = 0; i < nProducts; ++i) {
108 int daughterPDGCode = daughter->getPDGCode();
119 B2FATAL(
"Your decay string " <<
m_decayString <<
" violates electric charge conservation!\n"
120 "If you want to allow this you can set the argument 'allowChargeViolation' to True. Something like:\n"
121 "modularAnalysis.reconstructDecay(" <<
m_decayString <<
", your_cuts, allowChargeViolation=True, path=mypath)");
123 B2WARNING(
"Your decay string " <<
m_decayString <<
" violates electric charge conservation!\n"
124 "Processing is continued assuming that you allowed this deliberately, e.g. for systematic studies etc.");
130 string noCutInParticleCombiner =
"";
143 "! Valid values are 0 (not a recoil), 1 (recoiling against e+e- and daughters), 2 (daughter of a recoil)");
160 int numberOfCandidates = 0;
176 ROOT::Math::PxPyPzEVector recoilMomentum = T.
getBeamFourMomentum() - particle.get4Vector();
177 particle.set4Vector(recoilMomentum);
179 const std::vector<Particle*> daughters = particle.getDaughters();
181 if (daughters.size() < 2)
182 B2FATAL(
"Reconstructing particle as a daughter of a recoil with less then 2 daughters!");
184 ROOT::Math::PxPyPzEVector pDaughters;
185 for (
unsigned i = 1; i < daughters.size(); i++) {
186 pDaughters += daughters[i]->get4Vector();
189 ROOT::Math::PxPyPzEVector mom = daughters[0]->get4Vector() - pDaughters;
190 particle.set4Vector(mom);
193 if (!
m_cut->check(&particle)) {
198 numberOfCandidates++;
EStoreFlags
Flags describing behaviours of objects etc.
@ c_WriteOut
Object/array should be saved by output modules.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
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
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
int getNDaughters() const
return number of direct daughters.
bool isIgnoreMassive() const
Check if missing massive final state particles shall be ignored.
const DecayDescriptorParticle * getMother() const
return mother.
static std::unique_ptr< GeneralCut > compile(const std::string &cut)
Creates an instance of a cut and returns a unique_ptr to it, if you need a copy-able object instead y...
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
int m_recoilParticleType
type of recoil particle: 0 - not recoil (normal reconstruction); 1 - recoil against e+e- and all daug...
bool m_isSelfConjugatedParticle
flag that indicates whether an anti-particle mother does not exist and should not be reconstructed as...
ParticleCombinerModule()
Constructor.
int m_maximumNumberOfCandidates
maximum number of reconstructed candidates
std::string m_antiListName
output anti-particle list name
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
std::string m_decayString
Input DecayString specifying the decay being reconstructed.
std::string m_listName
output particle list name
StoreObjPtr< ParticleList > m_outputAntiList
output anti-particle list
StoreArray< Particle > m_particles
StoreArray of Particles.
StoreObjPtr< ParticleList > m_outputList
output particle list
std::unique_ptr< ParticleGenerator > m_generator
Generates the combinations.
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
int m_decayModeID
user specified decay mode identifier
bool m_allowChargeViolation
switch to turn on and off the requirement of electric charge conservation
std::string m_cutParameter
selection criteria
DecayDescriptor m_decaydescriptor
Decay descriptor of the decay being reconstructed.
bool m_writeOut
toggle output particle list btw.
bool m_ignoreIfTooManyCandidates
drop all candidates if max.
int m_pdgCode
PDG code of the combined mother particle.
bool m_chargeConjugation
boolean to control whether charge conjugated decay should be reconstructed as well
Class to store reconstructed particles.
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
T * appendNew()
Construct a new T object at the end of the array.
Type-safe access to single objects in the data store.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Abstract base class for different kinds of events.