<!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 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 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> <span class="keyword">import</span> ROOT,os,sys,getopt</div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <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> <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> <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> <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> chi2CutOff = 4.</div> <div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#ae4bbc2933f320de4354b9f109b3b4272"> 7</a></span> 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> 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> 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> 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> nEvents = 99999</div> <div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a59242778da470dc9ad01e42501dff24b"> 12</a></span> 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> measCut = 25</div> <div class="line"><a name="l00014"></a><span class="lineno"> 14</span> </div> <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="keywordflow">try</span>:</div> <div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  opts, args = getopt.getopt(sys.argv[1:], <span class="stringliteral">"n:f:g:A:Y:i"</span>, [<span class="stringliteral">"nEvents="</span>,<span class="stringliteral">"geoFile="</span>])</div> <div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="keywordflow">except</span> getopt.GetoptError:</div> <div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  <span class="comment"># print help information and exit:</span></div> <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="keywordflow">print</span> <span class="stringliteral">' enter file name'</span></div> <div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  sys.exit()</div> <div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <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>  <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">"-f"</span>):</div> <div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  inputFile = a</div> <div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">"-g"</span>, <span class="stringliteral">"--geoFile"</span>):</div> <div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  geoFile = a</div> <div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">"-Y"</span>): </div> <div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  dy = float(a)</div> <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keywordflow">if</span> o <span class="keywordflow">in</span> (<span class="stringliteral">"-n"</span>, <span class="stringliteral">"--nEvents="</span>):</div> <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  nEvents = int(a)</div> <div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div> <div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keywordflow">if</span> <span class="keywordflow">not</span> dy:</div> <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <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>  tmp = inputFile.split(<span class="stringliteral">'.'</span>)</div> <div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">try</span>:</div> <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  dy = float( tmp[1]+<span class="stringliteral">'.'</span>+tmp[2] )</div> <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">except</span>:</div> <div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  dy = <span class="keywordtype">None</span></div> <div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">else</span>:</div> <div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  inputFile = <span class="stringliteral">'ship.'</span>+str(dy)+<span class="stringliteral">'.Pythia8-TGeant4_rec.root'</span></div> <div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div> <div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="keywordflow">if</span> <span class="keywordflow">not</span> geoFile:</div> <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  geoFile = inputFile.replace(<span class="stringliteral">'ship.'</span>,<span class="stringliteral">'geofile_full.'</span>).replace(<span class="stringliteral">'_rec.'</span>,<span class="stringliteral">'.'</span>)</div> <div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  </div> <div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="namespaceAnalyseThat.html#a9e8efbaad3020dd9b609220e1aea059b"> 44</a></span> 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> sTree = f.cbmsim</div> <div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div> <div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div> <div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div> <div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <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> 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>  plotField = <span class="keyword">False</span>,</div> <div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  plotTracking = <span class="keyword">False</span>,</div> <div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  plotVertex = <span class="keyword">True</span>, </div> <div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  plotVertexDetailed = <span class="keyword">False</span>, </div> <div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  plotMomentum = <span class="keyword">True</span>,</div> <div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  compareFits = <span class="keyword">True</span>)</div> <div class="line"><a name="l00057"></a><span class="lineno"> 57</span> 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  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.5 </small></address> </body> </html>