Newer
Older
FairShipTools / Katerina / doc / html / AnalyseThat_8py_source.html
<!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.5"/>
<title>Python: AnalyseThat.py Source File</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">Python
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">AnalyseThat.py</div>  </div>
</div><!--header-->
<div class="contents">
<a href="AnalyseThat_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html">    1</a></span>&#160;<span class="keyword">import</span> ROOT,os,sys,getopt</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="keyword">import</span> rootUtils <span class="keyword">as</span> ut</div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="keyword">import</span> shipunit <span class="keyword">as</span> u</div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="keyword">import</span> numpy <span class="keyword">as</span> n</div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="keyword">from</span> ShipGeoConfig <span class="keyword">import</span> ConfigRegistry</div>
<div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#aa68aaa1ce7900d107568a7e42f462e77">    6</a></span>&#160;chi2CutOff  = 4.</div>
<div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#ae4bbc2933f320de4354b9f109b3b4272">    7</a></span>&#160;PDG = ROOT.TDatabasePDG.Instance()</div>
<div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#abfd781b3154a22c0d345f8d65f134d3d">    8</a></span>&#160;inputFile  = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#aaaca6cef0cff175e2acd785b0e86f538">    9</a></span>&#160;geoFile    = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a0ab098f6a57898a066bfeff19e037c7c">   10</a></span>&#160;dy         = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a3553ede0c697eef66c64c77665d57222">   11</a></span>&#160;nEvents    = 99999</div>
<div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a59242778da470dc9ad01e42501dff24b">   12</a></span>&#160;fiducialCut = <span class="keyword">False</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a15d4f7541eb9a53d59247c76bd4f6723">   13</a></span>&#160;measCut = 25</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keywordflow">try</span>:</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;        opts, args = getopt.getopt(sys.argv[1:], <span class="stringliteral">&quot;n:f:g:A:Y:i&quot;</span>, [<span class="stringliteral">&quot;nEvents=&quot;</span>,<span class="stringliteral">&quot;geoFile=&quot;</span>])</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="keywordflow">except</span> getopt.GetoptError:</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;        <span class="comment"># print help information and exit:</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        <span class="keywordflow">print</span> <span class="stringliteral">&#39; enter file name&#39;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;        sys.exit()</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keywordflow">for</span> o, a <span class="keywordflow">in</span> opts:</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">&quot;-f&quot;</span>):</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;            inputFile = a</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;        <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">&quot;-g&quot;</span>, <span class="stringliteral">&quot;--geoFile&quot;</span>):</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;            geoFile = a</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">&quot;-Y&quot;</span>): </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;            dy = float(a)</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">&quot;-n&quot;</span>, <span class="stringliteral">&quot;--nEvents=&quot;</span>):</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;            nEvents = int(a)</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keywordflow">if</span> <span class="keywordflow">not</span> dy:</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  <span class="comment"># try to extract from input file name</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a3592c923fc264e85ae0213877ffc00f3">   33</a></span>&#160;  tmp = inputFile.split(<span class="stringliteral">&#39;.&#39;</span>)</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;  <span class="keywordflow">try</span>:</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    dy = float( tmp[1]+<span class="stringliteral">&#39;.&#39;</span>+tmp[2] )</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  <span class="keywordflow">except</span>:</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    dy = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keywordflow">else</span>:</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; inputFile = <span class="stringliteral">&#39;ship.&#39;</span>+str(dy)+<span class="stringliteral">&#39;.Pythia8-TGeant4_rec.root&#39;</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keywordflow">if</span> <span class="keywordflow">not</span> geoFile:</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;  geoFile = inputFile.replace(<span class="stringliteral">&#39;ship.&#39;</span>,<span class="stringliteral">&#39;geofile_full.&#39;</span>).replace(<span class="stringliteral">&#39;_rec.&#39;</span>,<span class="stringliteral">&#39;.&#39;</span>)</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;  </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a9e8efbaad3020dd9b609220e1aea059b">   44</a></span>&#160;f     = ROOT.TFile(inputFile)</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a590b027c5bfe96a97be19a4e3c4a8637">   45</a></span>&#160;sTree = f.cbmsim</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="keyword">from</span> LoopAnalyse <span class="keyword">import</span> LoopAnalyse</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a3129775c2fd307958d0d2cf447354db2">   50</a></span>&#160;la = <a class="code" href="classLoopAnalyse_1_1LoopAnalyse.html">LoopAnalyse</a>(sTree, dy, geoFile, debug=0, </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;         plotField           = <span class="keyword">False</span>,</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;         plotTracking        = <span class="keyword">False</span>,</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;         plotVertex          = <span class="keyword">True</span>, </div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;         plotVertexDetailed  = <span class="keyword">False</span>, </div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;         plotMomentum        = <span class="keyword">True</span>,</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;         compareFits         = <span class="keyword">True</span>)</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;la.Loop(nEvents)</div>
<div class="ttc" id="classLoopAnalyse_1_1LoopAnalyse_html"><div class="ttname"><a href="classLoopAnalyse_1_1LoopAnalyse.html">LoopAnalyse.LoopAnalyse</a></div><div class="ttdef"><b>Definition:</b> <a href="LoopAnalyse_8py_source.html#l00019">LoopAnalyse.py:19</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>