Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 5f484ffc0df874d32e4e8944dabff8f7 > files > 9

lhapdf-doc-5.9.1-2.fc18.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>LHAPDF C++ wrapper: /examples/CCTest1.cc</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">LHAPDF C++ wrapper
   &#160;<span id="projectnumber">5.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">/examples/CCTest1.cc</div>  </div>
</div><!--header-->
<div class="contents">
<p>This is an example of a program using the recommended C++ interface to <a class="el" href="namespaceLHAPDF.html" title="Namespace containing all the LHAPDF wrapper functions.">LHAPDF</a>.</p>
<div class="fragment"><div class="line"><span class="comment">// Simple test program to test functionality of</span></div>
<div class="line"><span class="comment">// the LHAPDF C++ wrapper.</span></div>
<div class="line"><span class="comment">// Use this as a template for your program.</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// Original author: Stefan Gieseke 2005</span></div>
<div class="line"><span class="comment">// Adapted for LHAPDF v5+ by Mike Whalley.</span></div>
<div class="line"><span class="comment">// Further updates for &gt;= v5.4 by Andy Buckley.</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &quot;LHAPDF/LHAPDF.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &lt;iterator&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
<div class="line"><span class="keyword">using namespace </span>std;</div>
<div class="line"></div>
<div class="line"><span class="comment">// NB. You might want to also have</span></div>
<div class="line"><span class="comment">// using namespace LHAPDF;</span></div>
<div class="line"><span class="comment">// for convenience.</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> SUBSET = 0;</div>
<div class="line">  <span class="keyword">const</span> <span class="keywordtype">string</span> NAME = <span class="stringliteral">&quot;CT10&quot;</span>;</div>
<div class="line"></div>
<div class="line">  <a name="a0"></a><a class="code" href="namespaceLHAPDF.html#aa10ba6e937b19cbc9d58ec0f5aaf2564" title="Initialise member in PDF set setid.">LHAPDF::initPDFSet</a>(NAME, LHAPDF::LHGRID, SUBSET);</div>
<div class="line"></div>
<div class="line">  <span class="keyword">const</span> <span class="keywordtype">double</span> Q = 10.0, mz = 91.2;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;alphas(mz) = &quot;</span> &lt;&lt; <a name="a1"></a><a class="code" href="namespaceLHAPDF.html#a38560c4ffe9c677e332e7b79ee1f430c" title=" used by the current PDF.">LHAPDF::alphasPDF</a>(mz) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;qcdlam4    = &quot;</span> &lt;&lt; <a name="a2"></a><a class="code" href="namespaceLHAPDF.html#ab93e76e23f624496bf6efe20dcb0871d" title="Value of QCD  for member m.">LHAPDF::getLam4</a>(SUBSET) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;qcdlam5    = &quot;</span> &lt;&lt; <a name="a3"></a><a class="code" href="namespaceLHAPDF.html#a45ac2af896fdc4d28e8e5457a46a68b7" title="Value of QCD  for member m.">LHAPDF::getLam5</a>(SUBSET) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;orderPDF   = &quot;</span> &lt;&lt; <a name="a4"></a><a class="code" href="namespaceLHAPDF.html#a18f83a309678f560e5be15a8b51bea5a" title="Get order at which the PDF was fitted.">LHAPDF::getOrderPDF</a>() &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;xmin       = &quot;</span> &lt;&lt; <a name="a5"></a><a class="code" href="namespaceLHAPDF.html#a4b68147f30e452ed7bbe300630b46a3f" title="Minimum  value considered valid for this set, as specified by the set authors.">LHAPDF::getXmin</a>(SUBSET) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;xmax       = &quot;</span> &lt;&lt; <a name="a6"></a><a class="code" href="namespaceLHAPDF.html#a9674750111bc08eee46291537f5aca71" title="Maximum  value considered valid for this set, as specified by the set authors.">LHAPDF::getXmax</a>(SUBSET) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;q2min      = &quot;</span> &lt;&lt; <a name="a7"></a><a class="code" href="namespaceLHAPDF.html#aaf8a27a30e2a01de0456096492804a9e" title="Minimum  value considered valid for this set, as specified by the set authors.">LHAPDF::getQ2min</a>(SUBSET) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;q2max      = &quot;</span> &lt;&lt; <a name="a8"></a><a class="code" href="namespaceLHAPDF.html#ad4db3b12b4887db4389adb37987c2c77" title="Maximum  value considered valid for this set, as specified by the set authors.">LHAPDF::getQ2max</a>(SUBSET) &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;orderalfas = &quot;</span> &lt;&lt; <a name="a9"></a><a class="code" href="namespaceLHAPDF.html#a550873e5d7fe446d28648e9789d2e54d" title="Perturbative order of parton evolution and  respectively.">LHAPDF::getOrderAlphaS</a>() &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;num flav   = &quot;</span> &lt;&lt; <a name="a10"></a><a class="code" href="namespaceLHAPDF.html#a06455b0d04084767234687d2157fbaac" title="Number of flavours used in the current PDF set.">LHAPDF::getNf</a>() &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;name       = &quot;</span> &lt;&lt; NAME &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;number     = &quot;</span> &lt;&lt; <a name="a11"></a><a class="code" href="namespaceLHAPDF.html#a4cfecd0693992eff5c0febc2838ed376" title="Number of members available in the current set.">LHAPDF::numberPDF</a>() &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; endl;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">  <span class="comment">// LHAPDF::extrapolate();</span></div>
<div class="line"></div>
<div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> NUMBER = <a class="code" href="namespaceLHAPDF.html#a4cfecd0693992eff5c0febc2838ed376" title="Number of members available in the current set.">LHAPDF::numberPDF</a>();</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> n = 0; n &lt; NUMBER + 1; ++n) {</div>
<div class="line">    cout &lt;&lt; <span class="stringliteral">&quot;Set number: &quot;</span> &lt;&lt; n &lt;&lt; endl;</div>
<div class="line">    <a name="a12"></a><a class="code" href="namespaceLHAPDF.html#a8db3179ee46b8fcdb742eba2c00837dd" title="The choice of PDF member out of one distribution.">LHAPDF::initPDF</a>(n);</div>
<div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ix = 1; ix &lt; 11; ++ix) {</div>
<div class="line">      <span class="keyword">const</span> <span class="keywordtype">double</span> x = (ix - 0.5) / 10.0;</div>
<div class="line">      cout &lt;&lt; <span class="stringliteral">&quot;x=&quot;</span> &lt;&lt; x &lt;&lt; <span class="stringliteral">&quot;, Q=&quot;</span> &lt;&lt; Q &lt;&lt; <span class="stringliteral">&quot;, f=0: &quot;</span> &lt;&lt; <a name="a13"></a><a class="code" href="namespaceLHAPDF.html#a1c64cf2da56507d8640034dcdb412b31">LHAPDF::xfx</a>(x, Q, 0) &lt;&lt; endl;</div>
<div class="line">    }</div>
<div class="line">    cout &lt;&lt; endl;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> n = 0; n &lt; NUMBER + 1; ++n) {</div>
<div class="line">    cout &lt;&lt; <span class="stringliteral">&quot;Set number: &quot;</span> &lt;&lt; n &lt;&lt; endl;</div>
<div class="line">    <a class="code" href="namespaceLHAPDF.html#a8db3179ee46b8fcdb742eba2c00837dd" title="The choice of PDF member out of one distribution.">LHAPDF::initPDF</a>(n);</div>
<div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ix = 1; ix &lt; 11; ++ix) {</div>
<div class="line">      <span class="keyword">const</span> <span class="keywordtype">double</span> x = (ix - 0.5) / 10.0;</div>
<div class="line">      cout &lt;&lt; <span class="stringliteral">&quot;x=&quot;</span> &lt;&lt; x &lt;&lt; <span class="stringliteral">&quot;, Q=&quot;</span> &lt;&lt; Q &lt;&lt; <span class="stringliteral">&quot;: &quot;</span>;</div>
<div class="line">      vector&lt;double&gt; result = <a class="code" href="namespaceLHAPDF.html#a1c64cf2da56507d8640034dcdb412b31">LHAPDF::xfx</a>(x, Q);</div>
<div class="line">      std::copy(result.begin(), result.end(), ostream_iterator&lt;double&gt;(cout,<span class="stringliteral">&quot;\t&quot;</span>));</div>
<div class="line">      cout &lt;&lt; endl;</div>
<div class="line">    }</div>
<div class="line">    cout &lt;&lt; endl;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">  cout &lt;&lt; string().insert(0, 40, <span class="charliteral">&#39;-&#39;</span>) &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;Checking LHAPDF with package &quot;</span> &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; NAME &lt;&lt; <span class="stringliteral">&quot; set number &quot;</span> &lt;&lt; SUBSET &lt;&lt; <span class="stringliteral">&quot;/&quot;</span> &lt;&lt; <a class="code" href="namespaceLHAPDF.html#a4cfecd0693992eff5c0febc2838ed376" title="Number of members available in the current set.">LHAPDF::numberPDF</a>() &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;LHAPDF::getDescription() gives:&quot;</span> &lt;&lt; endl;</div>
<div class="line">  <a name="a14"></a><a class="code" href="namespaceLHAPDF.html#a04cf7f990740e452d0fe736947b343ae" title="Prints a brief description of the current PDF set to stdout.">LHAPDF::getDescription</a>();</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> EXIT_SUCCESS;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &quot;FortranWrappers.h&quot;</span></div>
<div class="line"><span class="preprocessor">#ifdef FC_DUMMY_MAIN</span></div>
<div class="line"><span class="preprocessor"></span><span class="keywordtype">int</span> FC_DUMMY_MAIN() { <span class="keywordflow">return</span> 1; }</div>
<div class="line"><span class="preprocessor">#endif</span></div>
</div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Nov 21 2013 06:02:29 for LHAPDF C++ wrapper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>