<br><br><div class="gmail_quote">On Tue, Sep 21, 2010 at 12:04 PM, Brad Sawatzky &lt;<a href="mailto:brads@jlab.org">brads@jlab.org</a>&gt; wrote:<br><blockquote class="gmail_quote">
<div class="im"><br>
On Mon, 20 Sep 2010, David Flay wrote:<br>
<br>
&gt; I have been trying to construct S1 and S2m time average root variables<br>
&gt; using the SetAlias method.  However, I have run into some odd issues:<br>
&gt;<br>
&gt; To obtain the S1 time average, for instance, my code is:<br>
&gt;<br>
&gt;     //construct the time averages:<br>
&gt; ch-&gt;SetAlias(&quot;S1TAvg_0&quot;,&quot;0.5e+09*(L.s1.lt_c[0]+L.s1.rt_c[0])&quot;);<br>
&gt; ch-&gt;SetAlias(&quot;S1TAvg_1&quot;,&quot;0.5e+09*(L.s1.lt_c[1]+L.s1.rt_c[1])&quot;);<br>
&gt; ch-&gt;SetAlias(&quot;S1TAvg_2&quot;,&quot;0.5e+09*(L.s1.lt_c[2]+L.s1.rt_c[2])&quot;);<br>
&gt; ch-&gt;SetAlias(&quot;S1TAvg_3&quot;,&quot;0.5e+09*(L.s1.lt_c[3]+L.s1.rt_c[3])&quot;);<br>
&gt; ch-&gt;SetAlias(&quot;S1TAvg_4&quot;,&quot;0.5e+09*(L.s1.lt_c[4]+L.s1.rt_c[4])&quot;);<br>
&gt; ch-&gt;SetAlias(&quot;S1TAvg_5&quot;,&quot;0.5e+09*(L.s1.lt_c[5]+L.s1.rt_c[5])&quot;);<br>
&gt; ch-&gt;SetAlias(&quot;S1TimeAvg&quot;,&quot;(1.0/6.0)*(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5)&quot;);<br>
<br>
</div>The bad plots look like they are accessing the uncorrected variable<br>
data, but I do not see how that is possible from the code you quote...<br>
Any chance the you&#39;re not drawing the histo you think you are?  ie.<br>
Copy-and-paste type error that you&#39;re unintentionally repeating when you<br>
were testing (ie. commenting and uncommenting different blocks of lines<br>
that should be identical, but really aren&#39;t).  Or some low-level<br>
weirdness due to multiple object instantiations sharing the same name,<br>
or a &#39;generic&#39; histo pointer falls out of scope and isn&#39;t pointing to<br>
the object you think it is...  That&#39;s what seems to be the most likely<br>
culprit.<br></blockquote><div><br>hmm, I&#39;ll check this out.. <br><br></div><blockquote class="gmail_quote">
<br>
Hmm, as an additional observation, the event counts in the histograms<br>
don&#39;t seem to add up.  The &#39;Entries&#39; line claims 1.2M events, but if I<br>
add the bins up by eye I only get ~400k tops.  Where are the other 800k<br>
events?<br></blockquote><div><br>Good question... I&#39;ll have to investigate this<br> </div><blockquote class="gmail_quote">

<br>
That said, the statement that this line fails:<br>
<div class="im">&gt; ch-&gt;SetAlias(&quot;S1TimeAvg&quot;,&quot;(1.0/6.0)*(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5)&quot;);<br>
</div>but works if you leave off the 1/6 factor is really puzzling.  Do you<br>
mean that if you plot:<br>
&gt; ch-&gt;SetAlias(&quot;S1TimeAvg&quot;,&quot;(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5)&quot;);<br>
then you get figure 2:  a single clean peak at 55ns?  </blockquote><div><br>Yeah -- that&#39;s exactly what I was attempting to point out in the first email.  <br><br></div><blockquote class="gmail_quote">
Again, the Entries<br>
number and the integrated counts in the visible bins don&#39;t seem to add<br>
up, so perhaps you&#39;re just looking at a peak that was outside your histo<br>
bounds when you divided by 1/6?<br></blockquote><div><br>I should open up the bounds of the plot and see what it looks like with and without the 1/6 factor<br> <br></div><blockquote class="gmail_quote">

There could also be some weird operator or function precedence stuff<br>
going on when ROOT is internally unrolling all the aliases to get to the<br>
final expression.  You could try adding &#39;extra&#39; parentheses around<br>
the expression. Ex:<br>
  ch-&gt;SetAlias(&quot;S1TimeAvg&quot;,&quot;((1.0/6.0)*(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5))&quot;);<br>
I doubt this is the problem though.<br>
<br></blockquote><div>I should add this anyway just to be sure<br><br>Thanks! <br></div></div><br clear="all"><br>-- <br>-----------------------------------------------------------<br>David Flay<br>Physics Department<br>
Temple University<br>Philadelphia, PA 19122 <br><br>office: Barton Hall, BA319<br>phone: (215) 204-1331<br><br>e-mail: <a href="mailto:flay@jlab.org">flay@jlab.org</a> <br>            <a href="mailto:flay@temple.edu">flay@temple.edu</a><br>
<br>website: <a href="http://www.jlab.org/%7Eflay">http://www.jlab.org/~flay</a><br>              <a href="http://quarks.temple.edu">http://quarks.temple.edu</a><br>-----------------------------------------------------------<br>
<br><br>