hadron_seqsource.cc

Go to the documentation of this file.
00001 // $Id: hadron_seqsource.cc,v 3.8 2006/11/28 19:28:57 edwards Exp $
00002 /*! \file
00003  *  \brief Construct hadron sequential sources
00004  */
00005 
00006 #include "util/ft/single_phase.h"
00007 #include "meas/hadron/hadron_seqsource.h"
00008 #include "util/ferm/gamma5_herm_w.h"
00009 
00010 namespace Chroma 
00011 {
00012 
00013   //! Anonymous namespace
00014   /*! @ingroup hadron */
00015   namespace
00016   {
00017     //! Construct hadron sequential sources
00018     /*! @ingroup hadron */
00019     template<typename T> 
00020     T   hadSeqSourceProject(const T& source_prop,
00021                             int t_sink, int j_decay)
00022     {
00023       START_CODE();
00024 
00025       if (j_decay < 0 || j_decay >= Nd)
00026       {
00027         QDPIO::cerr << __func__ << ": j_decay out of bounds" << endl;
00028         QDP_abort(1);
00029       }
00030 
00031       /*
00032        * Now mask out all but sink time slice
00033        */
00034       T seq_src_prop = where(Layout::latticeCoordinate(j_decay) == t_sink,
00035                              source_prop,
00036                              T(zero));
00037         
00038       END_CODE();
00039 
00040       return seq_src_prop;
00041     }
00042 
00043 
00044     //! Get source location
00045     multi1d<int>
00046     hadSeqSourceGetTSrce(const multi1d<ForwardProp_t>& forward_headers)
00047     {
00048       multi1d<int> t_srce = forward_headers[0].source_header.getTSrce();
00049 
00050       for(int loop=1; loop < forward_headers.size(); ++loop)
00051       {
00052         multi1d<int> t_srce_b = forward_headers[loop].source_header.getTSrce();
00053 
00054         // Bummer, I wish qdp++ had a multi1d.operator!=()
00055         bool same = true;
00056         for(int i=0; i < t_srce.size(); ++i)
00057         {
00058           if (t_srce_b[i] != t_srce[i]) 
00059             same = false;
00060         }
00061       
00062         if (! same)
00063         {
00064           QDPIO::cerr << __func__ << ": the t_srce in the forward props are not all equal"
00065                       << endl;
00066           QDP_abort(1);
00067         }
00068       }
00069 
00070       return t_srce;
00071     }
00072 
00073 
00074   }
00075 
00076 
00077   // Default versions
00078   template<>
00079   Complex
00080   HadronSeqSource<LatticePropagator>::tieBack(const multi1d<LatticeColorMatrix>& u,
00081                                               const SequentialProp_t& seqprop_header,
00082                                               const LatticePropagator& seqprop, 
00083                                               int gamma_insertion)
00084   {
00085     getTSrce() = hadSeqSourceGetTSrce(seqprop_header.forward_props);
00086     LatticeComplex tr = trace(gamma5Herm(seqprop) * Gamma(gamma_insertion));
00087     Complex seq_src_value = peekSite(tr, getTSrce());
00088     return seq_src_value;
00089   }
00090 
00091 
00092   // Default versions
00093   template<>
00094   LatticePropagator
00095   HadronSeqSource<LatticePropagator>::project(const LatticePropagator& src_prop_tmp) const
00096   {
00097     return hadSeqSourceProject<LatticePropagator>(src_prop_tmp,
00098                                                   getTSink(), getDecayDir());
00099   }
00100 
00101 
00102   // Default versions
00103   template<>
00104   LatticeComplex
00105   HadronSeqSource<LatticePropagator>::phases() const
00106   {
00107     return singlePhase(getTSrce(), getSinkMom(), getDecayDir());
00108   }
00109 
00110 
00111   // Default versions
00112   template<>
00113   void
00114   HadronSeqSource<LatticePropagator>::setTSrce(const multi1d<ForwardProp_t>& forward_headers)
00115   {
00116     getTSrce() = hadSeqSourceGetTSrce(forward_headers);
00117   }
00118 
00119   // Any other fermion types, like staggered can go here
00120 
00121 
00122 }  // end namespace Chroma

Generated on Mon Mar 15 04:31:04 2010 for CHROMA by  doxygen 1.4.7