CHROMA
simple_meson_2pt_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct meson 2pt correlators.
3  */
4 
7 
9 
10 namespace Chroma
11 {
12 
13  // Read parameters
14  void read(XMLReader& xml, const std::string& path, SimpleMeson2PtEnv::Params& param)
15  {
16  SimpleMeson2PtEnv::Params tmp(xml, path);
17  param = tmp;
18  }
19 
20  // Writer
21  void write(XMLWriter& xml, const std::string& path, const SimpleMeson2PtEnv::Params& param)
22  {
23  param.writeXML(xml, path);
24  }
25 
26 
27  //! Meson correlators
28  /*!
29  * \ingroup hadron
30  *
31  * @{
32  */
33  namespace SimpleMeson2PtEnv
34  {
35  //! Anonymous namespace
36  namespace
37  {
38  //! Construct the correlator
39  LatticeComplex mesXCorr(const LatticePropagator& quark_prop_1,
40  const LatticePropagator& quark_prop_2,
41  int gamma_value)
42  {
43  // Construct the anti-quark propagator from quark_prop_2
44  int G5 = Ns*Ns-1;
45  LatticePropagator anti_quark_prop = Gamma(G5) * quark_prop_2 * Gamma(G5);
46 
47  return LatticeComplex(trace(adj(anti_quark_prop) * (Gamma(gamma_value) *
48  quark_prop_1 * Gamma(gamma_value))));
49  }
50 
51 
52  //-------------------- callback functions ---------------------------------------
53 
54  //! Construct pion correlator
55  HadronContract* mesDiagGammaCorrs(XMLReader& xml_in,
56  const std::string& path)
57  {
58  return new DiagGammaMesonCorrs(Params(xml_in, path)); // all gammas
59  }
60 
61 
62  //! Local registration flag
63  bool registered = false;
64 
65  } // end anonymous namespace
66 
67 
68  //! Initialize
70  {
71  }
72 
73 
74  //! Read parameters
75  Params::Params(XMLReader& xml, const std::string& path)
76  {
77  XMLReader paramtop(xml, path);
78 
79  int version;
80  read(paramtop, "version", version);
81 
82  switch (version)
83  {
84  case 1:
85  break;
86 
87  default:
88  QDPIO::cerr << __func__ << ": parameter version " << version
89  << " unsupported." << std::endl;
90  QDP_abort(1);
91  }
92 
93  read(paramtop, "mom2_max", mom2_max);
94  read(paramtop, "avg_equiv_mom", avg_equiv_mom);
95  read(paramtop, "mom_origin", mom_origin);
96  read(paramtop, "first_id", first_id);
97  read(paramtop, "second_id", second_id);
98  }
99 
100 
101  // Writer
102  void Params::writeXML(XMLWriter& xml, const std::string& path) const
103  {
104  push(xml, path);
105 
106  int version = 1;
107  write(xml, "version", version);
108 
109  write(xml, "mom2_max", mom2_max);
110  write(xml, "avg_equiv_mom", avg_equiv_mom);
111  write(xml, "mom_origin", mom_origin);
112 
113  write(xml, "first_id", first_id);
114  write(xml, "second_id", second_id);
115 
116  pop(xml);
117  }
118 
119 
120  // Construct all the correlators
121  std::list< Handle<HadronContractResult_t> >
122  DiagGammaMesonCorrs::operator()(const multi1d<LatticeColorMatrix>& u,
123  const std::string& xml_group,
124  const std::string& id_tag)
125  {
126  START_CODE();
127 
128  QDPIO::cout << "Hadron2Pt: diagonal_gamma_mesons" << std::endl;
129 
130  multi1d<ForwardProp_t> forward_headers(2);
133 
134  multi1d<int> t_srce = getTSrce(forward_headers);
135  int decay_dir = getDecayDir(forward_headers);
136 
137  // Get references to the props
138  const LatticePropagator& quark_prop1 =
139  TheNamedObjMap::Instance().getData<LatticePropagator>(params.first_id);
140  const LatticePropagator& quark_prop2 =
141  TheNamedObjMap::Instance().getData<LatticePropagator>(params.second_id);
142 
143  // Parameters needed for the momentum projection
144  SftMomParams_t sft_params;
145  sft_params.mom2_max = params.mom2_max;
146  sft_params.origin_offset = t_srce;
147  sft_params.mom_offset = params.mom_origin;
148  sft_params.avg_equiv_mom = params.avg_equiv_mom;
149  sft_params.decay_dir = decay_dir;
150 
151  std::list< Handle<Hadron2PtContract_t> > hadron; // holds the contract lattice correlator
152 
153  for(int gamma_value=0; gamma_value < Ns*Ns; ++gamma_value)
154  {
156 
157  push(had->xml, xml_group);
158  write(had->xml, id_tag, "diagonal_gamma_mesons");
159  write(had->xml, "gamma_value", gamma_value);
160  write(had->xml, "PropHeaders", forward_headers);
161  pop(had->xml);
162 
163  had->corr = mesXCorr(quark_prop1, quark_prop2, gamma_value);
164 
165  hadron.push_back(had); // push onto end of list
166  }
167 
168  END_CODE();
169 
170  return this->project(hadron, sft_params);
171  }
172 
173 
174  //! Register all the factories
175  bool registerAll()
176  {
177  bool success = true;
178  if (! registered)
179  {
180  //! Register all the factories
181  success &= Chroma::TheHadronContractFactory::Instance().registerObject(std::string("diagonal_gamma_mesons"),
182  mesDiagGammaCorrs);
183 
184  registered = true;
185  }
186  return success;
187  }
188 
189  } // end namespace SimpleMeson2PtEnv
190 
191  /*! @} */ // end of group io
192 
193 } // end namespace Chroma
194 
195 
196 
virtual std::list< Handle< HadronContractResult_t > > project(const std::list< Handle< Hadron2PtContract_t > > &had_list, const SftMomParams_t &p) const
Convenience function to project onto fixed momenta.
Definition: hadron_2pt.cc:33
Construct hadron correlators.
virtual multi1d< int > getTSrce(const multi1d< ForwardProp_t > &forward_headers) const
Convenience function to get t_srce from headers.
virtual ForwardProp_t readForwardPropHeader(const std::string &prop_id) const
Convenience function to read propagator.
virtual int getDecayDir(const multi1d< ForwardProp_t > &forward_headers) const
Convenience function to get decay_dir from headers.
Class for counted reference semantics.
Definition: handle.h:33
Simple meson 2pt construction - all simple mesons.
std::list< Handle< HadronContractResult_t > > operator()(const multi1d< LatticeColorMatrix > &u, const std::string &xml_group, const std::string &id_tag)
Construct the correlators.
static T & Instance()
Definition: singleton.h:432
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Factory for producing hadron correlator objects.
multi1d< int > t_srce
Named object function std::map.
static bool registered
Local registration flag.
multi1d< ForwardProp_t > & forward_headers
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
Construct meson 2pt correlators.
The result of hadron 2pt correlators.
Definition: hadron_2pt.h:17
Param struct for SftMom.
Definition: sftmom.h:20
Simple meson 2pt parameters.
void writeXML(XMLWriter &in, const std::string &path) const