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>
36 ParticleCombinerModule::ParticleCombinerModule() :
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);
60 "If not equal 0, the mother Particle is reconstructed in the recoil against the daughter particles.\n"
61 "In the case of the following decay chain M -> D1 D2 ... Dn and\n\n"
63 " a) recoilParticleType = 1: \n\n"
64 " - the mother momentum is given by: p(M) = p(e+e-) - p(D1) - p(D2) - ... - p(DN)\n"
65 " - D1, D2, ..., DN are attached as daughters of M\n\n"
66 " b) recoilParticleType = 2: \n\n"
67 " - the mother momentum is given by: p(M) = p(D1) - p(D2) - ... - p(DN)\n"
68 " - D1, D2, ..., DN are attached as daughters of M\n\n", 0);
70 "If true, the charge-conjugated mode will be reconstructed as well",
true);
72 "If true the decay string does not have to conserve electric charge",
false);
102 int daughtersNetCharge = 0;
103 for (
int i = 0; i < nProducts; ++i) {
107 int daughterPDGCode = daughter->getPDGCode();
118 B2FATAL(
"Your decay string " <<
m_decayString <<
" violates electric charge conservation!\n"
119 "If you want to allow this you can set the argument 'allowChargeViolation' to True. Something like:\n"
120 "modularAnalysis.reconstructDecay(" <<
m_decayString <<
", your_cuts, allowChargeViolation=True, path=mypath)");
122 B2WARNING(
"Your decay string " <<
m_decayString <<
" violates electric charge conservation!\n"
123 "Processing is continued assuming that you allowed this deliberately, e.g. for systematic studies etc.");
129 string noCutInParticleCombiner =
"";
142 "! Valid values are 0 (not a recoil), 1 (recoiling against e+e- and daughters), 2 (daughter of a recoil)");
159 int numberOfCandidates = 0;
175 ROOT::Math::PxPyPzEVector recoilMomentum = T.
getBeamFourMomentum() - particle.get4Vector();
176 particle.set4Vector(recoilMomentum);
178 const std::vector<Particle*> daughters = particle.getDaughters();
180 if (daughters.size() < 2)
181 B2FATAL(
"Reconstructing particle as a daughter of a recoil with less then 2 daughters!");
183 ROOT::Math::PxPyPzEVector pDaughters;
184 for (
unsigned i = 1; i < daughters.size(); i++) {
185 pDaughters += daughters[i]->get4Vector();
188 ROOT::Math::PxPyPzEVector mom = daughters[0]->get4Vector() - pDaughters;
189 particle.set4Vector(mom);
192 if (!
m_cut->check(&particle)) {
197 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.
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.
bool isIgnoreMassive() const
Check if missing massive final state particles shall be ignored.
const DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
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...
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.
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.