Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProvidersRepo.hh
Go to the documentation of this file.
1 ///
2 /// @file ProvidersRepo.hh
3 /// @brief Interface class for amplitudes, rates, FFs dictionary container
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_PROVIDERSREPO_HH
13 #define HAMMER_PROVIDERSREPO_HH
14 
15 #include <map>
16 #include <set>
17 #include <string>
18 #include <vector>
19 #include <memory>
20 
21 #include "Hammer/IndexTypes.hh"
23 #include "Hammer/Tools/Pdg.fhh"
25 
26 namespace Hammer {
27 
28  class AmplitudeBase;
29  class FormFactorBase;
30  class RateBase;
31  class SchemeDefinitions;
32 
33  /// @brief Main class
34  ///
35  /// Contains ...
36  ///
37  /// @ingroup Core
39 
40  public:
41  ProvidersRepo(const SchemeDefinitions* schemeDefs);
42 
43  ProvidersRepo(const ProvidersRepo& other) = delete;
44  ProvidersRepo& operator=(const ProvidersRepo& other) = delete;
45  ProvidersRepo(ProvidersRepo&& other) = delete;
46  ProvidersRepo& operator=(ProvidersRepo&& other) = delete;
47 
48  virtual ~ProvidersRepo() noexcept;
49 
50  public:
51 
52  virtual void setSettingsHandler(SettingsHandler& sh);
53 
54  void initialize();
55 
56  /// @brief
57  /// @param[in] parent
58  /// @param[in] daughters
59  /// @param[in] granddaughters
60  /// @return
61  virtual AmplitudeBase* getAmplitude(PdgId parent, const std::vector<PdgId>& daughters,
62  const std::vector<PdgId>& granddaughters = {}) const;
63 
64 
65  /// @brief Obtains a rate class
66  /// @details Extracts the pointer to the rate class from the container _rates, corresponding to the HashId of the parent plus daughters (and granddaughters if any)
67  /// @param[in] parent
68  /// @param[in] daughters
69  /// @param[in] granddaughters
70  /// @return Pointer to the rate class
71  virtual RateBase* getRate(PdgId parent, const std::vector<PdgId>& daughters,
72  const std::vector<PdgId>& granddaughters = {}) const;
73 
74  /// @brief Obtains a partial width
75  /// @details Extracts the pointer to the tensor from the container _partialWidths, corresponding to the HashId of the parent plus daughters (and granddaughters if any)
76  /// @param[in] parent
77  /// @param[in] daughters
78  /// @param[in] granddaughters
79  /// @return pointer to partial width double
80  virtual const double* getPartialWidth(PdgId parent, const std::vector<PdgId>& daughters,
81  const std::vector<PdgId>& granddaughters = {}) const;
82 
83  // /// @brief Obtains FF classes
84  // /// @details Extracts the vector of pointers to the chosen FF parametrization classes from the container _formFactors, corresponding to the HashId of the parent plus daughters (and granddaughters)
85  // /// @param[in] parent
86  // /// @param[in] daughters
87  // /// @param[in] granddaughters
88  // /// @return Vector of pointers to chosen FF parameterizations
89  // std::vector<FormFactorBase*> getFormFactor(PdgId parent, const std::vector<PdgId>& daughters,
90  // const std::vector<PdgId>& granddaughters = {}) const;
91 
92 
93  /// @brief
94  /// @param[in] processId
95  /// @return
96  virtual std::vector<FormFactorBase*> getFormFactor(HadronicUID processId) const;
97 
98 
99  AmplitudeBase* getWCProvider(const std::string& wcPrefix) const;
100  IndexLabel getWCLabel(const std::string& wcPrefix) const;
101  std::map<IndexLabel, AmplitudeBase*> getAllWCProviders() const;
102 
103  FormFactorBase* getFFErrProvider(const FFPrefixGroup& process) const;
104  IndexLabel getFFErrLabel(const FFPrefixGroup& process) const;
105  std::map<IndexLabel, SchemeDict<FormFactorBase*>> getAllFFErrProviders() const;
106 
107  /// @brief Clones a FF parametrization
108  /// @param[in] processId
109  /// @param[in] baseIndex
110  /// @param[in] newLabel
111  /// @return
112  FFIndex duplicateFormFactor(HadronicUID processId, FFIndex baseIndex, const std::string& newLabel);
113 
114  void initPreSchemeDefs();
115  void initPostSchemeDefs();
116 
117  bool checkFFPrefixAndGroup(const FFPrefixGroup& value) const;
118 
119  const std::set<std::string> schemeNamesFromPrefixAndGroup(const FFPrefixGroup& value) const;
120 
122 
123 
124  private:
125 
126  void fixWCValues();
127 
128  virtual void defineSettings();
129 
130  Log& getLog() const;
131 
132  void initializeWCs();
133  void initializeFFErrs();
134 
135  private:
136 
137  /// @brief Known amplitudes
138  /// @details A map {HashId (parent, daughters (and granddaughters)), amplitude class pointer} for all amplitudes known to hammer
140  /// @brief Known rates
141  /// @details A map {HashId (parent, daughters), rate class pointer} for all rates known to hammer
143  /// @brief Known formfactors
144  /// @details A map {HashId hadronicId(), vector of FF class pointers} for all FFs known to hammer
146  /// @brief Known partial widths
147  /// @details A map {HashId (parent, daughters), tensor pointer} for all partial widths known to hammer
149 
151 
154 
156  };
157 
158 } // namespace Hammer
159 
160 #endif
std::map< IndexLabel, AmplitudeBase * > getAllWCProviders() const
ProvidersRepo & operator=(const ProvidersRepo &other)=delete
Base class for form factors.
WCPrefixDict< std::pair< IndexLabel, AmplitudeBase * > > _WCProviders
Base class for amplitudes.
Hammer data types declarations.
bool checkFFPrefixAndGroup(const FFPrefixGroup &value) const
size_t FFIndex
Definition: IndexTypes.hh:69
std::map< IndexLabel, SchemeDict< FormFactorBase * > > getAllFFErrProviders() const
HashId HadronicUID
Definition: IndexTypes.hh:36
VertexIdDict< double > _partialWidths
Known partial widths.
FFIndex duplicateFormFactor(HadronicUID processId, FFIndex baseIndex, const std::string &newLabel)
Clones a FF parametrization.
AmplitudeIdDict< std::unique_ptr< AmplitudeBase > > _amplitudes
Known amplitudes.
HadronicIdDict< std::vector< std::string > > getFFGroups() const
FFPrefixGroupDict< std::set< std::string > > _schemeNamesFromPrefixGroup
const SchemeDefinitions * _schemeDefs
std::map< HadronicUID, T > HadronicIdDict
Definition: IndexTypes.hh:38
std::map< VertexUID, T > VertexIdDict
Definition: IndexTypes.hh:42
std::map< std::string, T > WCPrefixDict
Definition: IndexTypes.hh:67
IndexLabel getWCLabel(const std::string &wcPrefix) const
virtual std::vector< FormFactorBase * > getFormFactor(HadronicUID processId) const
Base class to access the settings repository.
Forward declarations of types used in the tensor classes.
virtual AmplitudeBase * getAmplitude(PdgId parent, const std::vector< PdgId > &daughters, const std::vector< PdgId > &granddaughters={}) const
virtual ~ProvidersRepo() noexcept
Pdg forward declarations.
virtual RateBase * getRate(PdgId parent, const std::vector< PdgId > &daughters, const std::vector< PdgId > &granddaughters={}) const
Obtains a rate class.
virtual void setSettingsHandler(SettingsHandler &sh)
set link to settings repository handler.
Log & getLog() const
virtual const double * getPartialWidth(PdgId parent, const std::vector< PdgId > &daughters, const std::vector< PdgId > &granddaughters={}) const
Obtains a partial width.
IndexLabel getFFErrLabel(const FFPrefixGroup &process) const
Logging class.
Definition: Logging.hh:33
IndexLabel
label identifiers of tensor indices they are used to determine which indices can be contracted togeth...
Definition: IndexLabels.hh:27
Base class for accessing Hammer settings repository.
ProvidersRepo(const SchemeDefinitions *schemeDefs)
std::map< FFPrefixGroup, T > FFPrefixGroupDict
Definition: IndexTypes.hh:87
Hammer settings manager class.
FormFactorBase * getFFErrProvider(const FFPrefixGroup &process) const
HadronicIdDict< std::vector< std::unique_ptr< FormFactorBase > > > _formFactors
Known formfactors.
AmplitudeBase * getWCProvider(const std::string &wcPrefix) const
virtual void defineSettings()
purely virtual function for a class to define new settings
VertexIdDict< std::unique_ptr< RateBase > > _rates
Known rates.
int PdgId
Definition: Pdg.fhh:17
Hammer settings manager class.
Base class for rates.
Definition: RateBase.hh:39
const std::set< std::string > schemeNamesFromPrefixAndGroup(const FFPrefixGroup &value) const
FFPrefixGroupDict< std::pair< IndexLabel, FormFactorBase * > > _FFErrProviders
std::map< AmplitudeUID, T > AmplitudeIdDict
Definition: IndexTypes.hh:35