9#include <analysis/modules/TauDecayMarker/TauDecayMarkerModule.h>
11#include <framework/logging/Logger.h>
12#include <framework/gearbox/Const.h>
29 idOfTauMinus(-1), m_pmode(-2), m_mmode(-2), m_pprong(0), m_mprong(0)
32 setDescription(
"Module to identify generated tau pair decays, using MCParticle information. Each tau lepton decay channel "
33 "is numbered following the order in the default KKMC decay table. Using this module, "
34 "the channel number will be stored in the variables `tauPlusMCMode`, and `tauMinusMCMode`. "
35 "Further details and usage can be found at `TauDecayMCModes`. ");
59 B2INFO(
"Decay ID: " <<
m_pmode <<
" (tau+), " <<
m_mmode <<
" (tau-)." <<
85 if (p.getStatus() == 1 && p.getPDG() == 15) {
89 if (p.getStatus() == 1 && p.getPDG() == -15) {
101 if (s == 0 || !
tauPair)
return -1;
108 for (
int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
110 if (abs(d.getPDG()) == 24)
111 ret += d.getLastDaughter() - d.getFirstDaughter() + 1;
115 for (
int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
117 int pdg = d.getPDG();
118 if (pdg ==
id || (sign == 0 && abs(pdg) == abs(
id))) ret++;
119 if (abs(pdg) == 24) {
120 for (
int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
122 int pdg2 = e.getPDG();
134 if (s == 0 || !
tauPair)
return -1;
141 for (
int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
143 if (abs(d.getPDG()) == 24) {
144 for (
int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
151 for (
int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
153 int pdg = d.getPDG();
154 if (abs(pdg) == 24) {
155 for (
int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
157 int pdg2 = e.getPDG();
159 (sign == 0 && abs(pdg2) == abs(
id))) ret++;
161 }
else if (pdg ==
id || (sign == 0 && abs(pdg) == abs(
id))) ret++;
565 const vector<MCParticle*> daughters = p.getDaughters();
566 if (daughters.empty())
return ret;
573 if (isChargedFinalState) ret++;
int getPDGCode() const
PDG code.
static const ParticleType photon
photon particle
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
void setDescription(const std::string &description)
Sets the description of the module.
int getEntries() const
Get the number of objects in the array.
Int_t m_mprong
Prong of the decay channel of negative tau.
const int finalStatePDGs[5]
PDG codes accepted as charged final state particles in generation: {e, mu, pi, K, p}.
int numOfTauPlus
Number of positive tau leptons in the event.
Int_t m_pprong
Prong of the decay channel of positive tau.
void IdentifyTauPair()
Identifies if the event is a generated tau pair.
virtual void initialize() override
Initializes the module.
virtual void event() override
Method is called for each event.
int getNumDaughterOfTau(int s=0, int id=0, int sign=0)
Count the number of daughers of the generated tau.
Int_t m_mmode
ID of the decay channel of negative tau.
int getNumDaughterOfTauExceptGamma(int s=0, int id=0, int sign=0)
Count the number of daughers of the generated tau except gammas.
bool tauPair
True if the generated event is a tau pair event.
int idOfTauMinus
Index of the generated negative tau.
Int_t m_pmode
ID of the decay channel of positive tau.
int numOfTauMinus
Number of negative tau leptons in the event.
int getProngOfDecay(const MCParticle &mc)
Get the prong of the generated tau decay.
int idOfTauPlus
Index of the generated positive tau.
StoreObjPtr< TauPairDecay > m_tauDecay
pointer to tau pair decay objects
int getDecayChannelOfTau(int s=0)
Gets the id of the decay channel.
bool m_printDecayInfo
If true, prints ID and prong of each tau lepton in the event.
StoreArray< MCParticle > m_MCParticles
StoreArray of MCParticles.
TauDecayMarkerModule()
Constructor: Sets the description, the properties and the parameters of the module.
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.
Abstract base class for different kinds of events.