<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>Hello there,</div>
<div><br>
</div>
<div>I am trying to convert the information in the root file into a txt format for processing with a different program, however whenever I write out the time variable it comes out as all 0's or all some ridiculously large (or small) number: the number itself
varies even between runs on the same root file. </div>
<div><br>
</div>
<div>I include below the relevant bits of code I am using to extract the data: any help as to why I can't seem to read out the time variable would be appreciated! </div>
<div><br>
</div>
<div>A few notes: I tried extracting the time variable as integer instead of float and that didn't work. Also I checked with the TBroswer that there are a range of time values and there are, so not sure why I can only seem to extract all of the same nonsense
values. </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>// Take the single tree, containing the position, energy and time</div>
<div>TTree* singlesTree = (TTree*)file->Get( "Singles" );</div>
<div><br>
</div>
<div>// Declare variables</div>
<div>Float_t globalPosX, energy, time;</div>
<div><br>
</div>
<div>//Source values</div>
<div>singlesTree->SetBranchAddress( "globalPosX", &globalPosX );</div>
<div>singlesTree->SetBranchAddress( "time", &time );</div>
<div>singlesTree->SetBranchAddress( "energy", &energy );<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div><br>
</div>
<div>//open output file</div>
<div>ofstream outputfile;</div>
<div>outputfile.open ("ConversionTest.txt");<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div>if (outputfile.is_open()) </div>
<div>{<span class="Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>for( Int_t ijk = 0; ijk != entriesSingleTree; ++ijk ) //loop over tree</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{ </div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>singlesTree->GetEntry( ijk );</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>outputfile << globalPosX << " " << time << " " << energy << "\n"; //write values to file
<span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
<div>}</div>
<div>outputfile.close();<span class="Apple-tab-span" style="white-space:pre"> </span>
</div>
<br>
<p></p>
</div>
</body>
</html>