Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParticleData.hh
Go to the documentation of this file.
1 ///
2 /// @file ParticleData.hh
3 /// @brief Hammer decay PDG code management
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #ifndef HAMMER_TOOLS_ParticleData
13 #define HAMMER_TOOLS_ParticleData
14 
15 #include <vector>
16 
17 #include "Hammer/Particle.fhh"
18 #include "Hammer/Tools/Pdg.fhh"
19 #include "Hammer/IndexTypes.hh"
20 
21 namespace Hammer {
22 
23 
24  /// @brief PDG code process signature class
25  ///
26  /// Manages the particle signatures (hashes, pdg lists, particle masses) of an object that needs to be associated
27  /// to a decay vertex, in order to associate it in a Process at runtime.
28  /// Supports multiple signatures to lump together similar decays
29  /// (e.g. \f$ B^0 \rightarrow D^- \bar \tau \nu_\tau \f$ with \f$ B^+ \rightarrow D^0 \bar \tau \nu_\tau \f$,
30  /// \f$ B^+ \rightarrow D^0 \bar \mu \nu_\mu \f$, etc.). Each signature can be selected by a signature index.
31  ///
32  /// @ingroup Core
33  class ParticleData {
34 
35  public:
36 
37  /// default constructor
38  ParticleData();
39 
40  ParticleData(const ParticleData& other) = default;
41  ParticleData& operator=(const ParticleData& other) = default;
42  ParticleData(ParticleData&& other) = default;
43  ParticleData& operator=(ParticleData&& other) = default;
44 
45  virtual ~ParticleData();
46 
47  protected:
48 
49  /// @brief Decay signature information
50  ///
51  /// Contains all the necessary information for a decay vertex
52  ///
53  /// @ingroup Core
54  struct Signature {
55 
56  PdgId parent; ///< particle ID of the parent particle
57  std::vector<PdgId> daughters; ///< particle IDs of the (ordered) daughter (and granddaughter) particles.
58  ///< the ordering is: daughters first, then grand-daughters (if available); within each group
59  ///< different type of particles are ordered according to abs(PDG code) and according to
60  ///< ascending PDG code for particles/anti-particles of the same type
61  HashId id; ///< unique ID of the decay process
62  HashId hadronicId; ///< unique ID of the hadronic part of the decay
63  ///< (parent + hadronic daughters) for form factor associations
64  std::vector<double> masses; ///< list of particle mass values parent + daughters (in the same order as the particle ID vector)
65 
66  /// @brief computes the unique IDs from the PDG codes
67  /// @param[in] numDaughters number of daughters to consider for the hadronic signature calculation
68  /// (necessary for processes which combines two decays, e.g. \f$ B\rightarrow D^*\ell\nu, D^*->D\pi \f$)
69  void calcIds(size_t numDaughters);
70 
71  /// @brief appends the mass of a particle to the mass list
72  /// @param[in] id the particle PDG code
73  void addMass(PdgId id);
74 
75  /// @brief appends the masses of a list of particles to the mass list
76  /// @param[in] ids the list of PDG codes of the particles
77  void addMasses(const std::vector<PdgId>& ids);
78  };
79 
80  public:
81 
82  /// @brief method to evaluate the object on a specific particle set
83  /// @param[in] parent the parent Particle
84  /// @param[in] daughters the daughters (and grand-daughters, if necessary) Particle list
85  /// @param[in] references the parent Particle siblings (necessary e.g. for helicity amplitude phase conventions)
86  virtual void eval(const Particle& parent, const ParticleList& daughters,
87  const ParticleList& references) = 0;
88 
89  public:
90 
91  /// @brief select a specific signature to be the current signature
92  /// @param[in] idx the signature index
93  virtual bool setSignatureIndex(size_t idx = 0);
94 
95  /// @brief returns the unique ID of the current decay signature
96  /// @return the UID
97  HashId id() const;
98 
99  /// @brief returns the hadronic unique ID (parent + hadronic daughters) of the current decay signature
100  /// @return the hadronic UID
101  HashId hadronicId() const;
102 
103  /// @brief returns the particle masses of the current decay signature
104  /// @return the list of masses
105  const std::vector<double>& masses() const;
106 
107  /// @brief returns the number of available signatures
108  /// @return the number of signatures
109  size_t numSignatures() const;
110 
111  protected:
112  /// @brief adds a signature to the list by specifying the particles PDG codes. The internal particle
113  /// ordering is automatically taken into account
114  /// @param[in] parent the parent PDG code
115  /// @param[in] daughters the list of daughter PDG codes
116  /// @param[in] subDaughters the list of subdaughters PDG codes for objects associated to 2-step decays
117  void addProcessSignature(PdgId parent, const std::vector<PdgId>& daughters,
118  const std::vector<PdgId>& subDaughters = {});
119 
120 
121  private:
122 
123  bool checkValidSignature(PdgId parent, const std::vector<PdgId>& daughters,
124  const std::vector<PdgId>& granddaughters);
125 
126  protected:
127 
128  std::vector<Signature> _signatures; ///< the list of signatures
129  size_t _signatureIndex; ///< the index of the current signature
130  };
131 
132 } // namespace Hammer
133 
134 #endif
std::vector< PdgId > daughters
particle IDs of the (ordered) daughter (and granddaughter) particles.
Definition: ParticleData.hh:57
PdgId parent
particle ID of the parent particle
Definition: ParticleData.hh:56
Hammer data types declarations.
HashId id() const
returns the unique ID of the current decay signature
Definition: ParticleData.cc:36
size_t numSignatures() const
returns the number of available signatures
bool checkValidSignature(PdgId parent, const std::vector< PdgId > &daughters, const std::vector< PdgId > &granddaughters)
Definition: ParticleData.cc:48
Decay signature information.
Definition: ParticleData.hh:54
ParticleData()
default constructor
Definition: ParticleData.cc:27
std::vector< double > masses
list of particle mass values parent + daughters (in the same order as the particle ID vector) ...
Definition: ParticleData.hh:64
const std::vector< double > & masses() const
returns the particle masses of the current decay signature
Definition: ParticleData.cc:44
void addMasses(const std::vector< PdgId > &ids)
appends the masses of a list of particles to the mass list
Definition: ParticleData.cc:93
void calcIds(size_t numDaughters)
computes the unique IDs from the PDG codes
Definition: ParticleData.cc:79
void addMass(PdgId id)
appends the mass of a particle to the mass list
Definition: ParticleData.cc:88
std::vector< Particle > ParticleList
Definition: Particle.fhh:20
Pdg forward declarations.
HashId hadronicId() const
returns the hadronic unique ID (parent + hadronic daughters) of the current decay signature ...
Definition: ParticleData.cc:40
HashId id
unique ID of the decay process
Definition: ParticleData.hh:61
virtual bool setSignatureIndex(size_t idx=0)
select a specific signature to be the current signature
Particle class.
Definition: Particle.hh:30
ParticleData & operator=(const ParticleData &other)=default
std::vector< Signature > _signatures
the list of signatures
size_t _signatureIndex
the index of the current signature
Forward declarations for particle class.
void addProcessSignature(PdgId parent, const std::vector< PdgId > &daughters, const std::vector< PdgId > &subDaughters={})
adds a signature to the list by specifying the particles PDG codes.
Definition: ParticleData.cc:64
size_t HashId
Definition: IndexTypes.hh:31
virtual void eval(const Particle &parent, const ParticleList &daughters, const ParticleList &references)=0
method to evaluate the object on a specific particle set
HashId hadronicId
unique ID of the hadronic part of the decay (parent + hadronic daughters) for form factor association...
Definition: ParticleData.hh:62
int PdgId
Definition: Pdg.fhh:17
PDG code process signature class.
Definition: ParticleData.hh:33